diff options
Diffstat (limited to 'app/src/main/java/ml')
7 files changed, 66 insertions, 13 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java index 6cd7d189..9a7fa962 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java @@ -7,19 +7,17 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; -import androidx.cardview.widget.CardView; import androidx.core.content.ContextCompat; import androidx.paging.PagedListAdapter; import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.material.card.MaterialCardView; - import CustomView.CustomMarkwonView; import butterknife.BindView; import butterknife.ButterKnife; @@ -70,14 +68,11 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { if(viewType == VIEW_TYPE_DATA) { - CardView cardView = (CardView) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_comment, parent, false); - return new DataViewHolder(cardView); + return new DataViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_comment, parent, false)); } else if(viewType == VIEW_TYPE_ERROR) { - RelativeLayout relativeLayout = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_error, parent, false); - return new ErrorViewHolder(relativeLayout); + return new ErrorViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_error, parent, false)); } else { - RelativeLayout relativeLayout = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_loading, parent, false); - return new LoadingViewHolder(relativeLayout); + return new LoadingViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_loading, parent, false)); } } @@ -165,7 +160,7 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R } class DataViewHolder extends RecyclerView.ViewHolder { - @BindView(R.id.card_view_item_comment) MaterialCardView cardView; + @BindView(R.id.linear_layout_item_comment) LinearLayout linearLayout; @BindView(R.id.vertical_block_item_post_comment) View verticalBlock; @BindView(R.id.author_text_view_item_post_comment) TextView authorTextView; @BindView(R.id.comment_time_text_view_item_post_comment) TextView commentTimeTextView; @@ -180,7 +175,7 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R super(itemView); ButterKnife.bind(this, itemView); - cardView.setOnClickListener(view -> { + linearLayout.setOnClickListener(view -> { Intent intent = new Intent(mContext, ViewPostDetailActivity.class); intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, getItem(getAdapterPosition()).getLinkId()); mContext.startActivity(intent); @@ -188,7 +183,7 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R verticalBlock.setVisibility(View.GONE); - commentMarkdownView.setOnClickListener(view -> cardView.callOnClick()); + commentMarkdownView.setOnClickListener(view -> linearLayout.callOnClick()); RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) shareButton.getLayoutParams(); lp.addRule(RelativeLayout.ALIGN_PARENT_END); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java index 3fd746aa..14b76146 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java @@ -149,7 +149,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (statusBarResourceId > 0) { ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams(); - params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId); + params.topMargin = resources.getDimensionPixelSize(statusBarResourceId); toolbar.setLayoutParams(params); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java index 2c22b131..823fa1cd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java @@ -1,6 +1,7 @@ package ml.docilealligator.infinityforreddit; import android.content.Intent; +import android.content.res.Configuration; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -9,6 +10,7 @@ import android.provider.MediaStore; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.view.Window; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; @@ -20,6 +22,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; import com.bumptech.glide.Glide; @@ -127,6 +130,14 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS ((Infinity) getApplication()).getAppComponent().inject(this); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Window window = getWindow(); + if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + } + window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor)); + } + setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java index e8d028ec..4960b627 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java @@ -1,10 +1,13 @@ package ml.docilealligator.infinityforreddit; import android.content.Intent; +import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.view.Window; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; @@ -14,6 +17,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; @@ -102,6 +106,14 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh ((Infinity) getApplication()).getAppComponent().inject(this); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Window window = getWindow(); + if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + } + window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor)); + } + setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java index 6b8784de..e4e94243 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java @@ -1,10 +1,13 @@ package ml.docilealligator.infinityforreddit; import android.content.Intent; +import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.view.Window; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; @@ -14,6 +17,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; @@ -102,6 +106,14 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh ((Infinity) getApplication()).getAppComponent().inject(this); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Window window = getWindow(); + if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + } + window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor)); + } + setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java index 6adf0c75..919502f1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java @@ -1,6 +1,7 @@ package ml.docilealligator.infinityforreddit; import android.content.Intent; +import android.content.res.Configuration; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -8,6 +9,7 @@ import android.provider.MediaStore; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.view.Window; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; @@ -19,6 +21,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; @@ -126,6 +129,14 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS ((Infinity) getApplication()).getAppComponent().inject(this); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Window window = getWindow(); + if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + } + window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor)); + } + setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java index e0bedcdf..cfade0b9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java @@ -2,10 +2,13 @@ package ml.docilealligator.infinityforreddit; import android.app.Activity; import android.content.Intent; +import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.view.Window; import android.view.WindowManager; import android.widget.RelativeLayout; import android.widget.TextView; @@ -14,6 +17,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; +import androidx.core.content.ContextCompat; import com.ferfalk.simplesearchview.SimpleSearchView; @@ -49,6 +53,14 @@ public class SearchActivity extends AppCompatActivity { ButterKnife.bind(this); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Window window = getWindow(); + if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + } + window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor)); + } + setSupportActionBar(toolbar); boolean searchOnlySubreddits = getIntent().getExtras().getBoolean(EXTRA_SEARCH_ONLY_SUBREDDITS); |