1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-16 17:32:08 +01:00
Rewrote ThemedSettings by inheriting Preference classes

Fixed issues pointed out by gsantner

Added back circle color picker preview to Settings and reflect color changes immediatelly :D

Removed some debug messages and unified usage of Themeable
This commit is contained in:
vanitasvitae 2016-10-25 17:04:32 +02:00
parent 6ad634cc5b
commit b9221099c2
20 changed files with 677 additions and 388 deletions

View file

@ -76,7 +76,7 @@ public class App extends Application {
// Clear avatar image // Clear avatar image
new AvatarImageLoader(this).clearAvatarImage(); new AvatarImageLoader(this).clearAvatarImage();
// Clear preferences // Clear preferences__master
appSettings.clearPodSettings(); appSettings.clearPodSettings();
// Clear cookies // Clear cookies

View file

@ -174,7 +174,7 @@ public class AboutActivity extends ThemedActivity
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
ThemeHelper.updateTextViewColor(aboutText); ThemeHelper.updateTextViewLinkColor(aboutText);
} }
@Override @Override
@ -258,8 +258,8 @@ public class AboutActivity extends ThemedActivity
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
ThemeHelper.updateTextViewColor(textLicense3partyBox); ThemeHelper.updateTextViewLinkColor(textLicense3partyBox);
ThemeHelper.updateTextViewColor(textLicenseBox); ThemeHelper.updateTextViewLinkColor(textLicenseBox);
} }
@Override @Override

View file

