Beige navigation menu

pull/185/head
M66B 4 years ago
parent bb702e7519
commit be5a5cddce

@ -170,7 +170,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
rvMenu = drawerContainer.findViewById(R.id.rvMenu);
LinearLayoutManager llm = new LinearLayoutManager(this);
rvMenu.setLayoutManager(llm);
final AdapterNavMenu adapter = new AdapterNavMenu(this, this);
final AdapterNavMenu adapter = new AdapterNavMenu(this, this, false);
rvMenu.setAdapter(adapter);
final Drawable d = getDrawable(R.drawable.divider);

@ -51,6 +51,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@ -231,6 +232,14 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerContainer = findViewById(R.id.drawer_container);
boolean beige = prefs.getBoolean("cards", true) &&
prefs.getBoolean("beige", true) &&
!Helper.isDarkTheme(ActivityView.this);
if (beige)
drawerContainer.setBackgroundColor(
ContextCompat.getColor(ActivityView.this, R.color.lightColorBackground_cards_beige));
int drawerWidth;
DisplayMetrics dm = getResources().getDisplayMetrics();
if (portrait || !landscape3) {
@ -256,7 +265,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
rvAccount = drawerContainer.findViewById(R.id.rvAccount);
rvAccount.setLayoutManager(new LinearLayoutManager(this));
adapterNavAccount = new AdapterNavAccount(this, this);
adapterNavAccount = new AdapterNavAccount(this, this, beige);
rvAccount.setAdapter(adapterNavAccount);
boolean nav_account = prefs.getBoolean("nav_account", true);
@ -278,7 +287,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
rvUnified = drawerContainer.findViewById(R.id.rvUnified);
rvUnified.setLayoutManager(new LinearLayoutManager(this));
adapterNavUnified = new AdapterNavUnified(this, this);
adapterNavUnified = new AdapterNavUnified(this, this, beige);
rvUnified.setAdapter(adapterNavUnified);
boolean unified_system = prefs.getBoolean("unified_system", true);
@ -298,12 +307,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
// Navigation folders
rvFolder = drawerContainer.findViewById(R.id.rvFolder);
rvFolder.setLayoutManager(new LinearLayoutManager(this));
adapterNavFolder = new AdapterNavFolder(this, this);
adapterNavFolder = new AdapterNavFolder(this, this, beige);
rvFolder.setAdapter(adapterNavFolder);
rvMenu = drawerContainer.findViewById(R.id.rvMenu);
rvMenu.setLayoutManager(new LinearLayoutManager(this));
adapterNavMenu = new AdapterNavMenu(this, this);
adapterNavMenu = new AdapterNavMenu(this, this, beige);
rvMenu.setAdapter(adapterNavMenu);
// Extra menus
@ -312,7 +321,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
rvMenuExtra = drawerContainer.findViewById(R.id.rvMenuExtra);
LinearLayoutManager llm = new LinearLayoutManager(this);
rvMenuExtra.setLayoutManager(llm);
adapterNavMenuExtra = new AdapterNavMenu(this, this);
adapterNavMenuExtra = new AdapterNavMenu(this, this, beige);
rvMenuExtra.setAdapter(adapterNavMenuExtra);
final Drawable d = getDrawable(R.drawable.divider);

@ -31,6 +31,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
@ -50,6 +51,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
private Context context;
private LifecycleOwner owner;
private LayoutInflater inflater;
private boolean beige;
private int colorUnread;
private int textColorSecondary;
@ -174,10 +176,11 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
}
}
AdapterNavAccount(Context context, LifecycleOwner owner) {
AdapterNavAccount(Context context, LifecycleOwner owner, boolean beige) {
this.context = context;
this.owner = owner;
this.inflater = LayoutInflater.from(context);
this.beige = beige;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
@ -276,7 +279,11 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
@Override
@NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(inflater.inflate(R.layout.item_nav, parent, false));
View view = inflater.inflate(R.layout.item_nav, parent, false);
if (beige)
view.setBackgroundColor(
ContextCompat.getColor(context, R.color.lightColorBackground_cards_beige));
return new ViewHolder(view);
}
@Override

@ -30,6 +30,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
@ -48,6 +49,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
private Context context;
private LifecycleOwner owner;
private LayoutInflater inflater;
private boolean beige;
private boolean debug;
private int colorUnread;
@ -153,10 +155,11 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
}
}
AdapterNavFolder(Context context, LifecycleOwner owner) {
AdapterNavFolder(Context context, LifecycleOwner owner, boolean beige) {
this.context = context;
this.owner = owner;
this.inflater = LayoutInflater.from(context);
this.beige = beige;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
@ -250,7 +253,11 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
@Override
@NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(inflater.inflate(R.layout.item_nav, parent, false));
View view = inflater.inflate(R.layout.item_nav, parent, false);
if (beige)
view.setBackgroundColor(
ContextCompat.getColor(context, R.color.lightColorBackground_cards_beige));
return new ViewHolder(view);
}
@Override

@ -29,6 +29,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.DiffUtil;
@ -44,6 +45,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
private Context context;
private LifecycleOwner owner;
private LayoutInflater inflater;
private boolean beige;
private int colorUnread;
private int textColorSecondary;
@ -120,10 +122,11 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
}
}
AdapterNavMenu(Context context, LifecycleOwner owner) {
AdapterNavMenu(Context context, LifecycleOwner owner, boolean beige) {
this.context = context;
this.owner = owner;
this.inflater = LayoutInflater.from(context);
this.beige = beige;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
@ -217,7 +220,11 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
@Override
@NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(inflater.inflate(R.layout.item_nav, parent, false));
View view = inflater.inflate(R.layout.item_nav, parent, false);
if (beige)
view.setBackgroundColor(
ContextCompat.getColor(context, R.color.lightColorBackground_cards_beige));
return new ViewHolder(view);
}
@Override

@ -30,6 +30,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
@ -47,6 +48,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
private Context context;
private LifecycleOwner owner;
private LayoutInflater inflater;
private boolean beige;
private int colorUnread;
private int textColorSecondary;
@ -125,10 +127,11 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
}
}
AdapterNavUnified(Context context, LifecycleOwner owner) {
AdapterNavUnified(Context context, LifecycleOwner owner, boolean beige) {
this.context = context;
this.owner = owner;
this.inflater = LayoutInflater.from(context);
this.beige = beige;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
@ -218,7 +221,11 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
@Override
@NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(inflater.inflate(R.layout.item_nav, parent, false));
View view = inflater.inflate(R.layout.item_nav, parent, false);
if (beige)
view.setBackgroundColor(
ContextCompat.getColor(context, R.color.lightColorBackground_cards_beige));
return new ViewHolder(view);
}
@Override

Loading…
Cancel
Save