From 5a0d6cf8169cd542f1ada92801333cfbf56802a2 Mon Sep 17 00:00:00 2001 From: stom79 Date: Fri, 11 May 2018 14:26:15 +0200 Subject: [PATCH] Black theme - Proxy activity --- .../mastodon/activities/ProxyActivity.java | 37 ++++++++++--------- app/src/main/res/values/colors.xml | 11 ------ app/src/main/res/values/styles.xml | 18 +++++++++ 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ProxyActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ProxyActivity.java index 0cc074816..3b3eed13f 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ProxyActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ProxyActivity.java @@ -17,9 +17,9 @@ package fr.gouv.etalab.mastodon.activities; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; +import android.support.v4.content.ContextCompat; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -30,15 +30,9 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.Spinner; - -import java.lang.reflect.Proxy; - import fr.gouv.etalab.mastodon.R; import fr.gouv.etalab.mastodon.helper.Helper; -import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_THEME_INTENT; -import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION; - /** * Created by Thomas on 19/01/2018. @@ -53,15 +47,30 @@ public class ProxyActivity extends BaseActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); - setTheme(R.style.AppThemeDark_NoActionBar); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme_NoActionBar); + getWindow().getDecorView().setBackgroundColor(ContextCompat.getColor(ProxyActivity.this, R.color.mastodonC3__)); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark_NoActionBar); + getWindow().getDecorView().setBackgroundColor(ContextCompat.getColor(ProxyActivity.this, R.color.mastodonC1)); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack_NoActionBar); + getWindow().getDecorView().setBackgroundColor(ContextCompat.getColor(ProxyActivity.this, R.color.black)); + break; + default: + setTheme(R.style.AppThemeDark_NoActionBar); + getWindow().getDecorView().setBackgroundColor(ContextCompat.getColor(ProxyActivity.this, R.color.mastodonC1)); + } setContentView(R.layout.activity_proxy); getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); - Bundle b = getIntent().getExtras(); if( getSupportActionBar() != null) getSupportActionBar().hide(); - final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - //Enable proxy boolean enable_proxy = sharedpreferences.getBoolean(Helper.SET_PROXY_ENABLED, false); final CheckBox set_enable_proxy = findViewById(R.id.enable_proxy); @@ -100,9 +109,6 @@ public class ProxyActivity extends BaseActivity { proxy_type.setAdapter(adapterTrans); - - - proxy_type.setSelection(sharedpreferences.getInt(Helper.SET_PROXY_TYPE, 0)); proxy_type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override @@ -120,9 +126,6 @@ public class ProxyActivity extends BaseActivity { } }); - - - save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 5e9ae6fe9..88bd35c22 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -71,15 +71,4 @@ @color/mastodonC3__ @color/mastodonC1 - @color/mastodonC1 - @color/mastodonC3__ - @color/mastodonC1 - @color/mastodonC3__ - - @color/mastodonC1 - @color/mastodonC3__ - @color/mastodonC1 - @color/mastodonC3__ - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index b3c4eb3c9..95b658f06 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -31,6 +31,9 @@ @style/DropDownListViewStyle @color/mastodonC3__ @color/mastodonC3 + @color/mastodonC3__ + @color/mastodonC3__ + @color/mastodonC3__