removing classes

This commit is contained in:
Mariotaku Lee 2016-03-12 22:20:56 +08:00
parent 5b4990671c
commit 70668f0eaf
35 changed files with 887 additions and 1177 deletions

View File

@ -75,7 +75,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Twidere.NoActionBar"
android:theme="@style/Theme.Compat.Base.NoActionBar"
tools:ignore="UnusedAttribute">
<uses-library
android:name="com.sec.android.app.multiwindow"
@ -233,7 +233,7 @@
android:name=".activity.SettingsActivity"
android:label="@string/settings"
android:parentActivityName=".activity.support.HomeActivity"
android:theme="@style/Theme.Twidere.NoActionBar"
android:theme="@style/Theme.Twidere"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE"/>

View File

@ -0,0 +1,538 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v7.app;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.annotation.CallSuper;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.view.KeyEventCompat;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.TintResources;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Base class for activities that use the
* <a href="{@docRoot}tools/extras/support-library.html">support library</a> action bar features.
*
* <p>You can add an {@link android.support.v7.app.ActionBar} to your activity when running on API level 7 or higher
* by extending this class for your activity and setting the activity theme to
* {@link android.support.v7.appcompat.R.style#Theme_AppCompat Theme.AppCompat} or a similar theme.
*
* <div class="special reference">
* <h3>Developer Guides</h3>
*
* <p>For information about how to use the action bar, including how to add action items, navigation
* modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action
* Bar</a> API guide.</p>
* </div>
*/
public class AppCompatPreferenceActivity extends PreferenceActivity implements AppCompatCallback,
TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider {
private AppCompatDelegate mDelegate;
private int mThemeId = 0;
private boolean mEatKeyUpEvent;
private Resources mResources;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
final AppCompatDelegate delegate = getDelegate();
delegate.installViewFactory();
delegate.onCreate(savedInstanceState);
if (delegate.applyDayNight() && mThemeId != 0) {
// If DayNight has been applied, we need to re-apply the theme for
// the changes to take effect. On API 23+, we should bypass
// setTheme(), which will no-op if the theme ID is identical to the
// current theme ID.
if (Build.VERSION.SDK_INT >= 23) {
onApplyThemeResource(getTheme(), mThemeId, false);
} else {
setTheme(mThemeId);
}
}
super.onCreate(savedInstanceState);
}
@Override
public void setTheme(@StyleRes final int resid) {
super.setTheme(resid);
// Keep hold of the theme id so that we can re-set it later if needed
mThemeId = resid;
}
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getDelegate().onPostCreate(savedInstanceState);
}
/**
* Support library version of {@link android.app.Activity#getActionBar}.
*
* <p>Retrieve a reference to this activity's ActionBar.
*
* @return The Activity's ActionBar, or null if it does not have one.
*/
@Nullable
public ActionBar getSupportActionBar() {
return getDelegate().getSupportActionBar();
}
/**
* Set a {@link android.widget.Toolbar Toolbar} to act as the
* {@link android.support.v7.app.ActionBar} for this Activity window.
*
* <p>When set to a non-null value the {@link #getActionBar()} method will return
* an {@link android.support.v7.app.ActionBar} object that can be used to control the given
* toolbar as if it were a traditional window decor action bar. The toolbar's menu will be
* populated with the Activity's options menu and the navigation button will be wired through
* the standard {@link android.R.id#home home} menu select action.</p>
*
* <p>In order to use a Toolbar within the Activity's window content the application
* must not request the window feature
* {@link android.view.Window#FEATURE_ACTION_BAR FEATURE_SUPPORT_ACTION_BAR}.</p>
*
* @param toolbar Toolbar to set as the Activity's action bar, or {@code null} to clear it
*/
public void setSupportActionBar(@Nullable Toolbar toolbar) {
getDelegate().setSupportActionBar(toolbar);
}
@NonNull
@Override
public MenuInflater getMenuInflater() {
return getDelegate().getMenuInflater();
}
@Override
public void setContentView(@LayoutRes int layoutResID) {
getDelegate().setContentView(layoutResID);
}
@Override
public void setContentView(View view) {
getDelegate().setContentView(view);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().setContentView(view, params);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().addContentView(view, params);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getDelegate().onConfigurationChanged(newConfig);
if (mResources != null) {
mResources.updateConfiguration(newConfig, null);
}
}
@Override
protected void onStop() {
super.onStop();
getDelegate().onStop();
}
@Override
protected void onPostResume() {
super.onPostResume();
getDelegate().onPostResume();
}
@Nullable
public View findViewById(@IdRes int id) {
return getDelegate().findViewById(id);
}
@Override
public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) {
if (super.onMenuItemSelected(featureId, item)) {
return true;
}
final ActionBar ab = getSupportActionBar();
if (item.getItemId() == android.R.id.home && ab != null &&
(ab.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
return onSupportNavigateUp();
}
return false;
}
@Override
protected void onDestroy() {
super.onDestroy();
getDelegate().onDestroy();
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
getDelegate().setTitle(title);
}
/**
* Enable extended support library window features.
* <p>
* This is a convenience for calling
* {@link android.view.Window#requestFeature getWindow().requestFeature()}.
* </p>
*
* @param featureId The desired feature as defined in
* {@link android.view.Window} or {@link android.support.v4.view.WindowCompat}.
* @return Returns true if the requested feature is supported and now enabled.
*
* @see android.app.Activity#requestWindowFeature
* @see android.view.Window#requestFeature
*/
public boolean supportRequestWindowFeature(int featureId) {
return getDelegate().requestWindowFeature(featureId);
}
/**
* @hide
*/
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
/**
* Notifies the Activity that a support action mode has been started.
* Activity subclasses overriding this method should call the superclass implementation.
*
* @param mode The new action mode.
*/
@CallSuper
public void onSupportActionModeStarted(@NonNull ActionMode mode) {
}
/**
* Notifies the activity that a support action mode has finished.
* Activity subclasses overriding this method should call the superclass implementation.
*
* @param mode The action mode that just finished.
*/
@CallSuper
public void onSupportActionModeFinished(@NonNull ActionMode mode) {
}
/**
* Called when a support action mode is being started for this window. Gives the
* callback an opportunity to handle the action mode in its own unique and
* beautiful way. If this method returns null the system can choose a way
* to present the mode or choose not to start the mode at all.
*
* @param callback Callback to control the lifecycle of this action mode
* @return The ActionMode that was started, or null if the system should present it
*/
@Nullable
@Override
public ActionMode onWindowStartingSupportActionMode(@NonNull ActionMode.Callback callback) {
return null;
}
/**
* Start an action mode.
*
* @param callback Callback that will manage lifecycle events for this context mode
* @return The ContextMode that was started, or null if it was canceled
*/
@Nullable
public ActionMode startSupportActionMode(@NonNull ActionMode.Callback callback) {
return getDelegate().startSupportActionMode(callback);
}
/**
* @deprecated Progress bars are no longer provided in AppCompat.
*/
@Deprecated
public void setSupportProgressBarVisibility(boolean visible) {
}
/**
* @deprecated Progress bars are no longer provided in AppCompat.
*/
@Deprecated
public void setSupportProgressBarIndeterminateVisibility(boolean visible) {
}
/**
* @deprecated Progress bars are no longer provided in AppCompat.
*/
@Deprecated
public void setSupportProgressBarIndeterminate(boolean indeterminate) {
}
/**
* @deprecated Progress bars are no longer provided in AppCompat.
*/
@Deprecated
public void setSupportProgress(int progress) {
}
/**
* Support version of {@link #onCreateNavigateUpTaskStack(android.app.TaskStackBuilder)}.
* This method will be called on all platform versions.
*
* Define the synthetic task stack that will be generated during Up navigation from
* a different task.
*
* <p>The default implementation of this method adds the parent chain of this activity
* as specified in the manifest to the supplied {@link android.support.v4.app.TaskStackBuilder}. Applications
* may choose to override this method to construct the desired task stack in a different
* way.</p>
*
* <p>This method will be invoked by the default implementation of {@link #onNavigateUp()}
* if {@link #shouldUpRecreateTask(android.content.Intent)} returns true when supplied with the intent
* returned by {@link #getParentActivityIntent()}.</p>
*
* <p>Applications that wish to supply extra Intent parameters to the parent stack defined
* by the manifest should override
* {@link #onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)}.</p>
*
* @param builder An empty TaskStackBuilder - the application should add intents representing
* the desired task stack
*/
public void onCreateSupportNavigateUpTaskStack(@NonNull TaskStackBuilder builder) {
builder.addParentStack(this);
}
/**
* Support version of {@link #onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder)}.
* This method will be called on all platform versions.
*
* Prepare the synthetic task stack that will be generated during Up navigation
* from a different task.
*
* <p>This method receives the {@link android.support.v4.app.TaskStackBuilder} with the constructed series of
* Intents as generated by {@link #onCreateSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)}.
* If any extra data should be added to these intents before launching the new task,
* the application should override this method and add that data here.</p>
*
* @param builder A TaskStackBuilder that has been populated with Intents by
* onCreateNavigateUpTaskStack.
*/
public void onPrepareSupportNavigateUpTaskStack(@NonNull TaskStackBuilder builder) {
}
/**
* This method is called whenever the user chooses to navigate Up within your application's
* activity hierarchy from the action bar.
*
* <p>If a parent was specified in the manifest for this activity or an activity-alias to it,
* default Up navigation will be handled automatically. See
* {@link #getSupportParentActivityIntent()} for how to specify the parent. If any activity
* along the parent chain requires extra Intent arguments, the Activity subclass
* should override the method {@link #onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)}
* to supply those arguments.</p>
*
* <p>See <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and
* Back Stack</a> from the developer guide and
* <a href="{@docRoot}design/patterns/navigation.html">Navigation</a> from the design guide
* for more information about navigating within your app.</p>
*
* <p>See the {@link android.support.v4.app.TaskStackBuilder} class and the Activity methods
* {@link #getSupportParentActivityIntent()}, {@link #supportShouldUpRecreateTask(android.content.Intent)}, and
* {@link #supportNavigateUpTo(android.content.Intent)} for help implementing custom Up navigation.</p>
*
* @return true if Up navigation completed successfully and this Activity was finished,
* false otherwise.
*/
public boolean onSupportNavigateUp() {
Intent upIntent = getSupportParentActivityIntent();
if (upIntent != null) {
if (supportShouldUpRecreateTask(upIntent)) {
TaskStackBuilder b = TaskStackBuilder.create(this);
onCreateSupportNavigateUpTaskStack(b);
onPrepareSupportNavigateUpTaskStack(b);
b.startActivities();
try {
ActivityCompat.finishAffinity(this);
} catch (IllegalStateException e) {
// This can only happen on 4.1+, when we don't have a parent or a result set.
// In that case we should just finish().
finish();
}
} else {
// This activity is part of the application's task, so simply
// navigate up to the hierarchical parent activity.
supportNavigateUpTo(upIntent);
}
return true;
}
return false;
}
/**
* Obtain an {@link android.content.Intent} that will launch an explicit target activity
* specified by sourceActivity's {@link android.support.v4.app.NavUtils#PARENT_ACTIVITY} &lt;meta-data&gt;
* element in the application's manifest. If the device is running
* Jellybean or newer, the android:parentActivityName attribute will be preferred
* if it is present.
*
* @return a new Intent targeting the defined parent activity of sourceActivity
*/
@Nullable
public Intent getSupportParentActivityIntent() {
return NavUtils.getParentActivityIntent(this);
}
/**
* Returns true if sourceActivity should recreate the task when navigating 'up'
* by using targetIntent.
*
* <p>If this method returns false the app can trivially call
* {@link #supportNavigateUpTo(android.content.Intent)} using the same parameters to correctly perform
* up navigation. If this method returns false, the app should synthesize a new task stack
* by using {@link android.support.v4.app.TaskStackBuilder} or another similar mechanism to perform up navigation.</p>
*
* @param targetIntent An intent representing the target destination for up navigation
* @return true if navigating up should recreate a new task stack, false if the same task
* should be used for the destination
*/
public boolean supportShouldUpRecreateTask(@NonNull Intent targetIntent) {
return NavUtils.shouldUpRecreateTask(this, targetIntent);
}
/**
* Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity
* in the process. upIntent will have the flag {@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP} set
* by this method, along with any others required for proper up navigation as outlined
* in the Android Design Guide.
*
* <p>This method should be used when performing up navigation from within the same task
* as the destination. If up navigation should cross tasks in some cases, see
* {@link #supportShouldUpRecreateTask(android.content.Intent)}.</p>
*
* @param upIntent An intent representing the target destination for up navigation
*/
public void supportNavigateUpTo(@NonNull Intent upIntent) {
NavUtils.navigateUpTo(this, upIntent);
}
@Override
public void onContentChanged() {
// Call onSupportContentChanged() for legacy reasons
onSupportContentChanged();
}
/**
* @deprecated Use {@link #onContentChanged()} instead.
*/
@Deprecated
public void onSupportContentChanged() {
}
@Nullable
@Override
public ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
return getDelegate().getDrawerToggleDelegate();
}
/**
* {@inheritDoc}
*
* <p>Please note: AppCompat uses it's own feature id for the action bar:
* {@link AppCompatDelegate#FEATURE_SUPPORT_ACTION_BAR FEATURE_SUPPORT_ACTION_BAR}.</p>
*/
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
return super.onMenuOpened(featureId, menu);
}
/**
* {@inheritDoc}
*
* <p>Please note: AppCompat uses it's own feature id for the action bar:
* {@link AppCompatDelegate#FEATURE_SUPPORT_ACTION_BAR FEATURE_SUPPORT_ACTION_BAR}.</p>
*/
@Override
public void onPanelClosed(int featureId, Menu menu) {
super.onPanelClosed(featureId, menu);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getDelegate().onSaveInstanceState(outState);
}
/**
* @return The {@link AppCompatDelegate} being used by this Activity.
*/
@NonNull
public AppCompatDelegate getDelegate() {
if (mDelegate == null) {
mDelegate = AppCompatDelegate.create(this, this);
}
return mDelegate;
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
final int keyCode = event.getKeyCode();
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
final int action = event.getAction();
if (action == KeyEvent.ACTION_DOWN) {
if (KeyEventCompat.hasModifiers(event, KeyEvent.META_ALT_ON)) {
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null && actionBar.isShowing() && actionBar.requestFocus()) {
mEatKeyUpEvent = true;
return true;
}
}
} else if (action == KeyEvent.ACTION_UP && mEatKeyUpEvent) {
mEatKeyUpEvent = false;
return true;
}
}
return super.dispatchKeyEvent(event);
}
@Override
public Resources getResources() {
if (mResources == null) {
mResources = new TintResources(this, super.getResources());
}
return mResources;
}
}

