Merge pull request #440 from neslihanturan/addThemeToggle

Add theme toggle
This commit is contained in:
Josephine Lim 2017-03-18 23:24:34 +10:00 committed by GitHub
commit b788047fd4
57 changed files with 250 additions and 42 deletions

View file

@ -1,12 +1,13 @@
package fr.free.nrw.commons; package fr.free.nrw.commons;
import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html; import android.text.Html;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.widget.TextView; import android.widget.TextView;
public class AboutActivity extends Activity { import fr.free.nrw.commons.theme.BaseActivity;
public class AboutActivity extends BaseActivity {
private TextView versionText; private TextView versionText;
private TextView licenseText; private TextView licenseText;
private TextView improveText; private TextView improveText;

View file

@ -1,11 +1,13 @@
package fr.free.nrw.commons; package fr.free.nrw.commons;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.annotation.LayoutRes; import android.support.annotation.LayoutRes;
import android.support.v7.app.AppCompatDelegate; import android.support.v7.app.AppCompatDelegate;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -21,6 +23,13 @@ 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
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
setTheme(R.style.DarkAppTheme);
}else {
setTheme(R.style.LightAppTheme); // default
}
super.onCreate(savedInstanceState);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
ListPreference licensePreference = (ListPreference) findPreference(Prefs.DEFAULT_LICENSE); ListPreference licensePreference = (ListPreference) findPreference(Prefs.DEFAULT_LICENSE);
@ -68,7 +77,12 @@ 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")){
// Finish current activity and start new one with selected theme
Intent intent = getIntent();
finish();
startActivity(intent);
}
} }
// All the stuff below is just to get a actionbar that says settings... // All the stuff below is just to get a actionbar that says settings...

View file

