mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Still prepare to support multiple themes.
This commit is contained in:
parent
192d64f6bc
commit
b1fe051023
@ -121,9 +121,6 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
public abstract SharedPreferences getSharedPreferences();
|
||||
|
||||
protected boolean isLightStatusbar() {
|
||||
return lightStatusbar;
|
||||
}
|
||||
protected boolean isChangeStatusBarIconColor() {
|
||||
return changeStatusBarIconColor;
|
||||
}
|
||||
@ -136,7 +133,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
return systemVisibilityToolbarCollapsed;
|
||||
}
|
||||
|
||||
protected boolean isImmersiveInterface() {
|
||||
public boolean isImmersiveInterface() {
|
||||
return immersiveInterface;
|
||||
}
|
||||
|
||||
@ -163,7 +160,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
protected int getNavBarHeight() {
|
||||
public int getNavBarHeight() {
|
||||
Resources resources = getResources();
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
|
@ -31,6 +31,7 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.CommentsListingRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.CommentViewModel;
|
||||
@ -108,12 +109,13 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mCommentRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
if ((mActivity instanceof BaseActivity && ((BaseActivity) mActivity).isImmersiveInterface())) {
|
||||
mCommentRecyclerView.setPadding(0, 0, 0, ((BaseActivity) mActivity).getNavBarHeight());
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mCommentRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.Fragment;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
@ -26,6 +27,7 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.FollowedUsersRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
@ -33,6 +35,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserViewModel;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -57,6 +60,8 @@ public class FollowedUsersListingFragment extends Fragment implements FragmentCo
|
||||
@Named("oauth")
|
||||
Retrofit mOauthRetrofit;
|
||||
@Inject
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
SubscribedUserViewModel mSubscribedUserViewModel;
|
||||
private Activity mActivity;
|
||||
@ -79,12 +84,13 @@ public class FollowedUsersListingFragment extends Fragment implements FragmentCo
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
if ((mActivity instanceof BaseActivity && ((BaseActivity) mActivity).isImmersiveInterface())) {
|
||||
mRecyclerView.setPadding(0, 0, 0, ((BaseActivity) mActivity).getNavBarHeight());
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -46,6 +47,7 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.MainActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
|
||||
@ -195,15 +197,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
if ((activity instanceof BaseActivity && ((BaseActivity) activity).isImmersiveInterface())) {
|
||||
mPostRecyclerView.setPadding(0, 0, 0, ((BaseActivity) activity).getNavBarHeight());
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mPostRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mPostRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SearchSubredditsResultActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.SubredditListingRecyclerViewAdapter;
|
||||
@ -100,12 +101,13 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mSubredditListingRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
if ((mActivity instanceof BaseActivity && ((BaseActivity) mActivity).isImmersiveInterface())) {
|
||||
mSubredditListingRecyclerView.setPadding(0, 0, 0, ((BaseActivity) mActivity).getNavBarHeight());
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mSubredditListingRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
@ -28,6 +29,7 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.SubscribedSubredditsRecyclerViewAdapter;
|
||||
@ -36,6 +38,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditViewModel;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -63,6 +66,8 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
|
||||
@Named("oauth")
|
||||
Retrofit mOauthRetrofit;
|
||||
@Inject
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
private Activity mActivity;
|
||||
private RequestManager mGlide;
|
||||
@ -81,13 +86,14 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
|
||||
|
||||
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
if ((mActivity instanceof BaseActivity && ((BaseActivity) mActivity).isImmersiveInterface())) {
|
||||
mRecyclerView.setPadding(0, 0, 0, ((BaseActivity) mActivity).getNavBarHeight());
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Resources resources = getResources();
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.UserListingRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
@ -97,12 +98,13 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mUserListingRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
if ((mActivity instanceof BaseActivity && ((BaseActivity) mActivity).isImmersiveInterface())) {
|
||||
mUserListingRecyclerView.setPadding(0, 0, 0, ((BaseActivity) mActivity).getNavBarHeight());
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mUserListingRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user