View File

@ -1,164 +0,0 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mariotaku.twidere.activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
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.app.AppCompatCallback;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.Toolbar;
import android.view.MenuInflater;
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
* to be used with AppCompat.
* <p/>
* This technique can be used with an {@link android.app.Activity} class, not just
* {@link android.preference.PreferenceActivity}.
*/
public abstract class AppCompatPreferenceActivity extends PreferenceActivity
implements AppCompatCallback, IAppCompatActivity {
private AppCompatDelegate mDelegate;
@Override
public ActionBar getSupportActionBar() {
return getDelegate().getSupportActionBar();
}
/**
* Notifies the Activity that a support action mode has been started.
* Activity subclasses overriding this method should call the superclass implementation.
*
* @param mode The new action mode.
*/
@Override
public void onSupportActionModeStarted(ActionMode mode) {
}
/**
* Notifies the activity that a support action mode has finished.
* Activity subclasses overriding this method should call the superclass implementation.
*
* @param mode The action mode that just finished.
*/
@Override
public void onSupportActionModeFinished(ActionMode mode) {
}
public ActionMode startSupportActionMode(ActionMode.Callback callback) {
return getDelegate().startSupportActionMode(callback);
}
public void setSupportActionBar(@Nullable Toolbar toolbar) {
getDelegate().setSupportActionBar(toolbar);
}
public boolean supportRequestWindowFeature(int featureId) {
return getDelegate().requestWindowFeature(featureId);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
}
@Override
protected void onStop() {
super.onStop();
getDelegate().onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
getDelegate().onDestroy();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getDelegate().onPostCreate(savedInstanceState);
}
@Override
protected void onPostResume() {
super.onPostResume();
getDelegate().onPostResume();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getDelegate().onConfigurationChanged(newConfig);
}
@Override
public void setContentView(@LayoutRes int layoutResID) {
getDelegate().setContentView(layoutResID);
}
@Override
public void setContentView(View view) {
getDelegate().setContentView(view);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().setContentView(view, params);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().addContentView(view, params);
}
@Override
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
@NonNull
@Override
public MenuInflater getMenuInflater() {
return getDelegate().getMenuInflater();
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
getDelegate().setTitle(title);
}
public AppCompatDelegate getDelegate() {
if (mDelegate == null) {
mDelegate = AppCompatDelegate.create(this, this);
}
return mDelegate;
}
}