@ -1,21 +1,8 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.activity; package com.github.dfa.diaspora_android.activity;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.FragmentTransaction;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -23,24 +10,20 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.Window;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings; import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener; import com.github.dfa.diaspora_android.fragment.ThemedPreferenceFragment;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.ProxyHandler; import com.github.dfa.diaspora_android.util.ProxyHandler;
@ -53,9 +36,13 @@ import uz.shift.colorpicker.LineColorPicker;
import uz.shift.colorpicker.OnColorChangedListener; import uz.shift.colorpicker.OnColorChangedListener;
/** /**
* @author vanitas * SettingsActivity
* Created by vanitas on 24.10.16.
*/ */
public class SettingsActivity extends ThemedActivity implements IntellihideToolbarActivityListener {
public class SettingsActivity extends ThemedActivity {
//Toolbar
@BindView(R.id.settings__appbar) @BindView(R.id.settings__appbar)
protected AppBarLayout appBarLayout; protected AppBarLayout appBarLayout;
@ -64,13 +51,13 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
private ProxyHandler.ProxySettings oldProxySettings; private ProxyHandler.ProxySettings oldProxySettings;
public void onCreate(Bundle b) {
@Override super.onCreate(b);
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings__activity); setContentView(R.layout.settings__activity);
ButterKnife.bind(this); ButterKnife.bind(this);
toolbar.setTitle(R.string.settings);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px)); toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
toolbar.setNavigationOnClickListener(new View.OnClickListener() { toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override @Override
@ -78,139 +65,131 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
SettingsActivity.this.onBackPressed(); SettingsActivity.this.onBackPressed();
} }
}); });
oldProxySettings = getAppSettings().getProxySettings(); oldProxySettings = getAppSettings().getProxySettings();
getFragmentManager().beginTransaction().replace(R.id.settings__fragment_container, new SettingsFragment()).commit(); showFragment(SettingsFragmentMaster.TAG, false);
} }
@Override protected void showFragment(String tag, boolean addToBackStack) {
public boolean onOptionsItemSelected(MenuItem menuItem) { PreferenceFragment fragment = (PreferenceFragment) getFragmentManager().findFragmentByTag(tag);
switch (menuItem.getItemId()) { if(fragment == null) {
case android.R.id.home: switch (tag) {
onBackPressed(); case SettingsFragmentThemes.TAG:
return true; fragment = new SettingsFragmentThemes();
break;
case SettingsFragmentNavSlider.TAG:
fragment = new SettingsFragmentNavSlider();
break;
case SettingsFragmentProxy.TAG:
fragment = new SettingsFragmentProxy();
break;
case SettingsFragmentDebugging.TAG:
fragment = new SettingsFragmentDebugging();
break;
case SettingsFragmentMaster.TAG:
default: default:
return super.onOptionsItemSelected(menuItem); fragment = new SettingsFragmentMaster();
break;
} }
} }
FragmentTransaction t = getFragmentManager().beginTransaction();
if(addToBackStack) {
t.addToBackStack(tag);
}
t.replace(R.id.settings__fragment_container, fragment, tag).commit();
}
@Override @Override
protected void applyColorToViews() { public void applyColorToViews() {
//Toolbar
ThemeHelper.updateToolbarColor(toolbar); ThemeHelper.updateToolbarColor(toolbar);
} }
@Override @Override
public void enableToolbarHiding() { protected void onStop() {
AppLog.d(this, "Enable Intellihide"); ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings();
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams(); if (!oldProxySettings.equals(newProxySettings)) {
//scroll|enterAlways|snap AppLog.d(this, "ProxySettings changed.");
params.setScrollFlags(toolbarDefaultScrollFlags); //Proxy on-off? => Restart app
appBarLayout.setExpanded(true, true); if (oldProxySettings.isEnabled() && !newProxySettings.isEnabled()) {
AppLog.d(this, "Proxy deactivated. Restarting app...");
Intent restartActivity = new Intent(SettingsActivity.this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(SettingsActivity.this, 12374, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) SettingsActivity.this.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent);
System.exit(0);
} //Proxy changed? => Update
else {
ProxyHandler.getInstance().updateProxySettings(this);
}
}
super.onStop();
} }
@Override public static class SettingsFragmentMaster extends ThemedPreferenceFragment {
public void disableToolbarHiding() { public static final String TAG = "com.github.dfa.diaspora_android.settings.SettingsFragmentMaster";
AppLog.d(this, "Disable Intellihide");
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
params.setScrollFlags(0); // clear all scroll flags
appBarLayout.setExpanded(true, true);
}
public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
private SharedPreferences sharedPreferences;
public void onCreate(Bundle savedInstances) { public void onCreate(Bundle savedInstances) {
super.onCreate(savedInstances); super.onCreate(savedInstances);
getPreferenceManager().setSharedPreferencesName("app"); getPreferenceManager().setSharedPreferencesName("app");
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences__master);
sharedPreferences = getPreferenceScreen().getSharedPreferences();
sharedPreferences.registerOnSharedPreferenceChangeListener(this);
setPreferenceSummaries();
sharedPreferences.edit().putBoolean(getString(R.string.pref_key__proxy_was_enabled),
sharedPreferences.getBoolean(getString(R.string.pref_key__http_proxy_enabled), false)).apply();
}
private void setPreferenceSummaries() {
String[] editTextKeys = new String[]{
getString(R.string.pref_key__http_proxy_host), getString(R.string.pref_key__http_proxy_port)
};
for (String key : editTextKeys) {
EditTextPreference p = (EditTextPreference) findPreference(key);
p.setSummary(p.getText());
}
} }
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void updateViewColors() {
updatePreference(findPreference(key));
if(isAdded()) {
if (key.equals(getString(R.string.pref_key__intellihide_toolbars))) {
if (sharedPreferences.getBoolean(getString(R.string.pref_key__intellihide_toolbars), false)) {
((SettingsActivity) getActivity()).enableToolbarHiding();
} else {
((SettingsActivity) getActivity()).disableToolbarHiding();
}
}
}
}
private void updatePreference(Preference preference) {
if (preference == null) {
return;
}
if (preference instanceof EditTextPreference) {
EditTextPreference textPref = (EditTextPreference) preference;
textPref.setSummary(textPref.getText());
return;
}
if (preference instanceof ListPreference) {
ListPreference listPref = (ListPreference) preference;
listPref.setSummary(listPref.getEntry());
}
} }
@Override @Override
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) { public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
App app = ((App) getActivity().getApplication()); if(isAdded() && preference.hasKey()) {
AppSettings appSettings = app.getSettings(); DiasporaUrlHelper diasporaUrlHelper = new DiasporaUrlHelper(((App)getActivity().getApplication()).getSettings());
if (Build.VERSION.SDK_INT >= 21) { String key = preference.getKey();
if (preference instanceof PreferenceScreen && ((PreferenceScreen) preference).getDialog() != null) { /** Sub-Categories */
Window window = ((PreferenceScreen) preference).getDialog().getWindow(); if(key.equals(getString(R.string.pref_key__cat_themes))) {
if (window != null) { ((SettingsActivity) getActivity()).showFragment(SettingsFragmentThemes.TAG, true);
window.setStatusBarColor(ThemeHelper.getPrimaryDarkColor()); return true;
} else if (key.equals(getString(R.string.pref_key__cat_nav_slider))) {
((SettingsActivity) getActivity()).showFragment(SettingsFragmentNavSlider.TAG, true);
return true;
} else if (key.equals(getString(R.string.pref_key__cat_proxy))) {
((SettingsActivity)getActivity()).showFragment(SettingsFragmentProxy.TAG, true);
return true;
} else if (key.equals(getString(R.string.pref_key__cat_debugging))) {
((SettingsActivity)getActivity()).showFragment(SettingsFragmentDebugging.TAG, true);
return true;
} }
} /** Network */
} else if (key.equals(getString(R.string.pref_key__clear_cache))) {
Intent intent = new Intent(getActivity(), MainActivity.class); Intent intent = new Intent(getActivity(), MainActivity.class);
DiasporaUrlHelper diasporaUrlHelper = new DiasporaUrlHelper(app.getSettings()); intent.setAction(MainActivity.ACTION_CLEAR_CACHE);
startActivity(intent);
switch (preference.getTitleRes()) { getActivity().finish();
case R.string.pref_title__primary_color: { return true;
showColorPickerDialog(1);
intent = null;
break;
} }
case R.string.pref_title__accent_color: { /** Pod Settings */
showColorPickerDialog(2); if (key.equals(getString(R.string.pref_key__personal_settings))) {
intent = null; Intent intent = new Intent(getActivity(), MainActivity.class);
break;
}
case R.string.pref_title__personal_settings: {
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getPersonalSettingsUrl()); intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getPersonalSettingsUrl());
break; startActivity(intent);
} getActivity().finish();
case R.string.pref_title__manage_tags: { return true;
} else if (key.equals(getString(R.string.pref_key__manage_tags))) {
Intent intent = new Intent(getActivity(), MainActivity.class);
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getManageTagsUrl()); intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getManageTagsUrl());
break; startActivity(intent);
} getActivity().finish();
case R.string.pref_title__manage_contacts: { return true;
} else if (key.equals(getString(R.string.pref_key__manage_contacts))) {
Intent intent = new Intent(getActivity(), MainActivity.class);
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getManageContactsUrl()); intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getManageContactsUrl());
break; startActivity(intent);
} getActivity().finish();
case R.string.pref_title__change_account: { return true;
} else if (key.equals(getString(R.string.pref_key__change_account))) {
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.confirmation)) .setTitle(getString(R.string.confirmation))
.setMessage(getString(R.string.pref_warning__change_account)) .setMessage(getString(R.string.pref_warning__change_account))
@ -226,27 +205,42 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
}) })
.show(); .show();
return true; return true;
}
}
return super.onPreferenceTreeClick(screen, preference);
} }
case R.string.pref_title__http_proxy_load_tor_preset: {
((EditTextPreference) findPreference(getString(R.string.pref_key__http_proxy_host))).setText("127.0.0.1");
((EditTextPreference) findPreference(getString(R.string.pref_key__http_proxy_port))).setText("8118");
return true;
} }
case R.string.pref_title__clear_cache: { public static class SettingsFragmentThemes extends ThemedPreferenceFragment {
intent.setAction(MainActivity.ACTION_CLEAR_CACHE); public static final String TAG = "com.github.dfa.diaspora_android.settings.SettingsFragmentThemes";
break;
public void onCreate(Bundle savedInstances) {
super.onCreate(savedInstances);
getPreferenceManager().setSharedPreferencesName("app");
addPreferencesFromResource(R.xml.preferences__sub_themes);
} }
default: { @Override
intent = null; public void updateViewColors() {
break; if(isAdded()) {
//Trigger redraw of whole preference screen in order to reflect changes
setPreferenceScreen(null);
addPreferencesFromResource(R.xml.preferences__sub_themes);
} }
} }
if (intent != null) {
startActivity(intent); @Override
getActivity().finish(); public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
if (isAdded() && preference.hasKey()) {
String key = preference.getKey();
if(key.equals(getString(R.string.pref_key__primary_color__preference_click))) {
showColorPickerDialog(1);
return true; return true;
} else if (key.equals(getString(R.string.pref_key__accent_color__preference_click))) {
showColorPickerDialog(2);
return true;
}
} }
return super.onPreferenceTreeClick(screen, preference); return super.onPreferenceTreeClick(screen, preference);
} }
@ -282,12 +276,13 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
base.setOnColorChangedListener(new OnColorChangedListener() { base.setOnColorChangedListener(new OnColorChangedListener() {
@Override @Override
public void onColorChanged(int i) { public void onColorChanged(int i) {
AppLog.d(this, "Selected Base color changed: " + i);
shade.setColors(ColorPalette.getColors(context, i)); shade.setColors(ColorPalette.getColors(context, i));
titleBackground.setBackgroundColor(i); titleBackground.setBackgroundColor(i);
if (i == current[0]) { if (i == current[0]) {
shade.setSelectedColor(current[1]); shade.setSelectedColor(current[1]);
titleBackground.setBackgroundColor(shade.getColor()); titleBackground.setBackgroundColor(shade.getColor());
} else {
shade.setSelectedColor(i);
} }
} }
}); });
@ -313,38 +308,94 @@ public class SettingsActivity extends ThemedActivity implements IntellihideToolb
} else { } else {
appSettings.setAccentColorSettings(base.getColor(), shade.getColor()); appSettings.setAccentColorSettings(base.getColor(), shade.getColor());
} }
updateViewColors();
} }
}).show(); }).show();
} }
} }
@Override public static class SettingsFragmentNavSlider extends ThemedPreferenceFragment {
protected void onPause() { public static final String TAG = "com.github.dfa.diaspora_android.settings.SettingsFragmentNavSlider";
super.onPause();
// Reset logging public void onCreate(Bundle savedInstances) {
AppSettings settings = new AppSettings(getApplicationContext()); super.onCreate(savedInstances);
AppLog.setLoggingEnabled(settings.isLoggingEnabled()); getPreferenceManager().setSharedPreferencesName("app");
AppLog.setLoggingSpamEnabled(settings.isLoggingSpamEnabled()); addPreferencesFromResource(R.xml.preferences__sub_navslider_vis);
} }
@Override @Override
protected void onStop() { public void updateViewColors() {
ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings();
if (!oldProxySettings.equals(newProxySettings)) {
AppLog.d(this, "ProxySettings changed.");
//Proxy on-off? => Restart app
if (oldProxySettings.isEnabled() && !newProxySettings.isEnabled()) {
Intent restartActivity = new Intent(SettingsActivity.this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(SettingsActivity.this, 12374, restartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) SettingsActivity.this.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent);
System.exit(0);
} //Proxy changed? => Update
else {
ProxyHandler.getInstance().updateProxySettings(this);
} }
} }
super.onStop();
public static class SettingsFragmentProxy extends ThemedPreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
public static final String TAG = "com.github.dfa.diaspora_android.settings.SettingsFragmentProxy";
public void onCreate(Bundle savedInstances) {
super.onCreate(savedInstances);
getPreferenceManager().setSharedPreferencesName("app");
addPreferencesFromResource(R.xml.preferences__sub_proxy);
SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();
sharedPreferences.registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
updateSummaries();
}
public void updateSummaries() {
if(isAdded()) {
AppSettings appSettings = ((App) getActivity().getApplication()).getSettings();
findPreference(getString(R.string.pref_key__http_proxy_host)).setSummary(appSettings.getProxyHttpHost());
findPreference(getString(R.string.pref_key__http_proxy_port)).setSummary(Integer.toString(appSettings.getProxyHttpPort()));
}
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
if (isAdded() && preference.hasKey()) {
AppSettings appSettings = ((App) getActivity().getApplication()).getSettings();
String key = preference.getKey();
if(key.equals(getString(R.string.pref_key__http_proxy_load_tor_preset))) {
appSettings.setProxyHttpHost("127.0.0.1");
appSettings.setProxyHttpPort(8118);
return true;
}
}
return super.onPreferenceTreeClick(screen, preference);
}
@Override
public void updateViewColors() {
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
if(isAdded()) {
if (s.equals(getString(R.string.pref_key__http_proxy_host)) ||
s.equals(getString(R.string.pref_key__http_proxy_port))) {
updateSummaries();
}
}
}
}
public static class SettingsFragmentDebugging extends ThemedPreferenceFragment {
public static final String TAG = "com.github.dfa.diaspora_android.settings.SettingsFragmentDebugging";
public void onCreate(Bundle savedInstances) {
super.onCreate(savedInstances);
getPreferenceManager().setSharedPreferencesName("app");
addPreferencesFromResource(R.xml.preferences__sub_debugging);
}
@Override
public void updateViewColors() {
}
} }
} }