@ -1,6 +1,5 @@
package fr.free.nrw.commons; package fr.free.nrw.commons;
import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.PagerAdapter; import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
@ -10,7 +9,9 @@ import android.widget.Button;
import com.viewpagerindicator.CirclePageIndicator; import com.viewpagerindicator.CirclePageIndicator;
public class WelcomeActivity extends Activity { import fr.free.nrw.commons.theme.BaseActivity;
public class WelcomeActivity extends BaseActivity {
static final int PAGE_WIKIPEDIA = 0, static final int PAGE_WIKIPEDIA = 0,
PAGE_DO_UPLOAD = 1, PAGE_DO_UPLOAD = 1,
PAGE_DONT_UPLOAD = 2, PAGE_DONT_UPLOAD = 2,

View file

@ -11,14 +11,14 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import java.io.IOException; import java.io.IOException;
import fr.free.nrw.commons.theme.BaseAppCompatActivity;
import fr.free.nrw.commons.CommonsApplication; import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.Utils; import fr.free.nrw.commons.Utils;
public abstract class AuthenticatedActivity extends AppCompatActivity { public abstract class AuthenticatedActivity extends BaseAppCompatActivity {
String accountType; String accountType;
CommonsApplication app; CommonsApplication app;

View file

@ -1,6 +1,5 @@
package fr.free.nrw.commons.auth; package fr.free.nrw.commons.auth;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@ -9,7 +8,9 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.Toast; import android.widget.Toast;
public class SignupActivity extends Activity { import fr.free.nrw.commons.theme.BaseActivity;
public class SignupActivity extends BaseActivity {
private WebView webView; private WebView webView;

View file

@ -23,6 +23,8 @@ import android.widget.ListAdapter;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.lang.reflect.Method;
import fr.free.nrw.commons.AboutActivity; import fr.free.nrw.commons.AboutActivity;
import fr.free.nrw.commons.CommonsApplication; import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
@ -207,6 +209,31 @@ public class ContributionsListFragment extends Fragment {
menu.findItem(R.id.menu_refresh).setVisible(false); menu.findItem(R.id.menu_refresh).setVisible(false);
} }
/*http://stackoverflow.com/questions/30076392/how-does-this-strange-condition-happens-when-show-menu-item-icon-in-toolbar-over/30337653#30337653
Overriden to show toggle_layout button on overlay menu
*/
@Override
public void onPrepareOptionsMenu(Menu menu) {
if(menu != null){
if(menu.getClass().getSimpleName().equals("MenuBuilder")){
try{
Method m = menu.getClass().getDeclaredMethod(
"setOptionalIconsVisible", Boolean.TYPE);
m.setAccessible(true);
m.invoke(menu, true);
}
catch(NoSuchMethodException e){
Log.e(TAG, "onMenuOpened", e);
}
catch(Exception e){
throw new RuntimeException(e);
}
}
}
super.onPrepareOptionsMenu(menu);
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -7,15 +7,15 @@ import android.location.LocationListener;
import android.location.LocationManager; import android.location.LocationManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import fr.free.nrw.commons.theme.BaseAppCompatActivity;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
public class NearbyActivity extends AppCompatActivity { public class NearbyActivity extends BaseAppCompatActivity {
private MyLocationListener myLocationListener; private MyLocationListener myLocationListener;
private LocationManager locationManager; private LocationManager locationManager;
@ -141,4 +141,4 @@ public class NearbyActivity extends AppCompatActivity {
unregisterLocationManager(); unregisterLocationManager();
} }
} }

View file

@ -0,0 +1,37 @@
package fr.free.nrw.commons.theme;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import fr.free.nrw.commons.R;
public class BaseActivity extends Activity {
boolean currentTheme;
@Override
protected void onCreate(Bundle savedInstanceState) {
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
currentTheme = true;
setTheme(R.style.DarkAppTheme);
}else {
currentTheme = false;
setTheme(R.style.LightAppTheme); // default
}
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
// Restart activity if theme is changed
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
if(currentTheme!=newTheme){ // is activity theme changed
Intent intent = getIntent();
finish();
startActivity(intent);
}
super.onResume();
}
}

View file

@ -0,0 +1,36 @@
package fr.free.nrw.commons.theme;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import fr.free.nrw.commons.R;
public class BaseAppCompatActivity extends AppCompatActivity {
boolean currentTheme;
@Override
protected void onCreate(Bundle savedInstanceState) {
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false)) {
currentTheme = true;
setTheme(R.style.DarkAppTheme);
}else {
currentTheme = false;
setTheme(R.style.LightAppTheme); // default
}
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
// Restart activity if theme is changed
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",false);
if(currentTheme!=newTheme){ //is activity theme changed
Intent intent = getIntent();
finish();
startActivity(intent);
}
super.onResume();
}
}

View file

@ -4,9 +4,9 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.Editable; import android.text.Editable;
@ -28,7 +28,6 @@ import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import fr.free.nrw.commons.Prefs; import fr.free.nrw.commons.Prefs;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
@ -112,6 +111,13 @@ public class SingleUploadFragment extends Fragment {
licenseSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { licenseSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
//Set selected color to white because it should be readable on random images.
TextView selectedText = (TextView) licenseSpinner.getChildAt(0);
if (selectedText != null ) {
selectedText.setTextColor(Color.WHITE);
}
String licenseName = parent.getItemAtPosition(position).toString(); String licenseName = parent.getItemAtPosition(position).toString();
String license = Prefs.Licenses.CC_BY_SA_3; // default value String license = Prefs.Licenses.CC_BY_SA_3; // default value

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

View file

@ -1,7 +1,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#000" android:background="?attr/mainBackground"
> >
<ImageView <ImageView

View file

@ -2,7 +2,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#0c609c" android:background="?attr/commonsAppBlue"
> >
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager

View file

@ -14,7 +14,7 @@
android:id="@+id/mediaDetailCategoryItemText" android:id="@+id/mediaDetailCategoryItemText"
android:textSize="14sp" android:textSize="14sp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:background="#20ffffff" android:background="?attr/subBackground"
/> />
<fr.free.nrw.commons.media.MediaDetailSpacer <fr.free.nrw.commons.media.MediaDetailSpacer

View file

@ -3,7 +3,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#AA000000" android:background="?attr/fragmentCategorisationBackground"
android:paddingBottom="8dip" android:paddingBottom="8dip"
android:paddingLeft="16dip" android:paddingLeft="16dip"
android:paddingStart="16dip" android:paddingStart="16dip"

View file

@ -3,7 +3,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#000000" android:background="?attr/mainBackground"
> >
<TextView <TextView

View file

@ -3,7 +3,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/background_dark" android:background="?attr/mainBackground"
> >
<ProgressBar <ProgressBar
@ -58,7 +58,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#AA000000" android:background="?attr/fragmentCategorisationBackground"
android:padding="16dp" android:padding="16dp"
> >
@ -66,7 +66,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#20ffffff" android:background="?attr/subBackground"
android:padding="16dp" android:padding="16dp"
> >
<TextView <TextView
@ -85,7 +85,7 @@
android:id="@+id/mediaDetailTitle" android:id="@+id/mediaDetailTitle"
android:layout_gravity="left|start" android:layout_gravity="left|start"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:background="#20ffffff" android:background="?attr/subBackground"
android:textSize="14sp" android:textSize="14sp"
android:padding="12dp" android:padding="12dp"
/> />
@ -100,7 +100,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#20ffffff" android:background="?attr/subBackground"
android:padding="16dp" android:padding="16dp"
> >
<TextView <TextView
@ -116,7 +116,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/media_detail_description_explanation" android:text="@string/media_detail_description_explanation"
android:background="#20ffffff" android:background="?attr/subBackground"
android:id="@+id/mediaDetailDesc" android:id="@+id/mediaDetailDesc"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:layout_gravity="left|start" android:layout_gravity="left|start"
@ -134,7 +134,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#20ffffff" android:background="?attr/subBackground"
android:padding="16dp" android:padding="16dp"
> >
<TextView <TextView
@ -152,7 +152,7 @@
android:text="License link" android:text="License link"
android:id="@+id/mediaDetailLicense" android:id="@+id/mediaDetailLicense"
android:layout_gravity="left|start" android:layout_gravity="left|start"
android:background="#20ffffff" android:background="?attr/subBackground"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="14sp" android:textSize="14sp"
android:padding="12dp" android:padding="12dp"
@ -168,7 +168,7 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#20ffffff" android:background="?attr/subBackground"
android:padding="16dp" android:padding="16dp"
android:textStyle="bold" android:textStyle="bold"
> >

View file

@ -4,13 +4,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="fill" android:layout_gravity="fill"
android:orientation="vertical" android:orientation="vertical"
android:background="#AA000000" android:background="?attr/fragmentCategorisationBackground"
android:paddingBottom="8dip" android:paddingBottom="8dip"
android:paddingLeft="16dip" android:paddingLeft="16dip"
android:paddingStart="16dip" android:paddingStart="16dip"
android:paddingRight="16dip" android:paddingRight="16dip"
android:paddingEnd="16dip" android:paddingEnd="16dip"
android:paddingTop="8dip" android:paddingTop="8dip"
android:theme="@style/DarkAppTheme"
> >
<EditText <EditText
@ -36,12 +37,12 @@
android:id="@+id/licenseSpinner" android:id="@+id/licenseSpinner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
> android:theme="?attr/spinnerTheme"
</Spinner> />
<Button <Button
android:text="@string/use_previous" android:text="@string/use_previous"
android:background="#90000000" android:background="?attr/buttonBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/titleDescButton" android:id="@+id/titleDescButton"

View file

@ -2,7 +2,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_upload_single" <item android:id="@+id/menu_upload_single"
android:title="@string/menu_upload_single" android:title="@string/menu_upload_single"
android:icon="@drawable/ic_send_white_24dp" android:icon="?attr/iconSend"
android:enabled="false" android:enabled="false"
app:showAsAction="always" /> app:showAsAction="always" />
</menu> </menu>

View file

@ -4,6 +4,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_save_categories" <item android:id="@+id/menu_save_categories"
android:title="@string/menu_save_categories" android:title="@string/menu_save_categories"
android:icon="@drawable/ic_save_white_24dp" android:icon="?attr/iconSave"
app:showAsAction="always" /> app:showAsAction="always" />
</menu> </menu>

View file

@ -4,13 +4,13 @@
android:title="@string/menu_from_camera" android:title="@string/menu_from_camera"
android:orderInCategory="100" android:orderInCategory="100"
app:showAsAction="ifRoom|withText" app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_photo_camera_white_24dp" android:icon="?attr/iconCamera"
/> />
<item android:id="@+id/menu_from_gallery" <item android:id="@+id/menu_from_gallery"
android:title="@string/menu_from_gallery" android:title="@string/menu_from_gallery"
android:orderInCategory="200" android:orderInCategory="200"
app:showAsAction="ifRoom|withText" app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_photo_white_24dp" android:icon="?attr/iconPhoto"
/> />
<item android:id="@+id/menu_settings" <item android:id="@+id/menu_settings"
android:title="@string/menu_settings" android:title="@string/menu_settings"

View file

@ -18,7 +18,7 @@
<item <item
android:id="@+id/menu_retry_current_image" android:id="@+id/menu_retry_current_image"
android:enabled="false" android:enabled="false"
android:icon="@drawable/ic_undo_white_24dp" android:icon="?attr/iconUndo"
android:title="@string/menu_retry_upload" android:title="@string/menu_retry_upload"
android:visible="false" android:visible="false"
app:showAsAction="ifRoom|withText" /> app:showAsAction="ifRoom|withText" />

View file

@ -6,6 +6,6 @@
<item android:id="@+id/menu_upload_multiple" <item android:id="@+id/menu_upload_multiple"
android:title="@string/share_upload_button" android:title="@string/share_upload_button"
app:showAsAction="always|withText" app:showAsAction="always|withText"
android:icon="@drawable/ic_send_white_24dp" android:icon="?attr/iconSend"
/> />
</menu> </menu>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="mainBackground" format="reference"/>
<attr name="semitransparentText" format="reference"/>
<attr name="commonsAppBlue" format="reference"/>
<attr name="subBackground" format="reference"/>
<attr name="fragmentCategorisationBackground" format="reference"/>
<attr name="buttonBackground" format="reference"/>
<attr name="uploadOverlayBackground" format="reference"/>
<attr name="spinnerTheme" format="reference"/>
<attr name="iconSend" format="reference"/>
<attr name="iconSave" format="reference"/>
<attr name="iconCamera" format="reference"/>
<attr name="iconPhoto" format="reference"/>
<attr name="iconUndo" format="reference"/>
</resources>

View file

@ -1,6 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Some colours are same for dark/light themes. They are written two times in case
we want to change light ones later.
-->
<color name="text_background">#90000000</color> <color name="text_background">#90000000</color>
<color name="item_white_background">#ffffffff</color>
<color name="main_background_dark">#000000</color>
<color name="main_background_light">#ffffff</color>
<color name="commons_app_blue_dark">#33FFFFFF</color>
<color name="commons_app_blue_light">#33FFFFFF</color>
<color name="activity_welcome_background_dark">#0c609c</color>
<color name="activity_welcome_background_light">#0c609c</color>
<color name="action_bar_blue">#0c609c</color>
<color name="status_bar_blue">#08436d</color>
<color name="sub_background_dark">#20ffffff</color>
<color name="sub_background_light">#20ffffff</color>
<color name="fragment_categorisation_background_dark">#AA000000</color>
<color name="fragment_categorisation_background_light">#AA000000</color>
<color name="button_background_dark">#90000000</color>
<color name="button_background_light">#B0000000</color>
<color name="upload_overlay_background_dark">#77000000</color>
<color name="upload_overlay_background_light">#44000000</color>
</resources> </resources>

View file

@ -91,6 +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">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>

View file

@ -1,8 +1,49 @@
<resources> <resources>
<style name="AppTheme" parent="Theme.AppCompat" /> <style name="DarkAppTheme" parent="Theme.AppCompat">
<item name="mainBackground">@color/main_background_dark</item>
<item name="semitransparentText">@color/commons_app_blue_dark</item>
<item name="commonsAppBlue">@color/activity_welcome_background_dark</item>
<item name="subBackground">@color/sub_background_dark</item>
<item name="fragmentCategorisationBackground">@color/fragment_categorisation_background_dark</item>
<item name="buttonBackground">@color/button_background_dark</item>
<item name="uploadOverlayBackground">@color/upload_overlay_background_dark</item>
<item name="iconSend">@drawable/ic_send_white_24dp</item>
<item name="iconSave">@drawable/ic_save_white_24dp</item>
<item name="iconCamera">@drawable/ic_photo_camera_white_24dp</item>
<item name="iconPhoto">@drawable/ic_photo_white_24dp</item>
<item name="iconUndo">@drawable/ic_undo_white_24dp</item>
<item name="spinnerTheme">@style/DarkSpinnerTheme</item>
</style>
<style name="NoTitle" parent="AppTheme"> <style name="LightAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="mainBackground">@color/main_background_light</item>
<item name="semitransparentText">@color/commons_app_blue_light</item>
<item name="commonsAppBlue">@color/activity_welcome_background_light</item>
<item name="subBackground">@color/sub_background_light</item>
<item name="fragmentCategorisationBackground">@color/fragment_categorisation_background_light</item>
<item name="buttonBackground">@color/button_background_light</item>
<item name="uploadOverlayBackground">@color/upload_overlay_background_light</item>
<item name="iconSend">@drawable/ic_send_white_24dp</item>
<item name="iconSave">@drawable/ic_save_white_24dp</item>
<item name="iconCamera">@drawable/ic_photo_camera_white_24dp</item>
<item name="iconPhoto">@drawable/ic_photo_white_24dp</item>
<item name="iconUndo">@drawable/ic_undo_white_24dp</item>
<item name="colorPrimary">@color/action_bar_blue</item>
<item name="colorPrimaryDark">@color/status_bar_blue</item>
<item name="spinnerTheme">@style/LightSpinnerTheme</item>
</style>
<style name="DarkSpinnerTheme" parent="DarkAppTheme">
<item name="colorControlNormal">#ffffff</item>
</style>
<style name="LightSpinnerTheme" parent="LightAppTheme">
<item name="colorControlNormal">#ffffff</item>
</style>
<style name="NoTitle" parent="DarkAppTheme">
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
</style> </style>

View file

@ -19,5 +19,11 @@
android:data="@string/beta_opt_in_link" /> android:data="@string/beta_opt_in_link" />
</Preference> </Preference>
<CheckBoxPreference
android:title="@string/preference_theme"
android:defaultValue="false"
android:summary="@string/preference_theme_summary"
android:key="theme" />
</PreferenceScreen> </PreferenceScreen>