Black theme - Proxy activity

This commit is contained in:
stom79 2018-05-11 14:26:15 +02:00
parent f73d6649be
commit 5a0d6cf816
3 changed files with 38 additions and 28 deletions

View File

@ -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) {

View File

@ -71,15 +71,4 @@
<color name="foreground_material_dark" >@color/mastodonC3__</color>
<color name="foreground_material_light">@color/mastodonC1</color>
<color name="background_material_dark">@color/mastodonC1</color>
<color name="background_material_light">@color/mastodonC3__</color>
<color name="background_floating_material_dark">@color/mastodonC1</color>
<color name="background_floating_material_light">@color/mastodonC3__</color>
<color name="primary_material_dark">@color/mastodonC1</color>
<color name="primary_material_light">@color/mastodonC3__</color>
<color name="primary_dark_material_dark">@color/mastodonC1</color>
<color name="primary_dark_material_light">@color/mastodonC3__</color>
</resources>

View File

@ -31,6 +31,9 @@
<item name="android:dropDownListViewStyle">@style/DropDownListViewStyle</item>
<item name="actionBarTextColor">@color/mastodonC3__</item>
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/mastodonC3__</item>
<item name="android:colorBackground">@color/mastodonC3__</item>
<item name="android:colorForeground">@color/mastodonC3__</item>
</style>
<style name="AppTheme_NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
@ -56,6 +59,9 @@
<item name="actionBarTextColor">@color/mastodonC3__</item>
<item name="colorButtonNormal">@color/mastodonC4</item>
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/mastodonC3__</item>
<item name="android:colorBackground">@color/mastodonC3__</item>
<item name="android:colorForeground">@color/mastodonC3__</item>
</style>
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
@ -146,6 +152,9 @@
<item name="android:dropDownListViewStyle">@style/BlackdropDownListViewStyle</item>
<item name="actionBarTextColor">@color/mastodonC3</item>
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/black</item>
<item name="android:colorBackground">@color/black</item>
<item name="android:colorForeground">@color/black</item>
</style>
<style name="AppThemeBlack_NoActionBar" parent="Theme.AppCompat.NoActionBar">
@ -171,6 +180,9 @@
<item name="actionBarTextColor">@color/mastodonC3</item>
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="android:actionBarStyle">@style/BlackActionBarTheme</item>
<item name="colorBackgroundFloating">@color/black</item>
<item name="android:colorBackground">@color/black</item>
<item name="android:colorForeground">@color/black</item>
</style>
<style name="BlackActionBarTheme" parent="Base.Widget.AppCompat.ActionBar">
@ -253,6 +265,9 @@
<item name="android:dropDownListViewStyle">@style/DarkdropDownListViewStyle</item>
<item name="actionBarTextColor">@color/mastodonC3</item>
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/mastodonC1</item>
<item name="android:colorBackground">@color/mastodonC1</item>
<item name="android:colorForeground">@color/mastodonC1</item>
</style>
<style name="AppThemeDark_NoActionBar" parent="Theme.AppCompat.NoActionBar">
@ -277,6 +292,9 @@
<item name="android:dropDownListViewStyle">@style/DarkdropDownListViewStyle</item>
<item name="actionBarTextColor">@color/mastodonC3</item>
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/mastodonC1</item>
<item name="android:colorBackground">@color/mastodonC1</item>
<item name="android:colorForeground">@color/mastodonC1</item>
</style>
<style name="DarkdropDownListViewStyle" parent="Base.Widget.AppCompat.ListView.DropDown">