View file

@ -379,4 +379,8 @@ public class AppSettings {
public boolean isExtendedNotificationsActivated() { public boolean isExtendedNotificationsActivated() {
return getBoolean(prefApp, R.string.pref_key__extended_notifications, false); return getBoolean(prefApp, R.string.pref_key__extended_notifications, false);
} }
public int getColor(String key) {
return prefApp.getInt(key, context.getResources().getColor(R.color.primary));
}
} }

View file

@ -0,0 +1,42 @@
package com.github.dfa.diaspora_android.fragment;
import android.os.Build;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.view.Window;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
/**
* Created by vanitas on 24.10.16.
*/
public abstract class ThemedPreferenceFragment extends PreferenceFragment {
public abstract void updateViewColors();
@Override
public void onResume() {
super.onResume();
updateViewColors();
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
if(isAdded()) {
App app = ((App) getActivity().getApplication());
AppSettings appSettings = app.getSettings();
if (Build.VERSION.SDK_INT >= 21) {
if (preference instanceof PreferenceScreen && ((PreferenceScreen) preference).getDialog() != null) {
Window window = ((PreferenceScreen) preference).getDialog().getWindow();
if (window != null) {
ThemeHelper.getInstance(appSettings);
window.setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
}
}
}
}
return super.onPreferenceTreeClick(screen, preference);
}
}

