Fixed controller position and margin in ViewVideoActivity. Minor UI tweaks.

This commit is contained in:
Alex Ning 2019-08-29 14:08:32 +08:00
parent c5a824ac89
commit eff076a270
5 changed files with 24 additions and 10 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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"

View File

@ -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"

View File

@ -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