ui fixes
This commit is contained in:
parent
c65410b1d1
commit
1c11a5a5d8
|
@ -45,12 +45,7 @@ public abstract class ThemedAppCompatActivity extends ATEActivity implements Con
|
|||
// Data fields
|
||||
private int mCurrentThemeColor;
|
||||
private int mCurrentThemeBackgroundAlpha;
|
||||
@ShapeStyle
|
||||
private int mProfileImageStyle;
|
||||
private String mCurrentThemeBackgroundOption;
|
||||
private String mCurrentThemeFontFamily;
|
||||
|
||||
private Toolbar mToolbar;
|
||||
|
||||
@Override
|
||||
public int getCurrentThemeBackgroundAlpha() {
|
||||
|
@ -88,8 +83,6 @@ public abstract class ThemedAppCompatActivity extends ATEActivity implements Con
|
|||
StrictModeUtils.detectAllVmPolicy();
|
||||
StrictModeUtils.detectAllThreadPolicy();
|
||||
}
|
||||
final int themeColor = getThemeColor();
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
|
@ -104,9 +97,7 @@ public abstract class ThemedAppCompatActivity extends ATEActivity implements Con
|
|||
protected void onApplyThemeResource(@NonNull Resources.Theme theme, int resId, boolean first) {
|
||||
mCurrentThemeColor = getThemeColor();
|
||||
mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha();
|
||||
mProfileImageStyle = Utils.getProfileImageStyle(this);
|
||||
mCurrentThemeBackgroundOption = getThemeBackgroundOption();
|
||||
mCurrentThemeFontFamily = getThemeFontFamily();
|
||||
super.onApplyThemeResource(theme, resId, first);
|
||||
final Window window = getWindow();
|
||||
if (shouldApplyWindowBackground()) {
|
||||
|
@ -122,21 +113,6 @@ public abstract class ThemedAppCompatActivity extends ATEActivity implements Con
|
|||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final Toolbar peekActionBarToolbar() {
|
||||
return mToolbar;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final Toolbar getActionBarToolbar() {
|
||||
if (mToolbar != null) return mToolbar;
|
||||
final View actionBarView = getWindow().findViewById(android.support.v7.appcompat.R.id.action_bar);
|
||||
if (actionBarView instanceof Toolbar) {
|
||||
return (Toolbar) actionBarView;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean shouldApplyWindowBackground() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1632,6 +1632,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
Color.BLACK);
|
||||
}
|
||||
WindowSupport.setStatusBarColor(activity.getWindow(), statusBarColor);
|
||||
int stackedTabColor = ThemeUtils.getActionBarColor(activity, mUiColor,
|
||||
activity.getThemeBackgroundOption());
|
||||
|
||||
if (mActionBarBackground != null) {
|
||||
mActionBarBackground.setFactor(factor);
|
||||
|
@ -1651,8 +1653,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
}
|
||||
|
||||
final Drawable tabBackground = mPagerIndicator.getBackground();
|
||||
int stackedTabColor = ThemeUtils.getActionBarColor(activity, mUiColor,
|
||||
activity.getThemeBackgroundOption());
|
||||
|
||||
|
||||
if (ThemeUtils.isTransparentBackground(activity.getCurrentThemeBackgroundOption())) {
|
||||
stackedTabColor = ColorUtils.setAlphaComponent(stackedTabColor,
|
||||
|
@ -1678,13 +1679,16 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
}
|
||||
mPreviousTabItemIsDark = (tabItemIsDark ? 1 : -1);
|
||||
|
||||
final int barColor = (Integer) sArgbEvaluator.evaluate(factor, mActionBarShadowColor, stackedTabColor);
|
||||
final boolean actionItemIsDark = TwidereColorUtils.getYIQLuminance(barColor) > ThemeUtils.ACCENT_COLOR_THRESHOLD;
|
||||
if (mPreviousActionBarItemIsDark == 0 || (actionItemIsDark ? 1 : -1) != mPreviousActionBarItemIsDark) {
|
||||
ThemeUtils.applyToolbarItemColor(activity, activity.getActionBarToolbar(), barColor);
|
||||
}
|
||||
mPreviousActionBarItemIsDark = actionItemIsDark ? 1 : -1;
|
||||
|
||||
}
|
||||
|
||||
final int barColor = (Integer) sArgbEvaluator.evaluate(factor, mActionBarShadowColor, stackedTabColor);
|
||||
final boolean actionItemIsDark = TwidereColorUtils.getYIQLuminance(barColor) > ThemeUtils.ACCENT_COLOR_THRESHOLD;
|
||||
if (mPreviousActionBarItemIsDark == 0 || (actionItemIsDark ? 1 : -1) != mPreviousActionBarItemIsDark) {
|
||||
ThemeUtils.applyToolbarItemColor(activity, mToolbar, barColor);
|
||||
}
|
||||
mPreviousActionBarItemIsDark = actionItemIsDark ? 1 : -1;
|
||||
|
||||
updateTitleAlpha();
|
||||
}
|
||||
|
||||
|
@ -1694,8 +1698,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
final float nameShowingRatio = (mHeaderDrawerLayout.getPaddingTop() - location[1])
|
||||
/ (float) mNameView.getHeight();
|
||||
final float textAlpha = TwidereMathUtils.clamp(nameShowingRatio, 0, 1);
|
||||
final ThemedAppCompatActivity activity = (ThemedAppCompatActivity) getActivity();
|
||||
final Toolbar actionBarView = activity.getActionBarToolbar();
|
||||
final Toolbar actionBarView = mToolbar;
|
||||
if (actionBarView != null) {
|
||||
final TextView titleView = ViewSupport.findViewByText(actionBarView, actionBarView.getTitle());
|
||||
if (titleView != null) {
|
||||
|
|
|
@ -54,12 +54,10 @@ import android.view.View.OnLongClickListener;
|
|||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.LinkHandlerActivity;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.graphic.ActionBarColorDrawable;
|
||||
import org.mariotaku.twidere.graphic.ActionIconDrawable;
|
||||
|
@ -599,19 +597,11 @@ public class ThemeUtils implements Constants {
|
|||
if (toolbar instanceof TwidereToolbar) {
|
||||
((TwidereToolbar) toolbar).setItemColor(itemColor);
|
||||
}
|
||||
final ActionMenuView actionMenuView = ViewSupport.findViewByType(toolbar, ActionMenuView.class);
|
||||
if (actionMenuView == null) return;
|
||||
View overflowView = null;
|
||||
for (int i = 0, j = actionMenuView.getChildCount(); i < j; i++) {
|
||||
final View child = actionMenuView.getChildAt(i);
|
||||
final ActionMenuView.LayoutParams lp = (ActionMenuView.LayoutParams) child.getLayoutParams();
|
||||
if (lp.isOverflowButton) {
|
||||
overflowView = child;
|
||||
break;
|
||||
}
|
||||
final Drawable overflowIcon = toolbar.getOverflowIcon();
|
||||
if (overflowIcon != null) {
|
||||
overflowIcon.setColorFilter(itemColor, Mode.SRC_ATOP);
|
||||
toolbar.setOverflowIcon(overflowIcon);
|
||||
}
|
||||
if (!(overflowView instanceof ImageView)) return;
|
||||
((ImageView) overflowView).setColorFilter(itemColor, Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
public static void setCompatToolbarOverlay(Activity activity, Drawable overlay) {
|
||||
|
@ -818,6 +808,11 @@ public class ThemeUtils implements Constants {
|
|||
} else {
|
||||
popupItemColor = getThemeForegroundColor(context);
|
||||
}
|
||||
final Drawable navigationIcon = toolbar.getNavigationIcon();
|
||||
if (navigationIcon != null) {
|
||||
navigationIcon.setColorFilter(contrastForegroundColor, Mode.SRC_ATOP);
|
||||
toolbar.setNavigationIcon(navigationIcon);
|
||||
}
|
||||
getThemeForegroundColor(context);
|
||||
setActionBarOverflowColor(toolbar, contrastForegroundColor);
|
||||
wrapToolbarMenuIcon(ViewSupport.findViewByType(toolbar, ActionMenuView.class),
|
||||
|
|
Loading…
Reference in New Issue