View File

@ -19,26 +19,15 @@
package org.mariotaku.twidere.activity;
import android.annotation.SuppressLint;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.preference.PreferenceActivity;
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;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager.LayoutParams;
import android.widget.FrameLayout;
import org.mariotaku.twidere.BuildConfig;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.ActivityTracker;
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
@ -46,16 +35,13 @@ import org.mariotaku.twidere.util.StrictModeUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper;
import org.mariotaku.twidere.util.support.ViewSupport;
import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
import javax.inject.Inject;
public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity implements Constants,
public abstract class BasePreferenceActivity extends PreferenceActivity implements Constants,
IThemedActivity, KeyboardShortcutsHandler.KeyboardShortcutCallback {
private TintedStatusFrameLayout mMainContent;
// Data fields
private int mCurrentThemeColor;
private int mCurrentThemeBackgroundAlpha;
@ -115,21 +101,6 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
Utils.restartActivity(this);
}
@Override
public void onContentChanged() {
super.onContentChanged();
mMainContent = (TintedStatusFrameLayout) findViewById(R.id.main_content);
setupTintStatusBar();
}
@Override
public void onSupportActionModeStarted(android.support.v7.view.ActionMode mode) {
super.onSupportActionModeStarted(mode);
ThemeUtils.applySupportActionModeColor(mode, getCurrentThemeColor(),
getThemeBackgroundOption(), true);
ThemeUtils.applySupportActionModeItemColor(mode, getCurrentThemeColor());
}
@Override
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event, int metaState) {
return false;
@ -146,7 +117,6 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
StrictModeUtils.detectAllVmPolicy();
StrictModeUtils.detectAllThreadPolicy();
}
setupWindow();
super.onCreate(savedInstanceState);
GeneralComponentHelper.build(this).inject(this);
}
@ -171,95 +141,6 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
return super.onKeyDown(keyCode, event);
}
@Override
public void setContentView(@LayoutRes int layoutResID) {
final FrameLayout mainContent = initMainContent();
getLayoutInflater().inflate(layoutResID, (ViewGroup) mainContent.findViewById(R.id.settings_content), true);
super.setContentView(mainContent);
}
@Override
public void setContentView(View view) {
final FrameLayout mainContent = initMainContent();
final ViewGroup settingsContent = (ViewGroup) mainContent.findViewById(R.id.settings_content);
settingsContent.removeAllViews();
settingsContent.addView(view);
super.setContentView(mainContent);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
final FrameLayout mainContent = initMainContent();
final ViewGroup settingsContent = (ViewGroup) mainContent.findViewById(R.id.settings_content);
settingsContent.removeAllViews();
settingsContent.addView(view);
super.setContentView(mainContent);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
FrameLayout mainContent = (FrameLayout) findViewById(R.id.main_content);
if (mainContent == null) {
@SuppressLint("InflateParams")
final View mainLayout = getLayoutInflater().inflate(R.layout.activity_settings, null);
mainContent = (FrameLayout) mainLayout.findViewById(R.id.main_content);
}
final ViewGroup settingsContent = (ViewGroup) mainContent.findViewById(R.id.settings_content);
settingsContent.addView(view, params);
onContentChanged();
}
protected boolean isActionBarOutlineEnabled() {
return true;
}
@Override
protected void onResume() {
super.onResume();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
final boolean result = super.onPrepareOptionsMenu(menu);
if (!shouldSetActionItemColor()) return result;
final View actionBarView = getWindow().findViewById(android.support.v7.appcompat.R.id.action_bar);
if (actionBarView instanceof Toolbar) {
final int themeColor = getCurrentThemeColor();
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);
}
return result;
}
protected boolean shouldSetActionItemColor() {
return true;
}
private FrameLayout initMainContent() {
final FrameLayout mainContent = (FrameLayout) findViewById(R.id.main_content);
if (mainContent != null) {
return mainContent;
}
return ((FrameLayout) getLayoutInflater().inflate(R.layout.activity_settings, null));
}
@Override
public void setTheme(int resId) {
super.setTheme(resId);
if (shouldApplyWindowBackground()) {
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();
@ -268,43 +149,23 @@ public abstract class BasePreferenceActivity extends AppCompatPreferenceActivity
mCurrentThemeBackgroundOption = getThemeBackgroundOption();
mCurrentThemeFontFamily = getThemeFontFamily();
super.onApplyThemeResource(theme, resId, first);
if (shouldApplyWindowBackground()) {
ThemeUtils.applyWindowBackground(this, getWindow(),
mCurrentThemeBackgroundOption, mCurrentThemeBackgroundAlpha);
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
setupActionBar();
public void onConfigurationChanged(Configuration newConfig) {
ThemeUtils.fixNightMode(getResources(), newConfig);
super.onConfigurationChanged(newConfig);
}
protected boolean shouldApplyWindowBackground() {
return true;
}
private void setupActionBar() {
final ActionBar actionBar = getSupportActionBar();
if (actionBar == null) return;
final int themeColor = getCurrentThemeColor();
final String option = getThemeBackgroundOption();
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(), getThemeBackgroundOption());
mMainContent.setColor(statusBarColor, alpha);
mMainContent.setDrawShadow(false);
mMainContent.setDrawColor(true);
mMainContent.setFactor(1);
}
private void setupWindow() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
}

View File

@ -20,6 +20,7 @@
package org.mariotaku.twidere.activity;
import android.app.Activity;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.NonNull;
@ -127,4 +128,10 @@ public abstract class BaseThemedActivity extends Activity implements IThemedActi
return true;
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
ThemeUtils.fixNightMode(getResources(), newConfig);
super.onConfigurationChanged(newConfig);
}
}

