Merge branch 'master' into 171-fixing-lint-jfj

This commit is contained in:
Jón Freysteinn Jónsson 2018-02-16 15:55:18 +00:00 committed by GitHub
commit 34c112fb30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 78 additions and 31 deletions

35
ISSUE_TEMPLATE.md Normal file
View file

@ -0,0 +1,35 @@
_Before creating an issue, please search the existing issues to see if a similar one has already been created. You can search issues by specific labels (e.g. `label:nearby `) or just by typing keywords into the search filter._
**Summary:**
Summarize your issue in one sentence (what goes wrong, what did you expect to happen)
**Steps to reproduce:**
How can we reproduce the issue?
**Add System logs:**
Add logcat files here (if possible).
**Expected behavior:**
What did you expect the App to do?
**Observed behavior:**
What did you see instead? Describe your issue in detail here.
**Device and Android version:**
What make and model device (e.g., Samsung J7) did you encounter this on? What Android
version (e.g., Android 4.0 Ice Cream Sandwich or Android 6.0 Marshmallow) are you running? Is it
the stock version from the manufacturer or a custom ROM ?
**Commons app version:**
You can find this information by going to the navigation drawer in the app and tapping 'About'
**Screen-shots:**
Can be created by pressing the Volume Down and Power Button at the same time on Android 4.0 and higher.

View file

