fix pill-less navigation bar with labels
This commit is contained in:
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||
import android.app.Fragment;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.assist.AssistContent;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
@@ -126,15 +127,27 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
|
||||
tabBarWrap=content.findViewById(R.id.tabbar_wrap);
|
||||
|
||||
// this one's for the pill haters (https://m3.material.io/components/navigation-bar/overview)
|
||||
if (GlobalUserPreferences.disableM3PillActiveIndicator){
|
||||
for(int i=0; i<tabBar.getChildCount(); i++){
|
||||
ViewGroup f=(ViewGroup) tabBar.getChildAt(i);
|
||||
f.setBackgroundResource(R.drawable.bg_tabbar_tab_ripple);
|
||||
if(GlobalUserPreferences.disableM3PillActiveIndicator){
|
||||
tabBar.findViewById(R.id.tab_home_pill).setBackground(null);
|
||||
tabBar.findViewById(R.id.tab_search_pill).setBackground(null);
|
||||
tabBar.findViewById(R.id.tab_notifications_pill).setBackground(null);
|
||||
tabBar.findViewById(R.id.tab_profile_pill).setBackgroundResource(R.drawable.bg_tab_profile);
|
||||
|
||||
View[] tabs={
|
||||
tabBar.findViewById(R.id.tab_home),
|
||||
tabBar.findViewById(R.id.tab_search),
|
||||
tabBar.findViewById(R.id.tab_notifications),
|
||||
tabBar.findViewById(R.id.tab_profile)
|
||||
};
|
||||
|
||||
for(View tab : tabs){
|
||||
tab.setBackgroundResource(R.drawable.bg_tabbar_tab_ripple);
|
||||
((RippleDrawable) tab.getBackground())
|
||||
.setRadius(V.dp(GlobalUserPreferences.showNavigationLabels ? 56 : 42));
|
||||
}
|
||||
tabBar.findViewById(R.id.tab_profile).setBackgroundResource(R.drawable.bg_tab_profile);
|
||||
}
|
||||
|
||||
if (!GlobalUserPreferences.showNavigationLabels){
|
||||
if(!GlobalUserPreferences.showNavigationLabels){
|
||||
tabBar.findViewById(R.id.tab_home_label).setVisibility(View.GONE);
|
||||
tabBar.findViewById(R.id.tab_search_label).setVisibility(View.GONE);
|
||||
tabBar.findViewById(R.id.tab_notifications_label).setVisibility(View.GONE);
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<ripple
|
||||
android:color="@color/m3_on_surface_variant_overlay"
|
||||
android:radius="42dp" />
|
||||
</item>
|
||||
<item>
|
||||
<selector>
|
||||
<item android:state_selected="true">
|
||||
<layer-list>
|
||||
<item android:gravity="center" android:width="28dp" android:height="28dp">
|
||||
<shape android:shape="oval">
|
||||
<stroke android:color="?colorM3OnSecondaryContainer" android:width="2dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<layer-list>
|
||||
<item android:gravity="center" android:width="28dp" android:height="28dp">
|
||||
<shape android:shape="oval">
|
||||
<stroke android:color="?colorM3OnSecondaryContainer" android:width="2dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
</layer-list>
|
||||
</item>
|
||||
</layer-list>
|
||||
</selector>
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
<ripple
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/m3_on_surface_variant_overlay"
|
||||
android:radius="42dp" />
|
||||
android:radius="56dp" />
|
||||
@@ -26,6 +26,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/tab_home_pill"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_tabbar_tab"
|
||||
@@ -63,6 +64,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/tab_search_pill"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_tabbar_tab"
|
||||
@@ -100,6 +102,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/tab_notifications_pill"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_tabbar_tab"
|
||||
@@ -155,6 +158,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/tab_profile_pill"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_tabbar_tab"
|
||||
|
||||
Reference in New Issue
Block a user