layout fix, added comments, bug fix

This commit is contained in:
nuclearfog 2020-12-30 14:52:33 +01:00
parent 2fbca1043f
commit 595ec21320
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14
8 changed files with 209 additions and 207 deletions

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="imageWizard">
<value>
<PersistentState />
</value>
</entry>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="autoMirrored" value="true" />
<entry key="outputName" value="add" />
<entry key="sourceFile" value="$USER_HOME$/Dokumente/Rest/Entypo SVG/circle-with-plus.svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@ -66,12 +66,25 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
*/
public static final String KEY_MEDIA_TYPE = "media_type";
/// Media Types
private static final int MEDIAVIEWER_NONE = 0; // Not Initialized
public static final int MEDIAVIEWER_IMG_S = 1; // Image from Storage
public static final int MEDIAVIEWER_IMAGE = 2; // Image from Twitter
public static final int MEDIAVIEWER_VIDEO = 3; // Video from Twitter
public static final int MEDIAVIEWER_ANGIF = 4; // GIF from Twitter
/**
* setup media viewer for images from storage
*/
public static final int MEDIAVIEWER_IMG_S = 1;
/**
* setup media viewer for images from twitter
*/
public static final int MEDIAVIEWER_IMAGE = 2;
/**
* setup media viewer for videos
*/
public static final int MEDIAVIEWER_VIDEO = 3;
/**
* setup media viewer for GIF animation
*/
public static final int MEDIAVIEWER_ANGIF = 4;
/**
* Quality of the saved jpeg images
@ -82,7 +95,11 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
* request write permission on API < 29
*/
private static final String[] REQ_WRITE_SD = {WRITE_EXTERNAL_STORAGE};
private static final int REQCODE_SD = 6;
/**
* request code for write permission
*/
private static final int REQUEST_WRITE = 6;
private ImageLoader imageAsync;
private Thread imageSaveThread;
@ -97,7 +114,7 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
private ZoomView zoomImage;
private String[] mediaLinks;
private int type = MEDIAVIEWER_NONE;
private int type;
private int videoPos = 0;
@ -121,7 +138,7 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
Bundle param = getIntent().getExtras();
if (param != null && param.containsKey(KEY_MEDIA_LINK)) {
mediaLinks = param.getStringArray(KEY_MEDIA_LINK);
type = param.getInt(KEY_MEDIA_TYPE, MEDIAVIEWER_NONE);
type = param.getInt(KEY_MEDIA_TYPE);
}
}
@ -188,7 +205,7 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
int check = checkSelfPermission(WRITE_EXTERNAL_STORAGE);
if (check == PERMISSION_DENIED) {
requestPermissions(REQ_WRITE_SD, REQCODE_SD);
requestPermissions(REQ_WRITE_SD, REQUEST_WRITE);
accessGranted = false;
}
}

View File

@ -40,6 +40,9 @@ public final class TimeString {
if (minutes > 0) {
return minutes + " m";
}
return seconds + " s";
if (seconds > 0) {
return seconds + " s";
}
return "0 s";
}
}

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="150dp"
android:height="50dp"
android:viewportWidth="15000"
android:viewportHeight="5000">
<path
android:pathData="M7500,5000L0,5000 0,0 15000,0 15000,5000 7500,5000Z"
android:fillColor="#80000000" />
</vector>

View File

@ -49,17 +49,18 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_weight="8"
android:layout_marginEnd="@dimen/tweetitem_textview_margin"
android:layout_marginRight="@dimen/tweetitem_textview_margin"
android:layout_weight="1"
android:drawablePadding="@dimen/tweetitem_padding_drawable"
android:gravity="start"
android:singleLine="true" />
<TextView
android:id="@+id/time"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="3"
android:gravity="end"
android:singleLine="true"
android:textAlignment="gravity"

View File