@ -57,7 +57,6 @@ public class CommonsApplication extends Application {
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";
private CommonsApplicationComponent component;
private RefWatcher refWatcher;
@ -136,9 +135,10 @@ public class CommonsApplication extends Application {
.subscribe(() -> {
Timber.d("All accounts have been removed");
//TODO: fix preference manager
defaultPrefs.edit().clear().commit();
applicationPrefs.edit().clear().commit();
applicationPrefs.edit().putBoolean("firstrun", false).apply();otherPrefs.edit().clear().commit();
defaultPrefs.edit().clear().apply();
applicationPrefs.edit().clear().apply();
applicationPrefs.edit().putBoolean("firstrun", false).apply();
otherPrefs.edit().clear().apply();
updateAllDatabases();
logoutListener.onLogoutComplete();

View file

@ -298,8 +298,10 @@ public class CategorizationFragment extends CommonsDaggerSupportFragment {
//Check if item contains a 4-digit word anywhere within the string (.* is wildcard)
//And that item does not equal the current year or previous year
//And if it is an irrelevant category such as Media_needing_categories_as_of_16_June_2017(Issue #750)
//Check if the year in the form of XX(X)0s is relevant, i.e. in the 2000s or 2010s as stated in Issue #1029
return ((item.matches(".*(19|20)\\d{2}.*") && !item.contains(yearInString) && !item.contains(prevYearInString))
|| item.matches("(.*)needing(.*)") || item.matches("(.*)taken on(.*)"));
|| item.matches("(.*)needing(.*)") || item.matches("(.*)taken on(.*)")
|| (item.matches(".*0s.*") && !item.matches(".*(200|201)0s.*")));
}
private void updateCategoryCount(CategoryItem item) {

View file

@ -38,7 +38,7 @@ public class LatLng {
/**
* gets the latitude and longitude of a given non-null location
* @param location the non-null location of the user
* @return A new instance of the class
* @return LatLng the Latitude and Longitude of a given location
*/
public static LatLng from(@NonNull Location location) {
return new LatLng(location.getLatitude(), location.getLongitude(), location.getAccuracy());
@ -48,13 +48,12 @@ public class LatLng {
* creates a hash code for the longitude and longitude
*/
public int hashCode() {
boolean var1 = true;
byte var2 = 1;
long var3 = Double.doubleToLongBits(this.latitude);
int var5 = 31 * var2 + (int)(var3 ^ var3 >>> 32);
var3 = Double.doubleToLongBits(this.longitude);
var5 = 31 * var5 + (int)(var3 ^ var3 >>> 32);
return var5;
byte var1 = 1;
long var2 = Double.doubleToLongBits(this.latitude);
int var3 = 31 * var1 + (int)(var2 ^ var2 >>> 32);
var2 = Double.doubleToLongBits(this.longitude);
var3 = 31 * var3 + (int)(var2 ^ var2 >>> 32);
return var3;
}
/**

View file

@ -71,7 +71,12 @@ public class SettingsFragment extends PreferenceFragment {
uploadLimit.setText(uploads + "");
uploadLimit.setSummary(uploads + "");
uploadLimit.setOnPreferenceChangeListener((preference, newValue) -> {
int value = Integer.parseInt(newValue.toString());
int value;
try {
value = Integer.parseInt(newValue.toString());
} catch(Exception e) {
value = 100; //Default number
}
final SharedPreferences.Editor editor = prefs.edit();
if (value > 500) {
new AlertDialog.Builder(getActivity())
@ -85,9 +90,9 @@ public class SettingsFragment extends PreferenceFragment {
uploadLimit.setSummary(500 + "");
uploadLimit.setText(500 + "");
} else {
editor.putInt(Prefs.UPLOADS_SHOWING, Integer.parseInt(newValue.toString()));
editor.putInt(Prefs.UPLOADS_SHOWING, value);
editor.putBoolean(Prefs.IS_CONTRIBUTION_COUNT_CHANGED,true);
uploadLimit.setSummary(newValue.toString());
uploadLimit.setSummary(String.valueOf(value));
}
editor.apply();
return true;

View file

@ -49,18 +49,14 @@ public class FileUtils {
if ("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
} else if (isDownloadsDocument(uri)) { // DownloadsProvider
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri)) {
} else if (isMediaDocument(uri)) { // MediaProvider
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];

View file

@ -15,6 +15,8 @@ public class ExecutorUtils {
}
};
public static Executor uiExecutor() { return uiExecutor; }
public static Executor uiExecutor() {
return uiExecutor;
}
}

View file

@ -15,9 +15,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/contributionsFragmentContainer"
android:orientation="horizontal"

View file

@ -15,8 +15,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/uploadsFragmentContainer"
<FrameLayout android:id="@+id/uploadsFragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"

View file

@ -121,7 +121,7 @@
<string name="tutorial_3_text">দয়া করে আপলোড করবেন না:</string>
<string name="tutorial_3_subtext">u2022 আপনার বন্ধুর সেলফি বা ছবি \nu2022 ইন্টারনেট থেকে ডাউনলোড করা ছবি \nu2022 মালিকানাযুক্ত অ্যাপসমূহের স্ক্রীনশট</string>
<string name="tutorial_4_text">আপলোডের উদাহরণ:</string>
<string name="tutorial_4_subtext" fuzzy="true">u2022 শিরোনাম: সিডনি অপেরা হাউস \nu2022 বিবরণ: উপসাগর থেকে দেখা সিডনি অপেরা হাউস\nu2022 বিষয়শ্রেণী: সিডনি অপেরা হাউস, পশ্চিম দিক থেকে সিডনি অপেরা হাউস, সিডনি অপেরা হাউসের দূরবর্তী দৃশ্য</string>
<string name="tutorial_4_subtext">- শিরোনাম: সিডনি অপেরা হাউস \n- বিবরণ: উপসাগর থেকে দেখা সিডনি অপেরা হাউস\n- বিষয়শ্রেণী: সিডনি অপেরা হাউস, পশ্চিম দিক থেকে সিডনি অপেরা হাউস, সিডনি অপেরা হাউসের দূরবর্তী দৃশ্য</string>
<string name="welcome_wikipedia_text">আপনার ছবি দিয়ে অবদান রাখুন। উইকিপিডিয়ার নিবন্ধগুলিকে নতুন রূপ দিতে সাহায্য করুন!</string>
<string name="welcome_wikipedia_subtext">উইকিপিডিয়াতে চিত্র উইকিমিডিয়া কমন্স থেকে এসেছে।</string>
<string name="welcome_copyright_text">আপনার ছবি সারা বিশ্বের শিক্ষিত মানুষকে সাহায্য করবে।</string>
@ -191,6 +191,7 @@
<string name="navigation_item_feedback">প্রতিক্রিয়া</string>
<string name="navigation_item_logout">প্রস্থান</string>
<string name="navigation_item_info">ভূমিকা</string>
<string name="navigation_item_notification">বিজ্ঞপ্তি</string>
<string name="nearby_needs_permissions">অবস্থানের অনুমতি ছাড়া কাছাকাছি জায়গাগুলি প্রদর্শন করা যাবে না</string>
<string name="no_description_found">কোন বিবরণ পাওয়া যায়নি</string>
<string name="nearby_info_menu_commons_article">কমন্সে ফাইলের পাতা</string>

View file

@ -55,7 +55,7 @@
<string name="enable_gps">Spustit GPS</string>
<string name="contributions_subtitle_zero">Žádné nahrané soubory</string>
<plurals name="contributions_subtitle">
<item quantity="zero">Žádné soubory</item>
<item quantity="zero">\@string/contributions_subtitle_zero</item>
<item quantity="one">1 soubor</item>
<item quantity="other">%1$d souborů</item>
</plurals>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="crash_dialog_text">Вагь. Бир зат чы терс гетди!</string>
<string name="crash_dialog_comment_prompt">Этгенигизни язып бизге электрон почгъа йибери. О масъаланы чечме кёмек этежек!</string>
<string name="crash_dialog_ok_toast">Савбол!</string>
</resources>

View file

@ -90,4 +90,5 @@
<string name="detail_description_empty">वर्णन छैन</string>
<string name="detail_license_empty">अज्ञान अनुमतिपत्र</string>
<string name="menu_refresh">ताजागर्ने</string>
<string name="toggle_view_button">टगल दृश्य</string>
</resources>

View file

@ -52,7 +52,10 @@
<string name="enable_gps">เปิดใช้งาน GPS</string>
<string name="contributions_subtitle_zero">ยังไม่มีการอัปโหลด</string>
<string name="contributions_subtitle">การอัปโหลด %1$d รายการ</string>
<string name="starting_multiple_uploads" fuzzy="true">กำลังเริ่มการอัปโหลด %1$d รายการ</string>
<plurals name="starting_multiple_uploads">
<item quantity="one">กำลังเริ่มอัปโหลด %1$d รายการ</item>
<item quantity="other">กำลังเริ่มอัปโหลด %1$d รายการ</item>
</plurals>
<plurals name="multiple_uploads_title">
<item quantity="one">การอัปโหลด %1$d รายการ</item>
<item quantity="other">การอัปโหลด %1$d รายการ</item>