Merge remote-tracking branch 'refs/remotes/commons-app/master'
1
CREDITS
|
|
@ -18,3 +18,4 @@ their contribution to the product.
|
|||
* Brian MacIntosh
|
||||
* Veyndan Stuart
|
||||
* Vivek Maskara
|
||||
* Neslihan Turan
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'pmd'
|
||||
|
||||
check.dependsOn 'checkstyle'
|
||||
check.dependsOn 'checkstyle', 'pmd'
|
||||
|
||||
checkstyle {
|
||||
toolVersion = '7.5.1'
|
||||
|
|
@ -17,7 +18,28 @@ task checkstyle(type: Checkstyle) {
|
|||
reports {
|
||||
html {
|
||||
enabled true
|
||||
destination "$project.buildDir/reports/checkstyle/checkstyle.html"
|
||||
destination "${project.buildDir}/reports/checkstyle/checkstyle.html"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task pmd(type: Pmd) {
|
||||
ignoreFailures = true
|
||||
ruleSetFiles = files("${project.rootDir}/ruleset.xml")
|
||||
ruleSets = []
|
||||
|
||||
source 'src'
|
||||
include '**/*.java'
|
||||
exclude '**/gen/**'
|
||||
|
||||
reports {
|
||||
xml.enabled = false
|
||||
html.enabled = true
|
||||
xml {
|
||||
destination "${project.buildDir}/reports/pmd/pmd.xml"
|
||||
}
|
||||
html {
|
||||
destination "${project.buildDir}/reports/pmd/pmd.html"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
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 licenseText;
|
||||
private TextView improveText;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.view.MenuInflater;
|
||||
|
|
@ -21,6 +23,13 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
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);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
ListPreference licensePreference = (ListPreference) findPreference(Prefs.DEFAULT_LICENSE);
|
||||
|
|
@ -68,7 +77,12 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
|
|||
|
||||
@Override
|
||||
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...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
|
@ -10,7 +9,9 @@ import android.widget.Button;
|
|||
|
||||
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,
|
||||
PAGE_DO_UPLOAD = 1,
|
||||
PAGE_DONT_UPLOAD = 2,
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ import android.os.AsyncTask;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import fr.free.nrw.commons.theme.BaseAppCompatActivity;
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
|
||||
public abstract class AuthenticatedActivity extends AppCompatActivity {
|
||||
public abstract class AuthenticatedActivity extends BaseAppCompatActivity {
|
||||
|
||||
String accountType;
|
||||
CommonsApplication app;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package fr.free.nrw.commons.auth;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
|
@ -9,7 +8,9 @@ import android.webkit.WebView;
|
|||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class SignupActivity extends Activity {
|
||||
import fr.free.nrw.commons.theme.BaseActivity;
|
||||
|
||||
public class SignupActivity extends BaseActivity {
|
||||
|
||||
private WebView webView;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import android.widget.ListAdapter;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import fr.free.nrw.commons.AboutActivity;
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.R;
|
||||
|
|
@ -207,6 +209,31 @@ public class ContributionsListFragment extends Fragment {
|
|||
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
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ import android.location.LocationListener;
|
|||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import fr.free.nrw.commons.theme.BaseAppCompatActivity;
|
||||
import fr.free.nrw.commons.R;
|
||||
|
||||
public class NearbyActivity extends AppCompatActivity {
|
||||
public class NearbyActivity extends BaseAppCompatActivity {
|
||||
|
||||
private MyLocationListener myLocationListener;
|
||||
private LocationManager locationManager;
|
||||
|
|
@ -141,4 +141,4 @@ public class NearbyActivity extends AppCompatActivity {
|
|||
|
||||
unregisterLocationManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,9 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.Editable;
|
||||
|
|
@ -28,7 +28,6 @@ import android.widget.Spinner;
|
|||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import fr.free.nrw.commons.Prefs;
|
||||
import fr.free.nrw.commons.R;
|
||||
|
|
@ -112,6 +111,13 @@ public class SingleUploadFragment extends Fragment {
|
|||
licenseSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
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 license = Prefs.Licenses.CC_BY_SA_3; // default value
|
||||
|
|
|
|||
BIN
app/src/main/res/drawable-hdpi/ic_photo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 256 B |
BIN
app/src/main/res/drawable-hdpi/ic_photo_camera_black_24dp.png
Normal file
|
After Width: | Height: | Size: 351 B |
BIN
app/src/main/res/drawable-hdpi/ic_save_black_24dp.png
Normal file
|
After Width: | Height: | Size: 240 B |
BIN
app/src/main/res/drawable-hdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 250 B |
BIN
app/src/main/res/drawable-hdpi/ic_undo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 276 B |
BIN
app/src/main/res/drawable-ldrtl-hdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 250 B |
BIN
app/src/main/res/drawable-ldrtl-mdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 204 B |
BIN
app/src/main/res/drawable-ldrtl-xhdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 341 B |
BIN
app/src/main/res/drawable-ldrtl-xxhdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
app/src/main/res/drawable-ldrtl-xxxhdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 551 B |
BIN
app/src/main/res/drawable-mdpi/ic_photo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 183 B |
BIN
app/src/main/res/drawable-mdpi/ic_photo_camera_black_24dp.png
Normal file
|
After Width: | Height: | Size: 236 B |
BIN
app/src/main/res/drawable-mdpi/ic_save_black_24dp.png
Normal file
|
After Width: | Height: | Size: 167 B |
BIN
app/src/main/res/drawable-mdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 205 B |
BIN
app/src/main/res/drawable-mdpi/ic_undo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 199 B |
BIN
app/src/main/res/drawable-xhdpi/ic_photo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 295 B |
BIN
app/src/main/res/drawable-xhdpi/ic_photo_camera_black_24dp.png
Normal file
|
After Width: | Height: | Size: 430 B |
BIN
app/src/main/res/drawable-xhdpi/ic_save_black_24dp.png
Normal file
|
After Width: | Height: | Size: 264 B |
BIN
app/src/main/res/drawable-xhdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
app/src/main/res/drawable-xhdpi/ic_undo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_photo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 424 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_photo_camera_black_24dp.png
Normal file
|
After Width: | Height: | Size: 643 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_save_black_24dp.png
Normal file
|
After Width: | Height: | Size: 368 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 412 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_undo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 473 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_photo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 548 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_photo_camera_black_24dp.png
Normal file
|
After Width: | Height: | Size: 860 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_save_black_24dp.png
Normal file
|
After Width: | Height: | Size: 477 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_send_black_24dp.png
Normal file
|
After Width: | Height: | Size: 543 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_undo_black_24dp.png
Normal file
|
After Width: | Height: | Size: 601 B |
|
|
@ -1,7 +1,7 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000"
|
||||
android:background="?attr/mainBackground"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#0c609c"
|
||||
android:background="?attr/commonsAppBlue"
|
||||
>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
android:id="@+id/mediaDetailCategoryItemText"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
/>
|
||||
|
||||
<fr.free.nrw.commons.media.MediaDetailSpacer
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#AA000000"
|
||||
android:background="?attr/fragmentCategorisationBackground"
|
||||
android:paddingBottom="8dip"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingStart="16dip"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000000"
|
||||
android:background="?attr/mainBackground"
|
||||
>
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/background_dark"
|
||||
android:background="?attr/mainBackground"
|
||||
>
|
||||
|
||||
<ProgressBar
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#AA000000"
|
||||
android:background="?attr/fragmentCategorisationBackground"
|
||||
android:padding="16dp"
|
||||
>
|
||||
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
android:padding="16dp"
|
||||
>
|
||||
<TextView
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
android:id="@+id/mediaDetailTitle"
|
||||
android:layout_gravity="left|start"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
android:textSize="14sp"
|
||||
android:padding="12dp"
|
||||
/>
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
android:padding="16dp"
|
||||
>
|
||||
<TextView
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/media_detail_description_explanation"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
android:id="@+id/mediaDetailDesc"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_gravity="left|start"
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
android:padding="16dp"
|
||||
>
|
||||
<TextView
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
android:text="License link"
|
||||
android:id="@+id/mediaDetailLicense"
|
||||
android:layout_gravity="left|start"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp"
|
||||
android:padding="12dp"
|
||||
|
|
@ -168,7 +168,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#20ffffff"
|
||||
android:background="?attr/subBackground"
|
||||
android:padding="16dp"
|
||||
android:textStyle="bold"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill"
|
||||
android:orientation="vertical"
|
||||
android:background="#AA000000"
|
||||
android:background="?attr/fragmentCategorisationBackground"
|
||||
android:paddingBottom="8dip"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:paddingEnd="16dip"
|
||||
android:paddingTop="8dip"
|
||||
android:theme="@style/DarkAppTheme"
|
||||
>
|
||||
|
||||
<EditText
|
||||
|
|
@ -36,12 +37,12 @@
|
|||
android:id="@+id/licenseSpinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
</Spinner>
|
||||
android:theme="?attr/spinnerTheme"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:text="@string/use_previous"
|
||||
android:background="#90000000"
|
||||
android:background="?attr/buttonBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/titleDescButton"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/menu_upload_single"
|
||||
android:title="@string/menu_upload_single"
|
||||
android:icon="@drawable/ic_send_white_24dp"
|
||||
android:icon="?attr/iconSend"
|
||||
android:enabled="false"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/menu_save_categories"
|
||||
android:title="@string/menu_save_categories"
|
||||
android:icon="@drawable/ic_save_white_24dp"
|
||||
android:icon="?attr/iconSave"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
|
|
@ -4,13 +4,13 @@
|
|||
android:title="@string/menu_from_camera"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:icon="@drawable/ic_photo_camera_white_24dp"
|
||||
android:icon="?attr/iconCamera"
|
||||
/>
|
||||
<item android:id="@+id/menu_from_gallery"
|
||||
android:title="@string/menu_from_gallery"
|
||||
android:orderInCategory="200"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:icon="@drawable/ic_photo_white_24dp"
|
||||
android:icon="?attr/iconPhoto"
|
||||
/>
|
||||
<item android:id="@+id/menu_settings"
|
||||
android:title="@string/menu_settings"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<item
|
||||
android:id="@+id/menu_retry_current_image"
|
||||
android:enabled="false"
|
||||
android:icon="@drawable/ic_undo_white_24dp"
|
||||
android:icon="?attr/iconUndo"
|
||||
android:title="@string/menu_retry_upload"
|
||||
android:visible="false"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
<item android:id="@+id/menu_upload_multiple"
|
||||
android:title="@string/share_upload_button"
|
||||
app:showAsAction="always|withText"
|
||||
android:icon="@drawable/ic_send_white_24dp"
|
||||
android:icon="?attr/iconSend"
|
||||
/>
|
||||
</menu>
|
||||
16
app/src/main/res/values/attrs.xml
Normal 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>
|
||||
|
|
@ -1,6 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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="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>
|
||||
|
|
|
|||
|
|
@ -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="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="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_four"> Attribution 4.0</string>
|
||||
<string name="license_name_cc_by_sa"> Attribution-ShareAlike 3.0</string>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,49 @@
|
|||
<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>
|
||||
</style>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,5 +19,11 @@
|
|||
android:data="@string/beta_opt_in_link" />
|
||||
</Preference>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:title="@string/preference_theme"
|
||||
android:defaultValue="false"
|
||||
android:summary="@string/preference_theme_summary"
|
||||
android:key="theme" />
|
||||
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
|
|||
14
ruleset.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Commons Android App Rules"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
|
||||
<description>Custom ruleset for Commons Android app</description>
|
||||
|
||||
<exclude-pattern>.*/R.java</exclude-pattern>
|
||||
<exclude-pattern>.*/gen/.*</exclude-pattern>
|
||||
|
||||
<rule ref="rulesets/java/android.xml" />
|
||||
<rule ref="rulesets/java/basic.xml" />
|
||||
</ruleset>
|
||||