improved theme

removed redundant set theme code
This commit is contained in:
Mariotaku Lee 2015-05-03 22:43:05 +08:00
parent af78dc4025
commit f01beee026
33 changed files with 453 additions and 469 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="org.mariotaku.twidere"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.mariotaku.twidere"
android:installLocation="auto">
<uses-sdk />
@ -68,7 +68,9 @@
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Twidere.Dark.NoActionBar">
android:supportsRtl="true"
android:theme="@style/Theme.Twidere.Dark.NoActionBar"
tools:ignore="UnusedAttribute">
<uses-library
android:name="com.sec.android.app.multiwindow"
android:required="false" />
@ -408,28 +410,28 @@
<intent-filter>
<data
android:host="twitter.com"
android:scheme="http"
android:pathPrefix="/" />
android:pathPrefix="/"
android:scheme="http" />
<data
android:host="twitter.com"
android:scheme="https"
android:pathPrefix="/" />
android:pathPrefix="/"
android:scheme="https" />
<data
android:host="www.twitter.com"
android:scheme="http"
android:pathPrefix="/" />
android:pathPrefix="/"
android:scheme="http" />
<data
android:host="www.twitter.com"
android:scheme="https"
android:pathPrefix="/" />
android:pathPrefix="/"
android:scheme="https" />
<data
android:host="mobile.twitter.com"
android:scheme="http"
android:pathPrefix="/" />
android:pathPrefix="/"
android:scheme="http" />
<data
android:host="mobile.twitter.com"
android:scheme="https"
android:pathPrefix="/" />
android:pathPrefix="/"
android:scheme="https" />
<action android:name="android.intent.action.VIEW" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />

View File

@ -248,8 +248,9 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
mProfileImageStyle = Utils.getProfileImageStyle(this);
mCurrentThemeBackgroundOption = getThemeBackgroundOption();
mCurrentThemeFontFamily = getThemeFontFamily();
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
super.onApplyThemeResource(theme, resid, first);
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
}
@Override
@ -271,9 +272,6 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
final int themeId = getCurrentThemeResourceId();
final String option = getThemeBackgroundOption();
ThemeUtils.applyActionBarBackground(actionBar, this, themeId, themeColor, option, isActionBarOutlineEnabled());
// final int titleColor = ThemeUtils.getContrastActionBarTitleColor(this, themeId, themeColor);
// final int actionBarItemsColor = ThemeUtils.getContrastForegroundColor(this, themeId, themeColor);
// ThemeUtils.setActionBarColor(getWindow(), actionBar, titleColor, actionBarItemsColor);
}
private void setupTintStatusBar() {

View File

@ -118,8 +118,9 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha();
mCurrentThemeBackgroundOption = getThemeBackgroundOption();
mProfileImageStyle = Utils.getProfileImageStyle(this);
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
super.onApplyThemeResource(theme, resId, first);
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
}
}

View File

@ -347,7 +347,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
ThemeUtils.wrapMenuIcon(this, menu);
return true;
}

View File

