mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
migrating to daynight theme
This commit is contained in:
parent
a5cc0b7fe1
commit
81040d8bea
@ -208,6 +208,7 @@ public interface IntentConstants {
|
||||
String EXTRA_CHANGED = "changed";
|
||||
String EXTRA_NOTIFY_CHANGE = "notify_change";
|
||||
String EXTRA_RESTART_ACTIVITY = "restart_activity";
|
||||
String EXTRA_RECREATE_ACTIVITY = "recreate_activity";
|
||||
String EXTRA_FROM_USER = "from_user";
|
||||
String EXTRA_SHOW_MEDIA_PREVIEW = "show_media_preview";
|
||||
String EXTRA_SHOW_EXTRA_TYPE = "show_extra_type";
|
||||
|
@ -80,7 +80,7 @@ public interface SharedPreferenceConstants {
|
||||
String VALUE_THEME_BACKGROUND_SOLID = "solid";
|
||||
String VALUE_THEME_BACKGROUND_TRANSPARENT = "transparent";
|
||||
|
||||
String VALUE_THEME_NAME_TWIDERE = "twidere";
|
||||
String VALUE_THEME_NAME_AUTO = "auto";
|
||||
String VALUE_THEME_NAME_DARK = "dark";
|
||||
String VALUE_THEME_NAME_LIGHT = "light";
|
||||
|
||||
@ -99,7 +99,7 @@ public interface SharedPreferenceConstants {
|
||||
int VALUE_CARD_HIGHLIGHT_OPTION_CODE_BACKGROUND = 0x1;
|
||||
int VALUE_CARD_HIGHLIGHT_OPTION_CODE_LINE = 0x2;
|
||||
|
||||
String DEFAULT_THEME = VALUE_THEME_NAME_TWIDERE;
|
||||
String DEFAULT_THEME = VALUE_THEME_NAME_LIGHT;
|
||||
String DEFAULT_THEME_BACKGROUND = VALUE_THEME_BACKGROUND_DEFAULT;
|
||||
String DEFAULT_THEME_FONT_FAMILY = VALUE_THEME_FONT_FAMILY_REGULAR;
|
||||
int DEFAULT_THEME_BACKGROUND_ALPHA = 160;
|
||||
|
@ -75,7 +75,7 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoActionBar"
|
||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<uses-library
|
||||
android:name="com.sec.android.app.multiwindow"
|
||||
@ -112,6 +112,7 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||
android:windowSoftInputMode="adjustNothing">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
@ -127,6 +128,7 @@
|
||||
android:icon="@mipmap/ic_launcher_hondajojo"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
@ -140,7 +142,7 @@
|
||||
android:name=".activity.support.HomeActivity"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoActionBar"
|
||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.HOME"/>
|
||||
@ -166,7 +168,7 @@
|
||||
android:label="@string/compose"
|
||||
android:launchMode="singleTop"
|
||||
android:parentActivityName=".activity.support.HomeActivity"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog"
|
||||
android:theme="@style/Theme.Twidere.Compose"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter android:label="@string/compose">
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
@ -197,7 +199,7 @@
|
||||
android:name=".activity.support.QuickSearchBarActivity"
|
||||
android:label="@string/search"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog"
|
||||
android:theme="@style/Theme.Twidere.QuickSearchBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.GLOBAL_SEARCH"/>
|
||||
@ -208,7 +210,7 @@
|
||||
<activity
|
||||
android:name=".activity.support.SignInActivity"
|
||||
android:label="@string/sign_in"
|
||||
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge.NoActionBar"
|
||||
android:theme="@style/Theme.Twidere.DialogWhenLarge.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.TWITTER_LOGIN"/>
|
||||
@ -219,7 +221,7 @@
|
||||
<activity
|
||||
android:name=".activity.support.BrowserSignInActivity"
|
||||
android:label="@string/browser_sign_in"
|
||||
android:theme="@style/Theme.Twidere.Dark"
|
||||
android:theme="@style/Theme.Twidere"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.TWITTER_BROWSER_LOGIN"/>
|
||||
@ -231,7 +233,7 @@
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:label="@string/settings"
|
||||
android:parentActivityName=".activity.support.HomeActivity"
|
||||
android:theme="@style/Theme.Twidere.Dark"
|
||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE"/>
|
||||
@ -247,12 +249,12 @@
|
||||
<activity
|
||||
android:name=".activity.support.APIEditorActivity"
|
||||
android:label="@string/edit_api"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog"
|
||||
android:theme="@style/Theme.Twidere.Dialog"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
<activity
|
||||
android:name=".activity.support.AccountSelectorActivity"
|
||||
android:label="@string/select_account"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog">
|
||||
android:theme="@style/Theme.Twidere.Dialog">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.SELECT_ACCOUNT"/>
|
||||
|
||||
@ -262,11 +264,11 @@
|
||||
<activity
|
||||
android:name=".activity.support.ColorPickerDialogActivity"
|
||||
android:label="@string/set_color"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay"/>
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"/>
|
||||
<activity
|
||||
android:name=".activity.support.LinkHandlerActivity"
|
||||
android:parentActivityName=".activity.support.HomeActivity"
|
||||
android:theme="@style/Theme.Twidere.Dark.DialogWhenLarge.NoActionBar"
|
||||
android:theme="@style/Theme.Twidere.DialogWhenLarge.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
@ -307,7 +309,7 @@
|
||||
android:name=".activity.support.FileSelectorActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/pick_file"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay"
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.PICK_FILE"/>
|
||||
@ -319,7 +321,7 @@
|
||||
<activity
|
||||
android:name=".activity.support.ThemedImagePickerActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay"
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
@ -333,7 +335,7 @@
|
||||
android:name=".activity.support.CustomTabEditorActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/add_tab"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog"
|
||||
android:theme="@style/Theme.Twidere.Dialog"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.ADD_TAB"/>
|
||||
@ -345,7 +347,7 @@
|
||||
<activity
|
||||
android:name=".activity.CreateComposeShortcutActivity"
|
||||
android:label="@string/compose"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay">
|
||||
android:theme="@style/Theme.Twidere.NoDisplay">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.CREATE_SHORTCUT"/>
|
||||
|
||||
@ -355,11 +357,11 @@
|
||||
<activity
|
||||
android:name=".activity.CopyLinkActivity"
|
||||
android:label="@string/copy_link"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay"/>
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"/>
|
||||
<activity
|
||||
android:name=".activity.support.RequestPermissionsActivity"
|
||||
android:label="@string/permissions_request"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog">
|
||||
android:theme="@style/Theme.Twidere.Dialog">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.REQUEST_PERMISSIONS"/>
|
||||
|
||||
@ -369,7 +371,7 @@
|
||||
<activity
|
||||
android:name=".activity.support.UserListSelectorActivity"
|
||||
android:label="@string/select_user_list"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog">
|
||||
android:theme="@style/Theme.Twidere.Dialog">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.SELECT_USER"/>
|
||||
<action android:name="org.mariotaku.twidere.SELECT_USER_LIST"/>
|
||||
@ -380,18 +382,18 @@
|
||||
<activity
|
||||
android:name=".activity.SettingsWizardActivity"
|
||||
android:label="@string/settings_wizard"
|
||||
android:theme="@style/Theme.Twidere.Dark"/>
|
||||
android:theme="@style/Theme.Twidere"/>
|
||||
<activity
|
||||
android:name=".activity.support.DataExportActivity"
|
||||
android:label="@string/export_settings"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay"/>
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"/>
|
||||
<activity
|
||||
android:name=".activity.support.DataImportActivity"
|
||||
android:label="@string/import_settings"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay"/>
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"/>
|
||||
<activity
|
||||
android:name=".activity.support.ActivityPickerActivity"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog">
|
||||
android:theme="@style/Theme.Twidere.Dialog">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.PICK_ACTIVITY"/>
|
||||
|
||||
@ -402,7 +404,7 @@
|
||||
android:name=".activity.TwitterLinkHandlerActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:taskAffinity=":twidere_twitter_link_handler"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay">
|
||||
android:theme="@style/Theme.Twidere.NoDisplay">
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="twitter.com"
|
||||
@ -441,7 +443,7 @@
|
||||
android:enabled="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:taskAffinity=":twidere_assist_launcher"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay">
|
||||
android:theme="@style/Theme.Twidere.NoDisplay">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ASSIST"/>
|
||||
|
||||
@ -454,7 +456,7 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.KeyboardShortcutPreferenceCompatActivity"
|
||||
android:theme="@style/Theme.Twidere.Dark.Dialog"/>
|
||||
android:theme="@style/Theme.Twidere.Dialog"/>
|
||||
<activity
|
||||
android:name=".activity.TestActivity"
|
||||
android:enabled="false"
|
||||
@ -475,11 +477,11 @@
|
||||
<activity
|
||||
android:name=".activity.UsageStatisticsActivity"
|
||||
android:label="@string/usage_statistics"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoDisplay"/>
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"/>
|
||||
<activity
|
||||
android:name=".activity.ImageCropperActivity"
|
||||
android:label="@string/crop_image"
|
||||
android:theme="@style/Theme.Twidere.Dark.NoActionBar"
|
||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
|
||||
<service
|
||||
|
@ -31,6 +31,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.mariotaku.twidere.activity.iface.IAppCompatActivity;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
/**
|
||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||
|
@ -25,6 +25,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@ -55,7 +56,9 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
|
||||
IThemedActivity, KeyboardShortcutsHandler.KeyboardShortcutCallback {
|
||||
|
||||
private TintedStatusFrameLayout mMainContent;
|
||||
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
|
||||
// Data fields
|
||||
private int mCurrentThemeColor;
|
||||
private int mCurrentThemeBackgroundAlpha;
|
||||
@ShapeStyle
|
||||
private int mProfileImageStyle;
|
||||
private String mCurrentThemeBackgroundOption;
|
||||
@ -86,11 +89,6 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
|
||||
return mCurrentThemeColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCurrentThemeResourceId() {
|
||||
return mCurrentThemeResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeBackgroundAlpha() {
|
||||
return ThemeUtils.getUserThemeBackgroundAlpha(this);
|
||||
@ -127,7 +125,7 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
|
||||
@Override
|
||||
public void onSupportActionModeStarted(android.support.v7.view.ActionMode mode) {
|
||||
super.onSupportActionModeStarted(mode);
|
||||
ThemeUtils.applySupportActionModeColor(mode, this, getCurrentThemeResourceId(),
|
||||
ThemeUtils.applySupportActionModeColor(mode, this,
|
||||
getCurrentThemeColor(), getThemeBackgroundOption(), true);
|
||||
}
|
||||
|
||||
@ -226,8 +224,7 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
|
||||
final View actionBarView = getWindow().findViewById(android.support.v7.appcompat.R.id.action_bar);
|
||||
if (actionBarView instanceof Toolbar) {
|
||||
final int themeColor = getCurrentThemeColor();
|
||||
final int themeId = getCurrentThemeResourceId();
|
||||
final int itemColor = ThemeUtils.getContrastForegroundColor(this, themeId, themeColor);
|
||||
final int itemColor = ThemeUtils.getContrastForegroundColor(this, themeColor);
|
||||
final Toolbar toolbar = (Toolbar) actionBarView;
|
||||
final int popupColor = ThemeUtils.getThemeForegroundColor(toolbar.getContext(), toolbar.getPopupTheme());
|
||||
ThemeUtils.wrapToolbarMenuIcon(ViewSupport.findViewByType(actionBarView, ActionMenuView.class), itemColor, popupColor);
|
||||
@ -249,13 +246,19 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
|
||||
|
||||
@Override
|
||||
public void setTheme(int resId) {
|
||||
super.setTheme(mCurrentThemeResource = getThemeResourceId());
|
||||
super.setTheme(resId);
|
||||
if (shouldApplyWindowBackground()) {
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(),
|
||||
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||
super.setSupportActionBar(toolbar);
|
||||
ThemeUtils.applyToolbarItemColor(this, toolbar, mCurrentThemeColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(@NonNull Resources.Theme theme, int resId, boolean first) {
|
||||
mCurrentThemeColor = getThemeColor();
|
||||
@ -281,16 +284,15 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
|
||||
if (actionBar == null) return;
|
||||
|
||||
final int themeColor = getCurrentThemeColor();
|
||||
final int themeId = getCurrentThemeResourceId();
|
||||
final String option = getThemeBackgroundOption();
|
||||
ThemeUtils.applyActionBarBackground(actionBar, this, themeId, themeColor, option, isActionBarOutlineEnabled());
|
||||
ThemeUtils.applyActionBarBackground(actionBar, this, themeColor, option, isActionBarOutlineEnabled());
|
||||
}
|
||||
|
||||
private void setupTintStatusBar() {
|
||||
if (mMainContent == null) return;
|
||||
|
||||
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption()) ? getCurrentThemeBackgroundAlpha() : 0xFF;
|
||||
final int statusBarColor = ThemeUtils.getActionBarColor(this, getCurrentThemeColor(), getCurrentThemeResourceId(), getThemeBackgroundOption());
|
||||
final int statusBarColor = ThemeUtils.getActionBarColor(this, getCurrentThemeColor(), getThemeBackgroundOption());
|
||||
mMainContent.setColor(statusBarColor, alpha);
|
||||
|
||||
mMainContent.setDrawShadow(false);
|
||||
|
@ -37,7 +37,6 @@ import javax.inject.Inject;
|
||||
|
||||
public abstract class BaseThemedActivity extends Activity implements IThemedActivity {
|
||||
|
||||
private int mCurrentThemeResource;
|
||||
private int mCurrentThemeColor;
|
||||
private int mCurrentThemeBackgroundAlpha;
|
||||
private String mCurrentThemeFontFamily;
|
||||
@ -66,11 +65,6 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
|
||||
return mCurrentThemeColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCurrentThemeResourceId() {
|
||||
return mCurrentThemeResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeBackgroundAlpha() {
|
||||
return ThemeUtils.getUserThemeBackgroundAlpha(this);
|
||||
@ -84,9 +78,6 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
|
||||
return ThemeUtils.getThemeFontFamily(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract int getThemeResourceId();
|
||||
|
||||
@Override
|
||||
@ShapedImageView.ShapeStyle
|
||||
public int getCurrentProfileImageStyle() {
|
||||
@ -115,10 +106,9 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
|
||||
|
||||
@Override
|
||||
public void setTheme(int resId) {
|
||||
final int themeResourceId = getThemeResourceId();
|
||||
super.setTheme(mCurrentThemeResource = themeResourceId != 0 ? themeResourceId : resId);
|
||||
super.setTheme(resId);
|
||||
if (shouldApplyWindowBackground()) {
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(),
|
||||
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,8 @@ import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
||||
public class ImageCropperActivity extends CropImageActivity implements IThemedActivity {
|
||||
|
||||
// Data fields
|
||||
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
|
||||
private int mCurrentThemeColor;
|
||||
private int mCurrentThemeBackgroundAlpha;
|
||||
@ShapedImageView.ShapeStyle
|
||||
private int mProfileImageStyle;
|
||||
private String mCurrentThemeBackgroundOption;
|
||||
@ -67,16 +68,15 @@ public class ImageCropperActivity extends CropImageActivity implements IThemedAc
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
}
|
||||
final int themeColor = getThemeColor();
|
||||
final int themeResId = getCurrentThemeResourceId();
|
||||
final String backgroundOption = getCurrentThemeBackgroundOption();
|
||||
mMainContent.setDrawColor(true);
|
||||
mMainContent.setDrawShadow(false);
|
||||
mMainContent.setColor(themeColor);
|
||||
ViewSupport.setBackground(mDoneCancelBar, ThemeUtils.getActionBarBackground(this, themeResId,
|
||||
ViewSupport.setBackground(mDoneCancelBar, ThemeUtils.getActionBarBackground(this,
|
||||
themeColor, backgroundOption, true));
|
||||
ViewCompat.setElevation(mDoneCancelBar, ThemeUtils.getSupportActionBarElevation(this));
|
||||
final View windowOverlay = findViewById(R.id.window_overlay);
|
||||
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this, themeResId));
|
||||
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,16 +92,11 @@ public class ImageCropperActivity extends CropImageActivity implements IThemedAc
|
||||
|
||||
@Override
|
||||
public void setTheme(final int resId) {
|
||||
super.setTheme(mCurrentThemeResource = getThemeResourceId());
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
|
||||
super.setTheme(resId);
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(),
|
||||
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoActionBarThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentThemeFontFamily() {
|
||||
return mCurrentThemeFontFamily;
|
||||
@ -122,11 +117,6 @@ public class ImageCropperActivity extends CropImageActivity implements IThemedAc
|
||||
return mCurrentThemeColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCurrentThemeResourceId() {
|
||||
return mCurrentThemeResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeBackgroundAlpha() {
|
||||
return ThemeUtils.getUserThemeBackgroundAlpha(this);
|
||||
|
@ -58,11 +58,6 @@ public class KeyboardShortcutPreferenceCompatActivity extends BaseThemedActivity
|
||||
return ThemeUtils.getThemeColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getDialogThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -27,7 +27,6 @@ import org.mariotaku.twidere.BuildConfig;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.support.HomeActivity;
|
||||
import org.mariotaku.twidere.util.StrictModeUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
public class MainActivity extends Activity implements Constants {
|
||||
|
||||
@ -43,8 +42,4 @@ public class MainActivity extends Activity implements Constants {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTheme(int resId) {
|
||||
super.setTheme(ThemeUtils.getNoActionBarThemeResource(this));
|
||||
}
|
||||
}
|
||||
|
@ -98,11 +98,6 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoActionBarThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBuildHeaders(final List<Header> target) {
|
||||
loadHeadersFromResource(R.xml.settings_headers, target);
|
||||
@ -272,7 +267,7 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
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()));
|
||||
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this));
|
||||
setIntent(getIntent().addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
|
||||
|
||||
|
||||
|
@ -177,11 +177,6 @@ public class SettingsWizardActivity extends BaseThemedActivity implements Consta
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoActionBarThemeResource(this);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LayoutInflater getLayoutInflater() {
|
||||
|
@ -29,8 +29,6 @@ public interface IThemedActivity {
|
||||
|
||||
int getCurrentThemeColor();
|
||||
|
||||
int getCurrentThemeResourceId();
|
||||
|
||||
int getThemeBackgroundAlpha();
|
||||
|
||||
String getThemeBackgroundOption();
|
||||
@ -41,8 +39,6 @@ public interface IThemedActivity {
|
||||
|
||||
String getCurrentThemeFontFamily();
|
||||
|
||||
int getThemeResourceId();
|
||||
|
||||
@ShapedImageView.ShapeStyle
|
||||
int getCurrentProfileImageStyle();
|
||||
|
||||
|
@ -90,15 +90,6 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoActionBarThemeResource(this);
|
||||
}
|
||||
|
||||
public TwidereApplication getTwidereApplication() {
|
||||
return (TwidereApplication) getApplication();
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return mIsVisible;
|
||||
}
|
||||
|
@ -41,12 +41,7 @@ public class BaseSupportDialogActivity extends ThemedFragmentActivity implements
|
||||
|
||||
@Override
|
||||
public int getThemeColor() {
|
||||
return ThemeUtils.getThemeColor(this, getThemeResourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getDialogThemeResource(this);
|
||||
return ThemeUtils.getThemeColor(this);
|
||||
}
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
@ -25,17 +25,11 @@ import android.os.Bundle;
|
||||
|
||||
import org.mariotaku.twidere.fragment.support.ColorPickerDialogFragment;
|
||||
import org.mariotaku.twidere.fragment.support.ColorPickerDialogFragment.Callback;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
public class ColorPickerDialogActivity extends BaseSupportDialogActivity implements Callback {
|
||||
|
||||
public static final int RESULT_CLEARED = -2;
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoDisplayThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled() {
|
||||
finish();
|
||||
|
@ -224,11 +224,6 @@ public class ComposeActivity extends ThemedFragmentActivity implements OnMenuIte
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getComposeThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
|
||||
switch (requestCode) {
|
||||
@ -1293,8 +1288,8 @@ public class ComposeActivity extends ThemedFragmentActivity implements OnMenuIte
|
||||
private void updateLocationState() {
|
||||
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
|
||||
if (attachLocation) {
|
||||
mLocationIcon.setColorFilter(ThemeUtils.getOptimalAccentColor(this, false,
|
||||
getCurrentThemeResourceId()), Mode.SRC_ATOP);
|
||||
mLocationIcon.setColorFilter(ThemeUtils.getOptimalAccentColor(this, false
|
||||
), Mode.SRC_ATOP);
|
||||
} else {
|
||||
mLocationIcon.setColorFilter(mLocationIcon.getDefaultColor(), Mode.SRC_ATOP);
|
||||
mLocationText.setText(R.string.no_location);
|
||||
|
@ -29,11 +29,6 @@ public class DataExportActivity extends ThemedFragmentActivity implements DataEx
|
||||
return ThemeUtils.getThemeColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoDisplayThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(DialogFragment df) {
|
||||
if (!isFinishing()) {
|
||||
|
@ -28,11 +28,6 @@ public class DataImportActivity extends ThemedFragmentActivity implements DataEx
|
||||
return ThemeUtils.getThemeColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoDisplayThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(final DialogFragment df) {
|
||||
if (!isFinishing()) {
|
||||
|
@ -33,7 +33,6 @@ import android.widget.Toast;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.fragment.support.FileSelectorDialogFragment;
|
||||
import org.mariotaku.twidere.util.PermissionUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -44,11 +43,6 @@ public class FileSelectorActivity extends BaseSupportDialogActivity implements F
|
||||
|
||||
private Runnable mResumeFragmentsRunnable;
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoDisplayThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(final DialogFragment df) {
|
||||
if (!isFinishing()) {
|
||||
|
@ -382,7 +382,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
||||
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()));
|
||||
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this));
|
||||
|
||||
setupSlidingMenu();
|
||||
setupBars();
|
||||
@ -424,7 +424,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ThemeUtils.isDarkTheme(getCurrentThemeResourceId())) {
|
||||
if (ThemeUtils.isDarkTheme(this)) {
|
||||
// TODO show dark bar
|
||||
} else {
|
||||
ActivitySupport.setTaskDescription(this, new TaskDescriptionCompat(null, null, getThemeColor()));
|
||||
@ -773,19 +773,18 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
||||
|
||||
private void setupBars() {
|
||||
final int themeColor = getThemeColor();
|
||||
final int themeResId = getCurrentThemeResourceId();
|
||||
final String backgroundOption = getCurrentThemeBackgroundOption();
|
||||
final boolean isTransparent = ThemeUtils.isTransparentBackground(backgroundOption);
|
||||
final int actionBarAlpha = isTransparent ? ThemeUtils.getActionBarAlpha(ThemeUtils.getUserThemeBackgroundAlpha(this)) : 0xFF;
|
||||
final IHomeActionButton homeActionButton = (IHomeActionButton) mActionsButton;
|
||||
mTabIndicator.setItemContext(ThemeUtils.getActionBarThemedContext(this, themeResId, themeColor));
|
||||
ViewSupport.setBackground(mActionBarContainer, ThemeUtils.getActionBarBackground(this, themeResId, themeColor,
|
||||
mTabIndicator.setItemContext(ThemeUtils.getActionBarThemedContext(this, themeColor));
|
||||
ViewSupport.setBackground(mActionBarContainer, ThemeUtils.getActionBarBackground(this, themeColor,
|
||||
backgroundOption, true));
|
||||
final int actionBarColor = ThemeUtils.getActionBarColor(this, themeColor, themeResId, backgroundOption);
|
||||
final int actionItemColor = ThemeUtils.getContrastForegroundColor(this, getCurrentThemeResourceId(), themeColor);
|
||||
final int actionBarColor = ThemeUtils.getActionBarColor(this, themeColor, backgroundOption);
|
||||
final int actionItemColor = ThemeUtils.getContrastForegroundColor(this, themeColor);
|
||||
final int[] foregroundColors = new int[2];
|
||||
ThemeUtils.getColorForegroundAndInverse(this, foregroundColors);
|
||||
if (ThemeUtils.isDarkTheme(themeResId)) {
|
||||
if (ThemeUtils.isDarkTheme(this)) {
|
||||
homeActionButton.setButtonColor(actionBarColor);
|
||||
homeActionButton.setIconColor(actionItemColor, Mode.SRC_ATOP);
|
||||
mTabIndicator.setStripColor(themeColor);
|
||||
@ -820,7 +819,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
||||
private void setupSlidingMenu() {
|
||||
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_start, GravityCompat.START);
|
||||
final Window window = getWindow();
|
||||
ThemeUtils.applyWindowBackground(this, mHomeContent, getCurrentThemeResourceId(),
|
||||
ThemeUtils.applyWindowBackground(this, mHomeContent,
|
||||
getThemeBackgroundOption(), getCurrentThemeBackgroundAlpha());
|
||||
window.setBackgroundDrawable(new EmptyDrawable());
|
||||
}
|
||||
|
@ -105,11 +105,6 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoActionBarThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mTwidereActionModeForChildListener.finishExisting()) {
|
||||
@ -226,7 +221,7 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
||||
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()));
|
||||
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this));
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
@ -274,8 +269,7 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
||||
final Toolbar toolbar = peekActionBarToolbar();
|
||||
if (toolbar != null) {
|
||||
final int themeColor = getCurrentThemeColor();
|
||||
final int themeId = getCurrentThemeResourceId();
|
||||
final int itemColor = ThemeUtils.getContrastForegroundColor(this, themeId, themeColor);
|
||||
final int itemColor = ThemeUtils.getContrastForegroundColor(this, themeColor);
|
||||
ThemeUtils.wrapToolbarMenuIcon(ViewSupport.findViewByType(toolbar, ActionMenuView.class), itemColor, itemColor);
|
||||
}
|
||||
}
|
||||
@ -341,20 +335,19 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
||||
@SuppressLint("AppCompatMethod")
|
||||
private void setActionBarTheme(ActionBar actionBar, int linkId, Uri data) {
|
||||
final int themeColor = getCurrentThemeColor();
|
||||
final int themeId = getCurrentThemeResourceId();
|
||||
final String option = getThemeBackgroundOption();
|
||||
int actionBarItemsColor = ThemeUtils.getContrastForegroundColor(this, themeId, themeColor);
|
||||
int actionBarItemsColor = ThemeUtils.getContrastForegroundColor(this, themeColor);
|
||||
final ActionBarContainer actionBarContainer = (ActionBarContainer) findViewById(R.id.twidere_action_bar_container);
|
||||
switch (linkId) {
|
||||
case LINK_ID_SEARCH:
|
||||
case LINK_ID_USER_LISTS:
|
||||
case LINK_ID_USER_LIST:
|
||||
case LINK_ID_FILTERS: {
|
||||
ThemeUtils.applyActionBarBackground(actionBarContainer, this, themeId, themeColor, option, false);
|
||||
ThemeUtils.applyActionBarBackground(actionBarContainer, this, themeColor, option, false);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ThemeUtils.applyActionBarBackground(actionBarContainer, this, themeId, themeColor, option, true);
|
||||
ThemeUtils.applyActionBarBackground(actionBarContainer, this, themeColor, option, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -379,7 +372,7 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
||||
mMainContent.setFactor(1);
|
||||
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption())
|
||||
? ThemeUtils.getActionBarAlpha(getCurrentThemeBackgroundAlpha()) : 0xFF;
|
||||
final int statusBarColor = ThemeUtils.getActionBarColor(this, getCurrentThemeColor(), getCurrentThemeResourceId(), getThemeBackgroundOption());
|
||||
final int statusBarColor = ThemeUtils.getActionBarColor(this, getCurrentThemeColor(), getThemeBackgroundOption());
|
||||
mMainContent.setColor(statusBarColor, alpha);
|
||||
}
|
||||
|
||||
@ -573,7 +566,7 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ThemeUtils.isColoredActionBar(getCurrentThemeResourceId())) {
|
||||
if (ThemeUtils.isColoredActionBar(this)) {
|
||||
ActivitySupport.setTaskDescription(this, new TaskDescriptionCompat(null, null,
|
||||
getCurrentThemeColor()));
|
||||
}
|
||||
|
@ -119,11 +119,6 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getQuickSearchBarThemeResource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
|
@ -284,8 +284,7 @@ public class SignInActivity extends BaseAppCompatActivity implements OnClickList
|
||||
final Toolbar toolbar = peekActionBarToolbar();
|
||||
if (toolbar != null) {
|
||||
final int themeColor = getCurrentThemeColor();
|
||||
final int themeId = getCurrentThemeResourceId();
|
||||
final int itemColor = ThemeUtils.getContrastForegroundColor(this, themeId, themeColor);
|
||||
final int itemColor = ThemeUtils.getContrastForegroundColor(this, themeColor);
|
||||
ThemeUtils.wrapToolbarMenuIcon(ViewSupport.findViewByType(toolbar, ActionMenuView.class), itemColor, itemColor);
|
||||
}
|
||||
return result;
|
||||
@ -331,7 +330,7 @@ public class SignInActivity extends BaseAppCompatActivity implements OnClickList
|
||||
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()));
|
||||
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this));
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mAPIUrlFormat = savedInstanceState.getString(Accounts.API_URL_FORMAT);
|
||||
@ -539,9 +538,8 @@ public class SignInActivity extends BaseAppCompatActivity implements OnClickList
|
||||
if (actionBar == null) return;
|
||||
|
||||
final int themeColor = getCurrentThemeColor();
|
||||
final int themeId = getCurrentThemeResourceId();
|
||||
final String option = getThemeBackgroundOption();
|
||||
ThemeUtils.applyActionBarBackground(actionBar, this, themeId, themeColor, option, isActionBarOutlineEnabled());
|
||||
ThemeUtils.applyActionBarBackground(actionBar, this, themeColor, option, isActionBarOutlineEnabled());
|
||||
}
|
||||
|
||||
private void setupTintStatusBar() {
|
||||
@ -550,7 +548,7 @@ public class SignInActivity extends BaseAppCompatActivity implements OnClickList
|
||||
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption()) ?
|
||||
getCurrentThemeBackgroundAlpha() : 0xFF;
|
||||
final int statusBarColor = ThemeUtils.getActionBarColor(this, getCurrentThemeColor(),
|
||||
getCurrentThemeResourceId(), getThemeBackgroundOption());
|
||||
getThemeBackgroundOption());
|
||||
mMainContent.setColor(statusBarColor, alpha);
|
||||
|
||||
mMainContent.setDrawShadow(false);
|
||||
|
@ -40,7 +40,9 @@ import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
|
||||
public abstract class ThemedAppCompatActivity extends AppCompatActivity implements Constants,
|
||||
IThemedActivity, IAppCompatActivity {
|
||||
|
||||
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
|
||||
// Data fields
|
||||
private int mCurrentThemeColor;
|
||||
private int mCurrentThemeBackgroundAlpha;
|
||||
@ShapeStyle
|
||||
private int mProfileImageStyle;
|
||||
private String mCurrentThemeBackgroundOption;
|
||||
@ -69,11 +71,6 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
|
||||
return mCurrentThemeColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCurrentThemeResourceId() {
|
||||
return mCurrentThemeResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeBackgroundAlpha() {
|
||||
return ThemeUtils.getUserThemeBackgroundAlpha(this);
|
||||
@ -107,12 +104,13 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
|
||||
StrictModeUtils.detectAllThreadPolicy();
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
ThemeUtils.applyToolbarItemColor(this, getActionBarToolbar(), getCurrentThemeColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSupportActionModeStarted(@NonNull android.support.v7.view.ActionMode mode) {
|
||||
super.onSupportActionModeStarted(mode);
|
||||
ThemeUtils.applySupportActionModeColor(mode, this, getCurrentThemeResourceId(),
|
||||
ThemeUtils.applySupportActionModeColor(mode, this,
|
||||
getCurrentThemeColor(), getThemeBackgroundOption(), true);
|
||||
}
|
||||
|
||||
@ -124,28 +122,30 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTheme(int resid) {
|
||||
super.setTheme(mCurrentThemeResource = getThemeResourceId());
|
||||
public void setTheme(int resId) {
|
||||
super.setTheme(resId);
|
||||
if (shouldApplyWindowBackground()) {
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource, mCurrentThemeBackgroundOption,
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeBackgroundOption,
|
||||
mCurrentThemeBackgroundAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha();
|
||||
mProfileImageStyle = Utils.getProfileImageStyle(this);
|
||||
mCurrentThemeBackgroundOption = getThemeBackgroundOption();
|
||||
mCurrentThemeFontFamily = getThemeFontFamily();
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
super.onApplyThemeResource(theme, resId, first);
|
||||
ThemeUtils.applyToolbarItemColor(this, getActionBarToolbar(), mCurrentThemeColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSupportActionBar(Toolbar toolbar) {
|
||||
super.setSupportActionBar(toolbar);
|
||||
mToolbar = toolbar;
|
||||
ThemeUtils.applyToolbarItemColor(this, toolbar, mCurrentThemeColor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -74,9 +74,9 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
|
||||
@Inject
|
||||
protected PermissionsManager mPermissionsManager;
|
||||
|
||||
|
||||
// Data fields
|
||||
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
|
||||
//Data fields
|
||||
private int mCurrentThemeColor;
|
||||
private int mCurrentThemeBackgroundAlpha;
|
||||
@ShapeStyle
|
||||
private int mProfileImageStyle;
|
||||
private String mCurrentThemeBackgroundOption;
|
||||
@ -118,11 +118,6 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
|
||||
return mCurrentThemeColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCurrentThemeResourceId() {
|
||||
return mCurrentThemeResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeBackgroundAlpha() {
|
||||
return ThemeUtils.getUserThemeBackgroundAlpha(this);
|
||||
@ -160,10 +155,10 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTheme(int resid) {
|
||||
super.setTheme(mCurrentThemeResource = getThemeResourceId());
|
||||
public void setTheme(int resId) {
|
||||
super.setTheme(resId);
|
||||
if (shouldApplyWindowBackground()) {
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeResource,
|
||||
ThemeUtils.applyWindowBackground(this, getWindow(),
|
||||
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
|
||||
}
|
||||
}
|
||||
@ -212,11 +207,6 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
|
||||
return isKeyboardShortcutHandled(mKeyboardShortcutsHandler, keyCode, event, mMetaState) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected boolean shouldApplyWindowBackground() {
|
||||
return true;
|
||||
}
|
||||
|
@ -8,15 +8,9 @@ import android.support.annotation.NonNull;
|
||||
import org.mariotaku.pickncrop.library.ImagePickerActivity;
|
||||
import org.mariotaku.twidere.activity.ImageCropperActivity;
|
||||
import org.mariotaku.twidere.util.RestFuNetworkStreamDownloader;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
public class ThemedImagePickerActivity extends ImagePickerActivity {
|
||||
|
||||
@Override
|
||||
public void setTheme(final int resid) {
|
||||
super.setTheme(ThemeUtils.getNoDisplayThemeResource(this));
|
||||
}
|
||||
|
||||
public static ThemedIntentBuilder withThemed(Context context) {
|
||||
return new ThemedIntentBuilder(context);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package org.mariotaku.twidere.app;
|
||||
|
||||
import android.app.UiModeManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@ -109,6 +110,7 @@ public class TwidereApplication extends MultiDexApplication implements Constants
|
||||
StrictModeUtils.detectAllVmPolicy();
|
||||
}
|
||||
super.onCreate();
|
||||
resetTheme(getSharedPreferences());
|
||||
initializeAsyncTask();
|
||||
initDebugMode();
|
||||
initBugReport();
|
||||
@ -245,6 +247,27 @@ public class TwidereApplication extends MultiDexApplication implements Constants
|
||||
DependencyHolder.get(this).getExternalThemeManager().reloadEmojiPreferences();
|
||||
break;
|
||||
}
|
||||
case KEY_THEME: {
|
||||
resetTheme(preferences);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void resetTheme(SharedPreferences preferences) {
|
||||
switch (Utils.getNonEmptyString(preferences, KEY_THEME, VALUE_THEME_NAME_LIGHT)) {
|
||||
case VALUE_THEME_NAME_DARK: {
|
||||
((UiModeManager) getSystemService(UI_MODE_SERVICE)).setNightMode(UiModeManager.MODE_NIGHT_YES);
|
||||
break;
|
||||
}
|
||||
case VALUE_THEME_NAME_AUTO: {
|
||||
((UiModeManager) getSystemService(UI_MODE_SERVICE)).setNightMode(UiModeManager.MODE_NIGHT_AUTO);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
((UiModeManager) getSystemService(UI_MODE_SERVICE)).setNightMode(UiModeManager.MODE_NIGHT_NO);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,9 @@ public class SettingsDetailsFragment extends BasePreferenceFragment implements S
|
||||
SettingsActivity.setShouldNotifyChange(activity);
|
||||
}
|
||||
if (extras.containsKey(EXTRA_RESTART_ACTIVITY)) {
|
||||
Utils.restartActivity(activity);
|
||||
Utils.restartActivity(getActivity());
|
||||
} else if (extras.containsKey(EXTRA_RECREATE_ACTIVITY)) {
|
||||
activity.recreate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -592,8 +592,7 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
|
||||
public Context getThemedContext() {
|
||||
if (mThemedContext != null) return mThemedContext;
|
||||
final Context context = getActivity();
|
||||
final int themeResource = ThemeUtils.getDrawerThemeResource(context);
|
||||
return mThemedContext = new ContextThemeWrapper(context, themeResource);
|
||||
return mThemedContext = new ContextThemeWrapper(context, R.style.Theme_Twidere_Drawer);
|
||||
}
|
||||
|
||||
private void onAccountSelected(AccountProfileImageViewHolder holder, final ParcelableAccount account) {
|
||||
|
@ -58,9 +58,7 @@ import android.support.v4.view.ViewPager.OnPageChangeListener;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.ActionBarContainer;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.support.v7.widget.TwidereToolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
@ -810,10 +808,10 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
setupUserPages();
|
||||
|
||||
if (activity instanceof IThemedActivity) {
|
||||
ViewSupport.setBackground(mPagerOverlay, ThemeUtils.getNormalWindowContentOverlay(activity,
|
||||
((IThemedActivity) activity).getCurrentThemeResourceId()));
|
||||
ViewSupport.setBackground(mErrorOverlay, ThemeUtils.getNormalWindowContentOverlay(activity,
|
||||
((IThemedActivity) activity).getCurrentThemeResourceId()));
|
||||
ViewSupport.setBackground(mPagerOverlay, ThemeUtils.getNormalWindowContentOverlay(activity
|
||||
));
|
||||
ViewSupport.setBackground(mErrorOverlay, ThemeUtils.getNormalWindowContentOverlay(activity
|
||||
));
|
||||
setUiColor(((IThemedActivity) activity).getCurrentThemeColor());
|
||||
}
|
||||
|
||||
@ -1420,9 +1418,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
}
|
||||
final AppCompatActivity activity = (AppCompatActivity) getActivity();
|
||||
final IThemedActivity themed = (IThemedActivity) activity;
|
||||
final int themeRes = themed.getCurrentThemeResourceId();
|
||||
final String backgroundOption = themed.getThemeBackgroundOption();
|
||||
final int actionBarColor = ThemeUtils.getActionBarColor(activity, color, themeRes, backgroundOption);
|
||||
final int actionBarColor = ThemeUtils.getActionBarColor(activity, color, backgroundOption);
|
||||
if (mTintedStatusContent != null) {
|
||||
final int alpha = ThemeUtils.isTransparentBackground(backgroundOption) ? themed.getCurrentThemeBackgroundAlpha() : 0xFF;
|
||||
mTintedStatusContent.setColor(actionBarColor, ThemeUtils.getActionBarAlpha(alpha));
|
||||
@ -1445,7 +1442,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
mURLView.setLinkTextColor(optimalAccentColor);
|
||||
mProfileBannerView.setBackgroundColor(color);
|
||||
ViewSupport.setBackground(mPagerIndicator, ThemeUtils.getActionBarStackedBackground(activity,
|
||||
themeRes, optimalAccentColor, backgroundOption, true));
|
||||
optimalAccentColor, backgroundOption, true));
|
||||
|
||||
final HeaderDrawerLayout drawer = mHeaderDrawerLayout;
|
||||
if (drawer != null) {
|
||||
@ -1463,7 +1460,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
if (actionBarContainer == null || actionBar == null) return;
|
||||
final Drawable shadow = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.shadow_user_banner_action_bar, null);
|
||||
mActionBarBackground = new ActionBarDrawable(shadow);
|
||||
if (!ThemeUtils.isWindowFloating(linkHandler, linkHandler.getCurrentThemeResourceId())
|
||||
if (!ThemeUtils.isWindowFloating(linkHandler)
|
||||
&& ThemeUtils.isTransparentBackground(linkHandler.getCurrentThemeBackgroundOption())) {
|
||||
// mActionBarBackground.setAlpha(ThemeUtils.getActionBarAlpha(linkHandler.getCurrentThemeBackgroundAlpha()));
|
||||
mProfileBannerView.setAlpha(linkHandler.getCurrentThemeBackgroundAlpha() / 255f);
|
||||
@ -1570,8 +1567,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
}
|
||||
|
||||
final Drawable tabBackground = mPagerIndicator.getBackground();
|
||||
final int themeId = activity.getCurrentThemeResourceId();
|
||||
int stackedTabColor = ThemeUtils.getActionBarColor(activity, mUiColor, themeId,
|
||||
int stackedTabColor = ThemeUtils.getActionBarColor(activity, mUiColor,
|
||||
activity.getThemeBackgroundOption());
|
||||
|
||||
if (ThemeUtils.isTransparentBackground(activity.getCurrentThemeBackgroundOption())) {
|
||||
@ -1584,11 +1580,11 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
|
||||
if (mPreviousTabItemIsDark == 0 || (tabItemIsDark ? 1 : -1) != mPreviousTabItemIsDark) {
|
||||
final int[] primaryColors = new int[2];
|
||||
ThemeUtils.getDarkLightForegroundColors(activity, themeId, primaryColors);
|
||||
ThemeUtils.getDarkLightForegroundColors(activity, primaryColors);
|
||||
final int tabContrastColor = primaryColors[tabItemIsDark ? 0 : 1];
|
||||
mPagerIndicator.setIconColor(tabContrastColor);
|
||||
mPagerIndicator.setLabelColor(tabContrastColor);
|
||||
if (ThemeUtils.isDarkTheme(themeId)) {
|
||||
if (ThemeUtils.isDarkTheme(activity)) {
|
||||
mPagerIndicator.setStripColor(ThemeUtils.getOptimalAccentColor(mUiColor,
|
||||
tabContrastColor));
|
||||
} else {
|
||||
@ -1601,18 +1597,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
||||
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) {
|
||||
final int contrastForegroundColor = ThemeUtils.getContrastForegroundColor(activity, themeId, barColor);
|
||||
final Toolbar actionBarView = activity.getActionBarToolbar();
|
||||
if (actionBarView != null) {
|
||||
actionBarView.setTitleTextColor(contrastForegroundColor);
|
||||
actionBarView.setSubtitleTextColor(contrastForegroundColor);
|
||||
ThemeUtils.setActionBarOverflowColor(actionBarView, contrastForegroundColor);
|
||||
ThemeUtils.wrapToolbarMenuIcon(ViewSupport.findViewByType(actionBarView, ActionMenuView.class),
|
||||
contrastForegroundColor, contrastForegroundColor);
|
||||
if (actionBarView instanceof TwidereToolbar) {
|
||||
((TwidereToolbar) actionBarView).setItemColor(contrastForegroundColor);
|
||||
}
|
||||
}
|
||||
ThemeUtils.applyToolbarItemColor(activity, activity.getActionBarToolbar(), barColor);
|
||||
}
|
||||
mPreviousActionBarItemIsDark = actionItemIsDark ? 1 : -1;
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
package org.mariotaku.twidere.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import org.jraf.android.backport.switchwidget.SwitchPreference;
|
||||
@ -44,12 +43,11 @@ public class DarkLightThemeTogglePreference extends SwitchPreference implements
|
||||
|
||||
@Override
|
||||
protected boolean getPersistedBoolean(final boolean defaultReturnValue) {
|
||||
final SharedPreferences preferences = getSharedPreferences();
|
||||
return ThemeUtils.isDarkTheme(getPersistedString(VALUE_THEME_NAME_TWIDERE));
|
||||
return ThemeUtils.isDarkTheme(getPersistedString(VALUE_THEME_NAME_LIGHT));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean persistBoolean(final boolean value) {
|
||||
return persistString(value ? VALUE_THEME_NAME_DARK : VALUE_THEME_NAME_TWIDERE);
|
||||
return persistString(value ? VALUE_THEME_NAME_DARK : VALUE_THEME_NAME_LIGHT);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.ColorUtils;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.WindowDecorActionBar;
|
||||
@ -47,7 +46,6 @@ import android.support.v7.widget.ActionMenuView;
|
||||
import android.support.v7.widget.ContentFrameLayout;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.support.v7.widget.TwidereToolbar;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
@ -85,10 +83,6 @@ public class ThemeUtils implements Constants {
|
||||
android.R.attr.textColorPrimaryInverse};
|
||||
public static final int[] ATTRS_COLOR_FOREGROUND_AND_INVERSE = {android.R.attr.colorForeground,
|
||||
android.R.attr.colorForegroundInverse};
|
||||
private static final int[] ANIM_OPEN_STYLE_ATTRS = {android.R.attr.activityOpenEnterAnimation,
|
||||
android.R.attr.activityOpenExitAnimation};
|
||||
private static final int[] ANIM_CLOSE_STYLE_ATTRS = {android.R.attr.activityCloseEnterAnimation,
|
||||
android.R.attr.activityCloseExitAnimation};
|
||||
|
||||
private ThemeUtils() {
|
||||
throw new AssertionError("ThemeUtils should never be instantiated");
|
||||
@ -96,20 +90,20 @@ public class ThemeUtils implements Constants {
|
||||
|
||||
|
||||
public static void applyActionBarBackground(final ActionBar actionBar, final Context context,
|
||||
final int themeRes, final int accentColor, String backgroundOption, boolean outlineEnabled) {
|
||||
final int accentColor, 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(getActionBarStackedBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled));
|
||||
actionBar.setBackgroundDrawable(getActionBarBackground(context, accentColor, backgroundOption, outlineEnabled));
|
||||
actionBar.setSplitBackgroundDrawable(getActionBarSplitBackground(context));
|
||||
actionBar.setStackedBackgroundDrawable(getActionBarStackedBackground(context, accentColor, backgroundOption, outlineEnabled));
|
||||
}
|
||||
|
||||
|
||||
public static void applyActionBarBackground(final ActionBarContainer actionBar, final Context context,
|
||||
final int themeRes, final int accentColor, String backgroundOption, boolean outlineEnabled) {
|
||||
final int accentColor, String backgroundOption, boolean outlineEnabled) {
|
||||
if (actionBar == null || context == null) return;
|
||||
actionBar.setPrimaryBackground(getActionBarBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled));
|
||||
actionBar.setSplitBackground(getActionBarSplitBackground(context, themeRes));
|
||||
actionBar.setStackedBackground(getActionBarStackedBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled));
|
||||
actionBar.setPrimaryBackground(getActionBarBackground(context, accentColor, backgroundOption, outlineEnabled));
|
||||
actionBar.setSplitBackground(getActionBarSplitBackground(context));
|
||||
actionBar.setStackedBackground(getActionBarStackedBackground(context, accentColor, backgroundOption, outlineEnabled));
|
||||
}
|
||||
|
||||
public static void applyColorFilterToMenuIcon(final Menu menu, final int color, final int popupColor,
|
||||
@ -139,7 +133,7 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
|
||||
public static void applySupportActionModeColor(final android.support.v7.view.ActionMode modeCompat,
|
||||
Activity activity, int themeRes,
|
||||
Activity activity,
|
||||
int accentColor, String backgroundOption,
|
||||
boolean outlineEnabled) {
|
||||
// Very dirty implementation
|
||||
@ -157,64 +151,46 @@ public class ThemeUtils implements Constants {
|
||||
ActionBarContextView.class);
|
||||
}
|
||||
if (!(contextView instanceof ActionBarContextView)) return;
|
||||
setActionBarContextViewBackground((ActionBarContextView) contextView, themeRes,
|
||||
setActionBarContextViewBackground((ActionBarContextView) contextView,
|
||||
accentColor, backgroundOption, outlineEnabled);
|
||||
}
|
||||
|
||||
public static void setActionBarContextViewBackground(@NonNull ActionBarContextView contextView,
|
||||
int themeRes, int accentColor,
|
||||
int accentColor,
|
||||
String backgroundOption, boolean outlineEnabled) {
|
||||
ViewSupport.setBackground(contextView, getActionBarBackground(contextView.getContext(),
|
||||
themeRes, accentColor, backgroundOption, outlineEnabled));
|
||||
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);
|
||||
if (actionModeCloseButton != null) {
|
||||
actionModeCloseButton.setColorFilter(itemColor, Mode.SRC_ATOP);
|
||||
}
|
||||
if (menuView != null) {
|
||||
setActionBarOverflowColor(menuView, itemColor);
|
||||
ThemeUtils.wrapToolbarMenuIcon(menuView, itemColor, itemColor);
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyWindowBackground(@NonNull Context context, @NonNull Window window, int theme, String option, int alpha) {
|
||||
if (isWindowFloating(context, theme)) return;
|
||||
final int normalTheme = getThemeResource(theme);
|
||||
public static void applyWindowBackground(@NonNull Context context, @NonNull Window window, String option, int alpha) {
|
||||
if (isWindowFloating(context)) return;
|
||||
if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(option)) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER);
|
||||
window.setBackgroundDrawable(getWindowBackgroundFromThemeApplyAlpha(context, normalTheme, alpha));
|
||||
window.setBackgroundDrawable(getWindowBackgroundFromThemeApplyAlpha(context, alpha));
|
||||
} else if (VALUE_THEME_BACKGROUND_SOLID.equals(option)) {
|
||||
window.setBackgroundDrawable(new ColorDrawable(isDarkTheme(normalTheme) ? Color.BLACK : Color.WHITE));
|
||||
window.setBackgroundDrawable(new ColorDrawable(isDarkTheme(context) ? Color.BLACK : Color.WHITE));
|
||||
} else {
|
||||
window.setBackgroundDrawable(getWindowBackgroundFromTheme(context, normalTheme));
|
||||
window.setBackgroundDrawable(getWindowBackgroundFromTheme(context));
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyWindowBackground(Context context, View window, int theme, String option, int alpha) {
|
||||
if (isWindowFloating(context, theme)) return;
|
||||
final int normalTheme = getThemeResource(theme);
|
||||
public static void applyWindowBackground(Context context, View window, String option, int alpha) {
|
||||
if (isWindowFloating(context)) return;
|
||||
if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(option)) {
|
||||
ViewSupport.setBackground(window, getWindowBackgroundFromThemeApplyAlpha(context, normalTheme, alpha));
|
||||
ViewSupport.setBackground(window, getWindowBackgroundFromThemeApplyAlpha(context, alpha));
|
||||
} else if (VALUE_THEME_BACKGROUND_SOLID.equals(option)) {
|
||||
ViewSupport.setBackground(window, new ColorDrawable(isDarkTheme(normalTheme) ? Color.BLACK : Color.WHITE));
|
||||
ViewSupport.setBackground(window, new ColorDrawable(isDarkTheme(context) ? Color.BLACK : Color.WHITE));
|
||||
} else {
|
||||
ViewSupport.setBackground(window, getWindowBackgroundFromTheme(context, normalTheme));
|
||||
ViewSupport.setBackground(window, getWindowBackgroundFromTheme(context));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
public static Drawable getActionBarBackground(final Context context, final int themeRes,
|
||||
final int accentColor, final String backgroundOption,
|
||||
final boolean outlineEnabled) {
|
||||
public static Drawable getActionBarBackground(final Context context, final int accentColor,
|
||||
final String backgroundOption, final boolean outlineEnabled) {
|
||||
final int actionBarColor;
|
||||
if (!isDarkTheme(themeRes)) {
|
||||
if (!isDarkTheme(context)) {
|
||||
actionBarColor = accentColor;
|
||||
} else if (isSolidBackground(backgroundOption)) {
|
||||
actionBarColor = Color.BLACK;
|
||||
@ -224,18 +200,8 @@ public class ThemeUtils implements Constants {
|
||||
return ActionBarColorDrawable.create(actionBarColor, outlineEnabled);
|
||||
}
|
||||
|
||||
public static int getActionBarPopupThemeRes(final Context context, int def) {
|
||||
final TypedValue outValue = new TypedValue();
|
||||
if (context.getTheme().resolveAttribute(R.attr.actionBarPopupTheme, outValue, true)) {
|
||||
return outValue.resourceId;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
public static Drawable getActionBarSplitBackground(final Context context, final int themeRes) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.backgroundSplit},
|
||||
android.R.attr.actionBarStyle, themeRes);
|
||||
public static Drawable getActionBarSplitBackground(final Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.backgroundSplit});
|
||||
try {
|
||||
return a.getDrawable(0);
|
||||
} finally {
|
||||
@ -244,10 +210,10 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Drawable getActionBarStackedBackground(final Context context, final int themeRes,
|
||||
public static Drawable getActionBarStackedBackground(final Context context,
|
||||
final int accentColor, String backgroundOption,
|
||||
boolean outlineEnabled) {
|
||||
return getActionBarBackground(context, themeRes, accentColor, backgroundOption, outlineEnabled);
|
||||
return getActionBarBackground(context, accentColor, backgroundOption, outlineEnabled);
|
||||
}
|
||||
|
||||
public static int getCardBackgroundColor(final Context context, String backgroundOption, int themeAlpha) {
|
||||
@ -283,19 +249,10 @@ public class ThemeUtils implements Constants {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getComposeThemeResource(final Context context) {
|
||||
return getComposeThemeResource(getThemeNameOption(context));
|
||||
}
|
||||
|
||||
public static int getComposeThemeResource(final String name) {
|
||||
if (VALUE_THEME_NAME_DARK.equals(name)) return R.style.Theme_Twidere_Dark_Compose;
|
||||
return R.style.Theme_Twidere_Light_Compose;
|
||||
}
|
||||
|
||||
public static int getContrastForegroundColor(Context context, int theme, int color) {
|
||||
public static int getContrastForegroundColor(Context context, int color) {
|
||||
final int[] colors = new int[2];
|
||||
getDarkLightForegroundColors(context, theme, colors);
|
||||
if (isDarkTheme(theme) || TwidereColorUtils.getYIQLuminance(color) <= ACCENT_COLOR_THRESHOLD) {
|
||||
getDarkLightForegroundColors(context, colors);
|
||||
if (isDarkTheme(context) || TwidereColorUtils.getYIQLuminance(color) <= ACCENT_COLOR_THRESHOLD) {
|
||||
//return light text color
|
||||
return colors[1];
|
||||
}
|
||||
@ -312,34 +269,14 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
|
||||
public static int getDialogThemeResource(final String name) {
|
||||
if (VALUE_THEME_NAME_DARK.equals(name)) return R.style.Theme_Twidere_Dark_Dialog;
|
||||
return R.style.Theme_Twidere_Light_Dialog;
|
||||
if (VALUE_THEME_NAME_DARK.equals(name)) return R.style.Theme_Twidere_Dialog;
|
||||
return R.style.Theme_Twidere_Dialog;
|
||||
}
|
||||
|
||||
public static Context getDialogThemedContext(final Context context) {
|
||||
return new ContextThemeWrapper(context, getDialogThemeResource(context));
|
||||
}
|
||||
|
||||
public static int getDialogWhenLargeThemeResource(final Context context) {
|
||||
return getDialogWhenLargeThemeResource(getThemeNameOption(context));
|
||||
}
|
||||
|
||||
public static int getDialogWhenLargeThemeResource(final String name) {
|
||||
if (VALUE_THEME_NAME_DARK.equals(name)) {
|
||||
return R.style.Theme_Twidere_Dark_DialogWhenLarge_NoActionBar;
|
||||
}
|
||||
return R.style.Theme_Twidere_Light_DialogWhenLarge_NoActionBar;
|
||||
}
|
||||
|
||||
public static int getDrawerThemeResource(final Context context) {
|
||||
return getDrawerThemeResource(getNoActionBarThemeResource(context));
|
||||
}
|
||||
|
||||
public static int getDrawerThemeResource(final int themeRes) {
|
||||
if (isDarkTheme(themeRes)) return R.style.Theme_Twidere_Drawer_Dark;
|
||||
return R.style.Theme_Twidere_Drawer_Light;
|
||||
}
|
||||
|
||||
public static Drawable getImageHighlightDrawable(final Context context) {
|
||||
final Drawable d = getSelectableItemBackgroundDrawable(context);
|
||||
if (d != null) {
|
||||
@ -348,14 +285,6 @@ public class ThemeUtils implements Constants {
|
||||
return d;
|
||||
}
|
||||
|
||||
public static int getNoDisplayThemeResource(final Context context) {
|
||||
if (context == null) return R.style.Theme_Twidere_Dark_NoDisplay;
|
||||
final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context);
|
||||
final String theme = pref.getString(KEY_THEME, VALUE_THEME_NAME_TWIDERE);
|
||||
if (VALUE_THEME_NAME_DARK.equals(theme)) return R.style.Theme_Twidere_Dark_NoDisplay;
|
||||
return R.style.Theme_Twidere_Light_NoDisplay;
|
||||
}
|
||||
|
||||
public static int getOptimalAccentColor(int accentColor, int foregroundColor) {
|
||||
final int[] yiq = new int[3];
|
||||
TwidereColorUtils.colorToYIQ(foregroundColor, yiq);
|
||||
@ -370,15 +299,6 @@ public class ThemeUtils implements Constants {
|
||||
return TwidereColorUtils.YIQToColor(Color.alpha(accentColor), yiq);
|
||||
}
|
||||
|
||||
public static int getQuickSearchBarThemeResource(final Context context) {
|
||||
return getQuickSearchBarThemeResource(getThemeNameOption(context));
|
||||
}
|
||||
|
||||
public static int getQuickSearchBarThemeResource(final String name) {
|
||||
if (VALUE_THEME_NAME_DARK.equals(name)) return R.style.Theme_Twidere_Dark_QuickSearchBar;
|
||||
return R.style.Theme_Twidere_Light_QuickSearchBar;
|
||||
}
|
||||
|
||||
public static Resources getResources(final Context context) {
|
||||
return context.getResources();
|
||||
}
|
||||
@ -412,17 +332,6 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
|
||||
|
||||
public static int getColorFromAttribute(Context context, int themeId, int attr, int def) {
|
||||
final TypedValue outValue = new TypedValue();
|
||||
final Resources.Theme theme = context.getResources().newTheme();
|
||||
theme.applyStyle(themeId, true);
|
||||
if (!theme.resolveAttribute(attr, outValue, true))
|
||||
return def;
|
||||
if (outValue.type == TypedValue.TYPE_REFERENCE)
|
||||
return context.getResources().getColor(attr);
|
||||
return outValue.data;
|
||||
}
|
||||
|
||||
public static int getTextColorPrimary(final Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS_TEXT_COLOR_PRIMARY);
|
||||
try {
|
||||
@ -433,17 +342,6 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
|
||||
|
||||
public static void getColorsFromAttribute(final Context context, int[] inAttrs, int[] outColors) {
|
||||
final TypedArray a = context.obtainStyledAttributes(inAttrs);
|
||||
try {
|
||||
for (int i = 0, j = inAttrs.length; i < j; i++) {
|
||||
outColors[i] = a.getColor(i, 0);
|
||||
}
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static void getTextColorPrimaryAndInverse(final Context context, int[] colors) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS_TEXT_COLOR_PRIMARY_AND_INVERSE);
|
||||
try {
|
||||
@ -454,10 +352,10 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
public static void getDarkLightForegroundColors(final Context context, int themeRes, int[] colors) {
|
||||
public static void getDarkLightForegroundColors(final Context context, int[] colors) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS_COLOR_FOREGROUND_AND_INVERSE);
|
||||
try {
|
||||
if (isDarkTheme(themeRes)) {
|
||||
if (isDarkTheme(context)) {
|
||||
colors[0] = a.getColor(1, Color.WHITE);
|
||||
colors[1] = a.getColor(0, Color.BLACK);
|
||||
} else {
|
||||
@ -469,23 +367,6 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
public static void getDarkLightForegroundColors(final Context context, int[] colors) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS_COLOR_FOREGROUND_AND_INVERSE);
|
||||
try {
|
||||
final int foreground = a.getColor(0, 0), background = a.getColor(1, 0);
|
||||
|
||||
if (ColorUtils.calculateLuminance(foreground) > ColorUtils.calculateLuminance(background)) {
|
||||
colors[0] = background;
|
||||
colors[1] = foreground;
|
||||
} else {
|
||||
colors[0] = foreground;
|
||||
colors[1] = background;
|
||||
}
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static void getColorForegroundAndInverse(final Context context, int[] colors) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS_COLOR_FOREGROUND_AND_INVERSE);
|
||||
try {
|
||||
@ -525,24 +406,11 @@ public class ThemeUtils implements Constants {
|
||||
return pref.getString(KEY_THEME_BACKGROUND, VALUE_THEME_BACKGROUND_DEFAULT);
|
||||
}
|
||||
|
||||
public static int getThemeColor(final Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.colorActivatedHighlight});
|
||||
try {
|
||||
final Resources resources = context.getResources();
|
||||
return a.getColor(0, resources.getColor(R.color.material_light_blue));
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getThemeColor(Context context, int themeResourceId) {
|
||||
public static int getThemeColor(Context context) {
|
||||
final Context appContext = context.getApplicationContext();
|
||||
final Resources res = appContext.getResources();
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final TypedArray a = appContext.obtainStyledAttributes(null,
|
||||
new int[]{android.R.attr.colorActivatedHighlight}, 0, themeResourceId);
|
||||
final TypedArray a = appContext.obtainStyledAttributes(new int[]{R.attr.colorPrimary});
|
||||
try {
|
||||
return a.getColor(0, res.getColor(R.color.material_light_blue));
|
||||
return a.getColor(0, ContextCompat.getColor(context, R.color.material_light_blue));
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
@ -581,31 +449,12 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
|
||||
public static String getThemeNameOption(final Context context) {
|
||||
if (context == null) return VALUE_THEME_NAME_TWIDERE;
|
||||
if (context == null) return VALUE_THEME_NAME_LIGHT;
|
||||
final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context);
|
||||
return pref.getString(KEY_THEME, VALUE_THEME_NAME_TWIDERE);
|
||||
}
|
||||
|
||||
public static int getThemeResource(final int otherTheme) {
|
||||
if (isDarkTheme(otherTheme)) {
|
||||
return R.style.Theme_Twidere_Dark;
|
||||
}
|
||||
return R.style.Theme_Twidere_Light;
|
||||
}
|
||||
|
||||
public static int getNoActionBarThemeResource(final Context context) {
|
||||
return getNoActionBarThemeResource(getThemeNameOption(context));
|
||||
}
|
||||
|
||||
public static int getNoActionBarThemeResource(final String name) {
|
||||
if (VALUE_THEME_NAME_DARK.equals(name)) {
|
||||
return R.style.Theme_Twidere_Dark_NoActionBar;
|
||||
}
|
||||
return R.style.Theme_Twidere_Light_NoActionBar;
|
||||
return pref.getString(KEY_THEME, VALUE_THEME_NAME_LIGHT);
|
||||
}
|
||||
|
||||
public static int getTitleTextAppearance(final Context context) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.titleTextStyle},
|
||||
android.R.attr.actionBarStyle, android.R.style.Widget_Holo_ActionBar);
|
||||
final int textAppearance = a.getResourceId(0, android.R.style.TextAppearance_Holo);
|
||||
@ -621,13 +470,13 @@ public class ThemeUtils implements Constants {
|
||||
return pref.getInt(KEY_THEME_COLOR, def);
|
||||
}
|
||||
|
||||
public static int getOptimalAccentColor(final Context context, boolean isActionBarContext, int themeResId) {
|
||||
return getOptimalAccentColor(context, getUserAccentColor(context), isActionBarContext, themeResId);
|
||||
public static int getOptimalAccentColor(final Context context, boolean isActionBarContext) {
|
||||
return getOptimalAccentColor(context, getUserAccentColor(context), isActionBarContext);
|
||||
}
|
||||
|
||||
public static int getOptimalAccentColor(final Context context, final int accentColor, boolean isActionBarContext, int themeResId) {
|
||||
public static int getOptimalAccentColor(final Context context, final int accentColor, boolean isActionBarContext) {
|
||||
final int backgroundColorApprox;
|
||||
final boolean isDarkTheme = isDarkTheme(themeResId);
|
||||
final boolean isDarkTheme = isDarkTheme(context);
|
||||
if (!isActionBarContext) {
|
||||
backgroundColorApprox = isDarkTheme ? Color.BLACK : Color.WHITE;
|
||||
} else if (isDarkTheme) {
|
||||
@ -644,25 +493,6 @@ public class ThemeUtils implements Constants {
|
||||
ContextCompat.getColor(context, R.color.branding_color));
|
||||
}
|
||||
|
||||
public static int getUserHighlightColor(final Context context) {
|
||||
final int color = getUserLinkTextColor(context);
|
||||
final int red = Color.red(color), green = Color.green(color), blue = Color.blue(color);
|
||||
return Color.argb(0x66, red, green, blue);
|
||||
}
|
||||
|
||||
public static int getUserLinkTextColor(final Context context) {
|
||||
if (context == null) return new TextPaint().linkColor;
|
||||
final int themeColor = getUserAccentColor(context);
|
||||
final float[] hsv = new float[3];
|
||||
Color.colorToHSV(themeColor, hsv);
|
||||
if (isDarkTheme(context)) {
|
||||
hsv[2] = TwidereMathUtils.clamp(hsv[2], 1, 0.5f);
|
||||
} else {
|
||||
hsv[2] = TwidereMathUtils.clamp(hsv[2], 0.1f, 0.75f);
|
||||
}
|
||||
return Color.HSVToColor(hsv);
|
||||
}
|
||||
|
||||
public static int getUserThemeBackgroundAlpha(final Context context) {
|
||||
if (context == null) return DEFAULT_THEME_BACKGROUND_ALPHA;
|
||||
final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context);
|
||||
@ -677,16 +507,6 @@ public class ThemeUtils implements Constants {
|
||||
ThemeBackgroundPreference.MIN_ALPHA, ThemeBackgroundPreference.MAX_ALPHA);
|
||||
}
|
||||
|
||||
public static Typeface getUserTypeface(final Context context, final Typeface defTypeface) {
|
||||
if (context == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
|
||||
return Typeface.DEFAULT;
|
||||
final int fontStyle = defTypeface != null ? defTypeface.getStyle() : Typeface.NORMAL;
|
||||
final String fontFamily = getThemeFontFamily(context);
|
||||
final Typeface tf = Typeface.create(fontFamily, fontStyle);
|
||||
if (tf != null) return tf;
|
||||
return Typeface.create(Typeface.DEFAULT, fontStyle);
|
||||
}
|
||||
|
||||
public static Typeface getUserTypeface(final Context context, final String fontFamily, final Typeface defTypeface) {
|
||||
if (context == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
|
||||
return Typeface.DEFAULT;
|
||||
@ -696,11 +516,8 @@ public class ThemeUtils implements Constants {
|
||||
return Typeface.create(Typeface.DEFAULT, fontStyle);
|
||||
}
|
||||
|
||||
public static int getViewerThemeResource(final Context context) {
|
||||
return R.style.Theme_Twidere_Viewer;
|
||||
}
|
||||
|
||||
public static Drawable getWindowBackground(final Context context) {
|
||||
public static Drawable getWindowBackgroundFromTheme(final Context context) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowBackground});
|
||||
try {
|
||||
return a.getDrawable(0);
|
||||
@ -709,19 +526,8 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
try {
|
||||
return a.getDrawable(0);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
public static Drawable getWindowBackgroundFromThemeApplyAlpha(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) return null;
|
||||
@ -731,9 +537,8 @@ public class ThemeUtils implements Constants {
|
||||
return d;
|
||||
}
|
||||
|
||||
public static Drawable getWindowContentOverlay(final Context context, int themeRes) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.windowContentOverlay}, 0, themeRes);
|
||||
public static Drawable getWindowContentOverlay(final Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowContentOverlay});
|
||||
try {
|
||||
return a.getDrawable(0);
|
||||
} finally {
|
||||
@ -741,22 +546,20 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
public static Drawable getNormalWindowContentOverlay(final Context context, int themeRes) {
|
||||
final int normalThemeResId = ThemeUtils.getThemeResource(themeRes);
|
||||
return getWindowContentOverlay(context, normalThemeResId);
|
||||
public static Drawable getNormalWindowContentOverlay(final Context context) {
|
||||
return getWindowContentOverlay(context);
|
||||
}
|
||||
|
||||
public static void initPagerIndicatorAsActionBarTab(FragmentActivity activity, TabPagerIndicator indicator, @Nullable View pagerOverlay) {
|
||||
final float supportActionBarElevation = getSupportActionBarElevation(activity);
|
||||
ViewCompat.setElevation(indicator, supportActionBarElevation);
|
||||
if (!(activity instanceof IThemedActivity)) return;
|
||||
final int themeRes = ((IThemedActivity) activity).getCurrentThemeResourceId();
|
||||
final int themeColor = ((IThemedActivity) activity).getCurrentThemeColor();
|
||||
final String backgroundOption = ((IThemedActivity) activity).getCurrentThemeBackgroundOption();
|
||||
final int colorDark, colorLight;
|
||||
final int[] textColors = new int[2];
|
||||
getTextColorPrimaryAndInverse(activity, textColors);
|
||||
if (isDarkTheme(themeRes)) {
|
||||
if (isDarkTheme(activity)) {
|
||||
colorDark = textColors[1];
|
||||
colorLight = textColors[0];
|
||||
} else {
|
||||
@ -765,8 +568,8 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
final int contrastColor = TwidereColorUtils.getContrastYIQ(themeColor, ACCENT_COLOR_THRESHOLD,
|
||||
colorDark, colorLight);
|
||||
ViewSupport.setBackground(indicator, getActionBarStackedBackground(activity, themeRes, themeColor, backgroundOption, true));
|
||||
if (isDarkTheme(themeRes)) {
|
||||
ViewSupport.setBackground(indicator, getActionBarStackedBackground(activity, themeColor, backgroundOption, true));
|
||||
if (isDarkTheme(activity)) {
|
||||
final int foregroundColor = getThemeForegroundColor(activity);
|
||||
indicator.setIconColor(foregroundColor);
|
||||
indicator.setLabelColor(foregroundColor);
|
||||
@ -778,28 +581,26 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
indicator.updateAppearance();
|
||||
if (pagerOverlay != null) {
|
||||
ViewSupport.setBackground(pagerOverlay, getNormalWindowContentOverlay(activity, themeRes));
|
||||
ViewSupport.setBackground(pagerOverlay, getNormalWindowContentOverlay(activity));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isColoredActionBar(int themeRes) {
|
||||
return !isDarkTheme(themeRes);
|
||||
public static boolean isColoredActionBar(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{R.attr.coloredActionBar});
|
||||
try {
|
||||
return a.getBoolean(0, false);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDarkTheme(final Context context) {
|
||||
return isDarkTheme(getNoActionBarThemeResource(context));
|
||||
}
|
||||
|
||||
public static boolean isDarkTheme(final int themeRes) {
|
||||
switch (themeRes) {
|
||||
case R.style.Theme_Twidere_Dark:
|
||||
case R.style.Theme_Twidere_Dark_NoActionBar:
|
||||
case R.style.Theme_Twidere_Dark_Dialog:
|
||||
case R.style.Theme_Twidere_Dark_DialogWhenLarge_NoActionBar:
|
||||
case R.style.Theme_Twidere_Dark_Compose:
|
||||
return true;
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{R.attr.darkTheme});
|
||||
try {
|
||||
return a.getBoolean(0, false);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSolidBackground(final String option) {
|
||||
@ -814,14 +615,8 @@ public class ThemeUtils implements Constants {
|
||||
return VALUE_THEME_BACKGROUND_TRANSPARENT.equals(option);
|
||||
}
|
||||
|
||||
public static boolean isWindowFloating(Context context, int theme) {
|
||||
final TypedArray a;
|
||||
if (theme != 0) {
|
||||
//noinspection ConstantConditions
|
||||
a = context.obtainStyledAttributes(null, new int[]{android.R.attr.windowIsFloating}, 0, theme);
|
||||
} else {
|
||||
a = context.obtainStyledAttributes(new int[]{android.R.attr.windowIsFloating});
|
||||
}
|
||||
public static boolean isWindowFloating(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.windowIsFloating});
|
||||
try {
|
||||
return a.getBoolean(0, false);
|
||||
} finally {
|
||||
@ -829,45 +624,6 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
public static void overrideActivityCloseAnimation(final Activity activity) {
|
||||
TypedArray a = activity.obtainStyledAttributes(new int[]{android.R.attr.windowAnimationStyle});
|
||||
final int windowAnimationStyleResId = a.getResourceId(0, 0);
|
||||
a.recycle();
|
||||
// Now retrieve the resource ids of the actual animations used in the
|
||||
// animation style pointed to by
|
||||
// the window animation resource id.
|
||||
a = activity.obtainStyledAttributes(windowAnimationStyleResId, ANIM_CLOSE_STYLE_ATTRS);
|
||||
final int activityCloseEnterAnimation = a.getResourceId(0, 0);
|
||||
final int activityCloseExitAnimation = a.getResourceId(1, 0);
|
||||
a.recycle();
|
||||
activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation);
|
||||
}
|
||||
|
||||
public static void overrideActivityOpenAnimation(final Activity activity) {
|
||||
|
||||
TypedArray a = activity.obtainStyledAttributes(new int[]{android.R.attr.windowAnimationStyle});
|
||||
final int windowAnimationStyleResId = a.getResourceId(0, 0);
|
||||
a.recycle();
|
||||
// Now retrieve the resource ids of the actual animations used in the
|
||||
// animation style pointed to by
|
||||
// the window animation resource id.
|
||||
a = activity.obtainStyledAttributes(windowAnimationStyleResId, ANIM_OPEN_STYLE_ATTRS);
|
||||
final int activityOpenEnterAnimation = a.getResourceId(0, 0);
|
||||
final int activityOpenExitAnimation = a.getResourceId(1, 0);
|
||||
a.recycle();
|
||||
activity.overridePendingTransition(activityOpenEnterAnimation, activityOpenExitAnimation);
|
||||
}
|
||||
|
||||
public static void overrideNormalActivityCloseAnimation(final Activity activity) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final TypedArray a = activity.obtainStyledAttributes(null, ANIM_CLOSE_STYLE_ATTRS,
|
||||
0, android.R.style.Animation_Activity);
|
||||
final int activityCloseEnterAnimation = a.getResourceId(0, 0);
|
||||
final int activityCloseExitAnimation = a.getResourceId(1, 0);
|
||||
a.recycle();
|
||||
activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation);
|
||||
}
|
||||
|
||||
public static void resetCheatSheet(ActionMenuView menuView) {
|
||||
final OnLongClickListener listener = new OnLongClickListener() {
|
||||
@Override
|
||||
@ -908,38 +664,6 @@ public class ThemeUtils implements Constants {
|
||||
((ImageView) overflowView).setColorFilter(itemColor, Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
public static void setActionBarMenuItemsColor(Toolbar toolbar, int itemColor) {
|
||||
if (toolbar == null) return;
|
||||
if (toolbar instanceof TwidereToolbar) {
|
||||
((TwidereToolbar) toolbar).setItemColor(itemColor);
|
||||
}
|
||||
final ActionMenuView actionMenuView = ViewSupport.findViewByType(toolbar, ActionMenuView.class);
|
||||
if (actionMenuView == null) return;
|
||||
for (int i = 0, j = actionMenuView.getChildCount(); i < j; i++) {
|
||||
final View child = actionMenuView.getChildAt(i);
|
||||
if (child instanceof ActionMenuView.ActionMenuChildView && child instanceof ImageView) {
|
||||
((ImageView) child).setColorFilter(itemColor, Mode.SRC_ATOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setActionBarOverflowColor(ActionMenuView actionMenuView, int itemColor) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!(overflowView instanceof ImageView)) return;
|
||||
final Drawable drawable = ((ImageView) overflowView).getDrawable();
|
||||
if (drawable == null) return;
|
||||
drawable.setColorFilter(itemColor, Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
public static void setCompatToolbarOverlay(Activity activity, Drawable overlay) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return;
|
||||
final Window window = activity.getWindow();
|
||||
@ -977,15 +701,13 @@ public class ThemeUtils implements Constants {
|
||||
|
||||
public static void setupDrawerBackground(Context context, View view) {
|
||||
if (!(context instanceof IThemedActivity)) return;
|
||||
final int themeRes = ((IThemedActivity) context).getCurrentThemeResourceId();
|
||||
final int drawerThemeRes = getDrawerThemeResource(themeRes);
|
||||
final String backgroundOption = ((IThemedActivity) context).getThemeBackgroundOption();
|
||||
final int alpha = ((IThemedActivity) context).getCurrentThemeBackgroundAlpha();
|
||||
final Drawable d;
|
||||
if (isSolidBackground(backgroundOption)) {
|
||||
d = new ColorDrawable(isDarkTheme(themeRes) ? Color.BLACK : Color.WHITE);
|
||||
d = new ColorDrawable(isDarkTheme(context) ? Color.BLACK : Color.WHITE);
|
||||
} else {
|
||||
d = getWindowBackgroundFromTheme(context, drawerThemeRes);
|
||||
d = getWindowBackgroundFromTheme(context);
|
||||
}
|
||||
if (d == null) throw new NullPointerException();
|
||||
d.mutate();
|
||||
@ -1107,12 +829,12 @@ public class ThemeUtils implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
public static Context getActionBarThemedContext(Context base, int themeId, int accentColor) {
|
||||
public static Context getActionBarThemedContext(Context base, int accentColor) {
|
||||
final int actionBarThemeId;
|
||||
if (isDarkTheme(themeId) || TwidereColorUtils.getYIQLuminance(accentColor) <= ACCENT_COLOR_THRESHOLD) {
|
||||
actionBarThemeId = R.style.Theme_Twidere_Dark;
|
||||
if (isDarkTheme(base) || TwidereColorUtils.getYIQLuminance(accentColor) <= ACCENT_COLOR_THRESHOLD) {
|
||||
actionBarThemeId = R.style.Theme_Twidere;
|
||||
} else {
|
||||
actionBarThemeId = R.style.Theme_Twidere_Light;
|
||||
actionBarThemeId = R.style.Theme_Twidere;
|
||||
}
|
||||
final Resources.Theme baseTheme = base.getTheme();
|
||||
final Resources.Theme actionBarTheme = base.getResources().newTheme();
|
||||
@ -1124,8 +846,8 @@ public class ThemeUtils implements Constants {
|
||||
return actionBarContext;
|
||||
}
|
||||
|
||||
public static int getActionBarColor(Context context, int themeColor, int themeResId, String backgroundOption) {
|
||||
if (!isDarkTheme(themeResId)) {
|
||||
public static int getActionBarColor(Context context, int themeColor, String backgroundOption) {
|
||||
if (!isDarkTheme(context)) {
|
||||
return themeColor;
|
||||
} else if (isSolidBackground(backgroundOption)) {
|
||||
return Color.BLACK;
|
||||
@ -1137,11 +859,18 @@ public class ThemeUtils implements Constants {
|
||||
return VALUE_THEME_NAME_DARK.equals(name);
|
||||
}
|
||||
|
||||
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;
|
||||
public static void applyToolbarItemColor(Context context, Toolbar toolbar, int toolbarColor) {
|
||||
final int contrastForegroundColor = getContrastForegroundColor(context, toolbarColor);
|
||||
if (toolbar == null || isDarkTheme(context)) {
|
||||
return;
|
||||
}
|
||||
toolbar.setTitleTextColor(contrastForegroundColor);
|
||||
toolbar.setSubtitleTextColor(contrastForegroundColor);
|
||||
setActionBarOverflowColor(toolbar, contrastForegroundColor);
|
||||
wrapToolbarMenuIcon(ViewSupport.findViewByType(toolbar, ActionMenuView.class),
|
||||
contrastForegroundColor, contrastForegroundColor);
|
||||
if (toolbar instanceof TwidereToolbar) {
|
||||
((TwidereToolbar) toolbar).setItemColor(contrastForegroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,15 +147,14 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
|
||||
// View context is not derived from ActionBar, apply color tint directly
|
||||
final Context viewContext = view.getContext();
|
||||
final boolean isActionBarContext = isActionBarContext(viewContext, getActionBarContext((Activity) activity));
|
||||
final int themeResourceId = activity.getCurrentThemeResourceId();
|
||||
final boolean isDarkTheme = ThemeUtils.isDarkTheme(themeResourceId);
|
||||
final boolean isDarkTheme = ThemeUtils.isDarkTheme(viewContext);
|
||||
final int backgroundColorApprox;
|
||||
final int currentThemeColor = activity.getCurrentThemeColor();
|
||||
if (!isActionBarContext) {
|
||||
accentColor = currentThemeColor;
|
||||
final int[] darkLightColors = new int[2];
|
||||
ThemeUtils.getDarkLightForegroundColors((Context) activity,
|
||||
activity.getCurrentThemeResourceId(), darkLightColors);
|
||||
darkLightColors);
|
||||
noTintColor = TwidereColorUtils.getContrastYIQ(accentColor, ThemeUtils.ACCENT_COLOR_THRESHOLD,
|
||||
darkLightColors[0], darkLightColors[1]);
|
||||
backgroundTintColor = accentColor;
|
||||
@ -186,7 +185,7 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
|
||||
}
|
||||
if (view instanceof WizardHighlightTextView) {
|
||||
((WizardHighlightTextView) view).setTextColor(ThemeUtils.getOptimalAccentColor((Context) activity,
|
||||
currentThemeColor, isActionBarContext, themeResourceId));
|
||||
currentThemeColor, isActionBarContext));
|
||||
}
|
||||
if (view instanceof IThemeAccentView) {
|
||||
if (isAccentOptimal || !isColorTint) {
|
||||
|
@ -107,7 +107,7 @@ public class TwidereActionModeForChildListener implements TintedStatusNativeActi
|
||||
if (mActionModeView == null) {
|
||||
// Use the action bar theme.
|
||||
final Context actionBarContext;
|
||||
actionBarContext = ThemeUtils.getActionBarThemedContext(mActivity, mThemed.getCurrentThemeResourceId(),
|
||||
actionBarContext = ThemeUtils.getActionBarThemedContext(mActivity,
|
||||
mThemed.getCurrentThemeColor());
|
||||
|
||||
mActionModeView = new ActionBarContextView(actionBarContext);
|
||||
@ -122,7 +122,7 @@ public class TwidereActionModeForChildListener implements TintedStatusNativeActi
|
||||
actionBarContext.getResources().getDisplayMetrics());
|
||||
mActionModeView.setContentHeight(height);
|
||||
ThemeUtils.setActionBarContextViewBackground(mActionModeView,
|
||||
mThemed.getCurrentThemeResourceId(), mThemed.getCurrentThemeColor(),
|
||||
mThemed.getCurrentThemeColor(),
|
||||
mThemed.getCurrentThemeBackgroundOption(), false);
|
||||
mActionModePopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
final Rect actionModeBounds = getActionModeBounds();
|
||||
|
@ -1296,18 +1296,13 @@ public final class Utils implements Constants {
|
||||
return TwidereArrayUtils.fromList(list);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String getNonEmptyString(final SharedPreferences pref, final String key, final String def) {
|
||||
if (pref == null) return def;
|
||||
final String val = pref.getString(key, def);
|
||||
return isEmpty(val) ? def : val;
|
||||
}
|
||||
|
||||
public static String getNonEmptyString(final SharedPreferencesWrapper pref, final String key, final String def) {
|
||||
if (pref == null) return def;
|
||||
final String val = pref.getString(key, def);
|
||||
return isEmpty(val) ? def : val;
|
||||
}
|
||||
|
||||
public static String getNormalTwitterProfileImage(final String url) {
|
||||
return getTwitterProfileImageOfSize(url, "normal");
|
||||
}
|
||||
|
@ -88,9 +88,8 @@ public class HomeActionButton extends FrameLayout implements IHomeActionButton {
|
||||
if (isInEditMode()) {
|
||||
inflate(context, R.layout.action_item_home_actions, this);
|
||||
} else if (context instanceof IThemedActivity) {
|
||||
int themeResourceId = ((IThemedActivity) context).getCurrentThemeResourceId();
|
||||
int themeColor = ((IThemedActivity) context).getCurrentThemeColor();
|
||||
inflate(ThemeUtils.getActionBarThemedContext(context, themeResourceId, themeColor),
|
||||
inflate(ThemeUtils.getActionBarThemedContext(context, themeColor),
|
||||
R.layout.action_item_home_actions, this);
|
||||
} else {
|
||||
inflate(ThemeUtils.getActionBarThemedContext(context), R.layout.action_item_home_actions,
|
||||
|
@ -61,9 +61,8 @@ public class HomeActionButtonCompat extends FrameLayout implements IHomeActionBu
|
||||
if (isInEditMode()) {
|
||||
inflate(context, R.layout.action_item_home_actions_compat, this);
|
||||
} else if (context instanceof IThemedActivity) {
|
||||
int themeResourceId = ((IThemedActivity) context).getCurrentThemeResourceId();
|
||||
int themeColor = ((IThemedActivity) context).getCurrentThemeColor();
|
||||
inflate(ThemeUtils.getActionBarThemedContext(context, themeResourceId, themeColor),
|
||||
inflate(ThemeUtils.getActionBarThemedContext(context, themeColor),
|
||||
R.layout.action_item_home_actions_compat, this);
|
||||
} else {
|
||||
inflate(ThemeUtils.getActionBarThemedContext(context), R.layout.action_item_home_actions_compat,
|
||||
|
@ -46,7 +46,6 @@ public class TwidereActionBarContainer extends ActionBarContainer {
|
||||
private static Context wrapContext(Context context) {
|
||||
if (context instanceof IThemedActivity) {
|
||||
return ThemeUtils.getActionBarThemedContext(context,
|
||||
((IThemedActivity) context).getCurrentThemeResourceId(),
|
||||
((IThemedActivity) context).getCurrentThemeColor());
|
||||
}
|
||||
return ThemeUtils.getActionBarThemedContext(context);
|
||||
|
@ -44,7 +44,6 @@ public class TwidereActionBarContextFrameLayout extends FrameLayout {
|
||||
private static Context wrapContext(Context context) {
|
||||
if (context instanceof IThemedActivity) {
|
||||
return ThemeUtils.getActionBarThemedContext(context,
|
||||
((IThemedActivity) context).getCurrentThemeResourceId(),
|
||||
((IThemedActivity) context).getCurrentThemeColor());
|
||||
}
|
||||
return ThemeUtils.getActionBarThemedContext(context);
|
||||
|
168
twidere/src/main/res/values-night/themes.xml
Normal file
168
twidere/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Twidere" parent="Theme.Compat.Base">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_dark</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.NoActionBar" parent="Theme.Compat.Base.NoActionBar">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_dark</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.DialogWhenLarge.NoActionBar" parent="Theme.Compat.Base.DialogWhenLarge">
|
||||
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowActionModeOverlay">false</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dialog" parent="Theme.Compat.Base.Dialog">
|
||||
|
||||
<!-- Custom view styles -->
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Compose" parent="Theme.Compat.Base.Dialog">
|
||||
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowActionModeOverlay">false</item>
|
||||
|
||||
<item name="android:actionModeStyle">@style/Widget.Twidere.ActionMode.Dark</item>
|
||||
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:panelColorBackground">#3c3c3c</item>
|
||||
<item name="android:dividerVertical">@drawable/divider_compose_vertical_dark</item>
|
||||
<item name="android:windowActionBarOverlay">false</item>
|
||||
<item name="android:windowActionModeOverlay">false</item>
|
||||
|
||||
<!-- Custom view styles -->
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.QuickSearchBar" parent="Theme.Twidere.Dialog">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">100%</item>
|
||||
<item name="android:windowActionBarOverlay">false</item>
|
||||
<item name="android:windowActionModeOverlay">false</item>
|
||||
|
||||
<item name="darkTheme">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Drawer" parent="Theme.Twidere.NoActionBar">
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_drawer_dark</item>
|
||||
<item name="textColorDrawerNamePrimary">?android:textColorPrimary</item>
|
||||
<item name="textColorDrawerNameSecondary">?android:textColorSecondary</item>
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.NoDisplay" parent="Theme.Twidere.Dialog">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--<item name="android:backgroundDimEnabled">false</item>-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowDisablePreview">true</item>
|
||||
|
||||
<item name="darkTheme">true</item>
|
||||
<!--<item name="android:windowNoDisplay">true</item>-->
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -34,6 +34,7 @@
|
||||
<string-array name="entries_theme">
|
||||
<item>@string/theme_light</item>
|
||||
<item>@string/theme_dark</item>
|
||||
<item>@string/theme_auto</item>
|
||||
</string-array>
|
||||
<string-array name="entries_theme_background">
|
||||
<item>@string/theme_background_default</item>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string-array name="values_theme">
|
||||
<item>light</item>
|
||||
<item>dark</item>
|
||||
<item>auto</item>
|
||||
</string-array>
|
||||
<string-array name="values_theme_background">
|
||||
<item>default</item>
|
||||
|
@ -15,6 +15,8 @@
|
||||
<attr name="textColorDrawerNamePrimary" format="color"/>
|
||||
<attr name="textColorDrawerNameSecondary" format="color"/>
|
||||
<attr name="progressWheelStyle" format="reference"/>
|
||||
<attr name="darkTheme" format="boolean"/>
|
||||
<attr name="coloredActionBar" format="boolean"/>
|
||||
</declare-styleable>
|
||||
<declare-styleable name="ColorLabelView">
|
||||
<attr name="ignorePadding" format="boolean"/>
|
||||
|
@ -410,6 +410,7 @@
|
||||
<string name="theme">Theme</string>
|
||||
<string name="theme_dark">Dark</string>
|
||||
<string name="theme_light">Light</string>
|
||||
<string name="theme_auto">Auto</string>
|
||||
<string name="settings_interface">Interface</string>
|
||||
<string name="no_rule">No rule</string>
|
||||
<string name="safety">Safety</string>
|
||||
|
@ -1,32 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<style name="Theme"/>
|
||||
|
||||
<style name="Theme.Twidere.Dark.NoActionBar" parent="Theme.Compat.Base.NoActionBar">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_dark</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.NoActionBar" parent="Theme.Compat.Base.Light.NoActionBar">
|
||||
<style name="Theme.Twidere" parent="Theme.Compat.Base.Light">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_light</item>
|
||||
@ -45,34 +20,12 @@
|
||||
<item name="menuIconColor">@color/action_icon_dark</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_light</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_light</item>
|
||||
<item name="coloredActionBar">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark" parent="Theme.Compat.Base">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_dark</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light" parent="Theme.Compat.Base.Light">
|
||||
<style name="Theme.Twidere.NoActionBar" parent="Theme.Compat.Base.Light.NoActionBar">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/background_color_window_light</item>
|
||||
@ -91,35 +44,13 @@
|
||||
<item name="menuIconColor">@color/action_icon_dark</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_light</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_light</item>
|
||||
<item name="coloredActionBar">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.DialogWhenLarge.NoActionBar" parent="Theme.Compat.Base.DialogWhenLarge">
|
||||
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowActionModeOverlay">false</item>
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DialogWhenLarge.NoActionBar" parent="Theme.Compat.Base.Light.DialogWhenLarge">
|
||||
<style name="Theme.Twidere.DialogWhenLarge.NoActionBar" parent="Theme.Compat.Base.Light.DialogWhenLarge">
|
||||
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
@ -139,34 +70,13 @@
|
||||
<item name="menuIconColor">@color/action_icon_dark</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_light</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_light</item>
|
||||
<item name="coloredActionBar">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.Dialog" parent="Theme.Compat.Base.Dialog">
|
||||
|
||||
<!-- Custom view styles -->
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.Dialog" parent="Theme.Compat.Base.Light.Dialog">
|
||||
<style name="Theme.Twidere.Dialog" parent="Theme.Compat.Base.Light.Dialog">
|
||||
|
||||
<!-- Custom view styles -->
|
||||
|
||||
@ -185,44 +95,13 @@
|
||||
<item name="menuIconColor">@color/action_icon_dark</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_light</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_light</item>
|
||||
<item name="coloredActionBar">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.Compose" parent="Theme.Compat.Base.Dialog">
|
||||
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowActionModeOverlay">false</item>
|
||||
|
||||
<item name="android:actionModeStyle">@style/Widget.Twidere.ActionMode.Dark</item>
|
||||
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:panelColorBackground">#3c3c3c</item>
|
||||
<item name="android:dividerVertical">@drawable/divider_compose_vertical_dark</item>
|
||||
<item name="android:windowActionBarOverlay">false</item>
|
||||
<item name="android:windowActionModeOverlay">false</item>
|
||||
|
||||
<!-- Custom view styles -->
|
||||
|
||||
<!-- Widget styles -->
|
||||
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
|
||||
</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
|
||||
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
|
||||
<item name="profileImageStyleLarge">@style/Widget.ProfileImage.Large</item>
|
||||
<item name="cardItemBackgroundColor">@color/background_color_card_item_dark</item>
|
||||
|
||||
<!-- Twidere specific styles -->
|
||||
<item name="menuIconColor">@color/action_icon_light</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.Compose" parent="Theme.Compat.Base.Light.Dialog">
|
||||
<style name="Theme.Twidere.Compose" parent="Theme.Compat.Base.Light.Dialog">
|
||||
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowActionModeOverlay">false</item>
|
||||
@ -252,11 +131,12 @@
|
||||
<item name="menuIconColor">@color/action_icon_dark</item>
|
||||
<item name="messageBubbleColor">@color/message_bubble_color_light</item>
|
||||
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_light</item>
|
||||
<item name="coloredActionBar">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.QuickSearchBar" parent="Theme.Twidere.Light.Dialog">
|
||||
<style name="Theme.Twidere.QuickSearchBar" parent="Theme.Twidere.Dialog">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
@ -265,13 +145,24 @@
|
||||
<item name="android:windowActionModeOverlay">false</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.QuickSearchBar" parent="Theme.Twidere.Dark.Dialog">
|
||||
<style name="Theme.Twidere.Drawer" parent="Theme.Twidere.NoActionBar">
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_drawer_light</item>
|
||||
<item name="textColorDrawerNamePrimary">?android:textColorPrimaryInverse</item>
|
||||
<item name="textColorDrawerNameSecondary">?android:textColorSecondaryInverse</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.NoDisplay" parent="Theme.Twidere.Dialog">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--<item name="android:backgroundDimEnabled">false</item>-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowDisablePreview">true</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">100%</item>
|
||||
<item name="android:windowActionBarOverlay">false</item>
|
||||
<item name="android:windowActionModeOverlay">false</item>
|
||||
<item name="android:windowTitleStyle">@style/Widget.TextView.WindowTitle.NoDisplay</item>
|
||||
<!--<item name="android:windowNoDisplay">true</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Viewer" parent="Theme.AppCompat">
|
||||
@ -303,47 +194,6 @@
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Drawer.Dark" parent="Theme.Twidere.Dark.NoActionBar">
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_drawer_dark</item>
|
||||
<item name="textColorDrawerNamePrimary">?android:textColorPrimary</item>
|
||||
<item name="textColorDrawerNameSecondary">?android:textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Drawer.Light" parent="Theme.Twidere.Light.NoActionBar">
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_drawer_light</item>
|
||||
<item name="textColorDrawerNamePrimary">?android:textColorPrimaryInverse</item>
|
||||
<item name="textColorDrawerNameSecondary">?android:textColorSecondaryInverse</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.NoDisplay" parent="Theme.Twidere.Dark.Dialog">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--<item name="android:backgroundDimEnabled">false</item>-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowDisablePreview">true</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowTitleStyle">@style/Widget.TextView.WindowTitle.NoDisplay</item>
|
||||
<!--<item name="android:windowNoDisplay">true</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.NoDisplay" parent="Theme.Twidere.Light.Dialog">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--<item name="android:backgroundDimEnabled">false</item>-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowDisablePreview">true</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowTitleStyle">@style/Widget.TextView.WindowTitle.NoDisplay</item>
|
||||
<!--<item name="android:windowNoDisplay">true</item>-->
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Theme.Nyan" parent="Theme.Compat.Base.NoActionBar">
|
||||
<item name="android:windowBackground">@color/nyan_background</item>
|
||||
</style>
|
||||
|
@ -4,17 +4,17 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/theme">
|
||||
|
||||
<org.mariotaku.twidere.preference.DarkLightThemeTogglePreference
|
||||
<ListPreference
|
||||
android:defaultValue="light"
|
||||
android:entries="@array/entries_theme"
|
||||
android:entryValues="@array/values_theme"
|
||||
android:key="theme"
|
||||
android:order="21"
|
||||
android:title="@string/dark_theme">
|
||||
android:title="@string/theme">
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:name="recreate_activity"
|
||||
android:value="true"/>
|
||||
<extra
|
||||
android:name="restart_activity"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.DarkLightThemeTogglePreference>
|
||||
</ListPreference>
|
||||
|
||||
<org.mariotaku.twidere.preference.ThemeBackgroundPreference
|
||||
android:defaultValue="default"
|
||||
|
Loading…
x
Reference in New Issue
Block a user