aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-08-11 08:44:46 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-08-11 08:44:46 +0000
commit2913c1583b8001ebdf75babb2d663f3cf9167ca9 (patch)
tree5421432c5534f5167d8090943b65b3be75534bfd /app/src/main/java/ml/docilealligator
parentc2f2fc1b39b5ccfe147062cb3be8f2236e705f48 (diff)
downloadinfinity-for-reddit-2913c1583b8001ebdf75babb2d663f3cf9167ca9.tar
infinity-for-reddit-2913c1583b8001ebdf75babb2d663f3cf9167ca9.tar.gz
infinity-for-reddit-2913c1583b8001ebdf75babb2d663f3cf9167ca9.tar.bz2
infinity-for-reddit-2913c1583b8001ebdf75babb2d663f3cf9167ca9.tar.lz
infinity-for-reddit-2913c1583b8001ebdf75babb2d663f3cf9167ca9.tar.xz
infinity-for-reddit-2913c1583b8001ebdf75babb2d663f3cf9167ca9.tar.zst
infinity-for-reddit-2913c1583b8001ebdf75babb2d663f3cf9167ca9.zip
Make nav bar white in day theme and change it to the same color as background color in some activities. Fixed nav bar icon color in dark theme. Minor UI tweaks.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java12
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);