@ -175,6 +175,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
};
private ControlBarShowHideHelper mControlBarShowHideHelper = new ControlBarShowHideHelper(this);
private int mTabColumns;
private View mActionBarContainer;
public void closeAccountsDrawer() {
if (mSlidingMenu == null) return;
@ -381,9 +382,8 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
mEmptyTabHint.setOnClickListener(this);
ThemeUtils.setCompatContentViewOverlay(this, new EmptyDrawable());
final View actionBarContainer = findViewById(R.id.twidere_action_bar_container);
ViewCompat.setElevation(actionBarContainer, ThemeUtils.getSupportActionBarElevation(this));
ViewSupport.setOutlineProvider(actionBarContainer, ViewOutlineProviderCompat.BACKGROUND);
ViewCompat.setElevation(mActionBarContainer, ThemeUtils.getSupportActionBarElevation(this));
ViewSupport.setOutlineProvider(mActionBarContainer, ViewOutlineProviderCompat.BACKGROUND);
final View windowOverlay = findViewById(R.id.window_overlay);
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this, getCurrentThemeResourceId()));
@ -656,6 +656,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
public void onContentChanged() {
super.onContentChanged();
mActionBar = (Toolbar) findViewById(R.id.action_bar);
mActionBarContainer = findViewById(R.id.twidere_action_bar_container);
mTabIndicator = (TabPagerIndicator) findViewById(R.id.main_tabs);
mSlidingMenu = (HomeSlidingMenu) findViewById(R.id.home_menu);
mViewPager = (ExtendedViewPager) findViewById(R.id.main_pager);
@ -798,10 +799,9 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
final int actionBarAlpha = isTransparent ? ThemeUtils.getUserThemeBackgroundAlpha(this) : 0xFF;
final IHomeActionButton homeActionButton = (IHomeActionButton) mActionsButton;
mTabIndicator.setItemContext(ThemeUtils.getActionBarThemedContext(this, themeResId, themeColor));
ViewSupport.setBackground(mActionBar, ThemeUtils.getActionBarBackground(this, themeResId, themeColor,
ViewSupport.setBackground(mActionBarContainer, ThemeUtils.getActionBarBackground(this, themeResId, themeColor,
backgroundOption, true));
final int statusBarColor;
final Resources resources = getResources();
final int[] foregroundColors = new int[2];
ThemeUtils.getColorForegroundAndInverse(this, foregroundColors);
if (ThemeUtils.isDarkTheme(themeResId)) {
@ -831,7 +831,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
mColorStatusFrameLayout.setColor(statusBarColor, actionBarAlpha);
StatusBarProxy.setStatusBarDarkIcon(getWindow(), TwidereColorUtils.getYIQLuminance(statusBarColor) > ThemeUtils.ACCENT_COLOR_THRESHOLD);
mColorStatusFrameLayout.setFactor(1);
mTabIndicator.setAlpha(actionBarAlpha / 255f);
mActionBarWithOverlay.setAlpha(actionBarAlpha / 255f);
mActionsButton.setAlpha(actionBarAlpha / 255f);
}

View File

@ -352,15 +352,6 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
break;
}
}
if (actionBarItemsColor != 0 && shouldSetActionItemColor()) {
// final int titleColor = ThemeUtils.getContrastActionBarTitleColor(this, themeId, themeColor);
// final Toolbar toolbar = peekActionBarToolbar();
// if (toolbar != null) {
// ThemeUtils.setToolBarColor(toolbar, titleColor, actionBarItemsColor);
// } else {
// ThemeUtils.setActionBarColor(getWindow(), getSupportActionBar(), titleColor, actionBarItemsColor);
// }
}
}
private void setStatusBarColor(int linkId, Uri uri) {

View File

@ -41,6 +41,7 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.internal.widget.NativeActionModeAwareLayout;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
@ -63,6 +64,7 @@ import org.mariotaku.twidere.activity.SettingsActivity;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
import org.mariotaku.twidere.fragment.support.SupportProgressDialogFragment;
import org.mariotaku.twidere.graphic.EmptyDrawable;
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
import org.mariotaku.twidere.util.AsyncTaskUtils;
import org.mariotaku.twidere.util.ContentValuesCreator;
@ -72,11 +74,13 @@ import org.mariotaku.twidere.util.OAuthPasswordAuthenticator.AuthenticityTokenEx
import org.mariotaku.twidere.util.OAuthPasswordAuthenticator.WrongUserPassException;
import org.mariotaku.twidere.util.ParseUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.TwidereActionModeForChildListener;
import org.mariotaku.twidere.util.TwidereColorUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.net.OkHttpClientFactory;
import org.mariotaku.twidere.util.net.TwidereHostResolverFactory;
import org.mariotaku.twidere.util.support.ViewSupport;
import org.mariotaku.twidere.util.support.view.ViewOutlineProviderCompat;
import org.mariotaku.twidere.view.iface.TintedStatusLayout;
import twitter4j.Twitter;
@ -124,17 +128,13 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
private ContentResolver mResolver;
private AbstractSignInTask mTask;
private TintedStatusLayout mMainContent;
private TwidereActionModeForChildListener mTwidereActionModeForChildListener;
@Override
public void afterTextChanged(final Editable s) {
}
@Override
public int getThemeResourceId() {
return ThemeUtils.getThemeResource(this);
}
@Override
public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) {
@ -311,7 +311,19 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
mResolver = getContentResolver();
mApplication = TwidereApplication.getInstance(this);
setContentView(R.layout.activity_sign_in);
// setSupportActionBar((Toolbar) findViewById(R.id.tool_bar));
setSupportActionBar((Toolbar) findViewById(R.id.action_bar));
mTwidereActionModeForChildListener = new TwidereActionModeForChildListener(this, this, false);
final NativeActionModeAwareLayout layout = (NativeActionModeAwareLayout) findViewById(android.R.id.content);
layout.setActionModeForChildListener(mTwidereActionModeForChildListener);
ThemeUtils.setCompatContentViewOverlay(this, new EmptyDrawable());
final View actionBarContainer = findViewById(R.id.twidere_action_bar_container);
ViewCompat.setElevation(actionBarContainer, ThemeUtils.getSupportActionBarElevation(this));
ViewSupport.setOutlineProvider(actionBarContainer, ViewOutlineProviderCompat.BACKGROUND);
final View windowOverlay = findViewById(R.id.window_overlay);
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this, getCurrentThemeResourceId()));
if (savedInstanceState != null) {
mAPIUrlFormat = savedInstanceState.getString(Accounts.API_URL_FORMAT);
mAuthType = savedInstanceState.getInt(Accounts.AUTH_TYPE);
@ -544,14 +556,7 @@ public class SignInActivity extends BaseAppCompatActivity implements TwitterCons
final int themeColor = getCurrentThemeColor();
final int themeId = getCurrentThemeResourceId();
final String option = getThemeBackgroundOption();
final int actionBarItemsColor = ThemeUtils.getContrastForegroundColor(this, themeId, themeColor);
ThemeUtils.applyActionBarBackground(actionBar, this, themeId, themeColor, option, isActionBarOutlineEnabled());
final Toolbar toolbar = peekActionBarToolbar();
if (toolbar != null) {
// ThemeUtils.setToolBarColor(toolbar, titleColor, actionBarItemsColor);
} else {
// ThemeUtils.setActionBarColor(getWindow(), getSupportActionBar(), titleColor, actionBarItemsColor);
}
}
private void setupTintStatusBar() {

View File

@ -131,9 +131,9 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
mProfileImageStyle = Utils.getProfileImageStyle(this);
mCurrentThemeBackgroundOption = getThemeBackgroundOption();
mCurrentThemeFontFamily = getThemeFontFamily();
super.onApplyThemeResource(theme, resid, first);
ThemeUtils.applyWindowBackground(this, getWindow(), resid,
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
super.onApplyThemeResource(theme, resid, first);
}
@Override

View File

@ -26,9 +26,6 @@ import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.LayoutInflaterCompat;
import android.support.v4.view.LayoutInflaterFactory;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@ -140,15 +137,17 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
}
@Override
protected void onApplyThemeResource(@NonNull Resources.Theme theme, int resid, boolean first) {
protected void onApplyThemeResource(@NonNull Resources.Theme theme, int resId, boolean first) {
mCurrentThemeColor = getThemeColor();
mCurrentThemeFontFamily = getThemeFontFamily();
mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha();
mCurrentThemeBackgroundOption = getThemeBackgroundOption();
mProfileImageStyle = Utils.getProfileImageStyle(this);
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
super.onApplyThemeResource(theme, resid, first);
super.onApplyThemeResource(theme, resId, first);
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
}
@Override
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event) {
return false;

View File

@ -126,7 +126,6 @@ public class QuickMenuFragment extends BaseSupportFragment implements OnFitSyste
mSlidingUpPanel = (SlidingUpPanelLayout) view.findViewById(R.id.activities_drawer);
mActivitiesConfigButton = (ImageButton) view.findViewById(R.id.activities_config_button);
final View activitiesContainer = view.findViewById(R.id.activities_container);
// ViewUtils.setBackground(activitiesContainer, ThemeUtils.getWindowBackground(getThemedContext()));
}
@Override

View File