View File

@ -21,12 +21,14 @@ package org.mariotaku.twidere.activity;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
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 {
@ -42,4 +44,10 @@ public class MainActivity extends Activity implements Constants {
finish();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
ThemeUtils.fixNightMode(getResources(), newConfig);
super.onConfigurationChanged(newConfig);
}
}

View File

@ -33,13 +33,6 @@ import android.content.res.Resources;
import android.graphics.PorterDuff.Mode;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.app.ThemedAppCompatDelegateFactory;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@ -47,26 +40,17 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewParent;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.support.DataExportActivity;
import org.mariotaku.twidere.activity.support.DataImportActivity;
import org.mariotaku.twidere.graphic.EmptyDrawable;
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.TwidereActionModeForChildListener;
import org.mariotaku.twidere.util.support.ViewSupport;
import org.mariotaku.twidere.util.support.view.ViewOutlineProviderCompat;
import org.mariotaku.twidere.view.TintedStatusNativeActionModeAwareLayout;
import org.mariotaku.twidere.view.holder.ViewListHolder;
import java.util.ArrayList;
@ -80,8 +64,6 @@ public class SettingsActivity extends BasePreferenceActivity {
private HeaderAdapter mAdapter;
private boolean mShouldNotifyChange;
private TwidereActionModeForChildListener mTwidereActionModeForChildListener;
private ThemedAppCompatDelegateFactory.ThemedAppCompatDelegate mDelegate;
public static void setShouldNotifyChange(Activity activity) {
if (!(activity instanceof SettingsActivity)) return;
@ -252,71 +234,10 @@ public class SettingsActivity extends BasePreferenceActivity {
@Override
protected void onCreate(final Bundle savedInstanceState) {
// supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
super.onCreate(savedInstanceState);
final Toolbar toolbar = (Toolbar) findViewById(R.id.action_bar);
setSupportActionBar(toolbar);
mTwidereActionModeForChildListener = new TwidereActionModeForChildListener(this, this, false);
final TintedStatusNativeActionModeAwareLayout layout = (TintedStatusNativeActionModeAwareLayout) findViewById(R.id.main_content);
layout.setActionModeForChildListener(mTwidereActionModeForChildListener);
ThemeUtils.setCompatContentViewOverlay(this, new EmptyDrawable());
final View actionBarContainer = findViewById(R.id.twidere_action_bar_container);
ViewCompat.setElevation(actionBarContainer, ThemeUtils.getSupportActionBarElevation(this));
ViewSupport.setOutlineProvider(actionBarContainer, ViewOutlineProviderCompat.BACKGROUND);
final View windowOverlay = findViewById(R.id.window_overlay);
ViewSupport.setBackground(windowOverlay, ThemeUtils.getNormalWindowContentOverlay(this));
setIntent(getIntent().addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
final String backgroundOption = getCurrentThemeBackgroundOption();
final boolean isTransparent = ThemeUtils.isTransparentBackground(backgroundOption);
final int actionBarAlpha = isTransparent ? ThemeUtils.getActionBarAlpha(ThemeUtils.getUserThemeBackgroundAlpha(this)) : 0xFF;
actionBarContainer.setAlpha(actionBarAlpha / 255f);
windowOverlay.setAlpha(actionBarAlpha / 255f);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
if (savedInstanceState != null) {
invalidateHeaders();
}
final ListView listView = getListView();
if (listView != null) {
listView.setChoiceMode(isMultiPane() ? ListView.CHOICE_MODE_SINGLE : ListView.CHOICE_MODE_NONE);
final LayoutParams lp = listView.getLayoutParams();
if (lp instanceof MarginLayoutParams) {
final MarginLayoutParams mlp = (MarginLayoutParams) lp;
mlp.leftMargin = 0;
mlp.topMargin = 0;
mlp.rightMargin = 0;
mlp.bottomMargin = 0;
listView.setLayoutParams(mlp);
}
final ViewParent listParent = listView.getParent();
if (listParent instanceof ViewGroup) {
((ViewGroup) listParent).setPadding(0, 0, 0, 0);
}
}
}
@Override
public AppCompatDelegate getDelegate() {
if (mDelegate == null) {
mDelegate = ThemedAppCompatDelegateFactory.create(this, this);
}
return mDelegate;
}
private void setShouldNotifyChange(boolean notify) {
@ -329,9 +250,6 @@ public class SettingsActivity extends BasePreferenceActivity {
@Override
public void onBackPressed() {
if (mTwidereActionModeForChildListener.finishExisting()) {
return;
}
if (isTopSettings() && shouldNotifyChange()) {
final RestartConfirmDialogFragment df = new RestartConfirmDialogFragment();
df.show(getFragmentManager().beginTransaction(), "restart_confirm");
@ -340,12 +258,6 @@ public class SettingsActivity extends BasePreferenceActivity {
super.onBackPressed();
}
@Nullable
@Override
public ActionMode onWindowStartingSupportActionMode(final ActionMode.Callback callback) {
return null;
}
public static class RestartConfirmDialogFragment extends DialogFragment implements DialogInterface.OnClickListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

View File

@ -20,7 +20,6 @@
package org.mariotaku.twidere.activity.support;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.annotation.NonNull;
@ -72,7 +71,6 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
private ArrayList<ControlBarOffsetListener> mControlBarOffsetListeners = new ArrayList<>();
// Data fields
private boolean mIsVisible;
private Rect mSystemWindowsInsets;
private int mKeyMetaState;
@ -88,10 +86,6 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
return ThemeUtils.getUserAccentColor(this);
}
public boolean isVisible() {
return mIsVisible;
}
@Override
public void onFitSystemWindows(Rect insets) {
if (mSystemWindowsInsets == null)
@ -130,11 +124,6 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
return isKeyboardShortcutHandled(mKeyboardShortcutsHandler, keyCode, event, mKeyMetaState) || super.onKeyDown(keyCode, event);
}
@Override
public void startActivity(final Intent intent) {
super.startActivity(intent);
}
@Override
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event, int metaState) {
return false;
@ -156,25 +145,12 @@ public class BaseAppCompatActivity extends ThemedAppCompatActivity implements Co
GeneralComponentHelper.build(this).inject(this);
}
@Override
protected void onStart() {
super.onStart();
mIsVisible = true;
}
@Override
protected void onPause() {
mActionHelper.dispatchOnPause();
super.onPause();
}
@Override
protected void onStop() {
mIsVisible = false;
super.onStop();
}
@Override
public void setControlBarOffset(float offset) {

View File

@ -123,15 +123,6 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
return mDelegate = ThemedAppCompatDelegateFactory.create(this, this);
}
@Override
public void setTheme(int resId) {
super.setTheme(resId);
if (shouldApplyWindowBackground()) {
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeBackgroundOption,
mCurrentThemeBackgroundAlpha);
}
}
@Override
protected void onApplyThemeResource(@NonNull Resources.Theme theme, int resId, boolean first) {
mCurrentThemeColor = getThemeColor();
@ -142,6 +133,10 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
super.onApplyThemeResource(theme, resId, first);
final Toolbar actionBarToolbar = getActionBarToolbar();
ThemeUtils.applyToolbarItemColor(this, actionBarToolbar, mCurrentThemeColor);
if (shouldApplyWindowBackground()) {
ThemeUtils.applyWindowBackground(this, getWindow(), mCurrentThemeBackgroundOption,
mCurrentThemeBackgroundAlpha);
}
}
@Override
@ -153,14 +148,8 @@ public abstract class ThemedAppCompatActivity extends AppCompatActivity implemen
@Override
public void onConfigurationChanged(Configuration newConfig) {
int currentNightMode = getResources().getConfiguration().uiMode
& Configuration.UI_MODE_NIGHT_MASK;
if (currentNightMode == Configuration.UI_MODE_NIGHT_YES)
newConfig.uiMode = (newConfig.uiMode & ~Configuration.UI_MODE_NIGHT_MASK) | Configuration.UI_MODE_NIGHT_YES;
ThemeUtils.fixNightMode(getResources(), newConfig);
super.onConfigurationChanged(newConfig);
}
@Nullable

View File

@ -20,6 +20,7 @@
package org.mariotaku.twidere.activity.support;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.NonNull;
@ -207,6 +208,12 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
return isKeyboardShortcutHandled(mKeyboardShortcutsHandler, keyCode, event, mMetaState) || super.onKeyDown(keyCode, event);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
ThemeUtils.fixNightMode(getResources(), newConfig);
super.onConfigurationChanged(newConfig);
}
protected boolean shouldApplyWindowBackground() {
return true;
}

View File

@ -1,34 +0,0 @@
package org.mariotaku.twidere.preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
public class AutoFixEditTextPreference extends EditTextPreference {
public AutoFixEditTextPreference(final Context context) {
super(context);
}
public AutoFixEditTextPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public AutoFixEditTextPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onSetInitialValue(final boolean restoreValue, final Object defaultValue) {
try {
super.onSetInitialValue(restoreValue, defaultValue);
} catch (final ClassCastException e) {
final SharedPreferences prefs = getSharedPreferences();
if (prefs != null) {
prefs.edit().remove(getKey()).apply();
}
}
}
}

View File

@ -1,54 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;
import org.jraf.android.backport.switchwidget.SwitchPreference;
public class AutoFixSwitchPreference extends SwitchPreference {
public AutoFixSwitchPreference(final Context context) {
super(context);
}
public AutoFixSwitchPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public AutoFixSwitchPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onSetInitialValue(final boolean restoreValue, final Object defaultValue) {
try {
super.onSetInitialValue(restoreValue, defaultValue);
} catch (final ClassCastException e) {
final SharedPreferences prefs = getSharedPreferences();
if (prefs != null) {
prefs.edit().remove(getKey()).apply();
}
}
}
}

View File

@ -1,114 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.preference;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.database.Cursor;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import org.apache.commons.lang3.ArrayUtils;
import org.mariotaku.twidere.R;
public class RingtonePreference extends AutoInvalidateListPreference {
private Ringtone[] mRingtones;
private String[] mEntries, mValues;
private int mSelectedItem;
public RingtonePreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public int getSelectedItem() {
return mSelectedItem;
}
public Ringtone getSelectedRingtone() {
return mRingtones[mSelectedItem];
}
public void setSelectedItem(final int selected) {
mSelectedItem = selected >= 0 && selected < mValues.length ? selected : 0;
}
@Override
protected void onDialogClosed(final boolean positiveResult) {
final Ringtone ringtone = getSelectedRingtone();
if (ringtone != null && ringtone.isPlaying()) {
ringtone.stop();
}
if (positiveResult && mSelectedItem >= 0 && mSelectedItem < mValues.length) {
if (callChangeListener(mValues[mSelectedItem])) {
persistString(mValues[mSelectedItem]);
}
}
}
@Override
protected void onPrepareDialogBuilder(@NonNull final Builder builder) {
loadRingtones(getContext());
setSelectedItem(ArrayUtils.indexOf(mValues, getPersistedString(null)));
builder.setSingleChoiceItems(getEntries(), getSelectedItem(), new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
setSelectedItem(which);
final Ringtone ringtone = getSelectedRingtone();
if (ringtone.isPlaying()) {
ringtone.stop();
}
ringtone.play();
}
});
}
private void loadRingtones(final Context context) {
final RingtoneManager manager = new RingtoneManager(context);
manager.setType(RingtoneManager.TYPE_NOTIFICATION);
final Cursor cur = manager.getCursor();
cur.moveToFirst();
final int count = cur.getCount();
mRingtones = new Ringtone[count + 1];
mEntries = new String[count + 1];
mValues = new String[count + 1];
final Uri default_uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
final Ringtone default_ringtone = RingtoneManager.getRingtone(context, default_uri);
mRingtones[0] = default_ringtone;
mEntries[0] = context.getString(R.string.default_ringtone);
mValues[0] = default_uri.toString();
for (int i = 0; i < count; i++) {
final Ringtone ringtone = manager.getRingtone(i);
mRingtones[i + 1] = ringtone;
mEntries[i + 1] = ringtone.getTitle(context);
mValues[i + 1] = manager.getRingtoneUri(i).toString();
}
setEntries(mEntries);
setEntryValues(mValues);
cur.close();
}
}

View File

@ -1,31 +0,0 @@
package org.mariotaku.twidere.preference;
import android.content.Context;
import android.util.AttributeSet;
public class SummaryEditTextPreference extends AutoFixEditTextPreference {
public SummaryEditTextPreference(final Context context) {
super(context);
}
public SummaryEditTextPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public SummaryEditTextPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
public CharSequence getSummary() {
return getText();
}
@Override
public void setText(final String text) {
super.setText(text);
setSummary(text);
}
}

View File

@ -1,21 +0,0 @@
package org.mariotaku.twidere.preference;
import android.content.Context;
import android.util.AttributeSet;
public class SummaryListPreference extends AutoInvalidateListPreference {
public SummaryListPreference(final Context context) {
super(context);
}
public SummaryListPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
@Override
public CharSequence getSummary() {
return getEntry();
}
}

View File

@ -1,93 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import org.apache.commons.lang3.ArrayUtils;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.ParseUtils;
import java.util.Map;
public class ValueDependencyDialogPreference extends DialogPreference implements OnSharedPreferenceChangeListener {
private final String mDependencyKey, mDependencyValueDefault;
private final String[] mDependencyValues;
public ValueDependencyDialogPreference(final Context context) {
this(context, null);
}
public ValueDependencyDialogPreference(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.dialogPreferenceStyle);
}
public ValueDependencyDialogPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
final Resources res = context.getResources();
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ValueDependencyPreference, defStyle, 0);
mDependencyKey = a.getString(R.styleable.ValueDependencyPreference_dependencyKey);
final int dependencyValueRes = a.getResourceId(R.styleable.ValueDependencyPreference_dependencyValues, 0);
mDependencyValues = dependencyValueRes > 0 ? res.getStringArray(dependencyValueRes) : null;
mDependencyValueDefault = a.getString(R.styleable.ValueDependencyPreference_dependencyValueDefault);
a.recycle();
}
@Override
public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) {
if (key.equals(mDependencyKey)) {
updateEnableState();
}
}
@Override
protected void notifyHierarchyChanged() {
super.notifyHierarchyChanged();
updateEnableState();
}
@Override
protected void onAttachedToHierarchy(@NonNull final PreferenceManager preferenceManager) {
super.onAttachedToHierarchy(preferenceManager);
final SharedPreferences prefs = getSharedPreferences();
if (prefs != null) {
prefs.registerOnSharedPreferenceChangeListener(this);
}
updateEnableState();
}
private void updateEnableState() {
final SharedPreferences prefs = getSharedPreferences();
if (prefs == null || mDependencyKey == null || mDependencyValues == null) return;
final Map<String, ?> all = prefs.getAll();
final String valueString = ParseUtils.parseString(all.get(mDependencyKey), mDependencyValueDefault);
setEnabled(ArrayUtils.contains(mDependencyValues, valueString));
}
}

