mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-24 18:08:23 +01:00
Disabling immersive mode (content shown under status bar and nav bar) is now available.
This commit is contained in:
parent
9b24fff160
commit
0036bb11d8
@ -37,6 +37,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
|
||||
public class AccountPostsActivity extends BaseActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||
|
||||
@ -83,7 +84,8 @@ public class AccountPostsActivity extends BaseActivity implements UserThingSortT
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))) {
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -42,6 +42,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class AccountSavedThingActivity extends BaseActivity {
|
||||
@ -92,7 +93,8 @@ public class AccountSavedThingActivity extends BaseActivity {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))) {
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -39,6 +39,7 @@ import ml.docilealligator.infinityforreddit.Post;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
|
||||
public class FilteredThingActivity extends BaseActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||
SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback, UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||
@ -95,7 +96,8 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeBotto
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))) {
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -66,8 +67,8 @@ import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchToAnonymousAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchMyInfo;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
|
||||
@ -206,50 +207,61 @@ public class MainActivity extends BaseActivity implements SortTypeBottomSheetFra
|
||||
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
TypedValue typedValue = new TypedValue();
|
||||
getTheme().resolveAttribute(R.attr.navBarColor, typedValue, true);
|
||||
int navBarColor = typedValue.data;
|
||||
window.setNavigationBarColor(navBarColor);
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
|
||||
boolean lightNavBar = false;
|
||||
if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
lightNavBar = true;
|
||||
}
|
||||
boolean finalLightNavBar = lightNavBar;
|
||||
if ((resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
View decorView = window.getDecorView();
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||
if (state == State.COLLAPSED) {
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
} else if (state == State.EXPANDED) {
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
boolean lightNavBar = false;
|
||||
if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
lightNavBar = true;
|
||||
}
|
||||
boolean finalLightNavBar = lightNavBar;
|
||||
|
||||
View decorView = window.getDecorView();
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||
if (state == State.COLLAPSED) {
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
} else if (state == State.EXPANDED) {
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (statusBarResourceId > 0) {
|
||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
||||
params.topMargin = resources.getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
});
|
||||
|
||||
int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (statusBarResourceId > 0) {
|
||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
||||
params.topMargin = resources.getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
int navBarHeight = resources.getDimensionPixelSize(navBarResourceId);
|
||||
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||
params.bottomMargin = navBarHeight;
|
||||
fab.setLayoutParams(params);
|
||||
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
int navBarHeight = resources.getDimensionPixelSize(navBarResourceId);
|
||||
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||
params.bottomMargin = navBarHeight;
|
||||
fab.setLayoutParams(params);
|
||||
|
||||
nestedScrollView.setPadding(0, 0, 0, navBarHeight);
|
||||
nestedScrollView.setPadding(0, 0, 0, navBarHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import ml.docilealligator.infinityforreddit.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.Rule;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@ -85,7 +86,8 @@ public class RulesActivity extends BaseActivity {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -44,6 +44,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
|
||||
public class SearchResultActivity extends BaseActivity implements SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback,
|
||||
SearchUserAndSubredditSortTypeBottomSheetFragment.SearchUserAndSubredditSortTypeSelectionCallback {
|
||||
@ -89,7 +90,8 @@ public class SearchResultActivity extends BaseActivity implements SearchPostSort
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
if ((resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -33,6 +33,7 @@ import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
|
||||
public class SearchSubredditsResultActivity extends BaseActivity {
|
||||
|
||||
@ -73,7 +74,8 @@ public class SearchSubredditsResultActivity extends BaseActivity {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -1,13 +1,8 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@ -45,7 +40,7 @@ public class SettingsActivity extends BaseActivity implements
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
@ -54,7 +49,7 @@ public class SettingsActivity extends BaseActivity implements
|
||||
getTheme().resolveAttribute(R.attr.navBarColor, typedValue, true);
|
||||
int navBarColor = typedValue.data;
|
||||
window.setNavigationBarColor(navBarColor);
|
||||
}
|
||||
}*/
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
|
@ -40,6 +40,7 @@ import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListing
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
|
||||
@ -93,7 +94,8 @@ public class SubredditSelectionActivity extends BaseActivity {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -41,6 +41,7 @@ import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListing
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
|
||||
@ -89,7 +90,8 @@ public class SubscribedThingListingActivity extends BaseActivity {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
if ((resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -48,6 +48,7 @@ import ml.docilealligator.infinityforreddit.MessageViewModel;
|
||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class ViewMessageActivity extends BaseActivity {
|
||||
@ -106,7 +107,8 @@ public class ViewMessageActivity extends BaseActivity {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))) {
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -175,7 +175,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))) {
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -56,6 +56,7 @@ import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.ReadMessage;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditDao;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel;
|
||||
@ -148,7 +149,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
Resources resources = getResources();
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
if ((resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -62,6 +62,7 @@ import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.ReadMessage;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserDao;
|
||||
import ml.docilealligator.infinityforreddit.User.UserDao;
|
||||
import ml.docilealligator.infinityforreddit.User.UserData;
|
||||
@ -212,7 +213,8 @@ public class ViewUserDetailActivity extends BaseActivity implements UserThingSor
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))) {
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
Window window = getWindow();
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
|
@ -157,7 +157,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))
|
||||
&& 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) {
|
||||
|
@ -46,6 +46,7 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
|
||||
((Infinity) activity.getApplication()).getAppComponent().inject(this);
|
||||
|
||||
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
|
||||
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
|
||||
SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
|
||||
SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY);
|
||||
SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY);
|
||||
@ -61,6 +62,18 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
|
||||
});
|
||||
}
|
||||
|
||||
if(immersiveInterfaceSwitch != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
immersiveInterfaceSwitch.setVisible(true);
|
||||
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
immersiveInterfaceSwitch.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (nsfwSwitch != null) {
|
||||
nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new ChangeNSFWEvent((Boolean) newValue));
|
||||
|
@ -28,4 +28,5 @@ public class SharedPreferencesUtils {
|
||||
public static final String TITLE_FONT_SIZE_KEY = "title_font_size";
|
||||
public static final String CONTENT_FONT_SIZE_KEY = "content_font_size";
|
||||
public static final String AMOLED_DARK_KEY = "amoled_dark";
|
||||
public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface";
|
||||
}
|
||||
|
@ -95,7 +95,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:gravity="center"
|
||||
android:textSize="?attr/font_default"
|
||||
android:textSize="?attr/font_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toEndOf="@+id/up_vote_button_item_post_comment"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
@ -24,8 +24,6 @@
|
||||
|
||||
<color name="roundedBottomSheetPrimaryBackground">#242424</color>
|
||||
|
||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
||||
|
||||
<color name="voteAndReplyUnavailableVoteButtonColor">#3C3C3C</color>
|
||||
|
||||
<color name="tabLayoutWithExpandedCollapsingToolbarTextColor">#FFFFFF</color>
|
||||
|
4
app/src/main/res/values-v27/colors.xml
Normal file
4
app/src/main/res/values-v27/colors.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
||||
</resources>
|
@ -24,7 +24,7 @@
|
||||
|
||||
<color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color>
|
||||
|
||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">@android:color/black</color>
|
||||
|
||||
<color name="upvoted">#E91E63</color>
|
||||
|
||||
|
@ -274,6 +274,7 @@
|
||||
<string name="settings_theme_dark_theme_summary">Dark Theme</string>
|
||||
<string name="settings_theme_system_default_summary">Device default</string>
|
||||
<string name="settings_amoled_dark_title">Amoled Dark</string>
|
||||
<string name="settings_immersive_interface_title">Immersive Interface</string>
|
||||
<string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string>
|
||||
<string name="settings_font_size_title">Font Size</string>
|
||||
<string name="settings_title_font_size_title">Title Font Size</string>
|
||||
|
@ -20,6 +20,12 @@
|
||||
app:key="amoled_dark"
|
||||
app:title="@string/settings_amoled_dark_title" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="true"
|
||||
app:key="immersive_interface"
|
||||
app:title="@string/settings_immersive_interface_title"
|
||||
app:isPreferenceVisible="false" />
|
||||
|
||||
<ListPreference
|
||||
app:defaultValue="2.5"
|
||||
android:entries="@array/settings_lazy_mode_interval"
|
||||
|
Loading…
Reference in New Issue
Block a user