@ -55,6 +55,7 @@ import android.support.v4.app.SharedElementCallback;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v4.content.Loader;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.graphics.ColorUtils;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
@ -664,15 +665,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_user, container, false);
// final ViewGroup profileDetailsContainer = (ViewGroup) view.findViewById(R.id.profile_details_container);
// final boolean isCompact = Utils.isCompactCards(getActivity());
// if (isCompact) {
// inflater.inflate(R.layout.layout_user_details_compact, profileDetailsContainer);
// } else {
// inflater.inflate(R.layout.layout_user_details, profileDetailsContainer);
// }
return view;
return inflater.inflate(R.layout.fragment_user, container, false);
}
@Override
@ -1463,8 +1456,10 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
final View profileBannerContainer = mProfileBannerContainer;
final int spaceHeight = space.getHeight();
final float factor = MathUtils.clamp(offset / (float) spaceHeight, 0, 1);
profileBannerContainer.setTranslationY(Math.max(-offset, -spaceHeight));
profileBannerView.setTranslationY(Math.min(offset, spaceHeight) / 2);
// profileBannerContainer.setTranslationY(Math.max(-offset, -spaceHeight));
// profileBannerView.setTranslationY(Math.min(offset, spaceHeight) / 2);
profileBannerContainer.setTranslationY(-offset);
profileBannerView.setTranslationY(offset / 2);
if (mActionBarBackground != null && mTintedStatusContent != null) {
mActionBarBackground.setFactor(factor);
@ -1485,8 +1480,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
setCompatToolbarOverlayAlpha(activity, factor * tabOutlineAlphaFactor);
}
final Drawable drawable = mPagerIndicator.getBackground();
final int stackedTabColor;
final Drawable tabBackground = mPagerIndicator.getBackground();
int stackedTabColor;
final int themeId = activity.getCurrentThemeResourceId();
if (ThemeUtils.isDarkTheme(themeId)) {
stackedTabColor = getResources().getColor(R.color.background_color_action_bar_dark);
@ -1494,8 +1489,11 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
stackedTabColor = mUiColor;
}
if (ThemeUtils.isTransparentBackground(activity.getCurrentThemeBackgroundOption())) {
stackedTabColor = ColorUtils.setAlphaComponent(stackedTabColor, activity.getCurrentThemeBackgroundAlpha());
}
final int tabColor = (Integer) sArgbEvaluator.evaluate(tabOutlineAlphaFactor, stackedTabColor, mCardBackgroundColor);
((ColorDrawable) drawable).setColor(tabColor);
((ColorDrawable) tabBackground).setColor(tabColor);
final boolean tabItemIsDark = TwidereColorUtils.getYIQLuminance(tabColor) > ThemeUtils.ACCENT_COLOR_THRESHOLD;
if (mPreviousTabItemIsDark == 0 || (tabItemIsDark ? 1 : -1) != mPreviousTabItemIsDark) {

View File

@ -368,6 +368,7 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
}
private void getUserInfo() {
if (getActivity() == null || isDetached()) return;
final LoaderManager lm = getLoaderManager();
lm.destroyLoader(LOADER_ID_USER);
mGetUserInfoCalled = true;

View File

@ -19,7 +19,6 @@
package org.mariotaku.twidere.util;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
@ -34,12 +33,10 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewCompat;
import android.support.v7.internal.app.ToolbarActionBar;
import android.support.v7.app.ActionBar;
import android.support.v7.internal.app.WindowDecorActionBar;
import android.support.v7.internal.app.WindowDecorActionBar.ActionModeImpl;
import android.support.v7.internal.view.StandaloneActionMode;
import android.support.v7.internal.view.SupportActionModeWrapper;
import android.support.v7.internal.view.SupportActionModeWrapperTrojan;
import android.support.v7.internal.view.menu.ActionMenuItemView;
import android.support.v7.internal.widget.ActionBarContainer;
import android.support.v7.internal.widget.ActionBarContextView;
@ -53,7 +50,6 @@ import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextThemeWrapper;
import android.view.Menu;
@ -69,7 +65,6 @@ import org.apache.commons.lang3.ArrayUtils;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.activity.support.LinkHandlerActivity;
import org.mariotaku.twidere.graphic.ActionBarColorDrawable;
import org.mariotaku.twidere.graphic.ActionIconDrawable;
import org.mariotaku.twidere.text.ParagraphSpacingSpan;
@ -101,16 +96,6 @@ public class ThemeUtils implements Constants {
public static void applyActionBarBackground(final ActionBar actionBar, final Context context,
final int themeRes, final int accentColor,
final String backgroundOption, boolean outlineEnabled) {
if (actionBar == null || context == null) return;
actionBar.setBackgroundDrawable(getActionBarBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled));
actionBar.setSplitBackgroundDrawable(getActionBarSplitBackground(context, themeRes));
actionBar.setStackedBackgroundDrawable(getActionBarBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled));
}
public static void applyActionBarBackground(final android.support.v7.app.ActionBar actionBar, final Context context,
final int themeRes, final int accentColor, String backgroundOption, boolean outlineEnabled) {
if (actionBar == null || context == null) return;
actionBar.setBackgroundDrawable(getActionBarBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled));
@ -127,22 +112,6 @@ public class ThemeUtils implements Constants {
actionBar.setStackedBackground(getActionBarStackedBackground(context, themeRes, accentColor, outlineEnabled));
}
public static void applyColorFilterToMenuIcon(Activity activity, Menu menu) {
final ActionBar actionBar = activity.getActionBar();
final Context context = actionBar != null ? actionBar.getThemedContext() : activity;
final int color = getThemeForegroundColor(context);
final int popupTheme = getActionBarPopupThemeRes(context);
final int popupColor = getThemeForegroundColor(context, popupTheme);
final int highlightColor = getUserAccentColor(activity);
applyColorFilterToMenuIcon(menu, color, popupColor, highlightColor, Mode.SRC_ATOP);
}
public static void applyColorFilterToMenuIcon(final Menu menu, final int color,
final int highlightColor, final Mode mode,
final int... excludedGroups) {
applyColorFilterToMenuIcon(menu, color, color, highlightColor, mode, excludedGroups);
}
public static void applyColorFilterToMenuIcon(final Menu menu, final int color, final int popupColor,
final int highlightColor, final Mode mode,
final int... excludedGroups) {
@ -183,69 +152,42 @@ public class ThemeUtils implements Constants {
textView.setText(builder);
}
public static void applySupportActionModeColor(final ActionMode mode, final Activity activity,
int themeRes, int accentColor,
String backgroundOption, boolean outlineEnabled) {
// Very dirty implementation
if (!(mode instanceof SupportActionModeWrapper) || !(activity instanceof IThemedActivity))
return;
final android.support.v7.view.ActionMode modeCompat = SupportActionModeWrapperTrojan.getWrappedObject((SupportActionModeWrapper) mode);
applySupportActionModeColor(modeCompat, activity, themeRes, accentColor, backgroundOption, outlineEnabled);
}
public static void applySupportActionModeColor(final android.support.v7.view.ActionMode modeCompat,
Activity activity, int themeRes,
int accentColor, String backgroundOption,
boolean outlineEnabled) {
// Very dirty implementation
// This call ensures TitleView created
modeCompat.setTitle(null);
try {
View contextView = null;
Context actionBarContext = null;
if (modeCompat instanceof ActionModeImpl) {
WindowDecorActionBar actionBar = (WindowDecorActionBar) Utils.findFieldOfTypes(modeCompat,
ActionModeImpl.class, WindowDecorActionBar.class);
if (actionBar == null) return;
actionBarContext = actionBar.getThemedContext();
final Field contextViewField = WindowDecorActionBar.class.getDeclaredField("mContextView");
contextViewField.setAccessible(true);
contextView = (View) contextViewField.get(actionBar);
} else if (modeCompat instanceof StandaloneActionMode) {
final Field[] fields = StandaloneActionMode.class.getDeclaredFields();
for (Field field : fields) {
if (ActionBarContextView.class.isAssignableFrom(field.getType())) {
field.setAccessible(true);
contextView = (View) field.get(modeCompat);
} else if (Context.class.isAssignableFrom(field.getType())) {
field.setAccessible(true);
actionBarContext = (Context) field.get(modeCompat);
}
if (contextView != null && actionBarContext != null) break;
}
}
if (!(contextView instanceof ActionBarContextView) || actionBarContext == null) return;
setActionBarContextViewColor(actionBarContext, (ActionBarContextView) contextView,
themeRes, accentColor, backgroundOption, outlineEnabled);
} catch (Exception e) {
e.printStackTrace();
modeCompat.setTitle(modeCompat.getTitle());
View contextView = null;
if (modeCompat instanceof ActionModeImpl) {
WindowDecorActionBar actionBar = (WindowDecorActionBar) Utils.findFieldOfTypes(modeCompat,
ActionModeImpl.class, WindowDecorActionBar.class);
if (actionBar == null) return;
contextView = (View) Utils.findFieldOfTypes(actionBar, WindowDecorActionBar.class,
ActionBarContextView.class);
} else if (modeCompat instanceof StandaloneActionMode) {
contextView = (View) Utils.findFieldOfTypes(modeCompat, StandaloneActionMode.class,
ActionBarContextView.class);
}
if (!(contextView instanceof ActionBarContextView)) return;
setActionBarContextViewBackground((ActionBarContextView) contextView, themeRes,
accentColor, backgroundOption, outlineEnabled);
}
public static void setActionBarContextViewColor(@NonNull Context context,
@NonNull ActionBarContextView contextView,
int themeRes, int accentColor, String backgroundOption, boolean outlineEnabled) {
public static void setActionBarContextViewBackground(@NonNull ActionBarContextView contextView,
int themeRes, int accentColor,
String backgroundOption, boolean outlineEnabled) {
ViewSupport.setBackground(contextView, getActionBarBackground(contextView.getContext(),
themeRes, accentColor, backgroundOption, outlineEnabled));
}
public static void setActionBarContextViewColor(@NonNull ActionBarContextView contextView,
int itemColor) {
contextView.setTitle(contextView.getTitle());
contextView.setSubtitle(contextView.getSubtitle());
final ImageView actionModeCloseButton = (ImageView) contextView.findViewById(android.support.v7.appcompat.R.id.action_mode_close_button);
final ActionMenuView menuView = ViewSupport.findViewByType(contextView, ActionMenuView.class);
final int actionBarColor;
if (isDarkTheme(themeRes)) {
actionBarColor = context.getResources().getColor(R.color.background_color_action_bar_dark);
} else {
actionBarColor = accentColor;
}
final int itemColor = getContrastForegroundColor(context, themeRes, actionBarColor);
if (actionModeCloseButton != null) {
actionModeCloseButton.setColorFilter(itemColor, Mode.SRC_ATOP);
}
@ -253,14 +195,13 @@ public class ThemeUtils implements Constants {
setActionBarOverflowColor(menuView, itemColor);
ThemeUtils.wrapToolbarMenuIcon(menuView, itemColor, itemColor);
}
ViewSupport.setBackground(contextView, getActionBarBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled));
}
public static void applyWindowBackground(Context context, Window window, int theme, String option, int alpha) {
if (isWindowFloating(context, theme)) return;
if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(option)) {
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
window.setBackgroundDrawable(ThemeUtils.getWindowBackgroundApplyAlpha(context, alpha));
window.setBackgroundDrawable(getWindowBackgroundFromThemeApplyAlpha(context, theme, alpha));
} else if (VALUE_THEME_BACKGROUND_SOLID.equals(option)) {
window.setBackgroundDrawable(new ColorDrawable(isDarkTheme(theme) ? Color.BLACK : Color.WHITE));
}
@ -269,11 +210,11 @@ public class ThemeUtils implements Constants {
public static void applyWindowBackground(Context context, View window, int theme, String option, int alpha) {
if (isWindowFloating(context, theme)) return;
if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(option)) {
ViewSupport.setBackground(window, ThemeUtils.getWindowBackgroundApplyAlpha(context, alpha));
ViewSupport.setBackground(window, getWindowBackgroundFromThemeApplyAlpha(context, theme, alpha));
} else if (VALUE_THEME_BACKGROUND_SOLID.equals(option)) {
ViewSupport.setBackground(window, new ColorDrawable(isDarkTheme(theme) ? Color.BLACK : Color.WHITE));
} else {
ViewSupport.setBackground(window, ThemeUtils.getWindowBackground(context));
ViewSupport.setBackground(window, getWindowBackground(context));
}
}
@ -291,17 +232,6 @@ public class ThemeUtils implements Constants {
return ActionBarColorDrawable.create(actionBarColor, outlineEnabled);
}
public static Drawable getActionBarHomeAsUpIndicator(android.support.v7.app.ActionBar actionBar) {
final Context context = actionBar.getThemedContext();
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
try {
return a.getDrawable(R.styleable.ActionBar_homeAsUpIndicator);
} finally {
a.recycle();
}
}
public static int getActionBarPopupThemeRes(final Context context) {
final TypedArray a = context.obtainStyledAttributes(new int[]{R.attr.actionBarPopupTheme});
try {
@ -475,17 +405,6 @@ public class ThemeUtils implements Constants {
}
}
public static Drawable getSupportActionBarBackground(final Context context, final int themeRes) {
@SuppressWarnings("ConstantConditions")
final TypedArray array = context.obtainStyledAttributes(null, new int[]{android.R.attr.background},
R.attr.actionBarStyle, themeRes);
try {
return array.getDrawable(0);
} finally {
array.recycle();
}
}
public static float getSupportActionBarElevation(final Context context) {
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(null, new int[]{R.attr.elevation}, R.attr.actionBarStyle, 0);
@ -505,15 +424,6 @@ public class ThemeUtils implements Constants {
return outValue.data;
}
public static int getTextAppearanceLarge(final Context context) {
// final Context wrapped = getThemedContext(context,
// getResources(context));
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.textAppearanceLarge});
final int textAppearance = a.getResourceId(0, android.R.style.TextAppearance_Holo_Large);
a.recycle();
return textAppearance;
}
public static int getTextColorPrimary(final Context context) {
final TypedArray a = context.obtainStyledAttributes(ATTRS_TEXT_COLOR_PRIMARY);
try {
@ -558,25 +468,6 @@ public class ThemeUtils implements Constants {
}
}
public static int getTextColorPrimaryInverse(final Context context) {
final TypedArray a = context.obtainStyledAttributes(ATTRS_TEXT_COLOR_PRIMARY_INVERSE);
try {
return a.getColor(0, Color.TRANSPARENT);
} finally {
a.recycle();
}
}
public static int getTextColorSecondary(final Context context) {
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.textColorSecondary});
try {
return a.getColor(0, Color.TRANSPARENT);
} finally {
a.recycle();
}
}
public static int getThemeBackgroundColor(final Context context) {
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.colorBackground});
try {
@ -642,8 +533,8 @@ public class ThemeUtils implements Constants {
}
public static int getThemeForegroundColor(final Context context, int theme) {
final Context wrapped = theme != 0 ? new ContextThemeWrapper(context, theme) : context;
final TypedArray a = wrapped.obtainStyledAttributes(new int[]{android.R.attr.colorForeground});
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.colorForeground}, 0, theme);
try {
return a.getColor(0, 0);
} finally {
@ -657,18 +548,6 @@ public class ThemeUtils implements Constants {
return pref.getString(KEY_THEME, VALUE_THEME_NAME_TWIDERE);
}
public static int getThemeResource(final Context context) {
return getThemeResource(getThemeNameOption(context));
}
public static int getThemeResource(final String name) {
if (VALUE_THEME_NAME_DARK.equals(name)) {
return R.style.Theme_Twidere_Dark;
}
return R.style.Theme_Twidere_Light;
}
public static int getThemeResource(final int otherTheme) {
if (isDarkTheme(otherTheme)) {
return R.style.Theme_Twidere_Dark;
@ -676,7 +555,6 @@ public class ThemeUtils implements Constants {
return R.style.Theme_Twidere_Light;
}
public static int getNoActionBarThemeResource(final Context context) {
return getNoActionBarThemeResource(getThemeNameOption(context));
}
@ -688,14 +566,6 @@ public class ThemeUtils implements Constants {
return R.style.Theme_Twidere_Light_NoActionBar;
}
public static Context getThemedContext(final Context context) {
return context;
}
public static Context getThemedContext(final Context context, final Resources res) {
return context;
}
public static int getTitleTextAppearance(final Context context) {
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.titleTextStyle},
@ -789,16 +659,6 @@ public class ThemeUtils implements Constants {
}
}
public static Drawable getWindowBackgroundApplyAlpha(final Context context, final int alpha) {
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowBackground});
final Drawable d = a.getDrawable(0);
a.recycle();
if (d != null) {
d.setAlpha(alpha);
}
return d;
}
public static Drawable getWindowBackgroundFromTheme(final Context context, int theme) {
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.windowBackground}, 0, theme);
@ -809,6 +669,17 @@ public class ThemeUtils implements Constants {
}
}
public static Drawable getWindowBackgroundFromThemeApplyAlpha(final Context context, final int theme, final int alpha) {
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.windowBackground}, 0, theme);
final Drawable d = a.getDrawable(0);
a.recycle();
if (d != null) {
d.setAlpha(alpha);
}
return d;
}
public static Drawable getWindowContentOverlay(final Context context) {
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowContentOverlay});
try {
@ -974,32 +845,6 @@ public class ThemeUtils implements Constants {
}
}
public static void setActionBarColor(Window window, android.support.v7.app.ActionBar actionBar,
int titleColor, int itemColor) {
// final Drawable drawable = getActionBarHomeAsUpIndicator(actionBar);
// if (drawable != null) {
// drawable.setColorFilter(itemColor, Mode.SRC_ATOP);
// }
// actionBar.setHomeAsUpIndicator(drawable);
// Ensure title view created
if (actionBar instanceof WindowDecorActionBar) {
actionBar.setTitle(actionBar.getTitle());
actionBar.setSubtitle(actionBar.getSubtitle());
} else if (actionBar instanceof ToolbarActionBar) {
}
}
public static void setToolBarColor(@NonNull Toolbar toolbar, int titleColor, int itemColor) {
// final Drawable drawable = toolbar.getNavigationIcon();
// if (drawable != null) {
// drawable.setColorFilter(itemColor, Mode.SRC_ATOP);
// }
// toolbar.setNavigationIcon(drawable);
toolbar.setTitleTextColor(titleColor);
toolbar.setSubtitleTextColor(titleColor);
}
public static void setActionBarOverflowColor(Toolbar toolbar, int itemColor) {
if (toolbar == null) return;
if (toolbar instanceof TwidereToolbar) {
@ -1144,29 +989,6 @@ public class ThemeUtils implements Constants {
}
}
public static void wrapMenuIcon(Context context, Menu menu, int... excludeGroups) {
final int backgroundColor = ThemeUtils.getThemeBackgroundColor(context);
wrapMenuIcon(context, backgroundColor, backgroundColor, menu, excludeGroups);
}
public static void wrapMenuIcon(Context context, int backgroundColor, int popupBackgroundColor,
Menu menu, int... excludeGroups) {
final Resources resources = context.getResources();
// final int colorDark = resources.getColor(R.color.action_icon_dark);
// final int colorLight = resources.getColor(R.color.action_icon_light);
// final int itemColor = TwidereColorUtils.getContrastYIQ(backgroundColor, colorDark, colorLight);
// final int popupItemColor = TwidereColorUtils.getContrastYIQ(popupBackgroundColor, colorDark, colorLight);
for (int i = 0, j = menu.size(), k = 0; i < j; i++) {
final MenuItem item = menu.getItem(i);
// wrapMenuItemIcon(item, itemColor, excludeGroups);
if (item.hasSubMenu()) {
// wrapMenuIcon(menu, popupItemColor, popupItemColor, excludeGroups);
}
if (item.isVisible()) {
k++;
}
}
}
public static void wrapMenuItemIcon(@NonNull MenuItem item, int itemColor, int... excludeGroups) {
if (ArrayUtils.contains(excludeGroups, item.getGroupId())) return;
@ -1217,13 +1039,6 @@ public class ThemeUtils implements Constants {
return 0;
}
@Nullable
public static Toolbar getToolbarFromActivity(Activity activity) {
if (activity instanceof LinkHandlerActivity)
return ((LinkHandlerActivity) activity).peekActionBarToolbar();
return null;
}
public static Context getActionBarThemedContext(Context base) {
final TypedValue outValue = new TypedValue();
final Resources.Theme baseTheme = base.getTheme();
@ -1234,7 +1049,7 @@ public class ThemeUtils implements Constants {
actionBarTheme.setTo(baseTheme);
actionBarTheme.applyStyle(outValue.resourceId, true);
final Context actionBarContext = new android.support.v7.internal.view.ContextThemeWrapper(base, 0);
final ActionBarContextThemeWrapper actionBarContext = new ActionBarContextThemeWrapper(base, outValue.resourceId);
actionBarContext.getTheme().setTo(actionBarTheme);
return actionBarContext;
} else {
@ -1254,8 +1069,23 @@ public class ThemeUtils implements Constants {
actionBarTheme.setTo(baseTheme);
actionBarTheme.applyStyle(actionBarThemeId, true);
final Context actionBarContext = new android.support.v7.internal.view.ContextThemeWrapper(base, 0);
final ActionBarContextThemeWrapper actionBarContext = new ActionBarContextThemeWrapper(base, actionBarThemeId);
actionBarContext.getTheme().setTo(actionBarTheme);
return actionBarContext;
}
public static final class ActionBarContextThemeWrapper extends android.support.v7.internal.view.ContextThemeWrapper {
public ActionBarContextThemeWrapper(Context base, int themeres) {
super(base, themeres);
}
}
public static int getActionBarThemeResource(int themeId, int accentColor) {
if (isDarkTheme(themeId) || TwidereColorUtils.getYIQLuminance(accentColor) <= ACCENT_COLOR_THRESHOLD) {
return R.style.Theme_Twidere_Dark;
} else {
return R.style.Theme_Twidere_Light;
}
}
}

View File

@ -35,6 +35,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.app.AppCompatDelegateTrojan;
import android.support.v7.internal.view.ContextThemeWrapper;
import android.util.AttributeSet;
import android.view.InflateException;
import android.view.View;
@ -125,7 +126,7 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
}
private static void initViewTint(View view, IThemedActivity activity) {
final int noTintColor, accentColor, backgroundTintColor, actionBarColor;
final int noTintColor, accentColor, backgroundTintColor;
final boolean isColorTint;
// View context is not derived from ActionBar, apply color tint directly
final Resources resources = ((Activity) activity).getResources();
@ -134,15 +135,18 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
final boolean isDarkTheme = ThemeUtils.isDarkTheme(themeResourceId);
final int backgroundColorApprox;
if (!isActionBarContext) {
accentColor = actionBarColor = activity.getCurrentThemeColor();
noTintColor = TwidereColorUtils.getContrastYIQ(accentColor, ThemeUtils.ACCENT_COLOR_THRESHOLD);
accentColor = activity.getCurrentThemeColor();
final int[] darkLightColors = new int[2];
ThemeUtils.getDarkLightForegroundColors((Context) activity,
activity.getCurrentThemeResourceId(), darkLightColors);
noTintColor = TwidereColorUtils.getContrastYIQ(accentColor, ThemeUtils.ACCENT_COLOR_THRESHOLD,
darkLightColors[0], darkLightColors[1]);
backgroundTintColor = accentColor;
backgroundColorApprox = isDarkTheme ? Color.BLACK : Color.WHITE;
isColorTint = true;
} else if (isDarkTheme) {
// View context is derived from ActionBar but is currently dark theme, so we should show
// light
actionBarColor = resources.getColor(R.color.background_color_action_bar_dark);
noTintColor = Color.WHITE;
accentColor = activity.getCurrentThemeColor();
backgroundTintColor = noTintColor;
@ -150,9 +154,14 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
isColorTint = true;
} else {
// View context is derived from ActionBar and it's light theme, so we use contrast color
actionBarColor = activity.getCurrentThemeColor();
accentColor = TwidereColorUtils.getContrastYIQ(actionBarColor, ThemeUtils.ACCENT_COLOR_THRESHOLD);
noTintColor = TwidereColorUtils.getContrastYIQ(accentColor, ThemeUtils.ACCENT_COLOR_THRESHOLD);
final int actionBarColor = activity.getCurrentThemeColor();
final int actionBarTheme = ThemeUtils.getActionBarThemeResource(activity.getThemeResourceId(), actionBarColor);
final int[] darkLightColors = new int[2];
ThemeUtils.getDarkLightForegroundColors((Context) activity, actionBarTheme, darkLightColors);
accentColor = TwidereColorUtils.getContrastYIQ(actionBarColor, ThemeUtils.ACCENT_COLOR_THRESHOLD,
darkLightColors[0], darkLightColors[1]);
noTintColor = TwidereColorUtils.getContrastYIQ(accentColor, ThemeUtils.ACCENT_COLOR_THRESHOLD,
darkLightColors[0], darkLightColors[1]);
backgroundTintColor = accentColor;
backgroundColorApprox = Color.WHITE;
isColorTint = false;
@ -182,9 +191,13 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
applyTintableBackgroundViewTint(tintable, accentColor, noTintColor, backgroundTintColor, isColorTint);
}
} else if (view instanceof TwidereToolbar) {
final int itemColor = ThemeUtils.getContrastForegroundColor((Context) activity,
themeResourceId, actionBarColor);
((TwidereToolbar) view).setItemColor(itemColor);
final Context context = view.getContext();
if (context instanceof android.support.v7.internal.view.ContextThemeWrapper) {
((TwidereToolbar) view).setItemColor(ThemeUtils.getThemeForegroundColor(context,
((ContextThemeWrapper) context).getThemeResId()));
} else {
((TwidereToolbar) view).setItemColor(ThemeUtils.getThemeForegroundColor(context));
}
} else if (view instanceof EditText) {
if (isAccentOptimal || !isColorTint) {
ViewCompat.setBackgroundTintList(view, ColorStateList.valueOf(backgroundTintColor));
@ -213,6 +226,7 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
}
private static boolean isActionBarContext(@NonNull Context context, @Nullable Context actionBarContext) {
if (context instanceof ThemeUtils.ActionBarContextThemeWrapper) return true;
if (actionBarContext == null) return false;
if (context == actionBarContext) return true;
Context base = context;

View File

@ -21,7 +21,6 @@ package org.mariotaku.twidere.util;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.AppCompatCallback;
import android.support.v7.internal.view.StandaloneActionMode;
@ -123,7 +122,7 @@ public class TwidereActionModeForChildListener implements NativeActionModeAwareL
final int height = TypedValue.complexToDimensionPixelSize(outValue.data,
actionBarContext.getResources().getDisplayMetrics());
mActionModeView.setContentHeight(height);
ThemeUtils.setActionBarContextViewColor(actionBarContext, mActionModeView,
ThemeUtils.setActionBarContextViewBackground(mActionModeView,
mThemed.getCurrentThemeResourceId(), mThemed.getCurrentThemeColor(),
mThemed.getCurrentThemeBackgroundOption(), false);
mActionModePopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

View File

@ -0,0 +1,45 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.util.support;
import android.annotation.TargetApi;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.Nullable;
import android.widget.TextView;
/**
* Created by mariotaku on 15/5/3.
*/
public class TextViewSupport {
@Nullable
public static Drawable[] getCompoundDrawablesRelative(TextView view) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return null;
return TextViewSupportJBMR1.getCompoundDrawablesRelative(view);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private static class TextViewSupportJBMR1 {
public static Drawable[] getCompoundDrawablesRelative(TextView view) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return null;
return view.getCompoundDrawablesRelative();
}
}
}

View File

@ -28,6 +28,7 @@ import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.support.TextViewSupport;
/**
* Created by mariotaku on 14/11/20.
@ -54,6 +55,7 @@ public class ActionIconThemedTextView extends AppCompatTextView {
mIconWidth = a.getDimensionPixelSize(R.styleable.IconActionButton_iabIconWidth, 0);
mIconHeight = a.getDimensionPixelSize(R.styleable.IconActionButton_iabIconHeight, 0);
a.recycle();
updateCompoundDrawables();
}
public int getActivatedColor() {
@ -113,7 +115,13 @@ public class ActionIconThemedTextView extends AppCompatTextView {
}
private void updateCompoundDrawables() {
for (Drawable d : getCompoundDrawables()) {
updateCompoundDrawables(getCompoundDrawables());
updateCompoundDrawables(TextViewSupport.getCompoundDrawablesRelative(this));
}
private void updateCompoundDrawables(Drawable[] drawables) {
if (drawables == null) return;
for (Drawable d : drawables) {
if (d == null) continue;
d.mutate();
final int color;

View File

@ -0,0 +1,60 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.view;
import android.content.Context;
import android.support.v7.internal.widget.ActionBarContextView;
import android.support.v7.view.ActionMode;
import android.util.AttributeSet;
import org.mariotaku.twidere.util.ThemeUtils;
/**
* Created by mariotaku on 15/1/16.
*/
public class TwidereActionBarContextView extends ActionBarContextView {
private int mItemColor;
public TwidereActionBarContextView(Context context) {
super(context);
}
public TwidereActionBarContextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public TwidereActionBarContextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void initForMode(ActionMode mode) {
super.initForMode(mode);
if (mItemColor != 0) {
ThemeUtils.setActionBarContextViewColor(this, mItemColor);
}
}
public void setItemColor(int itemColor) {
mItemColor = itemColor;
ThemeUtils.setActionBarContextViewColor(this, itemColor);
}
}

View File

@ -23,7 +23,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/float_action_button_size"
android:layout_height="@dimen/float_action_button_size"
android:layout_gravity="bottom|right"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/element_spacing_large"
android:elevation="@dimen/element_spacing_small"
android:visibility="visible"/>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -21,7 +20,6 @@
<org.mariotaku.twidere.view.MainFrameLayout
android:id="@+id/home_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
@ -31,9 +29,9 @@
android:focusable="true"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />
<include layout="@layout/layout_empty_tab_hint"/>
<include layout="@layout/layout_empty_tab_hint" />
<RelativeLayout
android:id="@+id/twidere_action_bar_with_overlay"
@ -59,5 +57,5 @@
android:background="?android:windowContentOverlay" />
</RelativeLayout>
<include layout="@layout/layout_home_actions_button"/>
<include layout="@layout/layout_home_actions_button" />
</org.mariotaku.twidere.view.MainFrameLayout>

View File

@ -18,94 +18,117 @@
-->
<org.mariotaku.twidere.view.TintedStatusFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:setPadding="true">
<ScrollView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="300dp"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/twidere_action_bar_container"
android:layout_gravity="center">
<LinearLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/username_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/username"
android:inputType="textEmailAddress"
android:singleLine="true"
android:typeface="normal" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
android:singleLine="true"
android:typeface="normal" />
</LinearLayout>
<LinearLayout
android:id="@+id/sign_in_sign_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp">
<Button
android:id="@+id/sign_up"
style="?android:buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:minHeight="48dp"
android:onClick="onClick"
android:text="@string/register" />
<Button
android:id="@+id/sign_in"
style="?android:buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:minHeight="48dp"
android:onClick="onClick"
android:text="@string/sign_in" />
</LinearLayout>
<Button
android:id="@+id/sign_in_method_introduction"
style="?android:borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:clickable="true"
android:gravity="center_vertical"
android:minHeight="36dp"
android:onClick="onClick"
android:text="@string/sign_in_method_introduction_title"
android:textAppearance="?android:textAppearanceSmall" />
</LinearLayout>
</ScrollView>
<org.mariotaku.twidere.view.TwidereActionBarContainer
android:id="@+id/twidere_action_bar_container"
style="?attr/actionBarStyle"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:layout_alignParentTop="true"
android:touchscreenBlocksFocus="true"
tools:ignore="UnusedAttribute" />
<View
android:id="@+id/window_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/username_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/username"
android:inputType="textEmailAddress"
android:singleLine="true"
android:typeface="normal" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
android:singleLine="true"
android:typeface="normal" />
</LinearLayout>
<LinearLayout
android:id="@+id/sign_in_sign_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp">
<Button
android:id="@+id/sign_up"
style="?android:buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:minHeight="48dp"
android:onClick="onClick"
android:text="@string/register" />
<Button
android:id="@+id/sign_in"
style="?android:buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:minHeight="48dp"
android:onClick="onClick"
android:text="@string/sign_in" />
</LinearLayout>
<Button
android:id="@+id/sign_in_method_introduction"
style="?android:borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:clickable="true"
android:gravity="center_vertical"
android:minHeight="36dp"
android:onClick="onClick"
android:text="@string/sign_in_method_introduction_title"
android:textAppearance="?android:textAppearanceSmall" />
</LinearLayout>
</ScrollView>
android:layout_below="@+id/twidere_action_bar_container"
android:background="?android:windowContentOverlay" />
</RelativeLayout>
</org.mariotaku.twidere.view.TintedStatusFrameLayout>

View File

@ -7,10 +7,9 @@
style="?attr/toolbarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:navigationContentDescription="@string/abc_action_bar_up_description"
app:navigationIcon="?homeAsUpIndicator" />
app:navigationContentDescription="@string/abc_action_bar_up_description" />
<android.support.v7.internal.widget.ActionBarContextView
<org.mariotaku.twidere.view.TwidereActionBarContextView
android:id="@+id/action_context_bar"
style="?attr/actionModeStyle"
android:layout_width="match_parent"

View File

@ -20,7 +20,7 @@
app:tabHorizontalPadding="@dimen/element_spacing_normal" />
</org.mariotaku.twidere.view.TwidereToolbar>
<android.support.v7.internal.widget.ActionBarContextView
<org.mariotaku.twidere.view.TwidereActionBarContextView
android:id="@+id/action_context_bar"
style="?attr/actionModeStyle"
android:layout_width="match_parent"

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,8 +17,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/element_size_normal"
@ -34,14 +32,17 @@
android:layout_height="match_parent"
android:contentDescription="@string/icon"
android:scaleType="centerInside"
tools:src="@drawable/ic_action_search"/>
tools:src="@drawable/ic_action_search" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/element_spacing_small">
android:paddingEnd="0dp"
android:paddingRight="0dp"
android:paddingLeft="@dimen/element_spacing_small"
android:paddingStart="@dimen/element_spacing_small">
<TextView
android:id="@android:id/text1"
@ -49,7 +50,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Mariotaku"/>
tools:text="Mariotaku" />
</LinearLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,8 +17,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/element_size_normal"
@ -34,13 +32,16 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/icon"
android:scaleType="centerCrop"/>
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="0dp"
android:paddingRight="0dp"
android:paddingStart="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_small">
<TextView
@ -49,16 +50,17 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Mariotaku"/>
tools:text="Mariotaku" />
<TextView
android:id="@android:id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/element_spacing_small"
android:layout_marginStart="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="\@mariotaku"/>
tools:text="\@mariotaku" />
</LinearLayout>
</LinearLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,8 +17,8 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
@ -32,28 +31,34 @@
android:layout_width="@dimen/icon_size_list_item"
android:layout_height="@dimen/icon_size_list_item"
android:contentDescription="@string/icon"
android:scaleType="fitCenter"/>
android:scaleType="fitCenter"
tools:src="@android:drawable/sym_def_app_icon" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_normal">
android:paddingEnd="0dp"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="0dp"
android:paddingStart="@dimen/element_spacing_normal">
<TextView
android:id="@android:id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="text1" />
<TextView
android:id="@android:id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="text2" />
</LinearLayout>
</LinearLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,8 +17,8 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
@ -35,30 +34,36 @@
android:layout_height="@dimen/icon_size_list_item"
android:layout_weight="0"
android:contentDescription="@string/icon"
android:scaleType="fitCenter"/>
android:scaleType="fitCenter"
tools:src="@android:drawable/sym_def_app_icon" />
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_normal">
android:paddingEnd="0dp"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="0dp"
android:paddingStart="@dimen/element_spacing_normal">
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"/>
android:textStyle="bold"
tools:text="text1" />
<TextView
android:id="@android:id/text2"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="text2" />
</LinearLayout>
<org.mariotaku.twidere.view.ActivatedCheckBox
@ -68,6 +73,7 @@
android:layout_weight="0"
android:clickable="false"
android:focusable="false"
android:visibility="gone"/>
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>

View File

@ -39,7 +39,10 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_small">
android:paddingEnd="0dp"
android:paddingLeft="@dimen/element_spacing_small"
android:paddingRight="0dp"
android:paddingStart="@dimen/element_spacing_small">
<TextView
android:id="@android:id/text1"

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,8 +17,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -34,14 +32,17 @@
android:layout_width="@dimen/icon_size_list_item_small"
android:layout_height="@dimen/icon_size_list_item_small"
android:contentDescription="@string/icon"
android:scaleType="centerCrop"/>
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_small">
android:paddingEnd="0dp"
android:paddingLeft="@dimen/element_spacing_small"
android:paddingRight="0dp"
android:paddingStart="@dimen/element_spacing_small">
<TextView
android:id="@android:id/text1"
@ -49,7 +50,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Mariotaku"/>
tools:text="Mariotaku" />
<TextView
android:id="@android:id/text2"
@ -57,7 +58,7 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="\@mariotaku"/>
tools:text="\@mariotaku" />
</LinearLayout>
</LinearLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,8 +17,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -28,12 +26,15 @@
android:padding="@dimen/element_spacing_normal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="@dimen/element_spacing_normal">
android:paddingEnd="@dimen/element_spacing_normal"
android:paddingLeft="0dp"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingStart="0dp">
<TextView
android:id="@+id/name"
@ -44,17 +45,17 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:text="Sample list"/>
tools:text="Sample list" />
<TextView
android:id="@+id/created_by"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/element_spacing_xsmall"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
tools:text="Created by Mariotaku"/>
tools:text="Created by Mariotaku" />
</LinearLayout>
<org.mariotaku.twidere.view.SquareShapedImageView
@ -64,5 +65,5 @@
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
android:scaleType="fitCenter" />
</LinearLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,8 +17,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -29,13 +27,13 @@
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_gravity="end"
android:fontFamily="sans-serif-condensed"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:colorActivatedHighlight"
android:textSize="@dimen/text_size_wizard_nav_item"
android:textStyle="bold"
tools:ignore="UnusedAttribute"/>
tools:ignore="UnusedAttribute" />
</FrameLayout>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -18,9 +17,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<org.mariotaku.twidere.view.SquareFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<org.mariotaku.twidere.view.SquareFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/element_spacing_small">
@ -32,6 +29,6 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:contentDescription="@string/profile_image"
android:scaleType="centerCrop"/>
android:scaleType="centerCrop" />
</org.mariotaku.twidere.view.SquareFrameLayout>

View File

@ -18,7 +18,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/theme_preview_status_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
@ -28,7 +28,8 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_weight="1"
tools:ignore="UselessParent">
<include
android:id="@+id/status_content"