View File

@ -1,93 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import org.apache.commons.lang3.ArrayUtils;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.ParseUtils;
import java.util.Map;
public class ValueDependencySeekBarDialogPreference extends SeekBarDialogPreference implements
OnSharedPreferenceChangeListener {
private final String mDependencyKey, mDependencyValueDefault;
private final String[] mDependencyValues;
public ValueDependencySeekBarDialogPreference(final Context context) {
this(context, null);
}
public ValueDependencySeekBarDialogPreference(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.dialogPreferenceStyle);
}
public ValueDependencySeekBarDialogPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
final Resources res = context.getResources();
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ValueDependencyPreference, defStyle, 0);
mDependencyKey = a.getString(R.styleable.ValueDependencyPreference_dependencyKey);
final int dependencyValueRes = a.getResourceId(R.styleable.ValueDependencyPreference_dependencyValues, 0);
mDependencyValues = dependencyValueRes > 0 ? res.getStringArray(dependencyValueRes) : null;
mDependencyValueDefault = a.getString(R.styleable.ValueDependencyPreference_dependencyValueDefault);
a.recycle();
}
@Override
public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) {
if (key.equals(mDependencyKey)) {
updateEnableState();
}
}
@Override
protected void notifyHierarchyChanged() {
super.notifyHierarchyChanged();
updateEnableState();
}
@Override
protected void onAttachedToHierarchy(@NonNull final PreferenceManager preferenceManager) {
super.onAttachedToHierarchy(preferenceManager);
final SharedPreferences prefs = getSharedPreferences();
if (prefs != null) {
prefs.registerOnSharedPreferenceChangeListener(this);
}
updateEnableState();
}
private void updateEnableState() {
final SharedPreferences prefs = getSharedPreferences();
if (prefs == null || mDependencyKey == null || mDependencyValues == null) return;
final Map<String, ?> all = prefs.getAll();
final String valueString = ParseUtils.parseString(all.get(mDependencyKey), mDependencyValueDefault);
setEnabled(ArrayUtils.contains(mDependencyValues, valueString));
}
}

