Don't draw under display cutouts in landscape mode (API >= 28).

This commit is contained in:
Alex Ning 2019-02-27 13:15:32 +08:00
parent acc08489fa
commit fb525d62ed
4 changed files with 22 additions and 12 deletions

View File

@ -3,7 +3,6 @@ package ml.docilealligator.infinityforreddit;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -102,8 +101,7 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
context.startActivity(intent);
});
if(subredditData.getIconUrl() != null) {
Log.i("url", subredditData.getIconUrl());
if(!subredditData.getIconUrl().equals("")) {
glide.load(subredditData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon)

View File

@ -94,15 +94,15 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if(holder instanceof UserListingRecyclerViewAdapter.DataViewHolder) {
UserData UserData = getItem(position);
UserData userData = getItem(position);
((UserListingRecyclerViewAdapter.DataViewHolder) holder).constraintLayout.setOnClickListener(view -> {
Intent intent = new Intent(context, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, UserData.getName());
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, userData.getName());
context.startActivity(intent);
});
if(UserData.getIconUrl() != null) {
glide.load(UserData.getIconUrl())
if(!userData.getIconUrl().equals("")) {
glide.load(userData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
@ -113,9 +113,9 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
.into(((UserListingRecyclerViewAdapter.DataViewHolder) holder).iconGifImageView);
}
((UserListingRecyclerViewAdapter.DataViewHolder) holder).UserNameTextView.setText(UserData.getName());
((UserListingRecyclerViewAdapter.DataViewHolder) holder).UserNameTextView.setText(userData.getName());
new CheckIsFollowingUserAsyncTask(subscribedUserDao, UserData.getName(),
new CheckIsFollowingUserAsyncTask(subscribedUserDao, userData.getName(),
new CheckIsFollowingUserAsyncTask.CheckIsFollowingUserListener() {
@Override
public void isSubscribed() {
@ -127,7 +127,7 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
((UserListingRecyclerViewAdapter.DataViewHolder) holder).subscribeButton.setVisibility(View.VISIBLE);
((UserListingRecyclerViewAdapter.DataViewHolder) holder).subscribeButton.setOnClickListener(view -> {
UserFollowing.followUser(oauthRetrofit, retrofit,
authInfoSharedPreferences, UserData.getName(), subscribedUserDao,
authInfoSharedPreferences, userData.getName(), subscribedUserDao,
new UserFollowing.UserFollowingListener() {
@Override
public void onUserFollowingSuccess() {

View File

@ -17,8 +17,7 @@
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
android:layout_gravity="start">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowLayoutInDisplayCutoutMode">never</item>
<item name="android:navigationBarColor">@android:color/black</item>
<item name="android:textColorPrimary">@android:color/white</item>
</style>
</resources>