@ -30,36 +30,52 @@
android:layout_marginBottom="@dimen/editprofile_layout_margin"
android:gravity="center_vertical">
<Button
android:id="@+id/edit_add_banner"
android:layout_width="wrap_content"
android:layout_height="@dimen/editprofile_button_height"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/editprofile_button_margin"
android:layout_marginRight="@dimen/editprofile_button_margin"
android:background="@drawable/button"
android:paddingLeft="@dimen/editprofile_button_padding"
android:paddingRight="@dimen/editprofile_button_padding"
android:text="@string/editprofile_add_banner"
android:visibility="invisible" />
<ImageView
android:id="@+id/edit_banner"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/profile_banner"
android:paddingLeft="@dimen/editprofile_banner_padding"
android:paddingRight="@dimen/editprofile_banner_padding"
android:scaleType="centerCrop" />
android:layout_height="wrap_content">
<ImageView
android:id="@+id/edit_change_banner"
android:layout_width="@dimen/editprofile_add_btn_size"
android:layout_height="@dimen/editprofile_add_btn_size"
android:layout_gravity="center"
android:contentDescription="@string/descr_add_profile_image"
app:srcCompat="@drawable/add" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/profile_banner"
android:paddingLeft="@dimen/editprofile_banner_padding"
android:paddingRight="@dimen/editprofile_banner_padding"
android:scaleType="centerCrop"
app:srcCompat="@drawable/empty_banner" />
<ImageView
android:id="@+id/edit_banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="@string/profile_banner"
android:paddingLeft="@dimen/editprofile_banner_padding"
android:paddingRight="@dimen/editprofile_banner_padding"
android:scaleType="centerCrop" />
<Button
android:id="@+id/edit_add_banner"
android:layout_width="wrap_content"
android:layout_height="@dimen/editprofile_button_height"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/editprofile_button_margin"
android:layout_marginRight="@dimen/editprofile_button_margin"
android:background="@drawable/button"
android:paddingLeft="@dimen/editprofile_button_padding"
android:paddingRight="@dimen/editprofile_button_padding"
android:text="@string/editprofile_add_banner"
android:visibility="invisible" />
<ImageView
android:id="@+id/edit_change_banner"
android:layout_width="@dimen/editprofile_add_btn_size"
android:layout_height="@dimen/editprofile_add_btn_size"
android:layout_gravity="center"
android:contentDescription="@string/descr_add_profile_image"
app:srcCompat="@drawable/add" />
</FrameLayout>
<FrameLayout
android:layout_width="@dimen/editprofile_image"

View File

