mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Make navigation bar and status bar transparent to display posts, comments, subreddits and users under them. Minor UI tweaks for bottom sheet fragments.
This commit is contained in:
parent
4c21eea852
commit
413a18f6d3
@ -0,0 +1,41 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
|
|
||||||
|
abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {
|
||||||
|
// State
|
||||||
|
public enum State {
|
||||||
|
EXPANDED,
|
||||||
|
COLLAPSED,
|
||||||
|
IDLE
|
||||||
|
}
|
||||||
|
|
||||||
|
private AppBarStateChangeListener.State mCurrentState = AppBarStateChangeListener.State.IDLE;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void onOffsetChanged(AppBarLayout appBarLayout, int i) {
|
||||||
|
if (i == 0) {
|
||||||
|
if (mCurrentState != AppBarStateChangeListener.State.EXPANDED) {
|
||||||
|
onStateChanged(appBarLayout, AppBarStateChangeListener.State.EXPANDED);
|
||||||
|
}
|
||||||
|
mCurrentState = AppBarStateChangeListener.State.EXPANDED;
|
||||||
|
} else if (Math.abs(i) >= appBarLayout.getTotalScrollRange()) {
|
||||||
|
if (mCurrentState != AppBarStateChangeListener.State.COLLAPSED) {
|
||||||
|
onStateChanged(appBarLayout, AppBarStateChangeListener.State.COLLAPSED);
|
||||||
|
}
|
||||||
|
mCurrentState = AppBarStateChangeListener.State.COLLAPSED;
|
||||||
|
} else {
|
||||||
|
if (mCurrentState != AppBarStateChangeListener.State.IDLE) {
|
||||||
|
onStateChanged(appBarLayout, AppBarStateChangeListener.State.IDLE);
|
||||||
|
}
|
||||||
|
mCurrentState = AppBarStateChangeListener.State.IDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies on state change
|
||||||
|
* @param appBarLayout Layout
|
||||||
|
* @param state Collapse state
|
||||||
|
*/
|
||||||
|
abstract void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state);
|
||||||
|
}
|
@ -3,6 +3,9 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -76,6 +79,17 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
|
|||||||
|
|
||||||
mGlide = Glide.with(activity);
|
mGlide = Glide.with(activity);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||||
|
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
if (navBarResourceId > 0) {
|
||||||
|
mCommentRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mCommentRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
mCommentRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
||||||
|
|
||||||
mAdapter = new CommentsListingRecyclerViewAdapter(activity, mOauthRetrofit,
|
mAdapter = new CommentsListingRecyclerViewAdapter(activity, mOauthRetrofit,
|
||||||
@ -85,7 +99,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
|
|||||||
|
|
||||||
mCommentRecyclerView.setAdapter(mAdapter);
|
mCommentRecyclerView.setAdapter(mAdapter);
|
||||||
|
|
||||||
CommentViewModel.Factory factory = new CommentViewModel.Factory(mRetrofit, getResources().getConfiguration().locale, username);
|
CommentViewModel.Factory factory = new CommentViewModel.Factory(mRetrofit, resources.getConfiguration().locale, username);
|
||||||
mCommentViewModel = ViewModelProviders.of(this, factory).get(CommentViewModel.class);
|
mCommentViewModel = ViewModelProviders.of(this, factory).get(CommentViewModel.class);
|
||||||
mCommentViewModel.getComments().observe(this, comments -> mAdapter.submitList(comments));
|
mCommentViewModel.getComments().observe(this, comments -> mAdapter.submitList(comments));
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -67,6 +69,11 @@ public class FlairBottomSheetFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
((Infinity) mAcitivity.getApplication()).getAppComponent().inject(this);
|
((Infinity) mAcitivity.getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
|
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
|
||||||
mAdapter = new FlairBottomSheetRecyclerViewAdapter(flair -> ((FlairSelectionCallback) mAcitivity).flairSelected(flair));
|
mAdapter = new FlairBottomSheetRecyclerViewAdapter(flair -> ((FlairSelectionCallback) mAcitivity).flairSelected(flair));
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
recyclerView.setAdapter(mAdapter);
|
recyclerView.setAdapter(mAdapter);
|
||||||
|
@ -2,6 +2,9 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -59,6 +62,17 @@ public class FollowedUsersListingFragment extends Fragment {
|
|||||||
|
|
||||||
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
|
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||||
|
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
if (navBarResourceId > 0) {
|
||||||
|
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mGlide = Glide.with(this);
|
mGlide = Glide.with(this);
|
||||||
|
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||||
|
@ -2,11 +2,16 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -15,6 +20,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.core.view.GravityCompat;
|
import androidx.core.view.GravityCompat;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@ -62,6 +68,8 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
|||||||
private static final int LOGIN_ACTIVITY_REQUEST_CODE = 0;
|
private static final int LOGIN_ACTIVITY_REQUEST_CODE = 0;
|
||||||
|
|
||||||
@BindView(R.id.drawer_layout) DrawerLayout drawer;
|
@BindView(R.id.drawer_layout) DrawerLayout drawer;
|
||||||
|
@BindView(R.id.coordinator_layout_main_activity) CoordinatorLayout coordinatorLayout;
|
||||||
|
@BindView(R.id.appbar_layout_main_activity) AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.view_pager_main_activity) ViewPager viewPager;
|
@BindView(R.id.view_pager_main_activity) ViewPager viewPager;
|
||||||
@BindView(R.id.collapsing_toolbar_layout_main_activity) CollapsingToolbarLayout collapsingToolbarLayout;
|
@BindView(R.id.collapsing_toolbar_layout_main_activity) CollapsingToolbarLayout collapsingToolbarLayout;
|
||||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||||
@ -119,6 +127,41 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
|||||||
|
|
||||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
((Infinity) getApplication()).getAppComponent().inject(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)) {
|
||||||
|
Window window = getWindow();
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
|
||||||
|
View decorView = window.getDecorView();
|
||||||
|
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||||
|
if(state == State.COLLAPSED) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
} else if(state == State.EXPANDED) {
|
||||||
|
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) {
|
||||||
|
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||||
|
params.bottomMargin = resources.getDimensionPixelSize(navBarResourceId);
|
||||||
|
fab.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||||
|
|
||||||
bestSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
|
bestSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
|
||||||
@ -390,10 +433,9 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if(requestCode == LOGIN_ACTIVITY_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
if(requestCode == LOGIN_ACTIVITY_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
||||||
Intent intent = getIntent();
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
finish();
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
overridePendingTransition(0, 0);
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
@ -4,6 +4,9 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -125,6 +128,17 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
|
|
||||||
window = activity.getWindow();
|
window = activity.getWindow();
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||||
|
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
if (navBarResourceId > 0) {
|
||||||
|
mPostRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mGlide = Glide.with(activity);
|
mGlide = Glide.with(activity);
|
||||||
|
|
||||||
lazyModeRunnable = new Runnable() {
|
lazyModeRunnable = new Runnable() {
|
||||||
|
@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -48,6 +50,11 @@ public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen
|
|||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
|
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
|
||||||
textTypeLinearLayout.setOnClickListener(view -> {
|
textTypeLinearLayout.setOnClickListener(view -> {
|
||||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_TEXT);
|
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_TEXT);
|
||||||
dismiss();
|
dismiss();
|
||||||
|
@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -44,6 +46,11 @@ public class SearchPostSortTypeBottomSheetFragment extends RoundedBottomSheetDia
|
|||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
|
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
|
||||||
relevanceTypeTextView.setOnClickListener(view -> {
|
relevanceTypeTextView.setOnClickListener(view -> {
|
||||||
((SearchSortTypeSelectionCallback) activity).searchSortTypeSelected(PostDataSource.SORT_TYPE_RELEVANCE);
|
((SearchSortTypeSelectionCallback) activity).searchSortTypeSelected(PostDataSource.SORT_TYPE_RELEVANCE);
|
||||||
dismiss();
|
dismiss();
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
@ -14,6 +20,7 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
import androidx.fragment.app.FragmentPagerAdapter;
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -36,6 +43,7 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
|||||||
private String mQuery;
|
private String mQuery;
|
||||||
private String mSubredditName;
|
private String mSubredditName;
|
||||||
|
|
||||||
|
@BindView(R.id.appbar_search_result_activity) AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.toolbar_search_result_activity) Toolbar toolbar;
|
@BindView(R.id.toolbar_search_result_activity) Toolbar toolbar;
|
||||||
@BindView(R.id.tab_layout_search_result_activity) TabLayout tabLayout;
|
@BindView(R.id.tab_layout_search_result_activity) TabLayout tabLayout;
|
||||||
@BindView(R.id.view_pager_search_result_activity) ViewPager viewPager;
|
@BindView(R.id.view_pager_search_result_activity) ViewPager viewPager;
|
||||||
@ -57,6 +65,34 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
|||||||
|
|
||||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
((Infinity) getApplication()).getAppComponent().inject(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)) {
|
||||||
|
Window window = getWindow();
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
|
||||||
|
View decorView = window.getDecorView();
|
||||||
|
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||||
|
if(state == State.COLLAPSED) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
} else if(state == State.EXPANDED) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -43,6 +45,11 @@ public class SearchUserAndSubredditSortTypeBottomSheetFragment extends RoundedBo
|
|||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
|
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
|
||||||
int position = getArguments().getInt(EXTRA_FRAGMENT_POSITION);
|
int position = getArguments().getInt(EXTRA_FRAGMENT_POSITION);
|
||||||
|
|
||||||
relevanceTypeTextView.setOnClickListener(view -> {
|
relevanceTypeTextView.setOnClickListener(view -> {
|
||||||
|
@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -49,6 +51,11 @@ public class SortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen
|
|||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||||
|
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
}
|
||||||
|
|
||||||
if(getArguments().getBoolean(EXTRA_NO_BEST_TYPE)) {
|
if(getArguments().getBoolean(EXTRA_NO_BEST_TYPE)) {
|
||||||
bestTypeTextView.setVisibility(View.GONE);
|
bestTypeTextView.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,6 +3,9 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -78,6 +81,17 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
|
|||||||
|
|
||||||
ButterKnife.bind(this, rootView);
|
ButterKnife.bind(this, rootView);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||||
|
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
if (navBarResourceId > 0) {
|
||||||
|
mSubredditListingRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mLinearLayoutManager = new LinearLayoutManager(getActivity());
|
mLinearLayoutManager = new LinearLayoutManager(getActivity());
|
||||||
mSubredditListingRecyclerView.setLayoutManager(mLinearLayoutManager);
|
mSubredditListingRecyclerView.setLayoutManager(mLinearLayoutManager);
|
||||||
|
|
||||||
|
@ -2,6 +2,9 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -63,6 +66,17 @@ public class SubscribedSubredditsListingFragment extends Fragment {
|
|||||||
|
|
||||||
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
|
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||||
|
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
if (navBarResourceId > 0) {
|
||||||
|
mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
|
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
|
||||||
|
|
||||||
mGlide = Glide.with(this);
|
mGlide = Glide.with(this);
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
@ -12,6 +18,7 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
import androidx.fragment.app.FragmentPagerAdapter;
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -33,6 +40,7 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
|||||||
private static final String ACCESS_TOKEN_STATE = "ATS";
|
private static final String ACCESS_TOKEN_STATE = "ATS";
|
||||||
private static final String ACCOUNT_NAME_STATE = "ANS";
|
private static final String ACCOUNT_NAME_STATE = "ANS";
|
||||||
|
|
||||||
|
@BindView(R.id.appbar_subscribed_thing_listing_activity) AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.toolbar_subscribed_thing_listing_activity) Toolbar toolbar;
|
@BindView(R.id.toolbar_subscribed_thing_listing_activity) Toolbar toolbar;
|
||||||
@BindView(R.id.tab_layout_subscribed_thing_listing_activity) TabLayout tabLayout;
|
@BindView(R.id.tab_layout_subscribed_thing_listing_activity) TabLayout tabLayout;
|
||||||
@BindView(R.id.view_pager_subscribed_thing_listing_activity) ViewPager viewPager;
|
@BindView(R.id.view_pager_subscribed_thing_listing_activity) ViewPager viewPager;
|
||||||
@ -60,6 +68,34 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
((Infinity) getApplication()).getAppComponent().inject(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)) {
|
||||||
|
Window window = getWindow();
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
|
||||||
|
View decorView = window.getDecorView();
|
||||||
|
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||||
|
if(state == State.COLLAPSED) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
} else if(state == State.EXPANDED) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -74,6 +77,17 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
|
|||||||
|
|
||||||
ButterKnife.bind(this, rootView);
|
ButterKnife.bind(this, rootView);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||||
|
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
if (navBarResourceId > 0) {
|
||||||
|
mUserListingRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mLinearLayoutManager = new LinearLayoutManager(getActivity());
|
mLinearLayoutManager = new LinearLayoutManager(getActivity());
|
||||||
mUserListingRecyclerView.setLayoutManager(mLinearLayoutManager);
|
mUserListingRecyclerView.setLayoutManager(mLinearLayoutManager);
|
||||||
|
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -99,6 +104,41 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
|
|||||||
|
|
||||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
((Infinity) getApplication()).getAppComponent().inject(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)) {
|
||||||
|
Window window = getWindow();
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
|
||||||
|
View decorView = window.getDecorView();
|
||||||
|
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||||
|
if (state == State.COLLAPSED) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
} else if (state == State.EXPANDED) {
|
||||||
|
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) {
|
||||||
|
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||||
|
params.bottomMargin = resources.getDimensionPixelSize(navBarResourceId);
|
||||||
|
fab.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME_KEY);
|
subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME_KEY);
|
||||||
|
|
||||||
if(savedInstanceState == null) {
|
if(savedInstanceState == null) {
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package ml.docilealligator.infinityforreddit;
|
package ml.docilealligator.infinityforreddit;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -51,16 +56,26 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
private static final String ACCOUNT_NAME_STATE = "ANS";
|
private static final String ACCOUNT_NAME_STATE = "ANS";
|
||||||
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
|
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
|
||||||
|
|
||||||
@BindView(R.id.coordinator_layout_view_user_detail_activity) CoordinatorLayout coordinatorLayout;
|
@BindView(R.id.coordinator_layout_view_user_detail_activity)
|
||||||
@BindView(R.id.view_pager_view_user_detail_activity) ViewPager viewPager;
|
CoordinatorLayout coordinatorLayout;
|
||||||
@BindView(R.id.appbar_layout_view_user_detail) AppBarLayout appBarLayout;
|
@BindView(R.id.view_pager_view_user_detail_activity)
|
||||||
@BindView(R.id.tab_layout_view_user_detail_activity) TabLayout tabLayout;
|
ViewPager viewPager;
|
||||||
@BindView(R.id.collapsing_toolbar_layout_view_user_detail_activity) CollapsingToolbarLayout collapsingToolbarLayout;
|
@BindView(R.id.appbar_layout_view_user_detail)
|
||||||
@BindView(R.id.banner_image_view_view_user_detail_activity) GifImageView bannerImageView;
|
AppBarLayout appBarLayout;
|
||||||
@BindView(R.id.icon_gif_image_view_view_user_detail_activity) GifImageView iconGifImageView;
|
@BindView(R.id.tab_layout_view_user_detail_activity)
|
||||||
@BindView(R.id.user_name_text_view_view_user_detail_activity) TextView userNameTextView;
|
TabLayout tabLayout;
|
||||||
@BindView(R.id.subscribe_user_chip_view_user_detail_activity) Chip subscribeUserChip;
|
@BindView(R.id.collapsing_toolbar_layout_view_user_detail_activity)
|
||||||
@BindView(R.id.karma_text_view_view_user_detail_activity) TextView karmaTextView;
|
CollapsingToolbarLayout collapsingToolbarLayout;
|
||||||
|
@BindView(R.id.banner_image_view_view_user_detail_activity)
|
||||||
|
GifImageView bannerImageView;
|
||||||
|
@BindView(R.id.icon_gif_image_view_view_user_detail_activity)
|
||||||
|
GifImageView iconGifImageView;
|
||||||
|
@BindView(R.id.user_name_text_view_view_user_detail_activity)
|
||||||
|
TextView userNameTextView;
|
||||||
|
@BindView(R.id.subscribe_user_chip_view_user_detail_activity)
|
||||||
|
Chip subscribeUserChip;
|
||||||
|
@BindView(R.id.karma_text_view_view_user_detail_activity)
|
||||||
|
TextView karmaTextView;
|
||||||
|
|
||||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||||
|
|
||||||
@ -140,8 +155,8 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
toolbar.setTitle(title);
|
toolbar.setTitle(title);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
ViewGroup.MarginLayoutParams toolbarLayoutParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
|
||||||
params.topMargin = statusBarHeight;
|
toolbarLayoutParams.topMargin = statusBarHeight;
|
||||||
|
|
||||||
expandedTabTextColor = getResources().getColor(R.color.tabLayoutWithExpandedCollapsingToolbarTextColor);
|
expandedTabTextColor = getResources().getColor(R.color.tabLayoutWithExpandedCollapsingToolbarTextColor);
|
||||||
expandedTabBackgroundColor = getResources().getColor(R.color.tabLayoutWithExpandedCollapsingToolbarTabBackground);
|
expandedTabBackgroundColor = getResources().getColor(R.color.tabLayoutWithExpandedCollapsingToolbarTabBackground);
|
||||||
@ -151,6 +166,39 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
collapsedTabBackgroundColor = getResources().getColor(R.color.tabLayoutWithCollapsedCollapsingToolbarTabBackground);
|
collapsedTabBackgroundColor = getResources().getColor(R.color.tabLayoutWithCollapsedCollapsingToolbarTabBackground);
|
||||||
collapsedTabIndicatorColor = getResources().getColor(R.color.tabLayoutWithCollapsedCollapsingToolbarTabIndicator);
|
collapsedTabIndicatorColor = getResources().getColor(R.color.tabLayoutWithCollapsedCollapsingToolbarTabIndicator);
|
||||||
|
|
||||||
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||||
|
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||||
|
|| resources.getBoolean(R.bool.isTablet))) {
|
||||||
|
Window window = getWindow();
|
||||||
|
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
|
||||||
|
View decorView = window.getDecorView();
|
||||||
|
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||||
|
@Override
|
||||||
|
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||||
|
if (state == State.COLLAPSED) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor);
|
||||||
|
tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor);
|
||||||
|
tabLayout.setBackgroundColor(collapsedTabBackgroundColor);
|
||||||
|
} else if (state == State.EXPANDED) {
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||||
|
tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor);
|
||||||
|
tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor);
|
||||||
|
tabLayout.setBackgroundColor(expandedTabBackgroundColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||||
@ -165,6 +213,7 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
subscribedUserDao = mRedditDataRoomDatabase.subscribedUserDao();
|
subscribedUserDao = mRedditDataRoomDatabase.subscribedUserDao();
|
||||||
glide = Glide.with(this);
|
glide = Glide.with(this);
|
||||||
@ -397,44 +446,6 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {
|
|
||||||
// State
|
|
||||||
public enum State {
|
|
||||||
EXPANDED,
|
|
||||||
COLLAPSED,
|
|
||||||
IDLE
|
|
||||||
}
|
|
||||||
|
|
||||||
private State mCurrentState = State.IDLE;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onOffsetChanged(AppBarLayout appBarLayout, int i) {
|
|
||||||
if (i == 0) {
|
|
||||||
if (mCurrentState != State.EXPANDED) {
|
|
||||||
onStateChanged(appBarLayout, State.EXPANDED);
|
|
||||||
}
|
|
||||||
mCurrentState = State.EXPANDED;
|
|
||||||
} else if (Math.abs(i) >= appBarLayout.getTotalScrollRange()) {
|
|
||||||
if (mCurrentState != State.COLLAPSED) {
|
|
||||||
onStateChanged(appBarLayout, State.COLLAPSED);
|
|
||||||
}
|
|
||||||
mCurrentState = State.COLLAPSED;
|
|
||||||
} else {
|
|
||||||
if (mCurrentState != State.IDLE) {
|
|
||||||
onStateChanged(appBarLayout, State.IDLE);
|
|
||||||
}
|
|
||||||
mCurrentState = State.IDLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies on state change
|
|
||||||
* @param appBarLayout Layout
|
|
||||||
* @param state Collapse state
|
|
||||||
*/
|
|
||||||
abstract void onStateChanged(AppBarLayout appBarLayout, State state);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class InsertUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
|
private static class InsertUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
interface InsertUserDataAsyncTaskListener {
|
interface InsertUserDataAsyncTaskListener {
|
||||||
|
@ -11,6 +11,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
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_search_result_activity">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
@ -38,11 +45,14 @@
|
|||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/tab_layout_search_result_activity"
|
android:id="@+id/tab_layout_search_result_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/colorPrimary"
|
android:background="@color/colorPrimary"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabMode="fixed"
|
app:tabMode="fixed"
|
||||||
app:tabIndicatorColor="@android:color/white"
|
app:tabIndicatorColor="@android:color/white"
|
||||||
|
@ -12,6 +12,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
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_subscribed_thing_listing_activity">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolbar_subscribed_thing_listing_activity"
|
android:id="@+id/toolbar_subscribed_thing_listing_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -19,11 +26,14 @@
|
|||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/tab_layout_subscribed_thing_listing_activity"
|
android:id="@+id/tab_layout_subscribed_thing_listing_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/colorPrimary"
|
android:background="@color/colorPrimary"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabMode="fixed"
|
app:tabMode="fixed"
|
||||||
app:tabIndicatorColor="@android:color/white"
|
app:tabIndicatorColor="@android:color/white"
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/coordinator_layout_main_activity"
|
||||||
tools:application="ml.docilealligator.infinityforreddit.MainActivity">
|
tools:application="ml.docilealligator.infinityforreddit.MainActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar_layout_main_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view_comments_listing_fragment"
|
android:id="@+id/recycler_view_comments_listing_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fetch_comments_info_linear_layout_comments_listing_fragment"
|
android:id="@+id/fetch_comments_info_linear_layout_comments_listing_fragment"
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view_followed_users_listing_fragment"
|
android:id="@+id/recycler_view_followed_users_listing_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/no_subscriptions_linear_layout_followed_users_listing_fragment"
|
android:id="@+id/no_subscriptions_linear_layout_followed_users_listing_fragment"
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view_post_fragment"
|
android:id="@+id/recycler_view_post_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fetch_post_info_linear_layout_post_fragment"
|
android:id="@+id/fetch_post_info_linear_layout_post_fragment"
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view_subreddit_listing_fragment"
|
android:id="@+id/recycler_view_subreddit_listing_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fetch_subreddit_listing_info_linear_layout_subreddit_listing_fragment"
|
android:id="@+id/fetch_subreddit_listing_info_linear_layout_subreddit_listing_fragment"
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view_subscribed_subreddits_listing_fragment"
|
android:id="@+id/recycler_view_subscribed_subreddits_listing_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/no_subscriptions_linear_layout_subreddits_listing_fragment"
|
android:id="@+id/no_subscriptions_linear_layout_subreddits_listing_fragment"
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view_user_listing_fragment"
|
android:id="@+id/recycler_view_user_listing_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fetch_user_listing_info_linear_layout_user_listing_fragment"
|
android:id="@+id/fetch_user_listing_info_linear_layout_user_listing_fragment"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryBackground">#242424</color>
|
<color name="roundedBottomSheetPrimaryBackground">#242424</color>
|
||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">#000000</color>
|
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
||||||
|
|
||||||
<color name="voteUnavailableVoteButtonColor">#3C3C3C</color>
|
<color name="voteUnavailableVoteButtonColor">#3C3C3C</color>
|
||||||
|
|
||||||
|
4
app/src/main/res/values-sw600dp/attr.xml
Normal file
4
app/src/main/res/values-sw600dp/attr.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="isTablet">true</bool>
|
||||||
|
</resources>
|
4
app/src/main/res/values/attr.xml
Normal file
4
app/src/main/res/values/attr.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="isTablet">false</bool>
|
||||||
|
</resources>
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color>
|
<color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color>
|
||||||
|
|
||||||
<color name="roundedBottomSheetPrimaryNavigationBarColor">#000000</color>
|
<color name="roundedBottomSheetPrimaryNavigationBarColor">@color/roundedBottomSheetPrimaryBackground</color>
|
||||||
|
|
||||||
<color name="voteUnavailableVoteButtonColor">#F0F0F0</color>
|
<color name="voteUnavailableVoteButtonColor">#F0F0F0</color>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<resources>
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
|
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
|
||||||
|
Loading…
Reference in New Issue
Block a user