View File

@ -22,6 +22,7 @@ package org.mariotaku.twidere.util;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
@ -994,6 +995,15 @@ public class ThemeUtils implements Constants {
}
}
public static void fixNightMode(Resources resources, Configuration newConfig) {
int currentNightMode = resources.getConfiguration().uiMode
& Configuration.UI_MODE_NIGHT_MASK;
if (currentNightMode == Configuration.UI_MODE_NIGHT_YES)
newConfig.uiMode = (newConfig.uiMode & ~Configuration.UI_MODE_NIGHT_MASK)
| Configuration.UI_MODE_NIGHT_YES;
}
public static final class ActionBarContextThemeWrapper extends android.support.v7.view.ContextThemeWrapper {

View File

@ -35,6 +35,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.app.AppCompatDelegateAccessor;
import android.support.v7.app.AppCompatPreferenceActivity;
import android.support.v7.view.ContextThemeWrapper;
import android.support.v7.widget.TwidereToolbar;
import android.util.AttributeSet;
@ -48,7 +49,6 @@ import android.widget.TextView;
import com.rengwuxian.materialedittext.MaterialEditText;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.AppCompatPreferenceActivity;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.support.ViewSupport;
import org.mariotaku.twidere.view.ProfileImageView;

View File

@ -17,10 +17,11 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<org.mariotaku.twidere.view.TintedStatusNativeActionModeAwareLayout xmlns:android="http://schemas.android.com/apk/res/android"
<org.mariotaku.twidere.view.TintedStatusNativeActionModeAwareLayout
android:id="@+id/main_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:setPadding="true">
@ -33,7 +34,7 @@
android:id="@+id/settings_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/twidere_action_bar_container" />
android:layout_below="@+id/twidere_action_bar_container"/>
<org.mariotaku.twidere.view.TwidereActionBarContainer
android:id="@+id/twidere_action_bar_container"
@ -42,13 +43,13 @@
android:layout_height="?actionBarSize"
android:layout_alignParentTop="true"
android:touchscreenBlocksFocus="true"
tools:ignore="UnusedAttribute" />
tools:ignore="UnusedAttribute"/>
<View
android:id="@+id/window_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/twidere_action_bar_container"
android:background="?android:windowContentOverlay" />
android:background="?android:windowContentOverlay"/>
</RelativeLayout>
</org.mariotaku.twidere.view.TintedStatusNativeActionModeAwareLayout>

View File

@ -1,167 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Twidere" parent="Theme.Compat.Base">
<!-- 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="android:windowNoTitle">true</item>
<item name="android:windowTitleStyle">@style/Widget.TextView.WindowTitle.NoDisplay</item>
<item name="darkTheme">true</item>
<!--<item name="android:windowNoDisplay">true</item>-->
</style>
</resources>

View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Twidere" parent="Theme.Compat.Base.Light">
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">#f8f8f8</item>
<!-- Twidere specific styles -->
<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.NoActionBar" parent="Theme.Compat.Base.Light.NoActionBar">
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">#f8f8f8</item>
<!-- Twidere specific styles -->
<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.DialogWhenLarge.NoActionBar" parent="Theme.Compat.Base.Light.DialogWhenLarge">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">false</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">#f8f8f8</item>
<!-- Twidere specific styles -->
<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.Dialog" parent="Theme.Compat.Base.Light.Dialog">
<!-- Custom view styles -->
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">@color/background_color_card_item_light</item>
<!-- Twidere specific styles -->
<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.Compose" parent="Theme.Compat.Base.Light.Dialog">
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">false</item>
<item name="android:actionModeStyle">@style/Widget.Twidere.ActionMode.Light</item>
<item name="android:windowNoTitle">true</item>
<item name="android:panelColorBackground">#e5e5e5</item>
<item name="android:dividerVertical">@drawable/divider_compose_vertical_light</item>
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowActionModeOverlay">false</item>
<!-- Custom view styles -->
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">@color/background_color_card_item_light</item>
<!-- Twidere specific styles -->
<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.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>
</style>
<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:windowTitleStyle">@style/Widget.TextView.WindowTitle.NoDisplay</item>
<!--<item name="android:windowNoDisplay">true</item>-->
</style>
</resources>

View File

@ -1,131 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.Twidere" parent="Theme.Compat.Base.Light">
<style name="Theme.Twidere" parent="Theme.Compat.Base">
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">#f8f8f8</item>
<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_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="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.Light.NoActionBar">
<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.Light.TextView.ListSeparator
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">#f8f8f8</item>
<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_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="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.Light.DialogWhenLarge">
<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.Light.TextView.ListSeparator
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">#f8f8f8</item>
<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_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="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.Light.Dialog">
<style name="Theme.Twidere.Dialog" parent="Theme.Compat.Base.Dialog">
<!-- Custom view styles -->
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">@color/background_color_card_item_light</item>
<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_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="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.Light.Dialog">
<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.Light</item>
<item name="android:actionModeStyle">@style/Widget.Twidere.ActionMode.Dark</item>
<item name="android:windowNoTitle">true</item>
<item name="android:panelColorBackground">#e5e5e5</item>
<item name="android:dividerVertical">@drawable/divider_compose_vertical_light</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.Light.TextView.ListSeparator
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
<item name="profileImageStyleLarge">@style/Widget.Light.ProfileImage.Large</item>
<item name="cardItemBackgroundColor">@color/background_color_card_item_light</item>
<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_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="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>
@ -137,13 +137,17 @@
<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_light</item>
<item name="textColorDrawerNamePrimary">?android:textColorPrimaryInverse</item>
<item name="textColorDrawerNameSecondary">?android:textColorSecondaryInverse</item>
<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">
@ -156,6 +160,8 @@
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowTitleStyle">@style/Widget.TextView.WindowTitle.NoDisplay</item>
<item name="darkTheme">true</item>
<!--<item name="android:windowNoDisplay">true</item>-->
</style>
@ -186,10 +192,12 @@
<item name="quoteIndicatorBackgroundColor">@color/quote_indicator_background_dark</item>
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
<item name="darkTheme">true</item>
</style>
<style name="Theme.Nyan" parent="Theme.Compat.Base.NoActionBar">
<item name="android:windowBackground">@color/nyan_background</item>
<item name="darkTheme">true</item>
</style>
</resources>

View File

@ -48,12 +48,12 @@
<PreferenceCategory
android:key="cat_other_settings"
android:title="@string/other_settings">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="notification_following_only"
android:summary="@string/following_only_summary"
android:title="@string/following_only"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="notification_mentions_only"
android:title="@string/mentions_only"/>

View File

@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/auto_refresh">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:disableDependentsState="false"
android:key="auto_refresh"
android:title="@string/auto_refresh"/>
@ -12,19 +12,19 @@
android:dependency="auto_refresh"
android:key="cat_refresh_content"
android:title="@string/content_to_refresh">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="auto_refresh_home_timeline"
android:title="@string/home"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="auto_refresh_mentions"
android:title="@string/mentions"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="auto_refresh_direct_messages"
android:title="@string/direct_messages"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="auto_refresh_trends"
android:title="@string/trends"/>
@ -35,7 +35,7 @@
<!--android:key="cat_streaming"-->
<!--android:title="@string/streaming">-->
<!--<org.mariotaku.twidere.preference.AutoFixSwitchPreference-->
<!--<SwitchPreference-->
<!--android:key="enable_streaming"-->
<!--android:title="@string/enable_streaming"/>-->

View File

@ -7,19 +7,19 @@
android:key="category_connectivity"
android:title="@string/connectivity">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="builtin_dns_resolver"
android:title="@string/builtin_dns_resolver"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:dependency="builtin_dns_resolver"
android:key="tcp_dns_query"
android:summary="@string/tcp_dns_query_summary"
android:title="@string/tcp_dns_query"/>
<org.mariotaku.twidere.preference.SummaryEditTextPreference
<EditTextPreference
android:dependency="builtin_dns_resolver"
android:dialogTitle="@string/dns_server"
android:inputType="textVisiblePassword"
@ -34,7 +34,7 @@
android:summary="@string/custom_host_mapping_summary"
android:title="@string/custom_host_mapping"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="retry_on_network_issue"
android:summary="@string/retry_on_network_issue_summary"
@ -43,38 +43,38 @@
<PreferenceCategory
android:key="category_proxy"
android:title="@string/proxy">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:disableDependentsState="false"
android:key="enable_proxy"
android:summary="@string/proxy_summary"
android:title="@string/proxy"/>
<org.mariotaku.twidere.preference.SummaryListPreference
<ListPreference
android:defaultValue="http"
android:dependency="enable_proxy"
android:entries="@array/entries_proxy_type"
android:entryValues="@array/values_proxy_type"
android:key="proxy_type"
android:title="@string/proxy_type"/>
<org.mariotaku.twidere.preference.SummaryEditTextPreference
<EditTextPreference
android:dependency="enable_proxy"
android:key="proxy_host"
android:singleLine="true"
android:title="@string/proxy_host"/>
<org.mariotaku.twidere.preference.SummaryEditTextPreference
<EditTextPreference
android:dependency="enable_proxy"
android:inputType="number"
android:key="proxy_port"
android:singleLine="true"
android:title="@string/proxy_port"/>
<org.mariotaku.twidere.preference.SummaryEditTextPreference
<EditTextPreference
android:dependency="enable_proxy"
android:inputType="textEmailAddress"
android:key="proxy_username"
android:singleLine="true"
android:title="@string/proxy_username"/>
<org.mariotaku.twidere.preference.AutoFixEditTextPreference
<EditTextPreference
android:dependency="enable_proxy"
android:inputType="textPassword"
android:key="proxy_password"
@ -95,18 +95,18 @@
android:key="category_tumbor"
android:title="@string/thumbor_integration">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="thumbor_enabled"
android:title="@string/thumbor_integration"/>
<org.mariotaku.twidere.preference.SummaryEditTextPreference
<EditTextPreference
android:dependency="thumbor_enabled"
android:inputType="textUri"
android:key="thumbor_address"
android:title="@string/server_address"/>
<org.mariotaku.twidere.preference.AutoFixEditTextPreference
<EditTextPreference
android:dependency="thumbor_enabled"
android:inputType="textVisiblePassword"
android:key="thumbor_security_key"

View File

@ -26,7 +26,7 @@
android:value="true"/>
</org.mariotaku.twidere.preference.SeekBarDialogPreference>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="display_profile_image"
android:order="23"
@ -34,9 +34,9 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
</SwitchPreference>
<org.mariotaku.twidere.preference.SummaryListPreference
<ListPreference
android:defaultValue="@string/default_profile_image_style"
android:entries="@array/entries_profile_image_style"
android:entryValues="@array/values_profile_image_style"
@ -46,9 +46,9 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.SummaryListPreference>
</ListPreference>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="media_preview"
android:order="25"
@ -56,7 +56,7 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
</SwitchPreference>
<org.mariotaku.twidere.preference.LinkHighlightPreference
android:defaultValue="none"
@ -68,7 +68,7 @@
android:value="true"/>
</org.mariotaku.twidere.preference.LinkHighlightPreference>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="compact_cards"
android:order="32"
@ -77,8 +77,8 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
</SwitchPreference>
<SwitchPreference
android:defaultValue="false"
android:key="hide_card_actions"
android:order="33"
@ -86,9 +86,9 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
</SwitchPreference>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="i_want_my_stars_back"
android:order="34"
@ -97,6 +97,6 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
</SwitchPreference>
</PreferenceScreen>

View File

@ -20,13 +20,13 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="quick_send"
android:summary="@string/quick_send_summary"
android:title="@string/quick_send"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="no_close_after_tweet_sent"
android:summary="@string/no_close_after_status_updated_summary"
@ -37,7 +37,7 @@
android:summary="@string/compose_now_summary"
android:title="@string/compose_now"/>
<org.mariotaku.twidere.preference.SummaryListPreference
<ListPreference
android:defaultValue="compose"
android:dependency="compose_now"
android:entries="@array/entries_compose_now_action"

View File

@ -8,7 +8,7 @@
android:key="category_content"
android:title="@string/content">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="name_first"
android:title="@string/name_first"
@ -17,7 +17,7 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
</SwitchPreference>
<org.mariotaku.twidere.preference.SeekBarDialogPreference
android:defaultValue="20"
@ -28,12 +28,12 @@
app:min="10"
app:step="5"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="remember_position"
android:summary="@string/remember_position_summary"
android:title="@string/remember_position"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="read_from_bottom"
android:summaryOff="@string/read_from_bottom_summary_off"
@ -73,12 +73,12 @@
<PreferenceCategory
android:key="category_safety"
android:title="@string/safety">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="phishing_link_warning"
android:summary="@string/phishing_link_warning_summary"
android:title="@string/phishing_link_warning"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="display_sensitive_contents"
android:summary="@string/display_sensitive_contents_summary"

View File

@ -7,12 +7,12 @@
android:key="image_preload_options"
android:title="@string/media_preload"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="preload_wifi_only"
android:title="@string/preload_wifi_only"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="bandwidth_saving_mode"
android:summary="@string/bandwidth_saving_mode_summary"

View File

@ -13,14 +13,14 @@
android:key="cat_general"
android:title="@string/general">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="combined_notifications"
android:summaryOff="@string/combined_notifications_summary_off"
android:summaryOn="@string/combined_notifications_summary_on"
android:title="@string/combined_notifications" />
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="pebble_notifications"
android:summary="@string/pebble_notifications_summary"

View File

@ -13,15 +13,14 @@
<PreferenceCategory
android:key="cat_general"
android:title="@string/general">
<org.mariotaku.twidere.preference.AutoInvalidateListPreference
<ListPreference
android:defaultValue="15"
android:entries="@array/entries_refresh_interval"
android:entryValues="@array/values_refresh_interval"
android:key="refresh_interval"
android:summary="%s"
android:title="@string/refresh_interval"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="true"
android:key="stop_auto_refresh_when_battery_low"
android:title="@string/stop_auto_refresh_when_battery_low"/>
@ -30,12 +29,12 @@
android:key="home_refresh"
android:title="@string/home_refresh"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="refresh_on_start"
android:summary="@string/refresh_on_start_summary"
android:title="@string/refresh_on_start"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="refresh_after_tweet"
android:summary="@string/refresh_after_status_updated_summary"

View File

@ -20,7 +20,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<org.mariotaku.twidere.preference.SummaryListPreference
<ListPreference
android:defaultValue="crop"
android:entries="@array/entries_media_preview_style"
android:entryValues="@array/values_media_preview_style"
@ -29,8 +29,8 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.SummaryListPreference>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
</ListPreference>
<SwitchPreference
android:defaultValue="false"
android:key="show_absolute_time"
android:summary="@string/show_absolute_time_summary"
@ -38,24 +38,24 @@
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
</SwitchPreference>
<SwitchPreference
android:defaultValue="true"
android:key="unread_count"
android:title="@string/unread_count">
<extra
android:name="notify_change"
android:value="true"/>
</org.mariotaku.twidere.preference.AutoFixSwitchPreference>
</SwitchPreference>
<org.mariotaku.twidere.preference.SummaryListPreference
<ListPreference
android:defaultValue="@string/default_tab_display_option"
android:entries="@array/entries_tab_display_option"
android:entryValues="@array/values_tab_display_option"
android:key="tab_display_option"
android:title="@string/tab_display_option"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="leftside_compose_button"
android:summary="@string/leftside_compose_button_summary"

View File

@ -22,11 +22,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/thumbor_integration">
<org.mariotaku.twidere.preference.AutoFixEditTextPreference
<EditTextPreference
android:inputType="textUri"
android:key="thumbor_address"
android:title="@string/server_address"/>
<org.mariotaku.twidere.preference.AutoFixEditTextPreference
<EditTextPreference
android:inputType="textVisiblePassword"
android:key="thumbor_security_key"
android:title="@string/security_key"/>

View File

@ -19,13 +19,13 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="false"
android:key="usage_statistics"
android:order="11"
android:title="@string/usage_statistics"/>
<org.mariotaku.twidere.preference.AutoFixSwitchPreference
<SwitchPreference
android:defaultValue="@bool/debug"
android:key="bug_reports"
android:order="12"