mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Apply reviews
This commit is contained in:
parent
85d0ce2c30
commit
e094101e58
4 changed files with 10 additions and 17 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.free.nrw.commons;
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
|
@ -10,7 +9,6 @@ import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.LayoutRes;
|
import android.support.annotation.LayoutRes;
|
||||||
import android.support.v4.content.IntentCompat;
|
|
||||||
import android.support.v7.app.AppCompatDelegate;
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -25,11 +23,11 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
getDelegate().installViewFactory();
|
getDelegate().installViewFactory();
|
||||||
getDelegate().onCreate(savedInstanceState);
|
getDelegate().onCreate(savedInstanceState);
|
||||||
//Check prefs on every activity starts
|
// Check prefs on every activity starts
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
|
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
|
||||||
setTheme(R.style.DarkAppTheme);
|
setTheme(R.style.DarkAppTheme);
|
||||||
}else {
|
}else {
|
||||||
setTheme(R.style.LightAppTheme); //default
|
setTheme(R.style.LightAppTheme); // default
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
@ -80,7 +78,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
if(key.equals("theme")){
|
if(key.equals("theme")){
|
||||||
//Finish current activity and tart new one with selected theme
|
// Finish current activity and start new one with selected theme
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
finish();
|
finish();
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
|
|
@ -19,17 +18,16 @@ public class BaseActivity extends Activity {
|
||||||
setTheme(R.style.DarkAppTheme);
|
setTheme(R.style.DarkAppTheme);
|
||||||
}else {
|
}else {
|
||||||
currentTheme = false;
|
currentTheme = false;
|
||||||
setTheme(R.style.LightAppTheme); //default
|
setTheme(R.style.LightAppTheme); // default
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
//Restart activity if theme is changed
|
// Restart activity if theme is changed
|
||||||
Log.d("deneme","onResume Base");
|
|
||||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
|
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
|
||||||
if(currentTheme!=newTheme){ //is activity theme changed
|
if(currentTheme!=newTheme){ // is activity theme changed
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
finish();
|
finish();
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
|
|
@ -18,15 +17,14 @@ public class BaseAppCompatActivity extends AppCompatActivity {
|
||||||
setTheme(R.style.DarkAppTheme);
|
setTheme(R.style.DarkAppTheme);
|
||||||
}else {
|
}else {
|
||||||
currentTheme = false;
|
currentTheme = false;
|
||||||
setTheme(R.style.LightAppTheme); //default
|
setTheme(R.style.LightAppTheme); // default
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
//Restart activity if theme is changed
|
// Restart activity if theme is changed
|
||||||
Log.d("deneme","onResume Base");
|
|
||||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
|
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
|
||||||
if(currentTheme!=newTheme){ //is activity theme changed
|
if(currentTheme!=newTheme){ //is activity theme changed
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
<string name="menu_from_camera">Take photo</string>
|
<string name="menu_from_camera">Take photo</string>
|
||||||
<string name="menu_nearby">Nearby</string>
|
<string name="menu_nearby">Nearby</string>
|
||||||
<string name="provider_contributions">My uploads</string>
|
<string name="provider_contributions">My uploads</string>
|
||||||
<string name="menu_theme_toggle">Night mode</string>
|
|
||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
<string name="menu_open_in_browser">View in Browser</string>
|
<string name="menu_open_in_browser">View in Browser</string>
|
||||||
<string name="share_title_hint">Title</string>
|
<string name="share_title_hint">Title</string>
|
||||||
|
|
@ -92,8 +91,8 @@ Tap this message (or hit back) to skip this step.</string>
|
||||||
<string name="use_previous">Use previous title/description</string>
|
<string name="use_previous">Use previous title/description</string>
|
||||||
<string name="allow_gps">Automatically get current location</string>
|
<string name="allow_gps">Automatically get current location</string>
|
||||||
<string name="allow_gps_summary">Retrieve current location to offer category suggestions if image is not geotagged</string>
|
<string name="allow_gps_summary">Retrieve current location to offer category suggestions if image is not geotagged</string>
|
||||||
<string name="preference_theme">Select theme</string>
|
<string name="preference_theme">Night mode</string>
|
||||||
<string name="preference_theme_summary">Select if you prefer night mode</string>
|
<string name="preference_theme_summary">Use dark theme</string>
|
||||||
<string name="license_name_cc_by_sa_four"> Attribution-ShareAlike 4.0</string>
|
<string name="license_name_cc_by_sa_four"> Attribution-ShareAlike 4.0</string>
|
||||||
<string name="license_name_cc_by_four"> Attribution 4.0</string>
|
<string name="license_name_cc_by_four"> Attribution 4.0</string>
|
||||||
<string name="license_name_cc_by_sa"> Attribution-ShareAlike 3.0</string>
|
<string name="license_name_cc_by_sa"> Attribution-ShareAlike 3.0</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue