From 6744940970b161c4ec41957e27d1a883ed26b80c Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Fri, 4 May 2018 01:44:26 +0530 Subject: [PATCH 01/15] Implemented Statistics --- app/build.gradle | 7 +- app/src/main/AndroidManifest.xml | 58 +- .../fr/free/nrw/commons/Achievements.java | 20 + app/src/main/res/drawable/featured.xml | 1069 +++++++++++++++++ app/src/main/res/drawable/ic_thanks.xml | 4 + .../main/res/layout/activity_achievements.xml | 96 ++ app/src/main/res/values/strings.xml | 561 ++++----- 7 files changed, 1504 insertions(+), 311 deletions(-) create mode 100644 app/src/main/java/fr/free/nrw/commons/Achievements.java create mode 100644 app/src/main/res/drawable/featured.xml create mode 100644 app/src/main/res/drawable/ic_thanks.xml create mode 100644 app/src/main/res/layout/activity_achievements.xml diff --git a/app/build.gradle b/app/build.gradle index 5d37f8f54..bba94c683 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ dependencies { implementation 'info.debatty:java-string-similarity:0.24' implementation 'com.borjabravo:readmoretextview:2.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' - implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:5.4.1@aar'){ - transitive=true + implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:5.4.1@aar') { + transitive = true } implementation "com.github.deano2390:MaterialShowcaseView:1.2.0" @@ -116,7 +116,8 @@ android { buildTypes { release { - minifyEnabled false // See https://stackoverflow.com/questions/40232404/google-play-apk-and-android-studio-apk-usb-debug-behaving-differently - proguard.cfg modification alone insufficient. + minifyEnabled false + // See https://stackoverflow.com/questions/40232404/google-play-apk-and-android-studio-apk-usb-debug-behaving-differently - proguard.cfg modification alone insufficient. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } debug { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 17f6770d2..f41cf677c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,3 +1,4 @@ + @@ -14,7 +15,7 @@ - + @@ -23,81 +24,81 @@ android:name=".CommonsApplication" android:icon="@drawable/ic_launcher" android:label="@string/app_name" - android:theme="@style/LightAppTheme" - android:supportsRtl="true" > - - + android:supportsRtl="true" + android:theme="@style/LightAppTheme"> + - - - - + - - + + - + + - - - - - - - - + + + + + + + + - + - + @@ -142,21 +143,18 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /> - - - - + \ No newline at end of file diff --git a/app/src/main/java/fr/free/nrw/commons/Achievements.java b/app/src/main/java/fr/free/nrw/commons/Achievements.java new file mode 100644 index 000000000..d16b384a6 --- /dev/null +++ b/app/src/main/java/fr/free/nrw/commons/Achievements.java @@ -0,0 +1,20 @@ +package fr.free.nrw.commons; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.View; +import android.widget.ImageView; + +public class Achievements extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_achievements); + + + } + +} diff --git a/app/src/main/res/drawable/featured.xml b/app/src/main/res/drawable/featured.xml new file mode 100644 index 000000000..e971c3446 --- /dev/null +++ b/app/src/main/res/drawable/featured.xml @@ -0,0 +1,1069 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_thanks.xml b/app/src/main/res/drawable/ic_thanks.xml new file mode 100644 index 000000000..480b45c1b --- /dev/null +++ b/app/src/main/res/drawable/ic_thanks.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml new file mode 100644 index 000000000..4841bda38 --- /dev/null +++ b/app/src/main/res/layout/activity_achievements.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6e30baa10..398b010b3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,287 +1,292 @@ - Appearance - General - Feedback - Location - Commons - - Settings - Username - Password - Log in to your Commons Beta account - Log in - Forgot Password? - Sign up - Logging in - Please wait… - Login success! - Login failed! - File not found. Please try another file. - Authentication failed! - Upload started! - %1$s uploaded! - Tap to view your upload - Starting %1$s upload - %1$s uploading - Finishing uploading %1$s - Uploading %1$s failed - Tap to view - - %1$d file uploading - %1$d files uploading - - My Recent Uploads - Queued - Failed - %1$d%% complete - Uploading - From Gallery - Take photo - Nearby - My uploads - Share - View in Browser - Title - Please provide a title for this file - Description - Unable to login - network failure - Unable to login - please check your username - Unable to login - please check your password - Too many unsuccessful attempts. Please try again in a few minutes. - Sorry, this user has been blocked on Commons - You must provide your two factor authentication code. - Login failed - Upload - Name this set - Modifications - Upload - Search categories - Save - Refresh - List - GPS is disabled in your device. Would you like to enable it? - Enable GPS - No uploads yet - - - @string/contributions_subtitle_zero - %1$d upload - %1$d uploads - - - Starting %1$d upload - Starting %1$d uploads - - - %1$d upload - %1$d uploads - - No categories matching %1$s found - Add categories to make your images more discoverable on Wikimedia Commons.\nStart typing to add categories. - Categories - Settings - Sign Up - Featured Images - About - The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. - Wikimedia Commons - Create a new <a href=\"https://github.com/commons-app/apps-android-commons/issues\">GitHub issue</a> for bug reports and suggestions. - Privacy policy]]> - Credits]]> - About - Send Feedback (via Email) - No email client installed - Recently used categories - Waiting for first sync… - You have not yet uploaded any photos. - Retry - Cancel - This image will be licensed under %1$s - By submitting this picture, I declare that this is my own work, that it does not contain copyrighted material or selfies, and otherwise adheres to <a href=\"https://commons.wikimedia.org/wiki/Commons:Policies_and_guidelines\">Wikimedia Commons policies</a>. - Download - Default License - Use previous title/description - Automatically get current location - Retrieve current location to offer category suggestions if image is not geotagged - Night mode - Use dark theme - Attribution-ShareAlike 4.0 - Attribution 4.0 - Attribution-ShareAlike 3.0 - Attribution 3.0 - CC0 - CC BY-SA 3.0 - CC BY-SA 3.0 (Austria) - CC BY-SA 3.0 (Germany) - CC BY-SA 3.0 (Estonia) - CC BY-SA 3.0 (Spain) - CC BY-SA 3.0 (Croatia) - CC BY-SA 3.0 (Luxembourg) - CC BY-SA 3.0 (Netherlands) - CC BY-SA 3.0 (Norway) - CC BY-SA 3.0 (Poland) - CC BY-SA 3.0 (Romania) - CC BY 3.0 - CC BY-SA 4.0 - CC BY 4.0 - CC Zero - Wikimedia Commons hosts most of the images that are used in Wikipedia. - Your images help educate people around the world! - Please upload pictures that are taken or created entirely by yourself: - Natural objects (flowers, animals, mountains)\n• Useful objects (bicycles, train stations)\n• Famous people (your mayor, Olympic athletes you met) - Natural objects (flowers, animals, mountains) - Useful objects (bicycles, train stations) - Famous people (your mayor, Olympic athletes you met) - Please do NOT upload: - - Selfies or pictures of your friends\n- Pictures you downloaded from the Internet\n- Screenshots of proprietary apps - Selfies or pictures of your friends - Pictures you downloaded from the Internet - Screenshots of proprietary apps - Example upload: - - Title: Sydney Opera House\n- Description: Sydney Opera House as viewed from across the bay\n- Categories: Sydney Opera House from the west, Sydney Opera House remote views - Title: Sydney Opera House - Description: Sydney Opera House as viewed from across the bay - Categories: Sydney Opera House from the west, Sydney Opera House remote views - Contribute your images. Help Wikipedia articles come to life! - Images on Wikipedia come from Wikimedia Commons. - Your images help educate people around the world. - Avoid copyrighted materials you found from the Internet as well as images of posters, book covers, etc. - You think you got it? - Yes! - More Information - Categories - Loading… - None selected - No description - Unknown license - Refresh - Required permission: Read external storage. App cannot access your gallery without this. - Required permission: Write external storage. App cannot access your camera without this. - Optional permission: Get current location for category suggestions - OK - Nearby Places - No nearby places found - Warning - This file already exists on Commons. Are you sure you want to proceed? - Yes - No - Title - Title of the media - Description - Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though. - Author - Featured image author user name goes here. - Uploaded date - License - Coordinates - None provided - Become a Beta Tester - Opt-in to our beta channel on Google Play and get early access to new features and bug fixes - https://play.google.com/apps/testing/fr.free.nrw.commons - mapbox://styles/mapbox/traffic-day-v2 - mapbox://styles/mapbox/traffic-night-v2 - pk.eyJ1IjoibWFza2FyYXZpdmVrIiwiYSI6ImNqMmxvdzFjMTAwMHYzM283ZWM3eW5tcDAifQ.ib5SZ9EVjwJe6GSKve0bcg - 2FA Code - My Recent Upload Limit - Maximum Limit - Unable to display more than 500 - Set Recent Upload Limit - Two factor authentication is currently not supported. - Do you really want to logout? - Commons Logo - Commons Website - Commons Facebook Page - Commons Github Source Code - Background Image - Media Image Failed - No Image Found - Upload Image - Mount Zao - Llamas - Rainbow Bridge - Tulip - No Selfies - Proprietary Image - Welcome Wikipedia - Welcome Copyright - Sydney Opera House - Cancel - Open - Close - Home - Upload - Nearby - About - Settings - Feedback - Logout - Tutorial - Notifications - Featured - Nearby places cannot be displayed without location permissions - no description found - Commons file page - Wikidata item - Wikipedia article - Error while caching pictures - A unique descriptive title for the file, which will serve as a filename. You may use plain language with spaces. Do not include the file extension - Please describe the media as much as possible: Where was it taken? What does it show? What is the context? Please describe the objects or persons. Reveal information that can not be easily guessed, for instance the time of day if it is a landscape. If the media shows something unusual, please explain what makes it unusual. - This picture is too dark, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. - This picture is blurry, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. - Give permission - Use external storage - Save pictures taken with the in-app camera on your device - Login to your account - Send log file - Send log file to developers via email - No web browser found to open URL - Error! URL not found - Nominate for Deletion - This image has been nominated for deletion. - See webpage for details - View in Browser + Appearance + General + Feedback + Location + Commons + + Settings + Username + Password + Log in to your Commons Beta account + Log in + Forgot Password? + Sign up + Logging in + Please wait… + Login success! + Login failed! + File not found. Please try another file. + Authentication failed! + Upload started! + %1$s uploaded! + Tap to view your upload + Starting %1$s upload + %1$s uploading + Finishing uploading %1$s + Uploading %1$s failed + Tap to view + + %1$d file uploading + %1$d files uploading + + My Recent Uploads + Queued + Failed + %1$d%% complete + Uploading + From Gallery + Take photo + Nearby + My uploads + Share + View in Browser + Title + Please provide a title for this file + Description + Unable to login - network failure + Unable to login - please check your username + Unable to login - please check your password + Too many unsuccessful attempts. Please try again in a few minutes. + Sorry, this user has been blocked on Commons + You must provide your two factor authentication code. + Login failed + Upload + Name this set + Modifications + Upload + Search categories + Save + Refresh + List + GPS is disabled in your device. Would you like to enable it? + Enable GPS + No uploads yet + + + @string/contributions_subtitle_zero + %1$d upload + %1$d uploads + + + Starting %1$d upload + Starting %1$d uploads + + + %1$d upload + %1$d uploads + + No categories matching %1$s found + Add categories to make your images more discoverable on Wikimedia Commons.\nStart typing to add categories. + Categories + Settings + Sign Up + Featured Images + About + The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. + Wikimedia Commons + Create a new <a href=\"https://github.com/commons-app/apps-android-commons/issues\">GitHub issue</a> for bug reports and suggestions. + Privacy policy]]> + Credits]]> + About + Send Feedback (via Email) + No email client installed + Recently used categories + Waiting for first sync… + You have not yet uploaded any photos. + Retry + Cancel + This image will be licensed under %1$s + By submitting this picture, I declare that this is my own work, that it does not contain copyrighted material or selfies, and otherwise adheres to <a href=\"https://commons.wikimedia.org/wiki/Commons:Policies_and_guidelines\">Wikimedia Commons policies</a>. + Download + Default License + Use previous title/description + Automatically get current location + Retrieve current location to offer category suggestions if image is not geotagged + Night mode + Use dark theme + Attribution-ShareAlike 4.0 + Attribution 4.0 + Attribution-ShareAlike 3.0 + Attribution 3.0 + CC0 + CC BY-SA 3.0 + CC BY-SA 3.0 (Austria) + CC BY-SA 3.0 (Germany) + CC BY-SA 3.0 (Estonia) + CC BY-SA 3.0 (Spain) + CC BY-SA 3.0 (Croatia) + CC BY-SA 3.0 (Luxembourg) + CC BY-SA 3.0 (Netherlands) + CC BY-SA 3.0 (Norway) + CC BY-SA 3.0 (Poland) + CC BY-SA 3.0 (Romania) + CC BY 3.0 + CC BY-SA 4.0 + CC BY 4.0 + CC Zero + Wikimedia Commons hosts most of the images that are used in Wikipedia. + Your images help educate people around the world! + Please upload pictures that are taken or created entirely by yourself: + Natural objects (flowers, animals, mountains)\n• Useful objects (bicycles, train stations)\n• Famous people (your mayor, Olympic athletes you met) + Natural objects (flowers, animals, mountains) + Useful objects (bicycles, train stations) + Famous people (your mayor, Olympic athletes you met) + Please do NOT upload: + - Selfies or pictures of your friends\n- Pictures you downloaded from the Internet\n- Screenshots of proprietary apps + Selfies or pictures of your friends + Pictures you downloaded from the Internet + Screenshots of proprietary apps + Example upload: + - Title: Sydney Opera House\n- Description: Sydney Opera House as viewed from across the bay\n- Categories: Sydney Opera House from the west, Sydney Opera House remote views + Title: Sydney Opera House + Description: Sydney Opera House as viewed from across the bay + Categories: Sydney Opera House from the west, Sydney Opera House remote views + Contribute your images. Help Wikipedia articles come to life! + Images on Wikipedia come from Wikimedia Commons. + Your images help educate people around the world. + Avoid copyrighted materials you found from the Internet as well as images of posters, book covers, etc. + You think you got it? + Yes! + More Information + Categories + Loading… + None selected + No description + Unknown license + Refresh + Required permission: Read external storage. App cannot access your gallery without this. + Required permission: Write external storage. App cannot access your camera without this. + Optional permission: Get current location for category suggestions + OK + Nearby Places + No nearby places found + Warning + This file already exists on Commons. Are you sure you want to proceed? + Yes + No + Title + Title of the media + Description + Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though. + Author + Featured image author user name goes here. + Uploaded date + License + Coordinates + None provided + Become a Beta Tester + Opt-in to our beta channel on Google Play and get early access to new features and bug fixes + https://play.google.com/apps/testing/fr.free.nrw.commons + mapbox://styles/mapbox/traffic-day-v2 + mapbox://styles/mapbox/traffic-night-v2 + pk.eyJ1IjoibWFza2FyYXZpdmVrIiwiYSI6ImNqMmxvdzFjMTAwMHYzM283ZWM3eW5tcDAifQ.ib5SZ9EVjwJe6GSKve0bcg + 2FA Code + My Recent Upload Limit + Maximum Limit + Unable to display more than 500 + Set Recent Upload Limit + Two factor authentication is currently not supported. + Do you really want to logout? + Commons Logo + Commons Website + Commons Facebook Page + Commons Github Source Code + Background Image + Media Image Failed + No Image Found + Upload Image + Mount Zao + Llamas + Rainbow Bridge + Tulip + No Selfies + Proprietary Image + Welcome Wikipedia + Welcome Copyright + Sydney Opera House + Cancel + Open + Close + Home + Upload + Nearby + About + Settings + Feedback + Logout + Tutorial + Notifications + Featured + Nearby places cannot be displayed without location permissions + no description found + Commons file page + Wikidata item + Wikipedia article + Error while caching pictures + A unique descriptive title for the file, which will serve as a filename. You may use plain language with spaces. Do not include the file extension + Please describe the media as much as possible: Where was it taken? What does it show? What is the context? Please describe the objects or persons. Reveal information that can not be easily guessed, for instance the time of day if it is a landscape. If the media shows something unusual, please explain what makes it unusual. + This picture is too dark, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. + This picture is blurry, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. + Give permission + Use external storage + Save pictures taken with the in-app camera on your device + Login to your account + Send log file + Send log file to developers via email + No web browser found to open URL + Error! URL not found + Nominate for Deletion + This image has been nominated for deletion. + See webpage for details + View in Browser - Location has not changed. - Location not available. - Permission required to display a list of nearby places - GET DIRECTIONS - READ ARTICLE + Location has not changed. + Location not available. + Permission required to display a list of nearby places + GET DIRECTIONS + READ ARTICLE - Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here. - %1$s left a message on your talk page - Thank you for making an edit - %1$s mentioned you on %2$s. - Toggle view - DIRECTIONS - WIKIDATA - WIKIPEDIA - COMMONS - Rate us]]> - FAQ]]> - Skip Tutorial - Internet unavailable - Internet available - Error fetching notifications - No notifications found - Translate]]> - Languages - Select the language that you would like to submit translations for - Proceed - Cancel - Retry + Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here. + %1$s left a message on your talk page + Thank you for making an edit + %1$s mentioned you on %2$s. + Toggle view + DIRECTIONS + WIKIDATA + WIKIPEDIA + COMMONS + Rate us]]> + FAQ]]> + Skip Tutorial + Internet unavailable + Internet available + Error fetching notifications + No notifications found + Translate]]> + Languages + Select the language that you would like to submit translations for + Proceed + Cancel + Retry - Got it! - These are the places near you that need pictures to illustrate their Wikipedia articles - Tapping this button brings up a list of these places - You can upload a picture for any place from your gallery or camera + Got it! + These are the places near you that need pictures to illustrate their Wikipedia articles + Tapping this button brings up a list of these places + You can upload a picture for any place from your gallery or camera - No images found! - Error occurred while loading images. - Uploaded by: %1$s + No images found! + Error occurred while loading images. + Uploaded by: %1$s - Share App - Coordinates were not specified during image selection - Error fetching nearby places. + Share App + Coordinates were not specified during image selection + Error fetching nearby places. + + Achievements + STATISTICS + Thanks Received + Featured Images From 8fc7f795f6c9e88bc35d50efdecd3b0fc759673b Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Sat, 5 May 2018 00:54:52 +0530 Subject: [PATCH 02/15] Basic Structure Implemented --- app/build.gradle | 1 + .../main/res/layout/activity_achievements.xml | 160 ++++++++++++++++-- app/src/main/res/values/strings.xml | 3 +- 3 files changed, 150 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bba94c683..25853684b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -68,6 +68,7 @@ dependencies { testImplementation 'org.robolectric:robolectric:3.7.1' testImplementation 'com.nhaarman:mockito-kotlin:1.5.0' testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1' + compile 'com.dinuscxj:circleprogressbar:1.1.1' androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1' diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml index 4841bda38..a8a0107ad 100644 --- a/app/src/main/res/layout/activity_achievements.xml +++ b/app/src/main/res/layout/activity_achievements.xml @@ -14,14 +14,126 @@ layout="@layout/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" /> - + - + + + + + + + + + + + + + + + + + - + - - + + android:layout_marginStart="@dimen/activity_margin_horizontal"> - + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 398b010b3..8b71f6d9f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -288,5 +288,6 @@ STATISTICS Thanks Received Featured Images - + LEVEL + Images Uploaded From 2a6ac7a5c6e4ed9b7e6f0fbc78514dcedd249562 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Sat, 12 May 2018 19:22:27 +0530 Subject: [PATCH 03/15] Layout made screen independent and menu inflated --- .../fr/free/nrw/commons/Achievements.java | 28 +++ .../main/res/layout/activity_achievements.xml | 162 +++++++++--------- 2 files changed, 112 insertions(+), 78 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/Achievements.java b/app/src/main/java/fr/free/nrw/commons/Achievements.java index d16b384a6..e210606d0 100644 --- a/app/src/main/java/fr/free/nrw/commons/Achievements.java +++ b/app/src/main/java/fr/free/nrw/commons/Achievements.java @@ -2,19 +2,47 @@ package fr.free.nrw.commons; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.util.DisplayMetrics; import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.Toolbar; + +import fr.free.nrw.commons.theme.NavigationBaseActivity; public class Achievements extends AppCompatActivity { + private static final double badge_image_ratio_width = 0.5; + private static final double badge_image_ratio_height = 0.5; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_achievements); + DisplayMetrics displayMetrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + int height = displayMetrics.heightPixels; + int width = displayMetrics.widthPixels; + + ImageView imageView = (ImageView)findViewById(R.id.achievement_badge); + + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) + imageView.getLayoutParams(); + params.height = (int) (height*badge_image_ratio_height); + params.width = (int) (width*badge_image_ratio_width); + imageView.setImageResource(R.drawable.sydney_opera_house); + imageView.requestLayout(); + + android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); + toolbar.inflateMenu(R.menu.menu_about); } + + + } diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml index a8a0107ad..60ab9c92f 100644 --- a/app/src/main/res/layout/activity_achievements.xml +++ b/app/src/main/res/layout/activity_achievements.xml @@ -5,6 +5,9 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + - + android:background="#D6DCE0" + android:orientation="vertical"> + + android:layout_marginStart="@dimen/activity_margin_horizontal" + android:layout_marginTop="@dimen/activity_margin_horizontal" + android:text="@string/level" + android:id="@+id/achievement_level"/> + android:layout_below="@id/achievement_level" + android:layout_centerHorizontal="true" + android:layout_marginVertical="@dimen/activity_margin_vertical" /> + + + android:layout_marginStart="@dimen/activity_margin_horizontal" + android:text="@string/images_uploaded" /> + + app:progress_start_color="#3A3381" + app:progress_stroke_width="3dp" + app:progress_text_format_pattern="12/24" + app:style="solid_line" /> + - - - - + + android:layout_marginStart="@dimen/activity_margin_horizontal" + android:text="@string/images_uploaded" /> + + app:progress_start_color="#3A3381" + app:progress_stroke_width="3dp" + app:progress_text_format_pattern="12/24" + app:style="solid_line" /> + + + + + + + + android:layout_height="wrap_content" + android:orientation="vertical"> + Date: Sat, 12 May 2018 20:43:41 +0530 Subject: [PATCH 04/15] Share Screenshot using cache --- .../fr/free/nrw/commons/Achievements.java | 64 +++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/Achievements.java b/app/src/main/java/fr/free/nrw/commons/Achievements.java index e210606d0..7206964e6 100644 --- a/app/src/main/java/fr/free/nrw/commons/Achievements.java +++ b/app/src/main/java/fr/free/nrw/commons/Achievements.java @@ -1,23 +1,34 @@ package fr.free.nrw.commons; +import android.content.Intent; +import android.graphics.Bitmap; +import android.net.Uri; +import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.DisplayMetrics; +import android.util.Log; import android.view.Menu; import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; +import android.widget.Toast; import android.widget.Toolbar; +import java.io.File; +import java.io.FileOutputStream; +import java.util.Random; + import fr.free.nrw.commons.theme.NavigationBaseActivity; public class Achievements extends AppCompatActivity { private static final double badge_image_ratio_width = 0.5; private static final double badge_image_ratio_height = 0.5; - + private ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -28,7 +39,7 @@ public class Achievements extends AppCompatActivity { int height = displayMetrics.heightPixels; int width = displayMetrics.widthPixels; - ImageView imageView = (ImageView)findViewById(R.id.achievement_badge); + imageView = (ImageView)findViewById(R.id.achievement_badge); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageView.getLayoutParams(); @@ -38,11 +49,56 @@ public class Achievements extends AppCompatActivity { imageView.requestLayout(); android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); - toolbar.inflateMenu(R.menu.menu_about); + setSupportActionBar(toolbar); } - + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_about, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == R.id.share_app_icon) { + View rootView = getWindow().getDecorView().findViewById(android.R.id.content); + Bitmap screenShot = getScreenShot(rootView); + imageView.setImageBitmap(screenShot); + shareScreen(screenShot); + } + + return super.onOptionsItemSelected(item); + } + + public static Bitmap getScreenShot(View view) { + View screenView = view.getRootView(); + screenView.setDrawingCacheEnabled(true); + Bitmap bitmap = Bitmap.createBitmap(screenView.getDrawingCache()); + screenView.setDrawingCacheEnabled(false); + return bitmap; + } + + void shareScreen ( Bitmap bitmap){ + try { + File file = new File(this.getExternalCacheDir(),"screen.png"); + FileOutputStream fOut = new FileOutputStream(file); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); + fOut.flush(); + fOut.close(); + file.setReadable(true, false); + final Intent intent = new Intent(android.content.Intent.ACTION_SEND); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); + intent.setType("image/png"); + startActivity(Intent.createChooser(intent, "Share image via")); + } catch (Exception e) { + e.printStackTrace(); + } + } + } From 3851d37a380a215ef938e17142d6e42d75dc3b5a Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Wed, 16 May 2018 03:11:10 +0530 Subject: [PATCH 05/15] Improved the Image Bound and added strings --- app/src/main/java/fr/free/nrw/commons/Achievements.java | 4 ++-- app/src/main/res/layout/activity_achievements.xml | 4 ++-- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/Achievements.java b/app/src/main/java/fr/free/nrw/commons/Achievements.java index 7206964e6..cafa9a167 100644 --- a/app/src/main/java/fr/free/nrw/commons/Achievements.java +++ b/app/src/main/java/fr/free/nrw/commons/Achievements.java @@ -26,8 +26,8 @@ import fr.free.nrw.commons.theme.NavigationBaseActivity; public class Achievements extends AppCompatActivity { - private static final double badge_image_ratio_width = 0.5; - private static final double badge_image_ratio_height = 0.5; + private static final double badge_image_ratio_width = 0.4; + private static final double badge_image_ratio_height = 0.36; private ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml index 60ab9c92f..761e791ac 100644 --- a/app/src/main/res/layout/activity_achievements.xml +++ b/app/src/main/res/layout/activity_achievements.xml @@ -92,7 +92,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="@dimen/activity_margin_horizontal" android:layout_marginStart="@dimen/activity_margin_horizontal" - android:text="@string/images_uploaded" /> + android:text="@string/image_reverts" /> + android:text="@string/images_used_by_wiki" /> Featured Images LEVEL Images Uploaded + Images Not Reverted + Images Used By Wiki From fe82581472373095ec0e9236546b3dd44849b5b0 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Sun, 20 May 2018 16:31:52 +0530 Subject: [PATCH 06/15] Improved the quality of Pr --- app/src/main/AndroidManifest.xml | 2 +- .../AchievementsActivity.java} | 42 +- .../main/res/layout/activity_achievements.xml | 418 +++++++++--------- app/src/main/res/values/colors.xml | 1 + 4 files changed, 244 insertions(+), 219 deletions(-) rename app/src/main/java/fr/free/nrw/commons/{Achievements.java => achievements/AchievementsActivity.java} (76%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f41cf677c..79bc3ab6c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -89,7 +89,7 @@ android:parentActivityName=".contributions.ContributionsActivity" /> diff --git a/app/src/main/java/fr/free/nrw/commons/Achievements.java b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java similarity index 76% rename from app/src/main/java/fr/free/nrw/commons/Achievements.java rename to app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java index cafa9a167..f19003c3f 100644 --- a/app/src/main/java/fr/free/nrw/commons/Achievements.java +++ b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java @@ -1,4 +1,4 @@ -package fr.free.nrw.commons; +package fr.free.nrw.commons.achievements; import android.content.Intent; import android.graphics.Bitmap; @@ -20,37 +20,42 @@ import android.widget.Toolbar; import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.util.Random; +import butterknife.BindView; +import butterknife.ButterKnife; +import dagger.Binds; +import fr.free.nrw.commons.R; import fr.free.nrw.commons.theme.NavigationBaseActivity; -public class Achievements extends AppCompatActivity { +public class AchievementsActivity extends AppCompatActivity { + + private static final double BADGE_IMAGE_WIDTH_RATIO = 0.4; + private static final double BADGE_IMAGE_HEIGHT_RATIO = 0.36; + + @BindView(R.id.achievement_badge) ImageView imageView; + @BindView(R.id.toolbar) android.support.v7.widget.Toolbar toolbar; - private static final double badge_image_ratio_width = 0.4; - private static final double badge_image_ratio_height = 0.36; - private ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_achievements); + ButterKnife.bind(this); DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int height = displayMetrics.heightPixels; int width = displayMetrics.widthPixels; - imageView = (ImageView)findViewById(R.id.achievement_badge); - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageView.getLayoutParams(); - params.height = (int) (height*badge_image_ratio_height); - params.width = (int) (width*badge_image_ratio_width); + params.height = (int) (height*BADGE_IMAGE_HEIGHT_RATIO); + params.width = (int) (width*BADGE_IMAGE_WIDTH_RATIO); imageView.setImageResource(R.drawable.sydney_opera_house); imageView.requestLayout(); - android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); - } @Override @@ -73,6 +78,11 @@ public class Achievements extends AppCompatActivity { return super.onOptionsItemSelected(item); } + /** + * To take screenshot of the screen and return it in Bitmap format + * @param view + * @return + */ public static Bitmap getScreenShot(View view) { View screenView = view.getRootView(); screenView.setDrawingCacheEnabled(true); @@ -81,6 +91,10 @@ public class Achievements extends AppCompatActivity { return bitmap; } + /** + * To take bitmap and store it temporary storage and share it + * @param bitmap + */ void shareScreen ( Bitmap bitmap){ try { File file = new File(this.getExternalCacheDir(),"screen.png"); @@ -94,11 +108,9 @@ public class Achievements extends AppCompatActivity { intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); intent.setType("image/png"); startActivity(Intent.createChooser(intent, "Share image via")); - } catch (Exception e) { - e.printStackTrace(); + } catch (IOException e) { + //Do Nothing } } - - } diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml index 761e791ac..9ec4b07dd 100644 --- a/app/src/main/res/layout/activity_achievements.xml +++ b/app/src/main/res/layout/activity_achievements.xml @@ -8,224 +8,235 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + android:layout_below="@+id/toolbar" + android:background="@color/layout_light_grey" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index ef5000d60..02dae825d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -50,6 +50,7 @@ #E0E0E0 #424242 + #D6DCE0 #757575 From 3797d714a1f008fdfe726ee7d6d5a836159bcd47 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Sun, 20 May 2018 21:50:15 +0530 Subject: [PATCH 07/15] Wired to navigation drawer --- app/src/main/AndroidManifest.xml | 11 +++++------ .../achievements/AchievementsActivity.java | 11 ++++++++++- .../nrw/commons/di/ActivityBuilderModule.java | 6 +++++- .../nrw/commons/theme/NavigationBaseActivity.java | 15 +++++++++++++-- .../main/res/drawable/ic_person_black_24dp.xml | 5 +++++ app/src/main/res/layout/drawer_header.xml | 13 +++++++++++++ 6 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 app/src/main/res/drawable/ic_person_black_24dp.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 79bc3ab6c..112ee6bcb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -33,7 +33,11 @@ android:launchMode="singleInstance" android:theme="@android:style/Theme.Dialog" /> + + + + - - + android:label="@string/Achievements" /> - - - void startActivityWithFlags(Context context, Class cls, int... flags) { Intent intent = new Intent(context, cls); - for (int flag: flags) { + for (int flag : flags) { intent.addFlags(flag); } context.startActivity(intent); } + } diff --git a/app/src/main/res/drawable/ic_person_black_24dp.xml b/app/src/main/res/drawable/ic_person_black_24dp.xml new file mode 100644 index 000000000..d7366bda0 --- /dev/null +++ b/app/src/main/res/drawable/ic_person_black_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/drawer_header.xml b/app/src/main/res/layout/drawer_header.xml index 9bd3ae3a3..53a2684a0 100644 --- a/app/src/main/res/layout/drawer_header.xml +++ b/app/src/main/res/layout/drawer_header.xml @@ -1,5 +1,6 @@ + + \ No newline at end of file From b0f9687a466a1f4addde30eaed54c116a6604c29 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Mon, 21 May 2018 19:38:25 +0530 Subject: [PATCH 08/15] Changed the bounds of the image --- .../nrw/commons/achievements/AchievementsActivity.java | 4 ++-- app/src/main/res/layout/activity_achievements.xml | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java index 85f6e84bd..dc5821c05 100644 --- a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java @@ -33,7 +33,7 @@ import fr.free.nrw.commons.theme.NavigationBaseActivity; public class AchievementsActivity extends NavigationBaseActivity { private static final double BADGE_IMAGE_WIDTH_RATIO = 0.4; - private static final double BADGE_IMAGE_HEIGHT_RATIO = 0.36; + private static final double BADGE_IMAGE_HEIGHT_RATIO = 0.3; @BindView(R.id.achievement_badge) ImageView imageView; @BindView(R.id.toolbar) android.support.v7.widget.Toolbar toolbar; @@ -60,7 +60,7 @@ public class AchievementsActivity extends NavigationBaseActivity { imageView.getLayoutParams(); params.height = (int) (height*BADGE_IMAGE_HEIGHT_RATIO); params.width = (int) (width*BADGE_IMAGE_WIDTH_RATIO); - imageView.setImageResource(R.drawable.sydney_opera_house); + imageView.setImageResource(R.drawable.featured); imageView.requestLayout(); setSupportActionBar(toolbar); diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml index 9ec4b07dd..1f158a787 100644 --- a/app/src/main/res/layout/activity_achievements.xml +++ b/app/src/main/res/layout/activity_achievements.xml @@ -188,11 +188,12 @@ android:layout_height="wrap_content" style="?android:textAppearanceMedium" android:layout_alignParentRight="true" - android:layout_marginEnd="@dimen/activity_margin_horizontal" + android:layout_marginEnd="44dp" android:layout_marginTop="@dimen/activity_margin_horizontal" android:layout_marginStart="@dimen/activity_margin_horizontal" android:text="2" - android:layout_marginLeft="@dimen/activity_margin_horizontal" /> + android:layout_marginLeft="@dimen/activity_margin_horizontal" + android:layout_marginRight="44dp" /> @@ -226,11 +227,12 @@ android:layout_height="wrap_content" style="?android:textAppearanceMedium" android:layout_alignParentRight="true" - android:layout_marginEnd="@dimen/activity_margin_horizontal" + android:layout_marginEnd="44dp" android:layout_marginTop="@dimen/activity_margin_horizontal" android:layout_marginStart="@dimen/activity_margin_horizontal" android:layout_marginLeft="@dimen/activity_margin_horizontal" - android:text="2" /> + android:text="2" + android:layout_marginRight="44dp" /> From a451dbf4fc9fe7c343f6302b2854dc84dd179e42 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Mon, 21 May 2018 20:12:11 +0530 Subject: [PATCH 09/15] Added Info icon --- app/src/main/res/layout/activity_achievements.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml index 1f158a787..99e1d28c1 100644 --- a/app/src/main/res/layout/activity_achievements.xml +++ b/app/src/main/res/layout/activity_achievements.xml @@ -37,6 +37,16 @@ android:text="@string/level" android:id="@+id/achievement_level" /> + + Date: Tue, 22 May 2018 11:19:03 +0530 Subject: [PATCH 10/15] Removed the unecessary functionality --- .../fr/free/nrw/commons/achievements/AchievementsActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java index dc5821c05..5164a2df7 100644 --- a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java @@ -80,7 +80,6 @@ public class AchievementsActivity extends NavigationBaseActivity { if (id == R.id.share_app_icon) { View rootView = getWindow().getDecorView().findViewById(android.R.id.content); Bitmap screenShot = getScreenShot(rootView); - imageView.setImageBitmap(screenShot); shareScreen(screenShot); } From aa26cbe81401c9ed4d3b031e75e1539d496b9aaa Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Tue, 22 May 2018 19:50:48 +0530 Subject: [PATCH 11/15] Updated JavaDocs and fetch the username --- .../achievements/AchievementsActivity.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java index 5164a2df7..6aa8c28b3 100644 --- a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java @@ -24,12 +24,18 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.Random; +import javax.inject.Inject; + import butterknife.BindView; import butterknife.ButterKnife; import dagger.Binds; import fr.free.nrw.commons.R; +import fr.free.nrw.commons.auth.SessionManager; import fr.free.nrw.commons.theme.NavigationBaseActivity; +/** + * activity for sharing feedback on uploaded activity + */ public class AchievementsActivity extends NavigationBaseActivity { private static final double BADGE_IMAGE_WIDTH_RATIO = 0.4; @@ -37,10 +43,11 @@ public class AchievementsActivity extends NavigationBaseActivity { @BindView(R.id.achievement_badge) ImageView imageView; @BindView(R.id.toolbar) android.support.v7.widget.Toolbar toolbar; - + @Inject SessionManager sessionManager; /** - * This method helps in the creation Achievement screen + * This method helps in the creation Achievement screen and + * dynamically set the size of imageView * * @param savedInstanceState Data bundle */ @@ -50,12 +57,17 @@ public class AchievementsActivity extends NavigationBaseActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_achievements); ButterKnife.bind(this); - + /** + * DisplayMetrics used to fetch the size of the screen + */ DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int height = displayMetrics.heightPixels; int width = displayMetrics.widthPixels; + /** + * Used for the setting the size of imageView at runtime + */ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageView.getLayoutParams(); params.height = (int) (height*BADGE_IMAGE_HEIGHT_RATIO); From 157e744ba31c748c0486b51c41b705de3e6cf323 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Wed, 23 May 2018 01:49:54 +0530 Subject: [PATCH 12/15] Fetch JsonObject from the api using JavaRx and OkHttp --- .../commons/achievements/Achievements.java | 5 +++ .../achievements/AchievementsActivity.java | 27 ++++++++++++++++ .../mwapi/ApacheHttpClientMediaWikiApi.java | 31 +++++++++++++++++++ .../free/nrw/commons/mwapi/MediaWikiApi.java | 6 ++++ 4 files changed, 69 insertions(+) create mode 100644 app/src/main/java/fr/free/nrw/commons/achievements/Achievements.java diff --git a/app/src/main/java/fr/free/nrw/commons/achievements/Achievements.java b/app/src/main/java/fr/free/nrw/commons/achievements/Achievements.java new file mode 100644 index 000000000..ea934c19b --- /dev/null +++ b/app/src/main/java/fr/free/nrw/commons/achievements/Achievements.java @@ -0,0 +1,5 @@ +package fr.free.nrw.commons.achievements; + +public class Achievements { + +} diff --git a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java index 6aa8c28b3..b489b7ea6 100644 --- a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java @@ -16,9 +16,12 @@ import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; +import android.widget.TextView; import android.widget.Toast; import android.widget.Toolbar; +import org.json.JSONObject; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -31,7 +34,12 @@ import butterknife.ButterKnife; import dagger.Binds; import fr.free.nrw.commons.R; import fr.free.nrw.commons.auth.SessionManager; +import fr.free.nrw.commons.mwapi.MediaWikiApi; import fr.free.nrw.commons.theme.NavigationBaseActivity; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.CompositeDisposable; +import io.reactivex.schedulers.Schedulers; +import timber.log.Timber; /** * activity for sharing feedback on uploaded activity @@ -42,9 +50,13 @@ public class AchievementsActivity extends NavigationBaseActivity { private static final double BADGE_IMAGE_HEIGHT_RATIO = 0.3; @BindView(R.id.achievement_badge) ImageView imageView; + @BindView(R.id.achievement_level) + TextView textView; @BindView(R.id.toolbar) android.support.v7.widget.Toolbar toolbar; @Inject SessionManager sessionManager; + @Inject MediaWikiApi mediaWikiApi; + private CompositeDisposable compositeDisposable = new CompositeDisposable(); /** * This method helps in the creation Achievement screen and * dynamically set the size of imageView @@ -76,6 +88,7 @@ public class AchievementsActivity extends NavigationBaseActivity { imageView.requestLayout(); setSupportActionBar(toolbar); + setUploadCount(); initDrawer(); } @@ -133,4 +146,18 @@ public class AchievementsActivity extends NavigationBaseActivity { } } + private void setUploadCount() { + compositeDisposable.add(mediaWikiApi + .getAchievements(sessionManager.getCurrentAccount().name) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe( + jsonObject -> parseJson(jsonObject) + )); + } + + private void parseJson(JSONObject object){ + Log.i("json",object.toString()); + } + } diff --git a/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java b/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java index 6629d0933..acda34cb5 100644 --- a/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java +++ b/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java @@ -23,6 +23,7 @@ import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.CoreProtocolPNames; import org.apache.http.util.EntityUtils; +import org.json.JSONObject; import org.mediawiki.api.ApiResult; import org.mediawiki.api.MWApi; import org.w3c.dom.NodeList; @@ -42,6 +43,7 @@ import java.util.concurrent.Callable; import fr.free.nrw.commons.BuildConfig; import fr.free.nrw.commons.Media; import fr.free.nrw.commons.PageTitle; +import fr.free.nrw.commons.achievements.Achievements; import fr.free.nrw.commons.category.CategoryImageUtils; import fr.free.nrw.commons.category.QueryContinue; import fr.free.nrw.commons.notification.Notification; @@ -49,6 +51,10 @@ import fr.free.nrw.commons.notification.NotificationUtils; import in.yuvi.http.fluent.Http; import io.reactivex.Observable; import io.reactivex.Single; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; import timber.log.Timber; import static fr.free.nrw.commons.utils.ContinueUtils.getQueryContinue; @@ -615,6 +621,31 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { }); } + @NonNull + @Override + public Single getAchievements(String userName) { + final String fetchAchievementUrlTemplate = + wikiMediaToolforgeUrl + "urbanecmbot/commonsmisc/feedback.py"; + return Single.fromCallable(()->{ + String url = String.format( + Locale.ENGLISH, + fetchAchievementUrlTemplate, + new PageTitle(userName).getText()); + HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); + urlBuilder.addQueryParameter("user",userName); + Log.i("url",urlBuilder.toString()); + Request request = new Request.Builder() + .url(urlBuilder.toString()) + .build(); + OkHttpClient client = new OkHttpClient(); + Response response = client.newCall(request).execute(); + String jsonData = response.body().string(); + JSONObject jsonObject = new JSONObject(jsonData); + return jsonObject; + }); + + } + private Date parseMWDate(String mwDate) { SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH); // Assuming MW always gives me UTC try { diff --git a/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java b/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java index c0bd2fd87..a7f9f8dfd 100644 --- a/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java +++ b/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java @@ -3,11 +3,14 @@ package fr.free.nrw.commons.mwapi; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import org.json.JSONObject; + import java.io.IOException; import java.io.InputStream; import java.util.List; import fr.free.nrw.commons.Media; +import fr.free.nrw.commons.achievements.Achievements; import fr.free.nrw.commons.notification.Notification; import io.reactivex.Observable; import io.reactivex.Single; @@ -75,6 +78,9 @@ public interface MediaWikiApi { @NonNull Single getUploadCount(String userName); + @NonNull + Single getAchievements (String userName); + interface ProgressListener { void onProgress(long transferred, long total); } From f40a566e105682758a10f6c6394ebb04d6363fbf Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Wed, 23 May 2018 02:34:32 +0530 Subject: [PATCH 13/15] Added JavaDocs and improved quality --- .../main/java/fr/free/nrw/commons/Utils.java | 27 +++++- .../achievements/AchievementsActivity.java | 82 ++++++++++--------- .../mwapi/ApacheHttpClientMediaWikiApi.java | 18 ++-- .../free/nrw/commons/mwapi/MediaWikiApi.java | 3 +- .../commons/theme/NavigationBaseActivity.java | 3 +- 5 files changed, 83 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/Utils.java b/app/src/main/java/fr/free/nrw/commons/Utils.java index 91c23ce26..889cffc22 100644 --- a/app/src/main/java/fr/free/nrw/commons/Utils.java +++ b/app/src/main/java/fr/free/nrw/commons/Utils.java @@ -2,11 +2,13 @@ package fr.free.nrw.commons; import android.content.Context; import android.content.Intent; +import android.graphics.Bitmap; import android.net.Uri; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.customtabs.CustomTabsIntent; import android.support.v4.content.ContextCompat; +import android.view.View; import android.widget.Toast; import org.apache.commons.codec.binary.Hex; @@ -58,6 +60,7 @@ public class Utils { /** * URL Encode an URL in UTF-8 format + * * @param url Unformatted URL * @return Encoded URL */ @@ -81,6 +84,7 @@ public class Utils { /** * Generates licence name with given ID + * * @param license License ID * @return Name of license */ @@ -106,7 +110,8 @@ public class Utils { /** * Fixing incorrect extension - * @param title File name + * + * @param title File name * @param extension Correct extension * @return File with correct extension */ @@ -127,6 +132,7 @@ public class Utils { /** * Tells whether dark theme is active or not + * * @param context Activity context * @return The state of dark theme */ @@ -146,7 +152,7 @@ public class Utils { StringBuilder stringBuilder = new StringBuilder(); try { - String[] command = new String[] {"logcat","-d","-v","threadtime"}; + String[] command = new String[]{"logcat", "-d", "-v", "threadtime"}; Process process = Runtime.getRuntime().exec(command); @@ -171,8 +177,7 @@ public class Utils { final String appPackageName = BuildConfig.class.getPackage().getName(); try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); - } - catch (android.content.ActivityNotFoundException anfe) { + } catch (android.content.ActivityNotFoundException anfe) { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } @@ -194,4 +199,18 @@ public class Utils { customTabsIntent.launchUrl(context, url); } + /** + * To take screenshot of the screen and return it in Bitmap format + * + * @param view + * @return + */ + public static Bitmap getScreenShot(View view) { + View screenView = view.getRootView(); + screenView.setDrawingCacheEnabled(true); + Bitmap bitmap = Bitmap.createBitmap(screenView.getDrawingCache()); + screenView.setDrawingCacheEnabled(false); + return bitmap; + } + } diff --git a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java index b489b7ea6..57187be51 100644 --- a/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/achievements/AchievementsActivity.java @@ -1,62 +1,61 @@ package fr.free.nrw.commons.achievements; import android.annotation.SuppressLint; +import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; -import android.os.Environment; -import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.widget.Toolbar; import android.util.DisplayMetrics; import android.util.Log; import android.view.Menu; -import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; -import android.widget.Toast; -import android.widget.Toolbar; import org.json.JSONObject; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.util.Random; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; -import dagger.Binds; import fr.free.nrw.commons.R; +import fr.free.nrw.commons.Utils; import fr.free.nrw.commons.auth.SessionManager; import fr.free.nrw.commons.mwapi.MediaWikiApi; import fr.free.nrw.commons.theme.NavigationBaseActivity; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; -import timber.log.Timber; /** - * activity for sharing feedback on uploaded activity + * activity for sharing feedback on uploaded activity */ public class AchievementsActivity extends NavigationBaseActivity { private static final double BADGE_IMAGE_WIDTH_RATIO = 0.4; private static final double BADGE_IMAGE_HEIGHT_RATIO = 0.3; - @BindView(R.id.achievement_badge) ImageView imageView; + @BindView(R.id.achievement_badge) + ImageView imageView; @BindView(R.id.achievement_level) TextView textView; - @BindView(R.id.toolbar) android.support.v7.widget.Toolbar toolbar; - @Inject SessionManager sessionManager; - @Inject MediaWikiApi mediaWikiApi; + @BindView(R.id.toolbar) + Toolbar toolbar; + @Inject + SessionManager sessionManager; + @Inject + MediaWikiApi mediaWikiApi; private CompositeDisposable compositeDisposable = new CompositeDisposable(); + /** * This method helps in the creation Achievement screen and * dynamically set the size of imageView @@ -82,13 +81,13 @@ public class AchievementsActivity extends NavigationBaseActivity { */ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageView.getLayoutParams(); - params.height = (int) (height*BADGE_IMAGE_HEIGHT_RATIO); - params.width = (int) (width*BADGE_IMAGE_WIDTH_RATIO); + params.height = (int) (height * BADGE_IMAGE_HEIGHT_RATIO); + params.width = (int) (width * BADGE_IMAGE_WIDTH_RATIO); imageView.setImageResource(R.drawable.featured); imageView.requestLayout(); setSupportActionBar(toolbar); - setUploadCount(); + setAchievements(); initDrawer(); } @@ -104,33 +103,21 @@ public class AchievementsActivity extends NavigationBaseActivity { int id = item.getItemId(); if (id == R.id.share_app_icon) { View rootView = getWindow().getDecorView().findViewById(android.R.id.content); - Bitmap screenShot = getScreenShot(rootView); + Bitmap screenShot = Utils.getScreenShot(rootView); shareScreen(screenShot); } return super.onOptionsItemSelected(item); } - /** - * To take screenshot of the screen and return it in Bitmap format - * @param view - * @return - */ - public static Bitmap getScreenShot(View view) { - View screenView = view.getRootView(); - screenView.setDrawingCacheEnabled(true); - Bitmap bitmap = Bitmap.createBitmap(screenView.getDrawingCache()); - screenView.setDrawingCacheEnabled(false); - return bitmap; - } - /** * To take bitmap and store it temporary storage and share it + * * @param bitmap */ - void shareScreen ( Bitmap bitmap){ + void shareScreen(Bitmap bitmap) { try { - File file = new File(this.getExternalCacheDir(),"screen.png"); + File file = new File(this.getExternalCacheDir(), "screen.png"); FileOutputStream fOut = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); fOut.flush(); @@ -146,18 +133,39 @@ public class AchievementsActivity extends NavigationBaseActivity { } } - private void setUploadCount() { + /** + * To call the API to get results in form Single + * which then calls parseJson when results are fetched + */ + private void setAchievements() { compositeDisposable.add(mediaWikiApi .getAchievements(sessionManager.getCurrentAccount().name) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( - jsonObject -> parseJson(jsonObject) + jsonObject -> parseJson(jsonObject) )); } - private void parseJson(JSONObject object){ - Log.i("json",object.toString()); + /** + * used to parse the JSONObject containing results + * + * @param object + */ + private void parseJson(JSONObject object) { + Log.i("json", object.toString()); + } + + /** + * Creates a way to change current activity to AchievementActivity + * + * @param context + */ + public static void startYourself(Context context) { + Intent intent = new Intent(context, AchievementsActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); + context.startActivity(intent); } } diff --git a/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java b/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java index acda34cb5..0d95282ef 100644 --- a/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java +++ b/app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java @@ -43,7 +43,6 @@ import java.util.concurrent.Callable; import fr.free.nrw.commons.BuildConfig; import fr.free.nrw.commons.Media; import fr.free.nrw.commons.PageTitle; -import fr.free.nrw.commons.achievements.Achievements; import fr.free.nrw.commons.category.CategoryImageUtils; import fr.free.nrw.commons.category.QueryContinue; import fr.free.nrw.commons.notification.Notification; @@ -223,7 +222,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { @Override public boolean pageExists(String pageName) throws IOException { - return Double.parseDouble( api.action("query") + return Double.parseDouble(api.action("query") .param("titles", pageName) .get() .getString("/api/query/pages/page/@_idx")) != -1; @@ -473,6 +472,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { * The method takes categoryName as input and returns a List of Media objects * It uses the generator query API to get the images in a category, 10 at a time. * Uses the query continue values for fetching paginated responses + * * @param categoryName Category name as defined on commons * @return */ @@ -524,6 +524,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { * For APIs that return paginated responses, MediaWiki APIs uses the QueryContinue to facilitate fetching of subsequent pages * https://www.mediawiki.org/wiki/API:Raw_query_continue * After fetching images a page of image for a particular category, shared prefs are updated with the latest QueryContinue Values + * * @param keyword * @param queryContinue */ @@ -535,6 +536,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { /** * Before making a paginated API call, this method is called to get the latest query continue values to be used + * * @param keyword * @return */ @@ -621,19 +623,25 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { }); } + /** + * This takes userName as input, which is then used to fetch the feedback/achievements + * statistics using OkHttp and JavaRx. This function return JSONObject + * @param userName + * @return + */ @NonNull @Override public Single getAchievements(String userName) { final String fetchAchievementUrlTemplate = wikiMediaToolforgeUrl + "urbanecmbot/commonsmisc/feedback.py"; - return Single.fromCallable(()->{ + return Single.fromCallable(() -> { String url = String.format( Locale.ENGLISH, fetchAchievementUrlTemplate, new PageTitle(userName).getText()); HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); - urlBuilder.addQueryParameter("user",userName); - Log.i("url",urlBuilder.toString()); + urlBuilder.addQueryParameter("user", userName); + Log.i("url", urlBuilder.toString()); Request request = new Request.Builder() .url(urlBuilder.toString()) .build(); diff --git a/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java b/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java index a7f9f8dfd..5cb5c4591 100644 --- a/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java +++ b/app/src/main/java/fr/free/nrw/commons/mwapi/MediaWikiApi.java @@ -10,7 +10,6 @@ import java.io.InputStream; import java.util.List; import fr.free.nrw.commons.Media; -import fr.free.nrw.commons.achievements.Achievements; import fr.free.nrw.commons.notification.Notification; import io.reactivex.Observable; import io.reactivex.Single; @@ -79,7 +78,7 @@ public interface MediaWikiApi { Single getUploadCount(String userName); @NonNull - Single getAchievements (String userName); + Single getAchievements(String userName); interface ProgressListener { void onProgress(long transferred, long total); diff --git a/app/src/main/java/fr/free/nrw/commons/theme/NavigationBaseActivity.java b/app/src/main/java/fr/free/nrw/commons/theme/NavigationBaseActivity.java index d046b895e..b9f5c9866 100644 --- a/app/src/main/java/fr/free/nrw/commons/theme/NavigationBaseActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/theme/NavigationBaseActivity.java @@ -80,8 +80,7 @@ public abstract class NavigationBaseActivity extends BaseActivity @Override public void onClick(View v) { drawerLayout.closeDrawer(navigationView); - startActivityWithFlags(NavigationBaseActivity.this, AchievementsActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP, - Intent.FLAG_ACTIVITY_SINGLE_TOP); + AchievementsActivity.startYourself(NavigationBaseActivity.this); } }); } From e09706c13205a1ba090897ec5e51afa7653325c6 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Thu, 24 May 2018 02:10:33 +0530 Subject: [PATCH 14/15] fixed strings file --- app/src/main/res/values/strings.xml | 570 ++++++++++++++-------------- 1 file changed, 285 insertions(+), 285 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7847194c6..60080d208 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,295 +1,295 @@ - Appearance - General - Feedback - Location - Commons - - Settings - Username - Password - Log in to your Commons Beta account - Log in - Forgot Password? - Sign up - Logging in - Please wait… - Login success! - Login failed! - File not found. Please try another file. - Authentication failed! - Upload started! - %1$s uploaded! - Tap to view your upload - Starting %1$s upload - %1$s uploading - Finishing uploading %1$s - Uploading %1$s failed - Tap to view - - %1$d file uploading - %1$d files uploading - - My Recent Uploads - Queued - Failed - %1$d%% complete - Uploading - From Gallery - Take photo - Nearby - My uploads - Share - View in Browser - Title - Please provide a title for this file - Description - Unable to login - network failure - Unable to login - please check your username - Unable to login - please check your password - Too many unsuccessful attempts. Please try again in a few minutes. - Sorry, this user has been blocked on Commons - You must provide your two factor authentication code. - Login failed - Upload - Name this set - Modifications - Upload - Search categories - Save - Refresh - List - GPS is disabled in your device. Would you like to enable it? - Enable GPS - No uploads yet - - - @string/contributions_subtitle_zero - %1$d upload - %1$d uploads - - - Starting %1$d upload - Starting %1$d uploads - - - %1$d upload - %1$d uploads - - No categories matching %1$s found - Add categories to make your images more discoverable on Wikimedia Commons.\nStart typing to add categories. - Categories - Settings - Sign Up - Featured Images - About - The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. - Wikimedia Commons - Create a new <a href=\"https://github.com/commons-app/apps-android-commons/issues\">GitHub issue</a> for bug reports and suggestions. - Privacy policy]]> - Credits]]> - About - Send Feedback (via Email) - No email client installed - Recently used categories - Waiting for first sync… - You have not yet uploaded any photos. - Retry - Cancel - This image will be licensed under %1$s - By submitting this picture, I declare that this is my own work, that it does not contain copyrighted material or selfies, and otherwise adheres to <a href=\"https://commons.wikimedia.org/wiki/Commons:Policies_and_guidelines\">Wikimedia Commons policies</a>. - Download - Default License - Use previous title/description - Automatically get current location - Retrieve current location to offer category suggestions if image is not geotagged - Night mode - Use dark theme - Attribution-ShareAlike 4.0 - Attribution 4.0 - Attribution-ShareAlike 3.0 - Attribution 3.0 - CC0 - CC BY-SA 3.0 - CC BY-SA 3.0 (Austria) - CC BY-SA 3.0 (Germany) - CC BY-SA 3.0 (Estonia) - CC BY-SA 3.0 (Spain) - CC BY-SA 3.0 (Croatia) - CC BY-SA 3.0 (Luxembourg) - CC BY-SA 3.0 (Netherlands) - CC BY-SA 3.0 (Norway) - CC BY-SA 3.0 (Poland) - CC BY-SA 3.0 (Romania) - CC BY 3.0 - CC BY-SA 4.0 - CC BY 4.0 - CC Zero - Wikimedia Commons hosts most of the images that are used in Wikipedia. - Your images help educate people around the world! - Please upload pictures that are taken or created entirely by yourself: - Natural objects (flowers, animals, mountains)\n• Useful objects (bicycles, train stations)\n• Famous people (your mayor, Olympic athletes you met) - Natural objects (flowers, animals, mountains) - Useful objects (bicycles, train stations) - Famous people (your mayor, Olympic athletes you met) - Please do NOT upload: - - Selfies or pictures of your friends\n- Pictures you downloaded from the Internet\n- Screenshots of proprietary apps - Selfies or pictures of your friends - Pictures you downloaded from the Internet - Screenshots of proprietary apps - Example upload: - - Title: Sydney Opera House\n- Description: Sydney Opera House as viewed from across the bay\n- Categories: Sydney Opera House from the west, Sydney Opera House remote views - Title: Sydney Opera House - Description: Sydney Opera House as viewed from across the bay - Categories: Sydney Opera House from the west, Sydney Opera House remote views - Contribute your images. Help Wikipedia articles come to life! - Images on Wikipedia come from Wikimedia Commons. - Your images help educate people around the world. - Avoid copyrighted materials you found from the Internet as well as images of posters, book covers, etc. - You think you got it? - Yes! - More Information - Categories - Loading… - None selected - No description - Unknown license - Refresh - Required permission: Read external storage. App cannot access your gallery without this. - Required permission: Write external storage. App cannot access your camera without this. - Optional permission: Get current location for category suggestions - OK - Nearby Places - No nearby places found - Warning - This file already exists on Commons. Are you sure you want to proceed? - Yes - No - Title - Title of the media - Description - Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though. - Author - Featured image author user name goes here. - Uploaded date - License - Coordinates - None provided - Become a Beta Tester - Opt-in to our beta channel on Google Play and get early access to new features and bug fixes - https://play.google.com/apps/testing/fr.free.nrw.commons - mapbox://styles/mapbox/traffic-day-v2 - mapbox://styles/mapbox/traffic-night-v2 - pk.eyJ1IjoibWFza2FyYXZpdmVrIiwiYSI6ImNqMmxvdzFjMTAwMHYzM283ZWM3eW5tcDAifQ.ib5SZ9EVjwJe6GSKve0bcg - 2FA Code - My Recent Upload Limit - Maximum Limit - Unable to display more than 500 - Set Recent Upload Limit - Two factor authentication is currently not supported. + AppearanceGeneral + Feedback + Location + Commons + + Settings + Username + Password + Log in to your Commons Beta account + Log in + Forgot Password? + Sign up + Logging in + Please wait… + Login success! + Login failed! + File not found. Please try another file. + Authentication failed! + Upload started! + %1$s uploaded! + Tap to view your upload + Starting %1$s upload + %1$s uploading + Finishing uploading %1$s + Uploading %1$s failed + Tap to view + + %1$d file uploading + %1$d files uploading + + My Recent Uploads + Queued + Failed + %1$d%% complete + Uploading + From Gallery + Take photo + Nearby + My uploads + Share + View in Browser + Title + Please provide a title for this file + Description + Unable to login - network failure + Unable to login - please check your username + Unable to login - please check your password + Too many unsuccessful attempts. Please try again in a few minutes. + Sorry, this user has been blocked on Commons + You must provide your two factor authentication code. + Login failed + Upload + Name this set + Modifications + Upload + Search categories + Save + Refresh + List + GPS is disabled in your device. Would you like to enable it? + Enable GPS + No uploads yet + + + @string/contributions_subtitle_zero + %1$d upload + %1$d uploads + + + Starting %1$d upload + Starting %1$d uploads + + + %1$d upload + %1$d uploads + + No categories matching %1$s found + Add categories to make your images more discoverable on Wikimedia Commons.\nStart typing to add categories. + Categories + Settings + Sign Up + Featured Images + About + The Wikimedia Commons app is an open-source app created and maintained by grantees and volunteers of the Wikimedia community. The Wikimedia Foundation is not involved in the creation, development, or maintenance of the app. + Wikimedia Commons + Create a new <a href=\"https://github.com/commons-app/apps-android-commons/issues\">GitHub issue</a> for bug reports and suggestions. + Privacy policy]]> + Credits]]> + About + Send Feedback (via Email) + No email client installed + Recently used categories + Waiting for first sync… + You have not yet uploaded any photos. + Retry + Cancel + This image will be licensed under %1$s + By submitting this picture, I declare that this is my own work, that it does not contain copyrighted material or selfies, and otherwise adheres to <a href=\"https://commons.wikimedia.org/wiki/Commons:Policies_and_guidelines\">Wikimedia Commons policies</a>. + Download + Default License + Use previous title/description + Automatically get current location + Retrieve current location to offer category suggestions if image is not geotagged + Night mode + Use dark theme + Attribution-ShareAlike 4.0 + Attribution 4.0 + Attribution-ShareAlike 3.0 + Attribution 3.0 + CC0 + CC BY-SA 3.0 + CC BY-SA 3.0 (Austria) + CC BY-SA 3.0 (Germany) + CC BY-SA 3.0 (Estonia) + CC BY-SA 3.0 (Spain) + CC BY-SA 3.0 (Croatia) + CC BY-SA 3.0 (Luxembourg) + CC BY-SA 3.0 (Netherlands) + CC BY-SA 3.0 (Norway) + CC BY-SA 3.0 (Poland) + CC BY-SA 3.0 (Romania) + CC BY 3.0 + CC BY-SA 4.0 + CC BY 4.0 + CC Zero + Wikimedia Commons hosts most of the images that are used in Wikipedia. + Your images help educate people around the world! + Please upload pictures that are taken or created entirely by yourself: + Natural objects (flowers, animals, mountains)\n• Useful objects (bicycles, train stations)\n• Famous people (your mayor, Olympic athletes you met) + Natural objects (flowers, animals, mountains) + Useful objects (bicycles, train stations) + Famous people (your mayor, Olympic athletes you met) + Please do NOT upload: + - Selfies or pictures of your friends\n- Pictures you downloaded from the Internet\n- Screenshots of proprietary apps + Selfies or pictures of your friends + Pictures you downloaded from the Internet + Screenshots of proprietary apps + Example upload: + - Title: Sydney Opera House\n- Description: Sydney Opera House as viewed from across the bay\n- Categories: Sydney Opera House from the west, Sydney Opera House remote views + Title: Sydney Opera House + Description: Sydney Opera House as viewed from across the bay + Categories: Sydney Opera House from the west, Sydney Opera House remote views + Contribute your images. Help Wikipedia articles come to life! + Images on Wikipedia come from Wikimedia Commons. + Your images help educate people around the world. + Avoid copyrighted materials you found from the Internet as well as images of posters, book covers, etc. + You think you got it? + Yes! + More Information + Categories + Loading… + None selected + No description + Unknown license + Refresh + Required permission: Read external storage. App cannot access your gallery without this. + Required permission: Write external storage. App cannot access your camera without this. + Optional permission: Get current location for category suggestions + OK + Nearby Places + No nearby places found + Warning + This file already exists on Commons. Are you sure you want to proceed? + Yes + No + Title + Title of the media + Description + Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though. + Author + Featured image author user name goes here. + Uploaded date + License + Coordinates + None provided + Become a Beta Tester + Opt-in to our beta channel on Google Play and get early access to new features and bug fixes + https://play.google.com/apps/testing/fr.free.nrw.commons + mapbox://styles/mapbox/traffic-day-v2 + mapbox://styles/mapbox/traffic-night-v2 + pk.eyJ1IjoibWFza2FyYXZpdmVrIiwiYSI6ImNqMmxvdzFjMTAwMHYzM283ZWM3eW5tcDAifQ.ib5SZ9EVjwJe6GSKve0bcg + 2FA Code + My Recent Upload Limit + Maximum Limit + Unable to display more than 500 + Set Recent Upload Limit + Two factor authentication is currently not supported. Do you really want to logout? - Commons Logo - Commons Website - Commons Facebook Page - Commons Github Source Code - Background Image - Media Image Failed - No Image Found - Upload Image - Mount Zao - Llamas - Rainbow Bridge - Tulip - No Selfies - Proprietary Image - Welcome Wikipedia - Welcome Copyright - Sydney Opera House - Cancel - Open - Close - Home - Upload - Nearby - About - Settings - Feedback - Logout - Tutorial - Notifications - Featured - Nearby places cannot be displayed without location permissions - no description found - Commons file page - Wikidata item - Wikipedia article - Error while caching pictures - A unique descriptive title for the file, which will serve as a filename. You may use plain language with spaces. Do not include the file extension - Please describe the media as much as possible: Where was it taken? What does it show? What is the context? Please describe the objects or persons. Reveal information that can not be easily guessed, for instance the time of day if it is a landscape. If the media shows something unusual, please explain what makes it unusual. - This picture is too dark, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. - This picture is blurry, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. - Give permission - Use external storage - Save pictures taken with the in-app camera on your device - Login to your account - Send log file - Send log file to developers via email - No web browser found to open URL - Error! URL not found - Nominate for Deletion - This image has been nominated for deletion. - See webpage for details - View in Browser + Commons Logo + Commons Website + Commons Facebook Page + Commons Github Source Code + Background Image + Media Image Failed + No Image Found + Upload Image + Mount Zao + Llamas + Rainbow Bridge + Tulip + No Selfies + Proprietary Image + Welcome Wikipedia + Welcome Copyright + Sydney Opera House + Cancel + Open + Close + Home + Upload + Nearby + About + Settings + Feedback + Logout + Tutorial + Notifications + Featured + Nearby places cannot be displayed without location permissions + no description found + Commons file page + Wikidata item + Wikipedia article + Error while caching pictures + A unique descriptive title for the file, which will serve as a filename. You may use plain language with spaces. Do not include the file extension + Please describe the media as much as possible: Where was it taken? What does it show? What is the context? Please describe the objects or persons. Reveal information that can not be easily guessed, for instance the time of day if it is a landscape. If the media shows something unusual, please explain what makes it unusual. + This picture is too dark, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. + This picture is blurry, are you sure you want to upload it? Wikimedia Commons is only for pictures with encyclopedic value. + Give permission + Use external storage + Save pictures taken with the in-app camera on your device + Login to your account + Send log file + Send log file to developers via email + No web browser found to open URL + Error! URL not found + Nominate for Deletion + This image has been nominated for deletion. + See webpage for details + View in Browser - Location has not changed. - Location not available. - Permission required to display a list of nearby places - GET DIRECTIONS - READ ARTICLE + Location has not changed. + Location not available. + Permission required to display a list of nearby places + GET DIRECTIONS + READ ARTICLE - Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here. - %1$s left a message on your talk page - Thank you for making an edit - %1$s mentioned you on %2$s. - Toggle view - DIRECTIONS - WIKIDATA - WIKIPEDIA - COMMONS - Rate us]]> - FAQ]]> - Skip Tutorial - Internet unavailable - Internet available - Error fetching notifications - No notifications found - Translate]]> - Languages - Select the language that you would like to submit translations for - Proceed - Cancel - Retry + Welcome to Wikimedia Commons, %1$s! We\'re glad you\'re here. + %1$s left a message on your talk page + Thank you for making an edit + %1$s mentioned you on %2$s. + Toggle view + DIRECTIONS + WIKIDATA + WIKIPEDIA + COMMONS + Rate us]]> + FAQ]]> + Skip Tutorial + Internet unavailable + Internet available + Error fetching notifications + No notifications found + Translate]]> + Languages + Select the language that you would like to submit translations for + Proceed + Cancel + Retry - Got it! - These are the places near you that need pictures to illustrate their Wikipedia articles - Tapping this button brings up a list of these places - You can upload a picture for any place from your gallery or camera + Got it! + These are the places near you that need pictures to illustrate their Wikipedia articles + Tapping this button brings up a list of these places + You can upload a picture for any place from your gallery or camera - No images found! - Error occurred while loading images. - Uploaded by: %1$s + No images found! + Error occurred while loading images. + Uploaded by: %1$s - Share App - Coordinates were not specified during image selection - Error fetching nearby places. + Share App + Coordinates were not specified during image selection + Error fetching nearby places. - Achievements - STATISTICS - Thanks Received - Featured Images - LEVEL - Images Uploaded - Images Not Reverted - Images Used By Wiki + Achievements + STATISTICS + Thanks Received + Featured Images + LEVEL + Images Uploaded + Images Not Reverted + Images Used By Wiki From dbd2051982741597a866150078b493dbc29ebc83 Mon Sep 17 00:00:00 2001 From: tanvidadu Date: Thu, 24 May 2018 02:30:46 +0530 Subject: [PATCH 15/15] Improved the quality of pr --- app/src/main/AndroidManifest.xml | 15 +++++++++++++++ app/src/main/java/fr/free/nrw/commons/Utils.java | 4 ---- .../mwapi/ApacheHttpClientMediaWikiApi.java | 3 --- .../nrw/commons/theme/NavigationBaseActivity.java | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 112ee6bcb..430e5f83c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -39,7 +39,9 @@ + + + + + + + + + + + @@ -121,6 +132,7 @@ android:name="android.content.SyncAdapter" android:resource="@xml/contributions_sync_adapter" /> + @@ -142,18 +154,21 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /> + + +