diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-29 06:08:32 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-29 06:08:32 +0000 |
commit | eff076a27014f0315151a68cd7f1659d1f9cf1cd (patch) | |
tree | fd75d58bee1c0351d908383b1e4621746a8ea980 /app | |
parent | c5a824ac89af99017b95b0806b700f0428e198e3 (diff) | |
download | infinity-for-reddit-eff076a27014f0315151a68cd7f1659d1f9cf1cd.tar infinity-for-reddit-eff076a27014f0315151a68cd7f1659d1f9cf1cd.tar.gz infinity-for-reddit-eff076a27014f0315151a68cd7f1659d1f9cf1cd.tar.bz2 infinity-for-reddit-eff076a27014f0315151a68cd7f1659d1f9cf1cd.tar.lz infinity-for-reddit-eff076a27014f0315151a68cd7f1659d1f9cf1cd.tar.xz infinity-for-reddit-eff076a27014f0315151a68cd7f1659d1f9cf1cd.tar.zst infinity-for-reddit-eff076a27014f0315151a68cd7f1659d1f9cf1cd.zip |
Fixed controller position and margin in ViewVideoActivity. Minor UI tweaks.
Diffstat (limited to 'app')
5 files changed, 24 insertions, 10 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java index 23b24de2..b2c0e12a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java @@ -325,12 +325,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator { filter, nsfw); } } else if(postType == PostDataSource.TYPE_USER) { - CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mFetchPostInfoLinearLayout.getLayoutParams(); - params.height = ViewGroup.LayoutParams.WRAP_CONTENT; - mFetchPostInfoLinearLayout.setLayoutParams(params); - String username = getArguments().getString(EXTRA_USER_NAME); String where = getArguments().getString(EXTRA_USER_WHERE); + if(where != null && where.equals(PostDataSource.USER_WHERE_SUBMITTED)) { + CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mFetchPostInfoLinearLayout.getLayoutParams(); + params.height = ViewGroup.LayoutParams.WRAP_CONTENT; + mFetchPostInfoLinearLayout.setLayoutParams(params); + } mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase, accessToken, postType, true, new PostRecyclerViewAdapter.Callback() { @@ -404,6 +405,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { this.hasPost = hasPost; if(hasPost) { mFetchPostInfoLinearLayout.setVisibility(View.GONE); + mProgressBar.setVisibility(View.GONE); } else { if(isInLazyMode) { stopLazyMode(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java index bffc0a9c..c3ed9951 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java @@ -8,6 +8,7 @@ import android.app.DownloadManager; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.graphics.PorterDuff; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; @@ -94,11 +95,20 @@ public class ViewVideoActivity extends AppCompatActivity { actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarColor))); setTitle(""); - //Set player controller margin bottom in order to display it above the navbar - int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android"); - LinearLayout controllerLinearLayout = findViewById(R.id.linear_layout_exo_playback_control_view); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) controllerLinearLayout.getLayoutParams(); - params.bottomMargin = getResources().getDimensionPixelSize(resourceId); + + if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || getResources().getBoolean(R.bool.isTablet)) { + //Set player controller bottom margin in order to display it above the navbar + int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android"); + LinearLayout controllerLinearLayout = findViewById(R.id.linear_layout_exo_playback_control_view); + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) controllerLinearLayout.getLayoutParams(); + params.bottomMargin = getResources().getDimensionPixelSize(resourceId); + } else { + //Set player controller right margin in order to display it above the navbar + int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android"); + LinearLayout controllerLinearLayout = findViewById(R.id.linear_layout_exo_playback_control_view); + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) controllerLinearLayout.getLayoutParams(); + params.rightMargin = getResources().getDimensionPixelSize(resourceId); + } Intent intent = getIntent(); mVideoUri = intent.getData(); diff --git a/app/src/main/res/layout/fragment_comments_listing.xml b/app/src/main/res/layout/fragment_comments_listing.xml index 886c093a..0e29f42a 100644 --- a/app/src/main/res/layout/fragment_comments_listing.xml +++ b/app/src/main/res/layout/fragment_comments_listing.xml @@ -28,6 +28,7 @@ android:id="@+id/fetch_comments_info_linear_layout_comments_listing_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="48dp" android:layout_marginBottom="48dp" android:gravity="center" android:orientation="vertical" diff --git a/app/src/main/res/layout/fragment_post.xml b/app/src/main/res/layout/fragment_post.xml index 240bcb60..34d34e02 100644 --- a/app/src/main/res/layout/fragment_post.xml +++ b/app/src/main/res/layout/fragment_post.xml @@ -26,6 +26,7 @@ android:id="@+id/fetch_post_info_linear_layout_post_fragment" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginTop="48dp" android:layout_marginBottom="48dp" android:gravity="center" android:orientation="vertical" diff --git a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml index ef3342d4..48fc99f5 100644 --- a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml +++ b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml @@ -2,7 +2,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="48dp" + android:layout_marginTop="48dp" android:orientation="vertical"> <ImageView |