View file

@ -0,0 +1,10 @@
package com.github.dfa.diaspora_android.ui;
/**
* Interface that allows setting Theme colors
* Created by vanitas on 24.10.16.
*/
public interface Themeable {
void setColors();
}

View file

@ -0,0 +1,45 @@
package com.github.dfa.diaspora_android.ui;
import android.content.Context;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
/**
* Created by vanitas on 24.10.16.
*/
public class ThemedCheckBoxPreference extends CheckBoxPreference implements Themeable {
protected View rootLayout;
@SuppressWarnings("unused")
public ThemedCheckBoxPreference(Context context) {
super(context);
}
@SuppressWarnings("unused")
public ThemedCheckBoxPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@SuppressWarnings("unused")
public ThemedCheckBoxPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected View onCreateView(ViewGroup parent) {
rootLayout = super.onCreateView(parent);
setColors();
return rootLayout;
}
@Override
public void setColors() {
CheckBox checkBox = (CheckBox) rootLayout.findViewById(android.R.id.checkbox);
ThemeHelper.getInstance(new AppSettings(getContext()));
ThemeHelper.updateCheckBoxColor(checkBox);
}
}

View file

@ -0,0 +1,50 @@
package com.github.dfa.diaspora_android.ui;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import com.github.dfa.diaspora_android.data.AppSettings;
/**
* Preference that shows selected Color in a circle
* Created by vanitas on 25.10.16.
*/
public class ThemedColorPickerPreference extends Preference implements Themeable {
protected ImageView colorPreview;
@SuppressWarnings("unused")
public ThemedColorPickerPreference(Context context) {
super(context);
}
@SuppressWarnings("unused")
public ThemedColorPickerPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@SuppressWarnings("unused")
public ThemedColorPickerPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onBindView(View view) {
super.onBindView(view);
colorPreview = (ImageView) view.findViewById(android.R.id.icon);
setColors();
}
@Override
public void setColors() {
AppSettings appSettings = new AppSettings(getContext());
if(colorPreview != null) {
Drawable circle = colorPreview.getDrawable();
if(circle != null) {
circle.setColorFilter(appSettings.getColor(getKey()), PorterDuff.Mode.SRC_ATOP);
}
}
}
}

