diff --git a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java index 57daf5a1..8e9281f0 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java @@ -22,6 +22,8 @@ import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod; import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod.DiasporaPodUrl; import com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference; +import com.github.dfa.diaspora_android.ui.ThemedIntEditTextPreference; +import com.github.dfa.diaspora_android.ui.ThemedStringEditTextPreference; import com.github.dfa.diaspora_android.util.ProxyHandler; import org.json.JSONException; @@ -465,12 +467,27 @@ public class AppSettings { setBool(prefApp, R.string.pref_key__extended_notifications, b); } - public boolean getThemedCheckboxPreferenceBoolean(ThemedCheckBoxPreference t) { + public boolean getThemedCheckboxPreferenceValue(ThemedCheckBoxPreference t) { return prefApp.getBoolean(t.getPrefKey(), t.getDefaultValue()); - //return getBoolean(prefApp, t.getPrefKey(), t.getDefaultValue()); } - public void setThemedCheckboxPreferenceBoolean(ThemedCheckBoxPreference t, boolean b) { + public void setThemedCheckboxPreferenceValue(ThemedCheckBoxPreference t, boolean b) { prefApp.edit().putBoolean(t.getPrefKey(), b).apply(); } + + public String getThemedStringEditTextPreferenceValue(ThemedStringEditTextPreference t) { + return prefApp.getString(t.getPrefKey(), t.getDefaultValue()); + } + + public void setThemedStringEditTextPreferenceValue(ThemedStringEditTextPreference t, String value) { + prefApp.edit().putString(t.getPrefKey(), value).apply(); + } + + public int getThemedIntEditTextPreferenceValue(ThemedIntEditTextPreference t) { + return prefApp.getInt(t.getPrefKey(), t.getDefaultValue()); + } + + public void setThemedIntEditTextPreferenceValue(ThemedIntEditTextPreference t, int value) { + prefApp.edit().putInt(t.getPrefKey(), value).apply(); + } } diff --git a/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Overview.java b/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Overview.java index 04e74da6..419859a2 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Overview.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Overview.java @@ -235,6 +235,7 @@ public class SettingsFragment__Overview extends ThemedSettingsFragment { } }) .show(); + break; } /** Network */ case R.id.settings_activity__clear_cache: { diff --git a/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Proxy.java b/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Proxy.java index d57a43ea..440309dc 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Proxy.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/fragment/SettingsFragment__Proxy.java @@ -30,12 +30,13 @@ import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.EditText; -import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference; +import com.github.dfa.diaspora_android.ui.ThemedIntEditTextPreference; +import com.github.dfa.diaspora_android.ui.ThemedStringEditTextPreference; import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.theming.ThemeHelper; @@ -54,19 +55,13 @@ public class SettingsFragment__Proxy extends ThemedSettingsFragment { protected TextView titleProxy; @BindView(R.id.settings_activity__proxy_enabled) - protected ThemedCheckBoxPreference checkboxProxyEna; + protected ThemedCheckBoxPreference checkboxProxyEnabled; @BindView(R.id.settings_activity__proxy_host) - protected LinearLayout optionProxyHost; - - @BindView(R.id.settings_activity__proxy_host_hint) - protected TextView hintProxyHost; + protected ThemedStringEditTextPreference editTextProxyHost; @BindView(R.id.settings_activity__proxy_port) - protected LinearLayout optionProxyPort; - - @BindView(R.id.settings_activity__proxy_port_hint) - protected TextView hintProxyPort; + protected ThemedIntEditTextPreference editTextProxyPort; @BindView(R.id.settings_activity__proxy_orbot_preset) protected RelativeLayout optionProxyOrbotPreset; @@ -82,56 +77,41 @@ public class SettingsFragment__Proxy extends ThemedSettingsFragment { @Override protected void applyColorToViews() { ThemeHelper.updateTitleColor(titleProxy); - optionProxyHost.setVisibility(getAppSettings().isProxyHttpEnabled() ? View.VISIBLE : View.GONE); - optionProxyPort.setVisibility(getAppSettings().isProxyHttpEnabled() ? View.VISIBLE : View.GONE); - optionProxyOrbotPreset.setVisibility(getAppSettings().isProxyHttpEnabled() ? View.VISIBLE : View.GONE); } @SuppressLint("SetTextI18n") @Override protected void applySettingsToViews() { - optionProxyHost.setEnabled(getAppSettings().isProxyHttpEnabled()); - hintProxyHost.setText(getAppSettings().getProxyHttpHost()); - optionProxyPort.setEnabled(getAppSettings().isProxyHttpEnabled()); - hintProxyPort.setText(""+getAppSettings().getProxyHttpPort()); - optionProxyOrbotPreset.setEnabled(getAppSettings().isProxyHttpEnabled()); + boolean enabled = getAppSettings().isProxyHttpEnabled(); + + editTextProxyHost.setVisibility(enabled ? View.VISIBLE : View.GONE); + editTextProxyHost.setEnabled(enabled); + editTextProxyPort.setVisibility(enabled ? View.VISIBLE : View.GONE); + editTextProxyPort.setEnabled(enabled); + optionProxyOrbotPreset.setVisibility(enabled ? View.VISIBLE : View.GONE); + optionProxyOrbotPreset.setEnabled(enabled); } @Override protected void setOnClickListenersOnViews() { - checkboxProxyEna.setOnCheckedChangedListener(new CompoundButton.OnCheckedChangeListener() { + optionProxyOrbotPreset.setOnClickListener(this); + checkboxProxyEnabled.setOnCheckedChangedListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { - optionProxyHost.setEnabled(b); - optionProxyPort.setEnabled(b); - optionProxyOrbotPreset.setEnabled(b); - optionProxyHost.setVisibility(b ? View.VISIBLE : View.GONE); - optionProxyPort.setVisibility(b ? View.VISIBLE : View.GONE); - optionProxyOrbotPreset.setVisibility(b ? View.VISIBLE : View.GONE); + AppLog.d(this, "Clicked: Proxy Enabled"); + applySettingsToViews(); } }); - optionProxyHost.setOnClickListener(this); - optionProxyPort.setOnClickListener(this); - optionProxyOrbotPreset.setOnClickListener(this); } @SuppressLint("SetTextI18n") @Override public void onClick(View view) { switch (view.getId()) { - case R.id.settings_activity__proxy_host: - showProxyHostDialog(); - break; - case R.id.settings_activity__proxy_port: - showProxyPortDialog(); - break; case R.id.settings_activity__proxy_orbot_preset: - final String presetHost = "localhost"; - final int presetPort = 8118; - getAppSettings().setProxyHttpHost(presetHost); - hintProxyHost.setText(presetHost); - getAppSettings().setProxyHttpPort(presetPort); - hintProxyPort.setText(""+presetPort); + AppLog.d(this, "Clicked: Proxy Preset"); + editTextProxyHost.setValue("localhost"); + editTextProxyPort.setValue(8118); break; } } @@ -150,38 +130,4 @@ public class SettingsFragment__Proxy extends ThemedSettingsFragment { public boolean onBackPressed() { return false; } - - protected void showProxyHostDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); - final EditText input = (EditText) getLayoutInflater(null).inflate(R.layout.settings_activity__dialog_proxy, null, false); - input.setInputType(InputType.TYPE_CLASS_TEXT); - input.setText(getAppSettings().getProxyHttpHost()); - ThemeHelper.updateEditTextColor(input); - builder.setTitle(R.string.pref_title__http_proxy_host) - .setView(input).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - getAppSettings().setProxyHttpHost(input.getText().toString()); - hintProxyHost.setText(input.getText()); - } - }).setNegativeButton(android.R.string.cancel, null).show(); - } - - @SuppressLint("SetTextI18n") - protected void showProxyPortDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); - final EditText input = (EditText) getLayoutInflater(null).inflate(R.layout.settings_activity__dialog_proxy, null, false); - input.setInputType(InputType.TYPE_CLASS_NUMBER); - input.setText(""+getAppSettings().getProxyHttpPort()); - ThemeHelper.updateEditTextColor(input); - builder.setTitle(R.string.pref_title__http_proxy_port) - .setView(input).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - getAppSettings().setProxyHttpPort(Integer.parseInt(input.getText().toString())); - hintProxyPort.setText(input.getText()); - } - }).setNegativeButton(android.R.string.cancel, null).show(); - } - } diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedCheckBoxPreference.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedCheckBoxPreference.java index b46c7d71..0ddf6945 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedCheckBoxPreference.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedCheckBoxPreference.java @@ -22,7 +22,7 @@ import butterknife.ButterKnife; * Created by vanitas on 23.10.16. */ -public class ThemedCheckBoxPreference extends RelativeLayout { +public class ThemedCheckBoxPreference extends RelativeLayout implements ThemedPreference { @BindView(R.id.preference__themed_checkbox__title) protected TextView title; @@ -76,7 +76,7 @@ public class ThemedCheckBoxPreference extends RelativeLayout { titleText = a.getString(R.styleable.ThemedCheckBoxPreference_titleText); summaryText = a.getString(R.styleable.ThemedCheckBoxPreference_summaryText); prefKey = a.getString(R.styleable.ThemedCheckBoxPreference_prefKey); - defaultValue = a.getBoolean(R.styleable.ThemedCheckBoxPreference_defaultValue, false); + defaultValue = a.getBoolean(R.styleable.ThemedCheckBoxPreference_defaultBoolean, false); } catch (Exception e) { AppLog.e(this, "There was an error loading attributes."); } finally { @@ -91,11 +91,11 @@ public class ThemedCheckBoxPreference extends RelativeLayout { if(summaryText == null || summaryText.equals("")) { summary.setVisibility(GONE); } - setChecked(appSettings.getThemedCheckboxPreferenceBoolean(this)); + setChecked(appSettings.getThemedCheckboxPreferenceValue(this)); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { - appSettings.setThemedCheckboxPreferenceBoolean(ThemedCheckBoxPreference.this, b); + appSettings.setThemedCheckboxPreferenceValue(ThemedCheckBoxPreference.this, b); if(externalOnCheckedChangedListener != null) { externalOnCheckedChangedListener.onCheckedChanged(compoundButton, b); } @@ -130,7 +130,17 @@ public class ThemedCheckBoxPreference extends RelativeLayout { return this.prefKey; } - public boolean getDefaultValue() { + public Boolean getDefaultValue() { return this.defaultValue; } + + @Override + public Boolean getValue() { + return appSettings.getThemedCheckboxPreferenceValue(this); + } + + @Override + public void setValue(Boolean value) { + appSettings.setThemedCheckboxPreferenceValue(this, value); + } } diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedIntEditTextPreference.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedIntEditTextPreference.java new file mode 100644 index 00000000..da8b6a4b --- /dev/null +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedIntEditTextPreference.java @@ -0,0 +1,161 @@ +package com.github.dfa.diaspora_android.ui; + +import android.content.Context; +import android.content.DialogInterface; +import android.content.res.TypedArray; +import android.support.v7.app.AlertDialog; +import android.text.InputType; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.github.dfa.diaspora_android.R; +import com.github.dfa.diaspora_android.data.AppSettings; +import com.github.dfa.diaspora_android.util.AppLog; + +import butterknife.BindView; +import butterknife.ButterKnife; + +/** + * Customizable EditTextPreference-like class + * Created by vanitas on 23.10.16. + */ + +public class ThemedIntEditTextPreference extends LinearLayout implements ThemedPreference { + @BindView(R.id.preference__themed_edittext_title) + protected TextView title; + @BindView(R.id.preference__themed_edittext_summary) + protected TextView summary; + + protected String prefKey; + protected int defaultValue; + protected AppSettings appSettings; + protected boolean showValueInSummary; + protected OnPositiveButtonClickedListener onPositiveButtonClickedListener; + + public ThemedIntEditTextPreference(Context context) { + super(context); + init(context, null, 0); + } + + public ThemedIntEditTextPreference(Context context, AttributeSet attrs) { + super(context, attrs); + init(context, attrs, 0); + } + + public ThemedIntEditTextPreference(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(context, attrs, defStyle); + } + + protected void init(final Context context, AttributeSet attrs, int defStyle) { + appSettings = new AppSettings(context.getApplicationContext()); + View.inflate(context, R.layout.preference__themed_edittext, this); + ButterKnife.bind(this); + setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS); + + // Assign custom attributes + if (attrs != null) { + String titleText = ""; + String summaryText = ""; + + TypedArray a = context.obtainStyledAttributes( + attrs, + R.styleable.ThemedIntEditTextPreference, + defStyle, 0); + try { + titleText = a.getString(R.styleable.ThemedIntEditTextPreference_titleText); + summaryText = a.getString(R.styleable.ThemedIntEditTextPreference_summaryText); + prefKey = a.getString(R.styleable.ThemedIntEditTextPreference_prefKey); + defaultValue = a.getInt(R.styleable.ThemedIntEditTextPreference_defaultInt, 0); + showValueInSummary = a.getBoolean(R.styleable.ThemedIntEditTextPreference_showValueInSummary, false); + } catch (Exception e) { + AppLog.e(this, "There was an error loading attributes."); + } finally { + a.recycle(); + } + final String finalTitle = titleText; + + AppLog.d(this, "ShowValueInSummary: "+showValueInSummary + " port: "+appSettings.getProxyHttpPort()); + setTitleText(titleText); + setSummaryText(showValueInSummary ? ""+appSettings.getThemedIntEditTextPreferenceValue(this) : summaryText); + setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + AppLog.d(this, "Click!"); + showDialog(context, finalTitle); + } + }); + } + } + + public void showDialog(Context context, String title) { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + final EditText dialogLayout = (EditText) LayoutInflater.from(context).inflate(R.layout.settings_activity__dialog_proxy, null, false); + dialogLayout.setInputType(InputType.TYPE_CLASS_NUMBER); + dialogLayout.setText(""+appSettings.getThemedIntEditTextPreferenceValue(this)); + builder.setTitle(title) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + setValue(Integer.valueOf(dialogLayout.getText().toString())); + if(onPositiveButtonClickedListener != null) { + onPositiveButtonClickedListener.onPositiveButtonClicked(Integer.valueOf(dialogLayout.getText().toString())); + } + } + }).setNegativeButton(android.R.string.cancel, null) + .setView(dialogLayout) + .show(); + } + + public void setTitleText(String titleText) { + this.title.setText(titleText); + if(titleText == null || titleText.equals("")) { + title.setVisibility(GONE); + } else { + title.setVisibility(VISIBLE); + } + } + + public void setSummaryText(String summaryText) { + this.summary.setText(summaryText); + if(summaryText == null || summaryText.equals("")) { + summary.setVisibility(GONE); + } else { + title.setVisibility(VISIBLE); + } + } + + @Override + public Integer getDefaultValue() { + return defaultValue; + } + + @Override + public Integer getValue() { + return appSettings.getThemedIntEditTextPreferenceValue(this); + } + + @Override + public void setValue(Integer value) { + appSettings.setThemedIntEditTextPreferenceValue(this, value); + if(showValueInSummary) { + setSummaryText(""+value); + } + } + + public String getPrefKey() { + return this.prefKey; + } + + public void setOnPositiveButtonClickedListener(OnPositiveButtonClickedListener listener) { + this.onPositiveButtonClickedListener = listener; + } + + public interface OnPositiveButtonClickedListener { + void onPositiveButtonClicked(int input); + } +} diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedPreference.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedPreference.java new file mode 100644 index 00000000..f51416e9 --- /dev/null +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedPreference.java @@ -0,0 +1,14 @@ +package com.github.dfa.diaspora_android.ui; + +/** + * Created by vanitas on 23.10.16. + */ + +public interface ThemedPreference { + String getPrefKey(); + void setTitleText(String titleText); + void setSummaryText(String summaryText); + T getDefaultValue(); + T getValue(); + void setValue(T value); +} diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedStringEditTextPreference.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedStringEditTextPreference.java new file mode 100644 index 00000000..7bb12f47 --- /dev/null +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/ThemedStringEditTextPreference.java @@ -0,0 +1,159 @@ +package com.github.dfa.diaspora_android.ui; + +import android.content.Context; +import android.content.DialogInterface; +import android.content.res.TypedArray; +import android.support.v7.app.AlertDialog; +import android.text.InputType; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.github.dfa.diaspora_android.R; +import com.github.dfa.diaspora_android.data.AppSettings; +import com.github.dfa.diaspora_android.util.AppLog; + +import butterknife.BindView; +import butterknife.ButterKnife; + +/** + * Customizable EditTextPreference-like class + * Created by vanitas on 23.10.16. + */ + +public class ThemedStringEditTextPreference extends LinearLayout implements ThemedPreference { + @BindView(R.id.preference__themed_edittext_title) + protected TextView title; + @BindView(R.id.preference__themed_edittext_summary) + protected TextView summary; + + protected String prefKey; + protected String defaultValue; + protected AppSettings appSettings; + protected boolean showValueInSummary; + protected OnPositiveButtonClickedListener onPositiveButtonClickedListener; + + public ThemedStringEditTextPreference(Context context) { + super(context); + init(context, null, 0); + } + + public ThemedStringEditTextPreference(Context context, AttributeSet attrs) { + super(context, attrs); + init(context, attrs, 0); + } + + public ThemedStringEditTextPreference(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(context, attrs, defStyle); + } + + protected void init(final Context context, AttributeSet attrs, int defStyle) { + appSettings = new AppSettings(context.getApplicationContext()); + View.inflate(context, R.layout.preference__themed_edittext, this); + ButterKnife.bind(this); + setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS); + + // Assign custom attributes + if (attrs != null) { + String titleText = ""; + String summaryText = ""; + + TypedArray a = context.obtainStyledAttributes( + attrs, + R.styleable.ThemedStringEditTextPreference, + defStyle, 0); + try { + titleText = a.getString(R.styleable.ThemedStringEditTextPreference_titleText); + summaryText = a.getString(R.styleable.ThemedStringEditTextPreference_summaryText); + prefKey = a.getString(R.styleable.ThemedStringEditTextPreference_prefKey); + defaultValue = a.getString(R.styleable.ThemedStringEditTextPreference_defaultString); + showValueInSummary = a.getBoolean(R.styleable.ThemedStringEditTextPreference_showValueInSummary, false); + } catch (Exception e) { + AppLog.e(this, "There was an error loading attributes."); + } finally { + a.recycle(); + } + final String finalTitle = titleText; + + setTitleText(titleText); + setSummaryText(showValueInSummary ? appSettings.getThemedStringEditTextPreferenceValue(this) : summaryText); + setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + showDialog(context, finalTitle); + } + }); + } + } + + public void showDialog(Context context, String title) { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + final EditText dialogLayout = (EditText) LayoutInflater.from(context).inflate(R.layout.settings_activity__dialog_proxy, null, false); + dialogLayout.setInputType(InputType.TYPE_CLASS_TEXT); + dialogLayout.setText(appSettings.getThemedStringEditTextPreferenceValue(this)); + builder.setTitle(title) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + setValue(dialogLayout.getText().toString()); + if(onPositiveButtonClickedListener != null) { + onPositiveButtonClickedListener.onPositiveButtonClicked(dialogLayout.getText().toString()); + } + } + }).setNegativeButton(android.R.string.cancel, null) + .setView(dialogLayout) + .show(); + } + + public void setTitleText(String titleText) { + this.title.setText(titleText); + if(titleText == null || titleText.equals("")) { + title.setVisibility(GONE); + } else { + title.setVisibility(VISIBLE); + } + } + + public void setSummaryText(String summaryText) { + this.summary.setText(summaryText); + if(summaryText == null || summaryText.equals("")) { + summary.setVisibility(GONE); + } else { + title.setVisibility(VISIBLE); + } + } + + @Override + public String getDefaultValue() { + return defaultValue; + } + + @Override + public String getValue() { + return appSettings.getThemedStringEditTextPreferenceValue(this); + } + + @Override + public void setValue(String value) { + appSettings.setThemedStringEditTextPreferenceValue(this, value); + if(showValueInSummary) { + setSummaryText(value); + } + } + + public String getPrefKey() { + return this.prefKey; + } + + public void setOnPositiveButtonClickedListener(OnPositiveButtonClickedListener listener) { + this.onPositiveButtonClickedListener = listener; + } + + public interface OnPositiveButtonClickedListener { + void onPositiveButtonClicked(String input); + } +} diff --git a/app/src/main/res/layout/preference__themed_checkbox.xml b/app/src/main/res/layout/preference__themed_checkbox.xml index 19b8dac9..1dc5177a 100644 --- a/app/src/main/res/layout/preference__themed_checkbox.xml +++ b/app/src/main/res/layout/preference__themed_checkbox.xml @@ -21,8 +21,7 @@ + android:layout_height="wrap_content"/> + android:layout_marginTop="@dimen/activity_vertical_margin"> + app:defaultBoolean="true" /> + app:defaultBoolean="false" /> + app:defaultBoolean="true" /> + app:defaultBoolean="true" /> \ No newline at end of file diff --git a/app/src/main/res/layout/settings_activity__section_network.xml b/app/src/main/res/layout/settings_activity__section_network.xml index 1c16a904..66d89d45 100644 --- a/app/src/main/res/layout/settings_activity__section_network.xml +++ b/app/src/main/res/layout/settings_activity__section_network.xml @@ -19,7 +19,7 @@ app:titleText="@string/pref_title__load_images" app:summaryText="@string/pref_desc__load_images" app:prefKey="@string/pref_key__load_images" - app:defaultValue="true" /> + app:defaultBoolean="true" /> + app:defaultBoolean="true"/> + app:defaultBoolean="true"/> diff --git a/app/src/main/res/layout/settings_activity__subsection_nav_slider.xml b/app/src/main/res/layout/settings_activity__subsection_nav_slider.xml index 8a3468fe..02661a7a 100644 --- a/app/src/main/res/layout/settings_activity__subsection_nav_slider.xml +++ b/app/src/main/res/layout/settings_activity__subsection_nav_slider.xml @@ -36,7 +36,7 @@ android:layout_height="wrap_content" app:titleText="@string/nav_profile" app:prefKey="@string/pref_key__visibility_nav__profile" - app:defaultValue="true"/> + app:defaultBoolean="true"/> + app:defaultBoolean="true"/> + app:defaultBoolean="true"/> + app:defaultBoolean="false"/> + app:defaultBoolean="true"/> + app:defaultBoolean="true"/> + app:defaultBoolean="false"/> + app:defaultBoolean="false"/> + app:defaultBoolean="false"/> + app:defaultBoolean="true"/> diff --git a/app/src/main/res/layout/settings_activity__subsection_proxy.xml b/app/src/main/res/layout/settings_activity__subsection_proxy.xml index 5fb9be04..ce9f6589 100644 --- a/app/src/main/res/layout/settings_activity__subsection_proxy.xml +++ b/app/src/main/res/layout/settings_activity__subsection_proxy.xml @@ -36,49 +36,27 @@ app:titleText="@string/pref_title__proxy_enabled" app:summaryText="@string/pref_desc__http_proxy_enabled" app:prefKey="@string/pref_key__http_proxy_enabled" - app:defaultValue="false" /> + app:defaultBoolean="false" /> - - - - + app:titleText="@string/pref_title__http_proxy_host" + app:showValueInSummary="true" + app:defaultString="" + app:prefKey="@string/pref_key__http_proxy_host"/> - - - - + app:titleText="@string/pref_title__http_proxy_port" + app:showValueInSummary="true" + app:defaultInt="0" + app:prefKey="@string/pref_key__http_proxy_port"/> + + + + + - - - - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file