diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 960322524..5dc75cfcb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,7 +40,7 @@ android:launchMode="singleTop" android:windowSoftInputMode="stateAlwaysHidden" android:configChanges="keyboardHidden|orientation|screenSize" - android:theme="@style/AppTheme.NoActionBar"> + android:theme="@style/AppTheme_NoActionBar"> @@ -114,6 +114,8 @@ /> diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java index 0d50e85f1..084748df6 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java @@ -15,6 +15,7 @@ package fr.gouv.etalab.mastodon.activities; import android.content.Intent; +import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.net.Uri; @@ -49,6 +50,13 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveSearcA @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } if( getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_about); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java index 80e286c1c..024cc0885 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java @@ -21,6 +21,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; +import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.AbsListView; @@ -62,8 +63,19 @@ public class HashTagActivity extends AppCompatActivity implements OnRetrieveFeed @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } + setContentView(R.layout.activity_hashtag); + if( getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); Bundle b = getIntent().getExtras(); @@ -77,9 +89,11 @@ public class HashTagActivity extends AppCompatActivity implements OnRetrieveFeed firstLoad = true; boolean isOnWifi = Helper.isOnWIFI(getApplicationContext()); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeContainer); - SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + + int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS); + final ListView lv_status = (ListView) findViewById(R.id.lv_status); tootsPerPage = sharedpreferences.getInt(Helper.SET_TOOTS_PER_PAGE, 40); mainLoader = (RelativeLayout) findViewById(R.id.loader); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java index b742b8aa9..498b7f501 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java @@ -16,6 +16,7 @@ package fr.gouv.etalab.mastodon.activities; import android.content.Intent; +import android.content.SharedPreferences; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; @@ -55,6 +56,13 @@ public class InstanceActivity extends AppCompatActivity implements OnRetrieveIns @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } if( getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_instance); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java index f29f93eb0..3e03806aa 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java @@ -69,6 +69,13 @@ public class LoginActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_login); final Button connectionButton = (Button) findViewById(R.id.login_button); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java index 12fbd7097..3a12160b0 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java @@ -25,6 +25,7 @@ import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.FragmentManager; import android.support.v7.app.AlertDialog; +import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; @@ -101,6 +102,14 @@ public class MainActivity extends AppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme_NoActionBar); + }else { + setTheme(R.style.AppThemeDark_NoActionBar); + } setContentView(R.layout.activity_main); //Test if user is still log in if( ! Helper.isLoggedIn(getApplicationContext())) { @@ -152,7 +161,6 @@ public class MainActivity extends AppCompatActivity headerLayout = navigationView.getHeaderView(0); - SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String prefKeyOauthTokenT = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null); Account account = new AccountDAO(getApplicationContext(), db).getAccountByToken(prefKeyOauthTokenT); updateHeaderAccountInfo(MainActivity.this, account, headerLayout, imageLoader, options); @@ -225,6 +233,7 @@ public class MainActivity extends AppCompatActivity private boolean mamageNewIntent(Intent intent){ if( intent == null || intent.getExtras() == null ) return false; + String action = intent.getAction(); String type = intent.getType(); Bundle extras = intent.getExtras(); @@ -389,7 +398,7 @@ public class MainActivity extends AppCompatActivity } } //Open the search bar - final EditText search = new EditText(getApplicationContext()); + final EditText search = new EditText(MainActivity.this); search.setSingleLine(true); search.setLayoutParams( new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java index d71b39abb..518d6954e 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java @@ -16,6 +16,7 @@ package fr.gouv.etalab.mastodon.activities; import android.Manifest; +import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.media.MediaPlayer; @@ -101,6 +102,14 @@ public class MediaActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_media); attachments = getIntent().getParcelableArrayListExtra("mediaArray"); mediaPosition = getIntent().getExtras().getInt("position", 1); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java index ebf699fb0..2339299f0 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java @@ -15,9 +15,12 @@ package fr.gouv.etalab.mastodon.activities; +import android.content.SharedPreferences; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; + +import fr.gouv.etalab.mastodon.helper.Helper; import mastodon.etalab.gouv.fr.mastodon.R; @@ -31,6 +34,13 @@ public class PrivacyActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } if( getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_privacy); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java index 7ebb656b6..6cfa31864 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java @@ -52,6 +52,13 @@ public class SearchResultActivity extends AppCompatActivity implements OnRetriev @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_search_result); loader = (RelativeLayout) findViewById(R.id.loader); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java index a2f9e25e8..f896559bf 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java @@ -105,9 +105,15 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_show_account); - SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); imageLoader = ImageLoader.getInstance(); statuses = new ArrayList<>(); boolean isOnWifi = Helper.isOnWIFI(getApplicationContext()); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java index af4014174..70bc26412 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java @@ -56,6 +56,14 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_show_conversation); if( getSupportActionBar() != null) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/SplashActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/SplashActivity.java index 2baefef2b..259215acc 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/SplashActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/SplashActivity.java @@ -28,7 +28,6 @@ public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java index 975bf9b7d..a162d472c 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java @@ -116,6 +116,13 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_toot); if( getSupportActionBar() != null) @@ -182,7 +189,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc } if( tootReply != null) { setTitle(R.string.toot_title_reply); - SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); boolean show_reply = sharedpreferences.getBoolean(Helper.SET_SHOW_REPLY, false); if( show_reply ){ @@ -269,7 +275,6 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc FloatingActionButton toot_close_accounts = (FloatingActionButton) findViewById(R.id.toot_close_accounts); SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); - SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); Account account = new AccountDAO(getApplicationContext(),db).getAccountByID(userId); boolean isAccountPrivate = account.isLocked(); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java index 7f18fd091..8d7127919 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java @@ -16,6 +16,7 @@ package fr.gouv.etalab.mastodon.activities; import android.Manifest; +import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; @@ -54,6 +55,13 @@ public class WebviewActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_webview); Bundle b = getIntent().getExtras(); if(b != null) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java index 6c4696754..f50691469 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java @@ -58,6 +58,13 @@ public class WebviewConnectActivity extends AppCompatActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + setTheme(R.style.AppTheme); + }else { + setTheme(R.style.AppThemeDark); + } setContentView(R.layout.activity_webview_connect); Bundle b = getIntent().getExtras(); if(b != null) @@ -65,7 +72,6 @@ public class WebviewConnectActivity extends AppCompatActivity { if( instance == null) finish(); - SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); clientId = sharedpreferences.getString(Helper.CLIENT_ID, null); clientSecret = sharedpreferences.getString(Helper.CLIENT_SECRET, null); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index e6f7aa02e..381132990 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -30,6 +30,7 @@ import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.Window; import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.Button; @@ -196,6 +197,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf }else{ holder.status_account_displayname.setCompoundDrawables( null, null, null, null); } + final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); //Click on a conversation if( type != RetrieveFeedsAsyncTask.Type.CONTEXT ){ holder.status_content.setOnClickListener(new View.OnClickListener() { @@ -209,10 +211,19 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf } }); }else { - if( position == ShowConversationActivity.position){ - holder.main_container.setBackgroundResource(R.color.blue_light); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + if( theme == Helper.THEME_LIGHT){ + if( position == ShowConversationActivity.position){ + holder.main_container.setBackgroundResource(R.color.blue_light); + }else { + holder.main_container.setBackgroundResource(R.color.white); + } }else { - holder.main_container.setBackgroundResource(R.color.white); + if( position == ShowConversationActivity.position){ + holder.main_container.setBackgroundResource(R.color.header2D); + }else { + holder.main_container.setBackgroundResource(R.color.cardview_dark_background); + } } } @@ -354,7 +365,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf holder.status_favorite_count.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + boolean confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true); if( confirmation ) displayConfirmationDialog(FAVOURITE,status); @@ -366,7 +377,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf holder.status_reblog_count.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); boolean confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true); if( confirmation ) displayConfirmationDialog(REBLOG,status); @@ -635,7 +645,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); final boolean isOwner = status.getAccount().getId().equals(userId); AlertDialog.Builder builderSingle = new AlertDialog.Builder(context); - builderSingle.setTitle(R.string.make_a_choice); + //builderSingle.setTitle(R.string.make_a_choice); final String[] stringArray, stringArrayConf; final API.StatusAction[] doAction; if( isOwner) { @@ -752,6 +762,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf builderInner.show(); } }); + builderSingle.create().requestWindowFeature(Window.FEATURE_NO_TITLE); builderSingle.show(); } } \ No newline at end of file diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java index f70ba1c3e..39d103174 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java @@ -173,6 +173,24 @@ public class SettingsFragment extends Fragment { file_chooser.setVisibility(View.GONE); } + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_LIGHT); + final SwitchCompat set_night_mode = (SwitchCompat) rootView.findViewById(R.id.set_night_mode); + set_night_mode.setChecked(theme == Helper.THEME_DARK); + set_night_mode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putInt(Helper.SET_THEME, isChecked?Helper.THEME_DARK:Helper.THEME_LIGHT); + editor.apply(); + if( isChecked){ + getActivity().setTheme(R.style.AppThemeDark); + }else { + getActivity().setTheme(R.style.AppTheme); + } + getActivity().recreate(); + } + }); + return rootView; } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index 55d3e0531..9fee206bf 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -157,10 +157,12 @@ public class Helper { public static final String SET_ACCOUNTS_PER_PAGE = "set_accounts_per_page"; public static final String SET_NOTIFICATIONS_PER_PAGE = "set_notifications_per_page"; public static final String SET_ATTACHMENT_ACTION = "set_attachment_action"; + public static final String SET_THEME = "set_theme"; public static final int ATTACHMENT_ALWAYS = 1; public static final int ATTACHMENT_WIFI = 2; public static final int ATTACHMENT_ASK = 3; - + public static final int THEME_LIGHT = 1; + public static final int THEME_DARK = 2; public static final String SET_NOTIF_FOLLOW = "set_notif_follow"; public static final String SET_NOTIF_ADD = "set_notif_follow_add"; @@ -177,6 +179,7 @@ public class Helper { public static final String SET_JAVASCRIPT = "set_javascript"; public static final String SET_COOKIES = "set_cookies"; public static final String SET_FOLDER_RECORD = "set_folder_record"; + //End points public static final String EP_AUTHORIZE = "/oauth/authorize"; diff --git a/app/src/main/res/drawable-hdpi/ic_local_post_office.png b/app/src/main/res/drawable-hdpi/ic_local_post_office.png index d86e1c615..8e7593223 100644 Binary files a/app/src/main/res/drawable-hdpi/ic_local_post_office.png and b/app/src/main/res/drawable-hdpi/ic_local_post_office.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_local_post_office.png b/app/src/main/res/drawable-ldpi/ic_local_post_office.png index b66d598a7..45514cfe2 100644 Binary files a/app/src/main/res/drawable-ldpi/ic_local_post_office.png and b/app/src/main/res/drawable-ldpi/ic_local_post_office.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_local_post_office.png b/app/src/main/res/drawable-mdpi/ic_local_post_office.png index f1979b2cc..b34a6bf8f 100644 Binary files a/app/src/main/res/drawable-mdpi/ic_local_post_office.png and b/app/src/main/res/drawable-mdpi/ic_local_post_office.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_local_post_office.png b/app/src/main/res/drawable-xhdpi/ic_local_post_office.png index 99bc82074..405a5e64e 100644 Binary files a/app/src/main/res/drawable-xhdpi/ic_local_post_office.png and b/app/src/main/res/drawable-xhdpi/ic_local_post_office.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_local_post_office.png b/app/src/main/res/drawable-xxhdpi/ic_local_post_office.png index 9abfba56b..5dbe8018e 100644 Binary files a/app/src/main/res/drawable-xxhdpi/ic_local_post_office.png and b/app/src/main/res/drawable-xxhdpi/ic_local_post_office.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_local_post_office.png b/app/src/main/res/drawable-xxxhdpi/ic_local_post_office.png index 766a707d6..ff8f15d77 100644 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_local_post_office.png and b/app/src/main/res/drawable-xxxhdpi/ic_local_post_office.png differ diff --git a/app/src/main/res/drawable/imageview_border_dark.xml b/app/src/main/res/drawable/imageview_border_dark.xml new file mode 100644 index 000000000..88adb4c4b --- /dev/null +++ b/app/src/main/res/drawable/imageview_border_dark.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_border_bottom_settings_dark.xml b/app/src/main/res/drawable/shape_border_bottom_settings_dark.xml new file mode 100644 index 000000000..0c5bc5117 --- /dev/null +++ b/app/src/main/res/drawable/shape_border_bottom_settings_dark.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/side_nav_bar_dark.xml b/app/src/main/res/drawable/side_nav_bar_dark.xml new file mode 100644 index 000000000..947a672d1 --- /dev/null +++ b/app/src/main/res/drawable/side_nav_bar_dark.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/activity_login.xml b/app/src/main/res/layout-sw600dp/activity_login.xml index 67ad6d2ad..446983e04 100644 --- a/app/src/main/res/layout-sw600dp/activity_login.xml +++ b/app/src/main/res/layout-sw600dp/activity_login.xml @@ -18,7 +18,6 @@ diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index a402c4f07..172f8258c 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -18,7 +18,6 @@ + app:popupTheme="?attr/popupOverlay" /> diff --git a/app/src/main/res/layout/activity_privacy.xml b/app/src/main/res/layout/activity_privacy.xml index 69b7f13ee..9e32bb2cd 100644 --- a/app/src/main/res/layout/activity_privacy.xml +++ b/app/src/main/res/layout/activity_privacy.xml @@ -32,14 +32,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" - android:layout_marginTop="10dp" + android:layout_marginTop="20dp" android:orientation="vertical" tools:ignore="UselessParent"> @@ -88,7 +89,7 @@ diff --git a/app/src/main/res/layout/dialog_profile.xml b/app/src/main/res/layout/dialog_profile.xml index e6b60e39b..0c373aef0 100644 --- a/app/src/main/res/layout/dialog_profile.xml +++ b/app/src/main/res/layout/dialog_profile.xml @@ -50,7 +50,6 @@ android:layout_below="@+id/dialog_profile_picture" android:layout_centerHorizontal="true" android:textSize="18sp" - android:textColor="@color/white" android:gravity="center_horizontal|top" android:id="@+id/dialog_profile_name" android:layout_width="match_parent" @@ -65,7 +64,6 @@ android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textColor="@color/white" android:id="@+id/dialog_profile_description" android:minLines="4" android:lines="4" diff --git a/app/src/main/res/layout/drawer_account.xml b/app/src/main/res/layout/drawer_account.xml index 4fa1aca76..8b643f705 100644 --- a/app/src/main/res/layout/drawer_account.xml +++ b/app/src/main/res/layout/drawer_account.xml @@ -20,6 +20,7 @@ android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/tools" + style="?attr/cardStyle" android:layout_marginTop="10dp" card_view:cardPreventCornerOverlap="true" app:cardUseCompatPadding="true"> diff --git a/app/src/main/res/layout/drawer_account_follow_request.xml b/app/src/main/res/layout/drawer_account_follow_request.xml index 011209a3f..647104199 100644 --- a/app/src/main/res/layout/drawer_account_follow_request.xml +++ b/app/src/main/res/layout/drawer_account_follow_request.xml @@ -21,6 +21,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/tools" android:layout_marginTop="10dp" + style="?attr/cardStyle" card_view:cardPreventCornerOverlap="true" app:cardUseCompatPadding="true"> @@ -69,7 +69,6 @@ android:text="@string/reject" android:layout_gravity="end" android:gravity="center" - android:textColor="@color/white" style="@style/Base.Widget.AppCompat.Button.Small" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/app/src/main/res/layout/drawer_account_main_search.xml b/app/src/main/res/layout/drawer_account_main_search.xml index 73ba64b7d..9e458d4ea 100644 --- a/app/src/main/res/layout/drawer_account_main_search.xml +++ b/app/src/main/res/layout/drawer_account_main_search.xml @@ -21,6 +21,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/tools" android:layout_marginTop="10dp" + style="?attr/cardStyle" card_view:cardPreventCornerOverlap="true" app:cardUseCompatPadding="true"> @@ -54,7 +55,7 @@ android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" - android:background="@drawable/imageview_border" + style="?attr/shapeBorder" android:visibility="gone" tools:ignore="ContentDescription" /> diff --git a/app/src/main/res/layout/drawer_status_main_search.xml b/app/src/main/res/layout/drawer_status_main_search.xml index fb2a0b2d8..3d9693375 100644 --- a/app/src/main/res/layout/drawer_status_main_search.xml +++ b/app/src/main/res/layout/drawer_status_main_search.xml @@ -21,6 +21,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/tools" android:layout_marginTop="10dp" + style="?attr/cardStyle" card_view:cardPreventCornerOverlap="true" app:cardUseCompatPadding="true"> - + + + + diff --git a/app/src/main/res/layout/fragment_settings_notifications.xml b/app/src/main/res/layout/fragment_settings_notifications.xml index 7e857ebce..fb7c4b8ed 100644 --- a/app/src/main/res/layout/fragment_settings_notifications.xml +++ b/app/src/main/res/layout/fragment_settings_notifications.xml @@ -36,7 +36,7 @@ \ No newline at end of file diff --git a/app/src/main/res/layout/show_attachment.xml b/app/src/main/res/layout/show_attachment.xml index b5cf58ff1..14d0d3bb3 100644 --- a/app/src/main/res/layout/show_attachment.xml +++ b/app/src/main/res/layout/show_attachment.xml @@ -49,7 +49,6 @@ android:id="@+id/loader" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@android:color/white" android:layout_gravity="center" android:gravity="center" > diff --git a/app/src/main/res/layout/tablayout_settings.xml b/app/src/main/res/layout/tablayout_settings.xml index f77e681bb..382d93140 100644 --- a/app/src/main/res/layout/tablayout_settings.xml +++ b/app/src/main/res/layout/tablayout_settings.xml @@ -19,6 +19,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" + android:background="@null" android:layout_height="match_parent"> @@ -35,7 +35,6 @@ android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@android:color/white" /> \ No newline at end of file diff --git a/app/src/main/res/layout/webview_actionbar.xml b/app/src/main/res/layout/webview_actionbar.xml index 60a616282..30a61fa9b 100644 --- a/app/src/main/res/layout/webview_actionbar.xml +++ b/app/src/main/res/layout/webview_actionbar.xml @@ -22,7 +22,6 @@ android:orientation="horizontal" tools:ignore="UseCompoundDrawables"> diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml index 28a3aa23f..1836bedd6 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -6,7 +6,6 @@ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index cb5f1f402..dfdd144fd 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,17 +1,30 @@ + + #3F51B5 #303F9F #2196F3 - + + #616161 + #212121 + #009688 #0288D1 #03A9F4 #4FC3F7 + + #263238 + #455A64 + #607D8B + + #BDBDBD + #00000000 #F5F5F5 + #546E7A #FFF #C5CAE9 @@ -24,4 +37,6 @@ #009688 #F44336 #000 + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a4d9f6033..ed66decd0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -243,7 +243,7 @@ Options avancées Notifier en WIFI seulement Utiliser le vibreur - + Mode nuit Modifier le profil Présentation… Enregistrer les modifications @@ -281,7 +281,6 @@ Seules les informations de base des comptes connectés sont enregistrées sur l\'appareil. Ces données sont strictement confidentielles et ne sont utilisables que par l\'application. La suppression de l\'application entraîne immédiatement la suppression de ces données.\n ⚠ Les identifiants et les mots de passe ne sont jamais enregistrés, ils ne sont utilisés que lors de l\'authentification sécurisée (SSL) vers l\'instance. - Autorisations de l\'application @@ -291,7 +290,7 @@ - WRITE_EXTERNAL_STORAGE : Utilisée pour télécharger les médias / déplacer sur la carte SD.\n - READ_EXTERNAL_STORAGE : Utilisée pour ajouter des médias aux pouets.\n - BOOT_COMPLETED : Utilisée pour lancer le service de notifications quand l\'appareil démarre.\n - - WAKE_LOCK : Utilisée lors du service de notifications.\n + - WAKE_LOCK : Utilisée lors du service de notifications. Autorisations de l\'API @@ -299,7 +298,7 @@ - Read : Lire les données du compte.\n - Write : Envoyer des messages et attacher des médias aux messages.\n - Follow : S\'abonner, se désabonner, bloquer, débloquer.\n\n - ⚠ Ces actions ne sont réalisées qu\'à la demande de l\'utilisateur.\n\n + ⚠ Ces actions ne sont réalisées qu\'à la demande de l\'utilisateur. Suivi et bibliothèques diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 0ed96a850..3086ae8a7 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,24 +1,103 @@ + + + + + + + + - + + - + + + + + + + + + + + + + + + + + + + + +