Merge "Make tabs respect the device default style." into rvc-dev

This commit is contained in:
Antoan Angelov
2020-03-17 17:32:21 +00:00
committed by Android (Google) Code Review
7 changed files with 19 additions and 10 deletions

View File

@@ -49,6 +49,7 @@ import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Insets;
import android.net.Uri;
import android.os.Build;
@@ -65,6 +66,7 @@ import android.stats.devicepolicy.DevicePolicyEnums;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -1606,7 +1608,10 @@ public class ResolverActivity extends Activity implements
for (int i = 0; i < tabWidget.getChildCount(); i++) {
View tabView = tabWidget.getChildAt(i);
TextView title = tabView.findViewById(android.R.id.title);
title.setTextColor(getColor(R.color.resolver_tabs_inactive_color));
title.setTextAppearance(android.R.style.TextAppearance_DeviceDefault_DialogWindowTitle);
title.setTextColor(getAttrColor(this, android.R.attr.textColorTertiary));
title.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.resolver_tab_text_size));
if (title.getText().equals(getString(R.string.resolver_personal_tab))) {
tabView.setContentDescription(personalContentDescription);
} else if (title.getText().equals(getString(R.string.resolver_work_tab))) {
@@ -1615,10 +1620,17 @@ public class ResolverActivity extends Activity implements
}
}
private static int getAttrColor(Context context, int attr) {
TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
int colorAccent = ta.getColor(0, 0);
ta.recycle();
return colorAccent;
}
private void updateActiveTabStyle(TabHost tabHost) {
TextView title = tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab())
.findViewById(android.R.id.title);
title.setTextColor(getColor(R.color.resolver_tabs_active_color));
title.setTextColor(getAttrColor(this, android.R.attr.colorAccent));
}
private void setupViewVisibilities() {

View File

@@ -25,7 +25,7 @@
</item>
<item android:gravity="bottom">
<shape android:shape="rectangle"
android:tint="@color/resolver_tabs_active_color">
android:tint="?attr/colorAccent">
<size android:height="2dp" />
<solid android:color="@color/tab_indicator_material" />
</shape>

View File

@@ -60,7 +60,7 @@
android:background="@null"
android:fontFamily="@string/config_headlineFontFamilyMedium"
android:textSize="14sp"
android:textColor="@color/resolver_tabs_active_color"
android:textColor="?attr/colorAccent"
android:layout_centerHorizontal="true" />
<ProgressBar
android:id="@+id/resolver_empty_state_progress"
@@ -71,5 +71,5 @@
android:indeterminate="true"
android:layout_centerHorizontal="true"
android:layout_below="@+id/resolver_empty_state_subtitle"
android:indeterminateTint="@color/resolver_tabs_active_color"/>
android:indeterminateTint="?attr/colorAccent"/>
</RelativeLayout>

View File

@@ -33,7 +33,6 @@
<color name="chooser_gradient_background">@color/loading_gradient_background_color_dark</color>
<color name="chooser_gradient_highlight">@color/loading_gradient_highlight_color_dark</color>
<color name="resolver_tabs_active_color">#FF8AB4F8</color>
<color name="resolver_empty_state_text">#FFFFFF</color>
<color name="resolver_empty_state_icon">#FFFFFF</color>
</resources>

View File

@@ -224,8 +224,6 @@
<!-- Resolver/Chooser -->
<color name="resolver_text_color_secondary_dark">#ffC4C6C6</color>
<color name="resolver_tabs_active_color">#FF1A73E8</color>
<color name="resolver_tabs_inactive_color">#FF80868B</color>
<color name="resolver_empty_state_text">#FF202124</color>
<color name="resolver_empty_state_icon">#FF5F6368</color>
</resources>

View File

@@ -800,6 +800,7 @@
<dimen name="resolver_empty_state_height_with_tabs">268dp</dimen>
<dimen name="resolver_max_collapsed_height">192dp</dimen>
<dimen name="resolver_max_collapsed_height_with_tabs">248dp</dimen>
<dimen name="resolver_tab_text_size">14sp</dimen>
<dimen name="chooser_action_button_icon_size">18dp</dimen>

View File

@@ -3906,8 +3906,6 @@
<java-symbol type="layout" name="conversation_face_pile_layout" />
<!-- Intent resolver and share sheet -->
<java-symbol type="color" name="resolver_tabs_active_color" />
<java-symbol type="color" name="resolver_tabs_inactive_color" />
<java-symbol type="string" name="resolver_personal_tab" />
<java-symbol type="string" name="resolver_personal_tab_accessibility" />
<java-symbol type="string" name="resolver_work_tab" />
@@ -3938,6 +3936,7 @@
<java-symbol type="dimen" name="resolver_empty_state_height_with_tabs" />
<java-symbol type="dimen" name="resolver_max_collapsed_height_with_tabs" />
<java-symbol type="bool" name="sharesheet_show_content_preview" />
<java-symbol type="dimen" name="resolver_tab_text_size" />
<!-- Toast message for background started foreground service while-in-use permission restriction feature -->
<java-symbol type="string" name="allow_while_in_use_permission_in_fgs" />