mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-24 16:54:45 +01:00
Still prepare to support multiple themes.
This commit is contained in:
parent
152a6a280a
commit
192d64f6bc
@ -19,17 +19,13 @@ import okhttp3.Response;
|
||||
import okhttp3.Route;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||
|
||||
class AccessTokenAuthenticator implements Authenticator {
|
||||
private Retrofit mRetrofit;
|
||||
private RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
|
||||
AccessTokenAuthenticator(RedditDataRoomDatabase accountRoomDatabase) {
|
||||
mRetrofit = new Retrofit.Builder()
|
||||
.baseUrl(RedditUtils.API_BASE_URI)
|
||||
.addConverterFactory(ScalarsConverterFactory.create())
|
||||
.build();
|
||||
AccessTokenAuthenticator(Retrofit retrofit, RedditDataRoomDatabase accountRoomDatabase) {
|
||||
mRetrofit = retrofit;
|
||||
mRedditDataRoomDatabase = accountRoomDatabase;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@ -27,7 +23,6 @@ import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
@ -84,43 +79,16 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,12 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@ -32,7 +30,6 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
@ -43,7 +40,6 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class AccountSavedThingActivity extends BaseActivity {
|
||||
@ -92,44 +88,17 @@ public class AccountSavedThingActivity extends BaseActivity {
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
boolean lightNavBar = false;
|
||||
if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
lightNavBar = true;
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
boolean finalLightNavBar = lightNavBar;
|
||||
|
||||
View decorView = window.getDecorView();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}*/
|
||||
}
|
||||
|
||||
int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
|
@ -14,6 +14,9 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
@ -30,6 +33,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
private boolean immersiveInterface;
|
||||
private boolean lightStatusbar;
|
||||
private boolean changeStatusBarIconColor = true;
|
||||
private boolean transparentStatusBarAfterToolbarCollapsed;
|
||||
private int systemVisibilityToolbarExpanded;
|
||||
private int systemVisibilityToolbarCollapsed;
|
||||
|
||||
@ -46,7 +50,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
getTheme().applyStyle(R.style.Theme_Purple, true);
|
||||
lightStatusbar = true;
|
||||
lightStatusbar = !transparentStatusBarAfterToolbarCollapsed;
|
||||
changeStatusBarIconColor = false;
|
||||
break;
|
||||
case 1:
|
||||
@ -66,7 +70,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
|
||||
getTheme().applyStyle(R.style.Theme_Purple, true);
|
||||
lightStatusbar = true;
|
||||
lightStatusbar = !transparentStatusBarAfterToolbarCollapsed;
|
||||
changeStatusBarIconColor = false;
|
||||
} else {
|
||||
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||
@ -88,15 +92,16 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
Window window = getWindow();
|
||||
View decorView = window.getDecorView();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (lightStatusbar) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
if (changeStatusBarIconColor) {
|
||||
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
}
|
||||
} else {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
if (changeStatusBarIconColor) {
|
||||
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
@ -105,7 +110,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
window.setNavigationBarColor(Utils.getAttributeColor(this, R.attr.navBarColor));
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (lightStatusbar) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
}
|
||||
if (changeStatusBarIconColor) {
|
||||
@ -144,6 +149,20 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void addOnOffsetChangedListener(AppBarLayout appBarLayout) {
|
||||
View decorView = getWindow().getDecorView();
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) {
|
||||
if (state == State.COLLAPSED) {
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarCollapsed());
|
||||
} else if (state == State.EXPANDED) {
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarExpanded());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected int getNavBarHeight() {
|
||||
Resources resources = getResources();
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
@ -152,4 +171,8 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setTransparentStatusBarAfterToolbarCollapsed(boolean transparentStatusBarAfterToolbarCollapsed) {
|
||||
this.transparentStatusBarAfterToolbarCollapsed = transparentStatusBarAfterToolbarCollapsed;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.SuperscriptSpan;
|
||||
@ -23,6 +24,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
@ -71,6 +73,8 @@ public class CommentActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.coordinator_layout_comment_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_comment_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_comment_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.comment_parent_markwon_view_comment_activity)
|
||||
@ -106,6 +110,10 @@ public class CommentActivity extends BaseActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
getCurrentAccount();
|
||||
} else {
|
||||
|
@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -16,6 +17,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -44,6 +46,8 @@ public class CreateMultiRedditActivity extends BaseActivity {
|
||||
private static final String SELECTED_OTHER_SUBREDDITS_STATE = "SOSS";
|
||||
@BindView(R.id.coordinator_layout_create_multi_reddit_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_create_multi_reddit_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_create_multi_reddit_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.multi_reddit_name_edit_text_create_multi_reddit_activity)
|
||||
@ -77,6 +81,10 @@ public class CreateMultiRedditActivity extends BaseActivity {
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -14,6 +15,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
@ -51,6 +53,8 @@ public class EditCommentActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.coordinator_layout_edit_comment_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_edit_comment_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_edit_comment_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.post_text_content_edit_text_edit_comment_activity)
|
||||
@ -77,6 +81,10 @@ public class EditCommentActivity extends BaseActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -15,6 +16,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
@ -48,6 +50,8 @@ public class EditPostActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.coordinator_layout_edit_post_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_edit_post_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_edit_post_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.post_title_text_view_edit_post_activity)
|
||||
@ -76,6 +80,10 @@ public class EditPostActivity extends BaseActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@ -27,7 +23,6 @@ import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
@ -42,9 +37,9 @@ import ml.docilealligator.infinityforreddit.Post.Post;
|
||||
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SortType;
|
||||
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
|
||||
public class FilteredThingActivity extends BaseActivity implements SortTypeSelectionCallback,
|
||||
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback {
|
||||
@ -100,45 +95,16 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.webkit.CookieManager;
|
||||
@ -15,6 +16,8 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -43,6 +46,8 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.toolbar_login_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.appbar_layout_login_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.webview_login_activity)
|
||||
WebView webView;
|
||||
@Inject
|
||||
@ -66,6 +71,10 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
@ -3,7 +3,6 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
@ -58,7 +57,6 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Account.AccountViewModel;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.NavigationDrawerRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
@ -196,31 +194,19 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
Resources resources = getResources();
|
||||
View decorView = window.getDecorView();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) {
|
||||
if (state == State.COLLAPSED) {
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarCollapsed());
|
||||
} else if (state == State.EXPANDED) {
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarExpanded());
|
||||
}
|
||||
}
|
||||
});
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
adjustToolbar(toolbar);
|
||||
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
linearLayoutBottomAppBar.setPadding(0,
|
||||
(int) (6 * resources.getDisplayMetrics().density), 0, navBarHeight);
|
||||
(int) (6 * getResources().getDisplayMetrics().density), 0, navBarHeight);
|
||||
navDrawerRecyclerView.setPadding(0, 0, 0, navBarHeight);
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,10 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
@ -36,7 +33,6 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.MultiRedditListingRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
@ -45,7 +41,6 @@ import ml.docilealligator.infinityforreddit.MultiReddit.MultiReddit;
|
||||
import ml.docilealligator.infinityforreddit.MultiReddit.MultiRedditViewModel;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -96,49 +91,20 @@ public class MultiRedditListingActivity extends BaseActivity {
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
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))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(mAppBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(mToolbar);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
mAppBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.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) mToolbar.getLayoutParams();
|
||||
params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
mToolbar.setLayoutParams(params);
|
||||
}
|
||||
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, navBarHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import androidx.core.content.FileProvider;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
@ -81,6 +82,8 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_image_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_post_image_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_post_image_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.subreddit_icon_gif_image_view_post_image_activity)
|
||||
@ -155,6 +158,10 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -19,6 +20,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.libRG.CustomTextView;
|
||||
@ -68,6 +70,8 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_link_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_post_link_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_post_link_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.subreddit_icon_gif_image_view_post_link_activity)
|
||||
@ -129,6 +133,10 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -19,6 +20,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.libRG.CustomTextView;
|
||||
@ -68,6 +70,8 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_text_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_post_text_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_post_text_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.subreddit_icon_gif_image_view_search_activity)
|
||||
@ -129,6 +133,10 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -31,6 +31,7 @@ import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
@ -83,6 +84,8 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
|
||||
@BindView(R.id.coordinator_layout_post_video_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_post_video_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_post_video_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.subreddit_icon_gif_image_view_post_video_activity)
|
||||
@ -163,6 +166,10 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
@ -1,14 +1,11 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ProgressBar;
|
||||
@ -35,14 +32,12 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.RulesRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.Rule;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@ -83,51 +78,20 @@ public class RulesActivity extends BaseActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
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)
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(toolbar);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
recyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
recyclerView.setPadding(0, 0, 0, navBarHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,11 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@ -31,7 +28,6 @@ import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
@ -47,9 +43,9 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SortType;
|
||||
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
|
||||
public class SearchResultActivity extends BaseActivity implements SortTypeSelectionCallback,
|
||||
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback {
|
||||
@ -94,42 +90,16 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
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))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,13 +3,9 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@ -26,14 +22,12 @@ import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
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.Utils.SharedPreferencesUtils;
|
||||
|
||||
public class SearchSubredditsResultActivity extends BaseActivity {
|
||||
|
||||
@ -71,42 +65,16 @@ public class SearchSubredditsResultActivity extends BaseActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
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)
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
@ -10,6 +11,8 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
@ -25,6 +28,8 @@ public class SettingsActivity extends BaseActivity implements
|
||||
|
||||
private static final String TITLE_STATE = "TS";
|
||||
|
||||
@BindView(R.id.appbar_layout_settings_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_settings_activity)
|
||||
Toolbar toolbar;
|
||||
|
||||
@ -41,6 +46,10 @@ public class SettingsActivity extends BaseActivity implements
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
|
@ -2,14 +2,11 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
@ -36,7 +33,6 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.SubredditMultiselectionRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
@ -44,7 +40,6 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubredditWithSelection;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditViewModel;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class SubredditMultiselectionActivity extends BaseActivity {
|
||||
@ -94,49 +89,20 @@ public class SubredditMultiselectionActivity extends BaseActivity {
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
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))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(mAppBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(mToolbar);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
mAppBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.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) mToolbar.getLayoutParams();
|
||||
params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
mToolbar.setLayoutParams(params);
|
||||
}
|
||||
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, navBarHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,10 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@ -31,7 +27,6 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
@ -40,7 +35,6 @@ 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.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
|
||||
@ -91,45 +85,16 @@ public class SubredditSelectionActivity extends BaseActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
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)
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@ -32,7 +29,6 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
@ -46,7 +42,6 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class SubscribedThingListingActivity extends BaseActivity {
|
||||
@ -89,45 +84,16 @@ public class SubscribedThingListingActivity extends BaseActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
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))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,12 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
@ -38,7 +36,6 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.MessageRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
@ -48,7 +45,6 @@ import ml.docilealligator.infinityforreddit.MessageViewModel;
|
||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -106,48 +102,21 @@ public class ViewMessageActivity extends BaseActivity {
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(toolbar);
|
||||
|
||||
boolean lightNavBar = false;
|
||||
if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
lightNavBar = true;
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, navBarHeight);
|
||||
}
|
||||
boolean finalLightNavBar = lightNavBar;
|
||||
|
||||
View decorView = window.getDecorView();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,11 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
@ -27,7 +24,6 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostLayoutBottomSheetFragment;
|
||||
@ -95,43 +91,16 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
adjustToolbar(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,15 +2,12 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
@ -52,7 +49,6 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.CommentAndPostRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.CommentData;
|
||||
@ -202,50 +198,19 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
mSlidrInterface = Slidr.attach(this);
|
||||
}
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(toolbar);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
int navBarHeight = resources.getDimensionPixelSize(navBarResourceId);
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||
params.bottomMargin = navBarHeight;
|
||||
fab.setLayoutParams(params);
|
||||
@ -253,6 +218,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
||||
showToast = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toolbar.setTitle("");
|
||||
setSupportActionBar(toolbar);
|
||||
|
@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@ -13,8 +12,6 @@ import android.text.util.Linkify;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
@ -46,7 +43,6 @@ import io.noties.markwon.recycler.table.TableEntry;
|
||||
import io.noties.markwon.recycler.table.TableEntryPlugin;
|
||||
import io.noties.markwon.simple.ext.SimpleExtPlugin;
|
||||
import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
@ -54,7 +50,6 @@ import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -89,54 +84,26 @@ public class ViewSidebarActivity extends BaseActivity {
|
||||
|
||||
Resources resources = getResources();
|
||||
|
||||
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(toolbar);
|
||||
|
||||
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();
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.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 = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
int dp = 16;
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
int px = (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
16,
|
||||
resources.getDisplayMetrics()
|
||||
);
|
||||
markdownRecyclerView.setPadding(px, px, px, resources.getDimensionPixelSize(navBarResourceId));
|
||||
markdownRecyclerView.setPadding(px, px, px, navBarHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,6 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
@ -12,7 +10,6 @@ import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
@ -45,7 +42,6 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsSubscribedToSubredditAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask;
|
||||
@ -163,6 +159,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
setTransparentStatusBarAfterToolbarCollapsed(true);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@ -172,44 +169,24 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
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))
|
||||
&& mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(toolbar);
|
||||
|
||||
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 navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
int navBarHeight = resources.getDimensionPixelSize(navBarResourceId);
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||
params.bottomMargin = navBarHeight;
|
||||
fab.setLayoutParams(params);
|
||||
linearLayoutBottomAppBar.setPadding(0,
|
||||
(int) (6 * resources.getDisplayMetrics().density), 0, navBarHeight);
|
||||
(int) (6 * getResources().getDisplayMetrics().density), 0, navBarHeight);
|
||||
|
||||
showToast = true;
|
||||
}
|
||||
@ -275,9 +252,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
subredditNameTextView.setText(title);
|
||||
|
||||
toolbar.setTitle(title);
|
||||
ViewGroup.MarginLayoutParams toolbarParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
||||
toolbarParams.topMargin = statusBarHeight;
|
||||
toolbar.setLayoutParams(toolbarParams);
|
||||
adjustToolbar(toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
glide = Glide.with(this);
|
||||
|
@ -3,7 +3,6 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
@ -98,6 +97,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
ViewPager viewPager;
|
||||
@BindView(R.id.appbar_layout_view_user_detail)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_view_user_detail_activity)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.tab_layout_view_user_detail_activity)
|
||||
TabLayout tabLayout;
|
||||
@BindView(R.id.collapsing_toolbar_layout_view_user_detail_activity)
|
||||
@ -151,6 +152,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
setTransparentStatusBarAfterToolbarCollapsed(true);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@ -195,10 +197,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
statusBarHeight = resources.getDimensionPixelSize(resourceId);
|
||||
}
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
ViewGroup.MarginLayoutParams toolbarLayoutParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
||||
toolbarLayoutParams.topMargin = statusBarHeight;
|
||||
toolbar.setLayoutParams(toolbarLayoutParams);
|
||||
adjustToolbar(toolbar);
|
||||
|
||||
String title = "u/" + username;
|
||||
userNameTextView.setText(title);
|
||||
@ -213,42 +212,47 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
collapsedTabIndicatorColor = Utils.getAttributeColor(this, R.attr.tabLayoutWithCollapsedCollapsingToolbarTabIndicator);
|
||||
collapsedTabBackgroundColor = Utils.getAttributeColor(this, R.attr.tabLayoutWithCollapsedCollapsingToolbarTabBackground);
|
||||
|
||||
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 (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
|
||||
boolean lightNavBar = false;
|
||||
if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
lightNavBar = true;
|
||||
showToast = true;
|
||||
}
|
||||
boolean finalLightNavBar = lightNavBar;
|
||||
|
||||
View decorView = window.getDecorView();
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
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);
|
||||
}
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarCollapsed());
|
||||
tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(collapsedTabBackgroundColor);
|
||||
} else if (state == State.EXPANDED) {
|
||||
if (finalLightNavBar) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarExpanded());
|
||||
tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(expandedTabBackgroundColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
showToast = true;
|
||||
} else {
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||
if (state == State.COLLAPSED) {
|
||||
tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(collapsedTabBackgroundColor);
|
||||
} else if (state == State.EXPANDED) {
|
||||
tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(expandedTabBackgroundColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
|
@ -5,12 +5,15 @@ import android.content.SharedPreferences;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import ml.docilealligator.infinityforreddit.Utils.RedditUtils;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||
@ -76,13 +79,13 @@ class AppModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
OkHttpClient provideOkHttpClient(RedditDataRoomDatabase accountRoomDatabase) {
|
||||
OkHttpClient provideOkHttpClient(@Named("no_oauth") Retrofit retrofit, RedditDataRoomDatabase accountRoomDatabase) {
|
||||
OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder();
|
||||
okHttpClientBuilder.authenticator(new AccessTokenAuthenticator(accountRoomDatabase));
|
||||
/*.connectTimeout(30, TimeUnit.SECONDS)
|
||||
okHttpClientBuilder.authenticator(new AccessTokenAuthenticator(retrofit, accountRoomDatabase))
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS));*/
|
||||
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS));
|
||||
//.addInterceptor(new Okhttp3DebugInterceptor(mApplication));
|
||||
return okHttpClientBuilder.build();
|
||||
}
|
||||
|
@ -9,11 +9,19 @@
|
||||
tools:application=".CommentActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_comment_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_comment_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_comment_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -21,6 +29,8 @@
|
||||
app:navigationIcon="?attr/homeAsUpIndicator"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
@ -8,11 +8,19 @@
|
||||
tools:context=".Activity.CreateMultiRedditActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_create_multi_reddit_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_create_multi_reddit_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_create_multi_reddit_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -20,6 +28,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
@ -9,11 +9,19 @@
|
||||
tools:context=".Activity.EditCommentActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_edit_comment_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_edit_comment_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_edit_comment_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -21,6 +29,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<EditText
|
||||
|
@ -9,11 +9,19 @@
|
||||
tools:context=".Activity.EditPostActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_edit_post_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_edit_post_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_edit_post_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -21,6 +29,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
@ -8,11 +8,19 @@
|
||||
tools:application="ml.docilealligator.infinityforreddit.Activity.LoginActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_login_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_login_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_login_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -20,6 +28,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<ml.docilealligator.infinityforreddit.CustomView.LollipopBugFixedWebView
|
||||
|
@ -9,11 +9,19 @@
|
||||
tools:application=".PostImageActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_post_image_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_post_image_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_post_image_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -21,6 +29,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
@ -9,11 +9,19 @@
|
||||
tools:application=".PostTextActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_post_link_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_post_link_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_post_link_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -21,6 +29,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
@ -9,11 +9,19 @@
|
||||
tools:application=".PostTextActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_post_text_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_post_text_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_post_text_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -21,6 +29,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
@ -9,11 +9,19 @@
|
||||
tools:application=".PostImageActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_post_video_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_post_text_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_post_video_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -21,6 +29,8 @@
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
@ -5,11 +5,19 @@
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_settings_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false"
|
||||
app:toolbarId="@+id/toolbar_post_text_activity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_settings_activity"
|
||||
android:layout_width="match_parent"
|
||||
@ -17,6 +25,8 @@
|
||||
app:navigationIcon="?attr/homeAsUpIndicator"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
@ -28,7 +28,7 @@
|
||||
app:titleEnabled="false"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
|
||||
app:toolbarId="@+id/toolbar">
|
||||
app:toolbarId="@+id/toolbar_view_user_detail_activity">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -93,7 +93,7 @@
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:id="@+id/toolbar_view_user_detail_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_collapseMode="pin"
|
||||
|
Loading…
x
Reference in New Issue
Block a user