View file

@ -0,0 +1,49 @@
package com.github.dfa.diaspora_android.ui;
import android.content.Context;
import android.preference.PreferenceCategory;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
/**
* PreferenceCategory with a colored title
* Created by vanitas on 24.10.16.
*/
public class ThemedPreferenceCategory extends PreferenceCategory implements Themeable {
protected TextView titleTextView;
@SuppressWarnings("unused")
public ThemedPreferenceCategory(Context context) {
super(context);
}
@SuppressWarnings("unused")
public ThemedPreferenceCategory(Context context, AttributeSet attrs) {
super(context, attrs);
}
@SuppressWarnings("unused")
public ThemedPreferenceCategory(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected View onCreateView(ViewGroup parent) {
View rootLayout = super.onCreateView(parent);
this.titleTextView = (TextView) rootLayout.findViewById(android.R.id.title);
setColors();
return rootLayout;
}
@Override
public void setColors() {
if(titleTextView != null) {
ThemeHelper.getInstance(new AppSettings(getContext()));
ThemeHelper.updateTextViewTextColor(titleTextView);
}
}
}

View file

@ -22,12 +22,10 @@ package com.github.dfa.diaspora_android.util.theming;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.os.Build; import android.os.Build;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.widget.CompoundButtonCompat; import android.support.v4.widget.CompoundButtonCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.View; import android.view.View;
@ -91,13 +89,19 @@ public class ThemeHelper {
} }
} }
public static void updateTextViewColor(TextView textView) { public static void updateTextViewLinkColor(TextView textView) {
if (textView != null) { if (textView != null) {
textView.setHighlightColor(getInstance().appSettings.getAccentColor()); textView.setHighlightColor(getInstance().appSettings.getAccentColor());
textView.setLinkTextColor(getInstance().appSettings.getAccentColor()); textView.setLinkTextColor(getInstance().appSettings.getAccentColor());
} }
} }
public static void updateTextViewTextColor(TextView textView) {
if(textView != null) {
textView.setTextColor(getInstance().appSettings.getAccentColor());
}
}
public static void updateToolbarColor(Toolbar toolbar) { public static void updateToolbarColor(Toolbar toolbar) {
if (toolbar != null) { if (toolbar != null) {
toolbar.setBackgroundColor(getInstance().appSettings.getPrimaryColor()); toolbar.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
@ -128,12 +132,6 @@ public class ThemeHelper {
return ColorPalette.getObscuredColor(getPrimaryColor()); return ColorPalette.getObscuredColor(getPrimaryColor());
} }
public static void updateActionBarColor(ActionBar actionBar) {
if (actionBar != null) {
actionBar.setBackgroundDrawable(new ColorDrawable(getInstance().appSettings.getPrimaryColor()));
}
}
public static void updateProgressBarColor(ProgressBar progressBar) { public static void updateProgressBarColor(ProgressBar progressBar) {
if (progressBar != null && progressBar.getProgressDrawable() != null) { if (progressBar != null && progressBar.getProgressDrawable() != null) {
progressBar.getProgressDrawable().setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN); progressBar.getProgressDrawable().setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN);

View file

@ -0,0 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/md_red_500"/>
<size android:width="@dimen/color_picker_circle_size" android:height="@dimen/color_picker_circle_size"/>
</shape>

View file

@ -22,7 +22,7 @@
<FrameLayout <FrameLayout
android:id="@+id/settings__fragment_container" android:id="@+id/settings__fragment_container"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />

View file

@ -15,4 +15,5 @@
<dimen name="textsize_badge_count">11sp</dimen> <dimen name="textsize_badge_count">11sp</dimen>
<dimen name="color_picker_circle_size">30dp</dimen>
</resources> </resources>

View file

@ -19,10 +19,10 @@
<string name="pref_key__extended_notifications" translatable="false">pref_key__extended_notifications</string> <string name="pref_key__extended_notifications" translatable="false">pref_key__extended_notifications</string>
<!-- Themes --> <!-- Themes -->
<string name="pref_key__primary_color__preference_click" translatable="false">pref_key_primary_color</string> <string name="pref_key__primary_color__preference_click" translatable="false">@string/pref_key__primary_color_shade</string>
<string name="pref_key__primary_color_base" translatable="false">pref_key_primary_color_base</string> <string name="pref_key__primary_color_base" translatable="false">pref_key_primary_color_base</string>
<string name="pref_key__primary_color_shade" translatable="false">pref_key_primary_color_shade</string> <string name="pref_key__primary_color_shade" translatable="false">pref_key_primary_color_shade</string>
<string name="pref_key__accent_color__preference_click" translatable="false">pref_key_accent_color</string> <string name="pref_key__accent_color__preference_click" translatable="false">@string/pref_key__accent_color_shade</string>
<string name="pref_key__accent_color_base" translatable="false">pref_key_accent_color_base</string> <string name="pref_key__accent_color_base" translatable="false">pref_key_accent_color_base</string>
<string name="pref_key__accent_color_shade" translatable="false">pref_key_accent_color_shade</string> <string name="pref_key__accent_color_shade" translatable="false">pref_key_accent_color_shade</string>
@ -151,4 +151,18 @@
<!-- Recently added - Please move to right section--> <!-- Recently added - Please move to right section-->
<!-- Sorry -->
<string name="pref_key__title__appearance" translatable="false">pref_key__title__appearance</string>
<string name="pref_key__title__pod_settings" translatable="false">pref_key__title__pod_settings</string>
<string name="pref_key__title__network" translatable="false">pref_key__title__network</string>
<string name="pref_key__title__more" translatable="false">pref_key__title__more</string>
<string name="pref_key__title__debugging" translatable="false">pref_key__title__debugging</string>
<string name="pref_key__title__visibility_nav" translatable="false">pref_key__title__visibility_nav</string>
<string name="pref_key__title__proxy" translatable="false">pref_key__title__proxy</string>
<string name="pref_key__title__themes" translatable="false">pref_key__title__themes</string>
<string name="pref_key__cat_themes" translatable="false">pref_key__cat_themes</string>
<string name="pref_key__cat_nav_slider" translatable="false">pref_key__cat_nav_slider</string>
<string name="pref_key__cat_proxy" translatable="false">pref_key__cat_proxy</string>
<string name="pref_key__cat_debugging" translatable="false">pref_key__cat_debugging</string>
</resources> </resources>

View file

@ -1,205 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Appearance -->
<PreferenceCategory
android:key="@string/pref_catkey__category_visuals"
android:title="@string/pref_cat__visuals">
<PreferenceScreen
android:summary="@string/pref_desc__sub_nav_slider"
android:title="@string/pref_title__sub_nav_slider">
<PreferenceCategory
android:key="@string/pref_catkey__visibility_nav"
android:title="@string/pref_cat__visibility_nav_items">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__profile"
android:title="@string/nav_profile"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__followed_tags"
android:title="@string/nav_followed_tags"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__aspects"
android:title="@string/nav_aspects"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__activities"
android:title="@string/nav_activities"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__liked"
android:title="@string/nav_liked"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__commented"
android:title="@string/nav_commented"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__mentions"
android:title="@string/nav_mentions"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__public_activities"
android:title="@string/nav_public_activities"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__exit"
android:title="@string/action_exit_app"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__help_license"
android:title="@string/nav_help_license"/>
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
android:title="@string/pref_title__themes"
android:summary="@string/pref_desc__themes" >
<Preference
android:key="@string/pref_key__primary_color__preference_click"
android:summary="@string/pref_desc__primary_color"
android:title="@string/pref_title__primary_color" />
<Preference
android:key="@string/pref_key__accent_color__preference_click"
android:summary="@string/pref_desc__accent_color"
android:title="@string/pref_title__accent_color" />
</PreferenceScreen>
<ListPreference
android:dialogTitle="@string/pref_title__font_size"
android:entries="@array/pref_entries__font_size"
android:entryValues="@array/pref_entries_values__font_size"
android:key="@string/pref_key__font_size"
android:summary="%s"
android:title="@string/pref_title__font_size"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__intellihide_toolbars"
android:summary="@string/pref_desc__intellihide_toolbars"
android:title="@string/pref_title__intellihide_toolbars"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__extended_notifications"
android:summary="@string/pref_desc__extended_notifications"
android:title="@string/pref_title__extended_notifications"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__append_shared_via_app"
android:summary="@string/pref_desc__append_shared_via_app"
android:title="@string/pref_title__append_shared_via_app"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__chrome_custom_tabs_enabled"
android:summary="@string/pref_desc__chrome_custom_tabs_enabled"
android:title="@string/pref_title__chrome_custom_tabs_enabled"/>
</PreferenceCategory>
<!-- Diaspora Pod Settings -->
<PreferenceCategory
android:key="@string/pref_catkey__pod_settings"
android:title="@string/pref_cat__pod_settings">
<Preference
android:key="@string/pref_key__personal_settings"
android:summary="@string/pref_desc__personal_settings"
android:title="@string/pref_title__personal_settings"/>
<Preference
android:key="@string/pref_key__manage_tags"
android:summary="@string/pref_desc__manage_tags"
android:title="@string/pref_title__manage_tags"/>
<Preference
android:key="@string/pref_key__manage_contacts"
android:summary="@string/pref_desc__manage_contacts"
android:title="@string/pref_title__manage_contacts"/>
<Preference
android:key="@string/pref_key__change_account"
android:summary="@string/pref_desc__change_account"
android:title="@string/pref_title__change_account"/>
</PreferenceCategory>
<!-- Networking -->
<PreferenceCategory
android:key="@string/pref_catkey__network"
android:title="@string/pref_cat__network">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__load_images"
android:summary="@string/pref_desc__load_images"
android:title="@string/pref_title__load_images"/>
<Preference
android:key="@string/pref_key__clear_cache"
android:summary="@string/pref_desc__clear_cache"
android:title="@string/pref_title__clear_cache"/>
<PreferenceScreen
android:summary="@string/pref_desc__sub_proxy"
android:title="@string/pref_title__sub_proxy">
<PreferenceCategory
android:title="@string/HTTP">
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__http_proxy_enabled"
android:summary="@string/pref_desc__http_proxy_enabled"
android:title="@string/pref_title__proxy_enabled"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="textNoSuggestions"
android:key="@string/pref_key__http_proxy_host"
android:title="@string/pref_title__http_proxy_host"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="number"
android:key="@string/pref_key__http_proxy_port"
android:title="@string/pref_title__http_proxy_port"/>
<Preference
android:icon="@drawable/tor_onion"
android:dependency="@string/pref_key__http_proxy_enabled"
android:key="@string/pref_key__http_proxy_load_tor_preset"
android:summary="@string/pref_desc__http_proxy_load_tor_preset"
android:title="@string/pref_title__http_proxy_load_tor_preset"/>
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>
<!-- More -->
<PreferenceCategory
android:key="@string/pref_catkey__category_more"
android:title="@string/pref_cat__more">
<PreferenceScreen
android:summary="@string/pref_desc__sub_logging"
android:title="@string/pref_title__sub_logging">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_enabled"
android:title="@string/pref_title__logging_enabled"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_spam_enabled"
android:title="@string/pref_title__logging_spam_enabled"/>
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Appearance -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__appearance"
android:title="@string/pref_cat__visuals">
<Preference
android:key="@string/pref_key__cat_themes"
android:title="@string/pref_title__themes"
android:summary="@string/pref_desc__themes" />
<Preference
android:key="@string/pref_key__cat_nav_slider"
android:summary="@string/pref_desc__sub_nav_slider"
android:title="@string/pref_title__sub_nav_slider" />
<ListPreference
android:dialogTitle="@string/pref_title__font_size"
android:entries="@array/pref_entries__font_size"
android:entryValues="@array/pref_entries_values__font_size"
android:key="@string/pref_key__font_size"
android:summary="%s"
android:title="@string/pref_title__font_size"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__intellihide_toolbars"
android:summary="@string/pref_desc__intellihide_toolbars"
android:title="@string/pref_title__intellihide_toolbars"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__extended_notifications"
android:summary="@string/pref_desc__extended_notifications"
android:title="@string/pref_title__extended_notifications"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__append_shared_via_app"
android:summary="@string/pref_desc__append_shared_via_app"
android:title="@string/pref_title__append_shared_via_app"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__chrome_custom_tabs_enabled"
android:summary="@string/pref_desc__chrome_custom_tabs_enabled"
android:title="@string/pref_title__chrome_custom_tabs_enabled"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
<!-- Diaspora Pod Settings -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__pod_settings"
android:title="@string/pref_cat__pod_settings">
<Preference
android:key="@string/pref_key__personal_settings"
android:summary="@string/pref_desc__personal_settings"
android:title="@string/pref_title__personal_settings"/>
<Preference
android:key="@string/pref_key__manage_tags"
android:summary="@string/pref_desc__manage_tags"
android:title="@string/pref_title__manage_tags"/>
<Preference
android:key="@string/pref_key__manage_contacts"
android:summary="@string/pref_desc__manage_contacts"
android:title="@string/pref_title__manage_contacts"/>
<Preference
android:key="@string/pref_key__change_account"
android:summary="@string/pref_desc__change_account"
android:title="@string/pref_title__change_account"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
<!-- Networking -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__network"
android:title="@string/pref_cat__network">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__load_images"
android:summary="@string/pref_desc__load_images"
android:title="@string/pref_title__load_images"/>
<Preference
android:key="@string/pref_key__clear_cache"
android:summary="@string/pref_desc__clear_cache"
android:title="@string/pref_title__clear_cache"/>
<Preference
android:key="@string/pref_key__cat_proxy"
android:summary="@string/pref_desc__sub_proxy"
android:title="@string/pref_title__sub_proxy" />
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
<!-- More -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__more"
android:title="@string/pref_cat__more">
<Preference
android:key="@string/pref_key__cat_debugging"
android:summary="@string/pref_desc__sub_logging"
android:title="@string/pref_title__sub_logging" />
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__debugging"
android:title="@string/pref_title__sub_logging">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_enabled"
android:title="@string/pref_title__logging_enabled"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_spam_enabled"
android:title="@string/pref_title__logging_spam_enabled"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__visibility_nav"
android:title="@string/pref_cat__visibility_nav_items">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__profile"
android:title="@string/nav_profile"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__followed_tags"
android:title="@string/nav_followed_tags"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__aspects"
android:title="@string/nav_aspects"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__activities"
android:title="@string/nav_activities"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__liked"
android:title="@string/nav_liked"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__commented"
android:title="@string/nav_commented"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__mentions"
android:title="@string/nav_mentions"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__public_activities"
android:title="@string/nav_public_activities"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__exit"
android:title="@string/action_exit_app"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__help_license"
android:title="@string/nav_help_license"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__proxy"
android:title="@string/HTTP">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__http_proxy_enabled"
android:summary="@string/pref_desc__http_proxy_enabled"
android:title="@string/pref_title__proxy_enabled"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="textNoSuggestions"
android:key="@string/pref_key__http_proxy_host"
android:title="@string/pref_title__http_proxy_host"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="number"
android:key="@string/pref_key__http_proxy_port"
android:title="@string/pref_title__http_proxy_port"/>
<Preference
android:icon="@drawable/tor_onion"
android:dependency="@string/pref_key__http_proxy_enabled"
android:key="@string/pref_key__http_proxy_load_tor_preset"
android:summary="@string/pref_desc__http_proxy_load_tor_preset"
android:title="@string/pref_title__http_proxy_load_tor_preset"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__themes"
android:title="@string/pref_title__themes">
<com.github.dfa.diaspora_android.ui.ThemedColorPickerPreference
android:key="@string/pref_key__primary_color__preference_click"
android:summary="@string/pref_desc__primary_color"
android:title="@string/pref_title__primary_color"
android:icon="@drawable/circle" />
<com.github.dfa.diaspora_android.ui.ThemedColorPickerPreference
android:key="@string/pref_key__accent_color__preference_click"
android:summary="@string/pref_desc__accent_color"
android:title="@string/pref_title__accent_color"
android:icon="@drawable/circle" />
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>