@ -28,161 +28,154 @@
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/tweet_head"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:paddingLeft="@dimen/tweet_layout_margin"
android:paddingRight="@dimen/tweet_layout_margin"
android:visibility="invisible">
<LinearLayout
android:id="@+id/tweet_head"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/tweet_layout_margin"
android:paddingRight="@dimen/tweet_layout_margin"
android:visibility="invisible">
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="@dimen/tweet_profile"
android:layout_height="@dimen/tweet_profile">
<androidx.cardview.widget.CardView
<ImageView
android:id="@+id/profileimage_detail"
android:layout_width="@dimen/tweet_profile"
android:layout_height="@dimen/tweet_profile">
android:layout_height="@dimen/tweet_profile"
android:contentDescription="@string/profile_image" />
<ImageView
android:id="@+id/profileimage_detail"
android:layout_width="@dimen/tweet_profile"
android:layout_height="@dimen/tweet_profile"
android:contentDescription="@string/profile_image" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/tweet_layout_margin"
android:layout_marginLeft="@dimen/tweet_layout_margin"
android:layout_marginBottom="@dimen/tweet_layout_margin"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/usernamedetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/tweet_padding_drawable"
android:singleLine="true" />
<TextView
android:id="@+id/scrnamedetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/tweet_padding_drawable"
android:singleLine="true" />
<TextView
android:id="@+id/timedetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_date" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/answer_reference_detail"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="@dimen/tweet_button_answer_height"
android:background="@drawable/button"
android:paddingLeft="@dimen/tweet_button_padding"
android:paddingRight="@dimen/tweet_button_padding"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_api"
android:visibility="gone" />
<TextView
android:id="@+id/tweet_detailed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/tweet_layout_margin"
android:layout_marginBottom="@dimen/tweet_layout_margin"
android:fadeScrollbars="false"
android:linksClickable="true"
android:maxLines="@integer/tweet_test_max_lines"
android:scrollbars="vertical"
android:textSize="@dimen/tweet_textsize"
android:visibility="gone" />
<ImageButton
android:id="@+id/tweet_media_attach"
android:layout_width="@dimen/tweet_button_media_width"
android:layout_height="@dimen/tweet_button_media_height"
android:layout_gravity="center"
android:layout_margin="@dimen/tweet_media_button_margin"
android:background="@drawable/button"
android:contentDescription="@string/image_preview"
android:visibility="gone" />
<TextView
android:id="@+id/tweet_sensitive"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/tweet_padding_drawable"
android:paddingLeft="@dimen/tweet_button_padding"
android:paddingRight="@dimen/tweet_button_padding"
android:singleLine="true"
android:text="@string/tweet_sensitive_media"
android:textSize="@dimen/tweet_textsize_api"
android:visibility="gone"
app:drawableLeftCompat="@drawable/sensitive"
app:drawableStartCompat="@drawable/sensitive" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_marginStart="@dimen/tweet_layout_margin"
android:layout_marginLeft="@dimen/tweet_layout_margin"
android:layout_marginBottom="@dimen/tweet_layout_margin"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tweet_location_name"
android:layout_width="wrap_content"
android:id="@+id/usernamedetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/tweet_padding_drawable"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_locale"
android:visibility="gone"
app:drawableLeftCompat="@drawable/userlocation"
app:drawableStartCompat="@drawable/userlocation" />
android:singleLine="true" />
<Button
android:id="@+id/tweet_location_coordinate"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="@dimen/tweet_button_location"
android:layout_marginLeft="@dimen/tweet_button_margin"
android:layout_marginRight="@dimen/tweet_button_margin"
android:background="@drawable/button"
android:paddingLeft="@dimen/tweet_button_padding"
android:paddingRight="@dimen/tweet_button_padding"
<TextView
android:id="@+id/scrnamedetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/tweet_padding_drawable"
android:singleLine="true" />
<TextView
android:id="@+id/timedetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_locale"
android:visibility="gone" />
android:textSize="@dimen/tweet_textsize_date" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/answer_reference_detail"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="@dimen/tweet_button_answer_height"
android:background="@drawable/button"
android:paddingLeft="@dimen/tweet_button_padding"
android:paddingRight="@dimen/tweet_button_padding"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_api"
android:visibility="gone" />
<TextView
android:id="@+id/tweet_detailed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/tweet_layout_margin"
android:layout_marginBottom="@dimen/tweet_layout_margin"
android:fadeScrollbars="false"
android:linksClickable="true"
android:maxLines="@integer/tweet_test_max_lines"
android:scrollbars="vertical"
android:textSize="@dimen/tweet_textsize"
android:visibility="gone" />
<ImageButton
android:id="@+id/tweet_media_attach"
android:layout_width="@dimen/tweet_button_media_width"
android:layout_height="@dimen/tweet_button_media_height"
android:layout_gravity="center"
android:layout_margin="@dimen/tweet_media_button_margin"
android:background="@drawable/button"
android:contentDescription="@string/image_preview"
android:visibility="gone" />
<TextView
android:id="@+id/tweet_sensitive"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/tweet_padding_drawable"
android:paddingLeft="@dimen/tweet_button_padding"
android:paddingRight="@dimen/tweet_button_padding"
android:singleLine="true"
android:text="@string/tweet_sensitive_media"
android:textSize="@dimen/tweet_textsize_api"
android:visibility="gone"
app:drawableLeftCompat="@drawable/sensitive"
app:drawableStartCompat="@drawable/sensitive" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/used_api"
android:layout_width="match_parent"
android:id="@+id/tweet_location_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="false"
android:drawablePadding="@dimen/tweet_padding_drawable"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_api" />
android:textSize="@dimen/tweet_textsize_locale"
android:visibility="gone"
app:drawableLeftCompat="@drawable/userlocation"
app:drawableStartCompat="@drawable/userlocation" />
<Button
android:id="@+id/tweet_location_coordinate"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="@dimen/tweet_button_location"
android:layout_marginLeft="@dimen/tweet_button_margin"
android:layout_marginRight="@dimen/tweet_button_margin"
android:background="@drawable/button"
android:paddingLeft="@dimen/tweet_button_padding"
android:paddingRight="@dimen/tweet_button_padding"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_locale"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/used_api"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:linksClickable="false"
android:singleLine="true"
android:textSize="@dimen/tweet_textsize_api" />
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>

View File

@ -84,6 +84,7 @@
<dimen name="tweetitem_profile_small">36sp</dimen>
<dimen name="tweetitem_layout_padding">5dp</dimen>
<dimen name="tweetitem_margin_layout">5dp</dimen>
<dimen name="tweetitem_textview_margin">10dp</dimen>
<dimen name="tweetitem_padding_drawable">5dp</dimen>
<dimen name="tweetitem_textsize_button">12sp</dimen>
<dimen name="tweetitem_textsize_date">12sp</dimen>