mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-31 08:54:57 +01:00
preferences migration
This commit is contained in:
parent
70668f0eaf
commit
b2ca6ae9da
@ -85,6 +85,8 @@ dependencies {
|
||||
compile 'com.android.support:appcompat-v7:23.2.1'
|
||||
compile 'com.android.support:cardview-v7:23.2.1'
|
||||
compile 'com.android.support:recyclerview-v7:23.2.1'
|
||||
compile 'com.android.support:preference-v7:23.2.1'
|
||||
compile 'com.android.support:preference-v14:23.2.1'
|
||||
compile 'com.twitter:twitter-text:1.13.0'
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
compile 'com.squareup:otto:1.3.8'
|
||||
|
@ -20,49 +20,27 @@
|
||||
package org.mariotaku.twidere.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.app.Fragment;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListAdapter;
|
||||
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.activity.support.BaseAppCompatActivity;
|
||||
import org.mariotaku.twidere.fragment.SettingsDetailsFragment;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.view.holder.ViewListHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class SettingsActivity extends BaseAppCompatActivity {
|
||||
|
||||
public class SettingsActivity extends BasePreferenceActivity {
|
||||
|
||||
private static final long HEADER_ID_RESTORE_ICON = 1001;
|
||||
private static final int RESULT_SETTINGS_CHANGED = 10;
|
||||
|
||||
private HeaderAdapter mAdapter;
|
||||
|
||||
private boolean mShouldNotifyChange;
|
||||
|
||||
public static void setShouldNotifyChange(Activity activity) {
|
||||
@ -70,43 +48,17 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
((SettingsActivity) activity).setShouldNotifyChange(true);
|
||||
}
|
||||
|
||||
public HeaderAdapter getHeaderAdapter() {
|
||||
if (mAdapter != null) return mAdapter;
|
||||
return mAdapter = new HeaderAdapter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeColor() {
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBuildHeaders(final List<Header> target) {
|
||||
loadHeadersFromResource(R.xml.settings_headers, target);
|
||||
final HeaderAdapter adapter = getHeaderAdapter();
|
||||
adapter.clear();
|
||||
adapter.addAll(target);
|
||||
final ComponentName main = new ComponentName(this, MainActivity.class);
|
||||
final PackageManager pm = getPackageManager();
|
||||
if (pm.getComponentEnabledSetting(main) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
|
||||
final Header restoreIconHeader = new Header();
|
||||
restoreIconHeader.titleRes = R.string.want_old_icon_back;
|
||||
restoreIconHeader.title = getString(restoreIconHeader.titleRes);
|
||||
restoreIconHeader.id = HEADER_ID_RESTORE_ICON;
|
||||
restoreIconHeader.intent = getIntent();
|
||||
adapter.add(restoreIconHeader);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidFragment(final String fragmentName) {
|
||||
final Class<?> cls;
|
||||
try {
|
||||
cls = Class.forName(fragmentName);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
return Fragment.class.isAssignableFrom(cls);
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SettingsDetailsFragment fragment = new SettingsDetailsFragment();
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(EXTRA_RESID, R.xml.preferences_network);
|
||||
fragment.setArguments(args);
|
||||
final FragmentManager fm = getSupportFragmentManager();
|
||||
final FragmentTransaction ft = fm.beginTransaction();
|
||||
ft.replace(android.R.id.content, fragment);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,48 +69,6 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeaderClick(@NonNull final Header header, final int position) {
|
||||
if (header.id == HEADER_ID_RESTORE_ICON) {
|
||||
final ComponentName main = new ComponentName(this, MainActivity.class);
|
||||
final ComponentName main2 = new ComponentName(this, MainHondaJOJOActivity.class);
|
||||
final PackageManager pm = getPackageManager();
|
||||
pm.setComponentEnabledSetting(main, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||
PackageManager.DONT_KILL_APP);
|
||||
pm.setComponentEnabledSetting(main2, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||
PackageManager.DONT_KILL_APP);
|
||||
Toast.makeText(this, R.string.icon_restored_message, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
super.onHeaderClick(header, position);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void startWithFragment(String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes) {
|
||||
Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes);
|
||||
if (resultTo == null) {
|
||||
startActivityForResult(intent, resultRequestCode);
|
||||
} else {
|
||||
resultTo.startActivityForResult(intent, resultRequestCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchToHeader(final String fragmentName, final Bundle args) {
|
||||
if (fragmentName == null) return;
|
||||
super.switchToHeader(fragmentName, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchToHeader(@NonNull final Header header) {
|
||||
if (header.fragment == null && header.intent == null) return;
|
||||
super.switchToHeader(header);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
@ -168,25 +78,9 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
}
|
||||
|
||||
private boolean isTopSettings() {
|
||||
return getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT) == null;
|
||||
return Boolean.parseBoolean("true");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.import_settings: {
|
||||
final Intent intent = new Intent(this, DataImportActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
case R.id.export_settings: {
|
||||
final Intent intent = new Intent(this, DataExportActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
@ -202,15 +96,6 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
super.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListAdapter(final ListAdapter adapter) {
|
||||
if (adapter == null) {
|
||||
super.setListAdapter(null);
|
||||
} else {
|
||||
super.setListAdapter(getHeaderAdapter());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event, int metaState) {
|
||||
final String action = handler.getKeyAction(CONTEXT_TAG_NAVIGATION, keyCode, event, metaState);
|
||||
@ -232,13 +117,6 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
return super.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
invalidateHeaders();
|
||||
}
|
||||
}
|
||||
|
||||
private void setShouldNotifyChange(boolean notify) {
|
||||
mShouldNotifyChange = notify;
|
||||
@ -252,13 +130,14 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
public void onBackPressed() {
|
||||
if (isTopSettings() && shouldNotifyChange()) {
|
||||
final RestartConfirmDialogFragment df = new RestartConfirmDialogFragment();
|
||||
df.show(getFragmentManager().beginTransaction(), "restart_confirm");
|
||||
df.show(getSupportFragmentManager(), "restart_confirm");
|
||||
return;
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public static class RestartConfirmDialogFragment extends DialogFragment implements DialogInterface.OnClickListener {
|
||||
public static class RestartConfirmDialogFragment extends BaseSupportDialogFragment implements DialogInterface.OnClickListener {
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
@ -285,172 +164,5 @@ public class SettingsActivity extends BasePreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private static class HeaderAdapter extends BaseAdapter {
|
||||
|
||||
static final int HEADER_TYPE_NORMAL = 0;
|
||||
static final int HEADER_TYPE_CATEGORY = 1;
|
||||
|
||||
private final Resources mResources;
|
||||
private final int mActionIconColor;
|
||||
private final ArrayList<Header> mHeaders;
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public HeaderAdapter(final Context context) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mHeaders = new ArrayList<>();
|
||||
mResources = context.getResources();
|
||||
mActionIconColor = ThemeUtils.getThemeForegroundColor(context);
|
||||
}
|
||||
|
||||
private static int getHeaderType(final Header header) {
|
||||
if (header.fragment != null || header.intent != null)
|
||||
return HEADER_TYPE_NORMAL;
|
||||
else return HEADER_TYPE_CATEGORY;
|
||||
|
||||
}
|
||||
|
||||
public void add(Header header) {
|
||||
mHeaders.add(header);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addAll(List<Header> headers) {
|
||||
mHeaders.addAll(headers);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mHeaders.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mHeaders.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Header getItem(final int position) {
|
||||
return mHeaders.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final Header header = getItem(position);
|
||||
final int viewType = getHeaderType(header);
|
||||
final View view = convertView != null ? convertView : inflateItemView(viewType, parent);
|
||||
switch (viewType) {
|
||||
case HEADER_TYPE_CATEGORY: {
|
||||
bindCategoryHeader(view, position, header);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
bindHeader(view, position, header);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areAllItemsEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(final int position) {
|
||||
return getItemViewType(position) == HEADER_TYPE_NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(final int position) {
|
||||
final Header header = getItem(position);
|
||||
return getHeaderType(header);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
private void bindCategoryHeader(View view, int position, Header header) {
|
||||
final TextView title = (TextView) view.findViewById(android.R.id.title);
|
||||
if (!TextUtils.isEmpty(header.title)) {
|
||||
title.setText(header.title);
|
||||
} else {
|
||||
title.setText(header.titleRes);
|
||||
}
|
||||
}
|
||||
|
||||
private void bindHeader(View view, int position, Header header) {
|
||||
final HeaderViewHolder holder;
|
||||
final Object tag = view.getTag();
|
||||
if (tag instanceof HeaderViewHolder) {
|
||||
holder = (HeaderViewHolder) tag;
|
||||
} else {
|
||||
holder = new HeaderViewHolder(view);
|
||||
view.setTag(holder);
|
||||
}
|
||||
final CharSequence title = header.getTitle(mResources);
|
||||
holder.title.setText(title);
|
||||
final CharSequence summary = header.getSummary(mResources);
|
||||
if (!TextUtils.isEmpty(summary)) {
|
||||
holder.summary.setVisibility(View.VISIBLE);
|
||||
holder.summary.setText(summary);
|
||||
} else {
|
||||
holder.summary.setVisibility(View.GONE);
|
||||
}
|
||||
if (header.iconRes != 0) {
|
||||
holder.icon.setImageResource(header.iconRes);
|
||||
} else {
|
||||
holder.icon.setImageDrawable(null);
|
||||
}
|
||||
holder.icon.setColorFilter(mActionIconColor, Mode.SRC_ATOP);
|
||||
|
||||
}
|
||||
|
||||
private int getCategoriesCount(final int start, final int end) {
|
||||
int categoriesCount = 0;
|
||||
for (int i = start; i < end; i++) {
|
||||
if (getHeaderType(mHeaders.get(i)) == HEADER_TYPE_CATEGORY) {
|
||||
categoriesCount++;
|
||||
}
|
||||
}
|
||||
return categoriesCount;
|
||||
}
|
||||
|
||||
private View inflateItemView(int viewType, ViewGroup parent) {
|
||||
final int layoutRes;
|
||||
switch (viewType) {
|
||||
case HEADER_TYPE_CATEGORY: {
|
||||
layoutRes = R.layout.list_item_preference_header_category;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
layoutRes = R.layout.list_item_preference_header_item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return mInflater.inflate(layoutRes, parent, false);
|
||||
}
|
||||
|
||||
private static class HeaderViewHolder extends ViewListHolder {
|
||||
private final TextView title, summary;
|
||||
private final ImageView icon;
|
||||
|
||||
HeaderViewHolder(final View view) {
|
||||
super(view);
|
||||
title = (TextView) findViewById(android.R.id.title);
|
||||
summary = (TextView) findViewById(android.R.id.summary);
|
||||
icon = (ImageView) findViewById(android.R.id.icon);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ public class SettingsWizardActivity extends BaseThemedActivity implements Consta
|
||||
final String key = preference.getKey();
|
||||
if (WIZARD_PREFERENCE_KEY_EDIT_CUSTOM_TABS.equals(key)) {
|
||||
final Intent intent = new Intent(getActivity(), SettingsActivity.class);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, CustomTabsFragment.class.getName());
|
||||
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, CustomTabsFragment.class.getName());
|
||||
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.tabs);
|
||||
startActivityForResult(intent, REQUEST_CUSTOM_TABS);
|
||||
} else if (WIZARD_PREFERENCE_KEY_USE_DEFAULTS.equals(key)) {
|
||||
|
@ -35,6 +35,7 @@ import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
@ -477,8 +478,8 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
||||
}
|
||||
case R.id.empty_tab_hint: {
|
||||
final Intent intent = new Intent(this, SettingsActivity.class);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, CustomTabsFragment.class.getName());
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.tabs);
|
||||
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, CustomTabsFragment.class.getName());
|
||||
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.tabs);
|
||||
startActivityForResult(intent, REQUEST_SETTINGS);
|
||||
break;
|
||||
}
|
||||
|
@ -20,25 +20,24 @@
|
||||
package org.mariotaku.twidere.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
import android.support.v7.preference.PreferenceManager;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.SettingsActivity;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
public class SettingsDetailsFragment extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public class SettingsDetailsFragment extends PreferenceFragmentCompat implements Constants,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
final PreferenceManager preferenceManager = getPreferenceManager();
|
||||
preferenceManager.setSharedPreferencesName(SHARED_PREFERENCES_NAME);
|
||||
final PreferenceScreen defaultScreen = getPreferenceScreen();
|
||||
final PreferenceScreen preferenceScreen;
|
||||
if (defaultScreen != null) {
|
||||
@ -48,6 +47,7 @@ public class SettingsDetailsFragment extends BasePreferenceFragment implements S
|
||||
preferenceScreen = preferenceManager.createPreferenceScreen(getActivity());
|
||||
}
|
||||
setPreferenceScreen(preferenceScreen);
|
||||
|
||||
final Bundle args = getArguments();
|
||||
final Object rawResId = args.get(EXTRA_RESID);
|
||||
final int resId;
|
||||
@ -61,20 +61,26 @@ public class SettingsDetailsFragment extends BasePreferenceFragment implements S
|
||||
if (resId != 0) {
|
||||
addPreferencesFromResource(resId);
|
||||
}
|
||||
final Context context = preferenceScreen.getContext();
|
||||
if (args.containsKey(EXTRA_SETTINGS_INTENT_ACTION)) {
|
||||
final Intent hiddenEntryIntent = new Intent(args.getString(EXTRA_SETTINGS_INTENT_ACTION));
|
||||
final PackageManager pm = context.getPackageManager();
|
||||
for (ResolveInfo info : pm.queryIntentActivities(hiddenEntryIntent, PackageManager.MATCH_DEFAULT_ONLY)) {
|
||||
final Preference preference = new Preference(context);
|
||||
final Intent intent = new Intent(hiddenEntryIntent);
|
||||
intent.setPackage(info.resolvePackageName);
|
||||
intent.setClassName(info.activityInfo.packageName, info.activityInfo.name);
|
||||
preference.setIntent(intent);
|
||||
preference.setTitle(info.loadLabel(pm));
|
||||
preferenceScreen.addPreference(preference);
|
||||
}
|
||||
}
|
||||
|
||||
// final Context context = preferenceScreen.getContext();
|
||||
// if (args.containsKey(EXTRA_SETTINGS_INTENT_ACTION)) {
|
||||
// final Intent hiddenEntryIntent = new Intent(args.getString(EXTRA_SETTINGS_INTENT_ACTION));
|
||||
// final PackageManager pm = context.getPackageManager();
|
||||
// for (ResolveInfo info : pm.queryIntentActivities(hiddenEntryIntent, PackageManager.MATCH_DEFAULT_ONLY)) {
|
||||
// final Preference preference = new Preference(context);
|
||||
// final Intent intent = new Intent(hiddenEntryIntent);
|
||||
// intent.setPackage(info.resolvePackageName);
|
||||
// intent.setClassName(info.activityInfo.packageName, info.activityInfo.name);
|
||||
// preference.setIntent(intent);
|
||||
// preference.setTitle(info.loadLabel(pm));
|
||||
// preferenceScreen.addPreference(preference);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,6 +23,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.SettingsActivity;
|
||||
@ -38,10 +39,10 @@ public class SecretCodeBroadcastReceiver extends BroadcastReceiver implements In
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(EXTRA_RESID, R.xml.preferences_hidden);
|
||||
args.putString(EXTRA_SETTINGS_INTENT_ACTION, INTENT_ACTION_HIDDEN_SETTINGS_ENTRY);
|
||||
testIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, cls);
|
||||
testIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
|
||||
testIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.hidden_settings);
|
||||
testIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_SHORT_TITLE, R.string.hidden_settings);
|
||||
testIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, cls);
|
||||
testIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
|
||||
testIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.hidden_settings);
|
||||
testIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_SHORT_TITLE, R.string.hidden_settings);
|
||||
testIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(testIntent);
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
<item name="coloredActionBar">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.NoActionBar" parent="Theme.Compat.Base.Light.NoActionBar">
|
||||
@ -40,6 +42,8 @@
|
||||
<item name="coloredActionBar">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
@ -78,5 +78,8 @@
|
||||
<item>HTTP</item>
|
||||
<!--<item>SOCKS</item>-->
|
||||
</string-array>
|
||||
<string-array name="entries_media_preload">
|
||||
<item>Wi-Fi</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -72,5 +72,8 @@
|
||||
<item>http</item>
|
||||
<!--<item>socks</item>-->
|
||||
</string-array>
|
||||
<string-array name="values_media_preload">
|
||||
<item>wifi</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -21,6 +21,8 @@
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.NoActionBar" parent="Theme.Compat.Base.NoActionBar">
|
||||
@ -45,6 +47,8 @@
|
||||
<item name="darkTheme">true</item>
|
||||
|
||||
<item name="asb_switchPreferenceStyle">@style/asb_Preference.SwitchPreference</item>
|
||||
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.DialogWhenLarge.NoActionBar" parent="Theme.Compat.Base.DialogWhenLarge">
|
||||
|
@ -3,8 +3,9 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/network">
|
||||
|
||||
<org.mariotaku.twidere.preference.ImagePreloadPreference
|
||||
android:key="image_preload_options"
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="media_preload"
|
||||
android:title="@string/media_preload"/>
|
||||
|
||||
<SwitchPreference
|
||||
|
Loading…
x
Reference in New Issue
Block a user