From d88fb3b0de8670913882a22bb4a9d0fc0c2d1411 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Sun, 23 Jul 2017 15:39:08 +0300 Subject: [PATCH 01/12] Prepare alert window and strings --- .../contributions/ContributionsActivity.java | 43 +++++++++++++++++++ app/src/main/res/values/strings.xml | 8 +++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java index f1a4adfe2..74cff702b 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java @@ -3,11 +3,13 @@ package fr.free.nrw.commons.contributions; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.database.Cursor; import android.database.DataSetObserver; +import android.net.Uri; import android.os.Bundle; import android.os.IBinder; import android.preference.PreferenceManager; @@ -17,6 +19,7 @@ import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.CursorAdapter; +import android.support.v7.app.AlertDialog; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -110,6 +113,46 @@ public class ContributionsActivity super.onPause(); } + @Override + protected void onStart() { + super.onStart(); + if (true) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(getResources().getString(R.string.feedback_popup_title)); + builder.setMessage(getResources().getString(R.string.feedback_popup_description)); + builder.setPositiveButton(getResources().getString(R.string.feedback_popup_accept) + , new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + // Go to the page + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources() + .getString(R.string.feedback_page_url))); + startActivity(browserIntent); + dialog.dismiss(); + } + }); + builder.setNeutralButton(getResources().getString(R.string.feedback_popup_remind) + ,new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Dismiss the dialog to show it later + dialog.dismiss(); + } + }); + builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline) + , new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Dismiss the dialog and not to show it later + dialog.dismiss(); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } else { + + } + } + @Override protected void onAuthCookieAcquired(String authCookie) { // Do a sync everytime we get here! diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f981902b3..f88df2ca4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -202,6 +202,12 @@ Tap this message (or hit back) to skip this step. no description found Commons file page Wikidata item - Error while caching pictures + Error while caching pictures + We need your feedbacks + We are planning several new features and improvements for the app! Have your say. + Decline + Remind me later + Join to discussion + https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal/User_feedback From 19784f0e82871fb8a7b136a0271f41db0132e012 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Sun, 23 Jul 2017 18:10:42 +0300 Subject: [PATCH 02/12] Add shared preferences --- .../free/nrw/commons/CommonsApplication.java | 3 + .../contributions/ContributionsActivity.java | 103 ++++++++++++------ 2 files changed, 71 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java index b78bfdc6f..3de167b82 100644 --- a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java +++ b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java @@ -11,6 +11,7 @@ import android.content.pm.PackageManager; import android.database.sqlite.SQLiteDatabase; import android.preference.PreferenceManager; import android.support.v4.util.LruCache; +import android.util.Log; import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.stetho.Stetho; @@ -139,6 +140,8 @@ public class CommonsApplication extends Application { System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); Fresco.initialize(this); + PreferenceManager.getDefaultSharedPreferences(CommonsApplication.getInstance()).edit() + .putBoolean("is_app_started", true).commit(); //For caching area -> categories cacheData = new CacheController(); diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java index 74cff702b..0793db8be 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java @@ -30,7 +30,10 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import butterknife.ButterKnife; import fr.free.nrw.commons.CommonsApplication; @@ -116,41 +119,7 @@ public class ContributionsActivity @Override protected void onStart() { super.onStart(); - if (true) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(getResources().getString(R.string.feedback_popup_title)); - builder.setMessage(getResources().getString(R.string.feedback_popup_description)); - builder.setPositiveButton(getResources().getString(R.string.feedback_popup_accept) - , new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - // Go to the page - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources() - .getString(R.string.feedback_page_url))); - startActivity(browserIntent); - dialog.dismiss(); - } - }); - builder.setNeutralButton(getResources().getString(R.string.feedback_popup_remind) - ,new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // Dismiss the dialog to show it later - dialog.dismiss(); - } - }); - builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline) - , new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // Dismiss the dialog and not to show it later - dialog.dismiss(); - } - }); - AlertDialog alert = builder.create(); - alert.show(); - } else { - - } + displayFeedbackPopup(); } @Override @@ -385,4 +354,68 @@ public class ContributionsActivity Intent contributionsIntent = new Intent(context, ContributionsActivity.class); context.startActivity(contributionsIntent); } + + private void displayFeedbackPopup(){ + + Date strDate = null; + try { + String valid_until = "23/08/2017"; + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + strDate = sdf.parse(valid_until); + } catch (ParseException e) { + e.printStackTrace(); + } + + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences + (CommonsApplication.getInstance()); + + // boolean to save users request about displaying popup + boolean displayFeedbackPopup = prefs.getBoolean("display_feedbak_popup", true); + + // boolean to recognize is application re-started. Will be used for "remind me later" option + boolean isApplicationStarted = prefs.getBoolean("is_app_started" , true); + + // if time is valid and shared pref says display + if (new Date().before(strDate) && displayFeedbackPopup && isApplicationStarted) { + // The window will be displayed once per application start + prefs.edit().putBoolean("is_app_started" , false).commit(); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(getResources().getString(R.string.feedback_popup_title)); + builder.setMessage(getResources().getString(R.string.feedback_popup_description)); + builder.setPositiveButton(getResources().getString(R.string.feedback_popup_accept) + , new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + // Go to the page + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri + .parse(getResources() + .getString(R.string.feedback_page_url))); + startActivity(browserIntent); + // No need to dislay this window to the user again. + prefs.edit().putBoolean("display_feedbak_popup" , false).commit(); + dialog.dismiss(); + } + }); + builder.setNeutralButton(getResources().getString(R.string.feedback_popup_remind) + ,new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Dismiss the dialog to show it later, + // don't set "display_feedbak_popup" to false, user wants to see it latr + dialog.dismiss(); + } + }); + builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline) + , new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Dismiss the dialog and not to show it later + prefs.edit().putBoolean("display_feedbak_popup", false).commit(); + dialog.dismiss(); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } + } } From 457148269508d79087c7d18d12293e2d6ac6bac7 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Sun, 23 Jul 2017 18:44:38 +0300 Subject: [PATCH 03/12] Fix codacy issues --- .../contributions/ContributionsActivity.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java index 0793db8be..2848055e8 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java @@ -355,19 +355,19 @@ public class ContributionsActivity context.startActivity(contributionsIntent); } - private void displayFeedbackPopup(){ + private void displayFeedbackPopup() { Date strDate = null; try { - String valid_until = "23/08/2017"; + String validUntil = "23/08/2017"; SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - strDate = sdf.parse(valid_until); + strDate = sdf.parse(validUntil); } catch (ParseException e) { e.printStackTrace(); } - final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences - (CommonsApplication.getInstance()); + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences( + CommonsApplication.getInstance()); // boolean to save users request about displaying popup boolean displayFeedbackPopup = prefs.getBoolean("display_feedbak_popup", true); @@ -383,8 +383,8 @@ public class ContributionsActivity AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getResources().getString(R.string.feedback_popup_title)); builder.setMessage(getResources().getString(R.string.feedback_popup_description)); - builder.setPositiveButton(getResources().getString(R.string.feedback_popup_accept) - , new DialogInterface.OnClickListener() { + builder.setPositiveButton(getResources().getString(R.string.feedback_popup_accept), + new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Go to the page Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri From 452dcaec7296f1d4e8f16c016727be7273d9c181 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 14:06:49 +0300 Subject: [PATCH 04/12] Display pop up once, on 4th app start --- .../fr/free/nrw/commons/CommonsApplication.java | 6 ++++-- .../contributions/ContributionsActivity.java | 15 ++------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java index 3de167b82..42dd55ac5 100644 --- a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java +++ b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java @@ -140,8 +140,10 @@ public class CommonsApplication extends Application { System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); Fresco.initialize(this); - PreferenceManager.getDefaultSharedPreferences(CommonsApplication.getInstance()).edit() - .putBoolean("is_app_started", true).commit(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences( + CommonsApplication.getInstance()); + // Increase counter by one, starts from 1 + prefs.edit().putInt("app_start_counter", prefs.getInt("app_start_counter" ,0) + 1).commit(); //For caching area -> categories cacheData = new CacheController(); diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java index 2848055e8..688c6fce1 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java @@ -373,12 +373,10 @@ public class ContributionsActivity boolean displayFeedbackPopup = prefs.getBoolean("display_feedbak_popup", true); // boolean to recognize is application re-started. Will be used for "remind me later" option - boolean isApplicationStarted = prefs.getBoolean("is_app_started" , true); + int appStartCounter = prefs.getInt("app_start_counter" ,0); // if time is valid and shared pref says display - if (new Date().before(strDate) && displayFeedbackPopup && isApplicationStarted) { - // The window will be displayed once per application start - prefs.edit().putBoolean("is_app_started" , false).commit(); + if (new Date().before(strDate) && displayFeedbackPopup && (appStartCounter == 4)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getResources().getString(R.string.feedback_popup_title)); @@ -396,15 +394,6 @@ public class ContributionsActivity dialog.dismiss(); } }); - builder.setNeutralButton(getResources().getString(R.string.feedback_popup_remind) - ,new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // Dismiss the dialog to show it later, - // don't set "display_feedbak_popup" to false, user wants to see it latr - dialog.dismiss(); - } - }); builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline) , new DialogInterface.OnClickListener() { @Override From 1c9989d6585fa14f55f5c92c7d8658307867a67e Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 14:13:25 +0300 Subject: [PATCH 05/12] Update strings --- app/src/main/res/values/strings.xml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f88df2ca4..1b45c70e8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -203,11 +203,10 @@ Tap this message (or hit back) to skip this step. Commons file page Wikidata item Error while caching pictures - We need your feedbacks - We are planning several new features and improvements for the app! Have your say. - Decline - Remind me later - Join to discussion + Feedback wanted + We are planning several new features and improvements for the app! Would you like to review them and provide feedback? (You can always access this by selecting "Developer plans" in the navigation drawer) + No thanks + Sure, take me there! https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal/User_feedback From 07102c04e9b5eba5a5c8b0b8f7517944c6945859 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 14:29:56 +0300 Subject: [PATCH 06/12] Add developer plans to nav drawer --- .../free/nrw/commons/theme/NavigationBaseActivity.java | 9 +++++++++ app/src/main/res/drawable/ic_help_outline_black_24dp.xml | 9 +++++++++ app/src/main/res/menu/drawer.xml | 5 +++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 24 insertions(+) create mode 100644 app/src/main/res/drawable/ic_help_outline_black_24dp.xml 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 a9c27e5e3..24dd2f2b6 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 @@ -3,6 +3,7 @@ package fr.free.nrw.commons.theme; import android.content.ActivityNotFoundException; import android.content.DialogInterface; import android.content.Intent; +import android.net.Uri; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; import android.support.v4.widget.DrawerLayout; @@ -114,6 +115,14 @@ public class NavigationBaseActivity extends BaseActivity Toast.makeText(this, R.string.no_email_client, Toast.LENGTH_SHORT).show(); } return true; + case R.id.action_developer_plans: + drawerLayout.closeDrawer(navigationView); + // Go to the page + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri + .parse(getResources() + .getString(R.string.feedback_page_url))); + startActivity(browserIntent); + return true; case R.id.action_logout: new AlertDialog.Builder(this) .setMessage(R.string.logout_verification) diff --git a/app/src/main/res/drawable/ic_help_outline_black_24dp.xml b/app/src/main/res/drawable/ic_help_outline_black_24dp.xml new file mode 100644 index 000000000..e7cf8ea21 --- /dev/null +++ b/app/src/main/res/drawable/ic_help_outline_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/menu/drawer.xml b/app/src/main/res/menu/drawer.xml index f0a0a5e29..cb6b63ffc 100644 --- a/app/src/main/res/menu/drawer.xml +++ b/app/src/main/res/menu/drawer.xml @@ -30,6 +30,11 @@ android:icon="@drawable/ic_feedback_black_24dp" android:title="@string/navigation_item_feedback"/> + + Feedback Logout Tutorial + Developer plans Nearby places cannot be displayed without location permissions no description found From fc8a3c1c9eace05cb99866756656bebfbc36ecfd Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 14:56:10 +0300 Subject: [PATCH 07/12] Ups, fix the link:) --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 41e73aeee..4f6d8e61d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -208,6 +208,6 @@ Tap this message (or hit back) to skip this step. We are planning several new features and improvements for the app! Would you like to review them and provide feedback? (You can always access this by selecting "Developer plans" in the navigation drawer) No thanks Sure, take me there! - https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal/User_feedback + https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal#Endorsements From d72b239e20b4fbe67f1aedf8dd67cbaceb2ce3a5 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 14:57:51 +0300 Subject: [PATCH 08/12] Fix codacy --- .../free/nrw/commons/contributions/ContributionsActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java index 688c6fce1..783c3b6c3 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java @@ -394,8 +394,8 @@ public class ContributionsActivity dialog.dismiss(); } }); - builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline) - , new DialogInterface.OnClickListener() { + builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline), + new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Dismiss the dialog and not to show it later From bfc74a610b20739fe493ebf89c3efce61d4af38a Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 18:20:57 +0300 Subject: [PATCH 09/12] Minor fixes --- app/src/main/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4f6d8e61d..524ef6a66 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -205,9 +205,9 @@ Tap this message (or hit back) to skip this step. Wikidata item Error while caching pictures Feedback wanted - We are planning several new features and improvements for the app! Would you like to review them and provide feedback? (You can always access this by selecting "Developer plans" in the navigation drawer) + We are planning several new features and improvements for the app! Would you like to review them and provide feedback? \n(You can always access this by selecting "Developer plans" in the navigation drawer) No thanks Sure, take me there! - https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal#Endorsements + https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal From 5e0e34cf10c6078125056184259737c009b36c12 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 18:24:09 +0300 Subject: [PATCH 10/12] Add one more line break --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 524ef6a66..30ea71515 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -205,7 +205,7 @@ Tap this message (or hit back) to skip this step. Wikidata item Error while caching pictures Feedback wanted - We are planning several new features and improvements for the app! Would you like to review them and provide feedback? \n(You can always access this by selecting "Developer plans" in the navigation drawer) + We are planning several new features and improvements for the app! Would you like to review them and provide feedback? \n\n(You can always access this by selecting "Developer plans" in the navigation drawer) No thanks Sure, take me there! https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal From 1c3332f6b517d41ad947c7567ed7741a81c4bbd6 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 20:29:57 +0300 Subject: [PATCH 11/12] Change url to a new page --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 30ea71515..9b984d339 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -208,6 +208,6 @@ Tap this message (or hit back) to skip this step. We are planning several new features and improvements for the app! Would you like to review them and provide feedback? \n\n(You can always access this by selecting "Developer plans" in the navigation drawer) No thanks Sure, take me there! - https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal + https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal/User_feedback From 8b460b6f3a5e5e9e1939d04b7dafc50a236d7f02 Mon Sep 17 00:00:00 2001 From: Neslihan Date: Wed, 26 Jul 2017 22:20:46 +0300 Subject: [PATCH 12/12] Fix ugly codes --- .../contributions/ContributionsActivity.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java index 783c3b6c3..4509818a4 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java @@ -357,11 +357,11 @@ public class ContributionsActivity private void displayFeedbackPopup() { - Date strDate = null; + Date popupMessageEndDate = null; try { String validUntil = "23/08/2017"; SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - strDate = sdf.parse(validUntil); + popupMessageEndDate = sdf.parse(validUntil); } catch (ParseException e) { e.printStackTrace(); } @@ -376,12 +376,12 @@ public class ContributionsActivity int appStartCounter = prefs.getInt("app_start_counter" ,0); // if time is valid and shared pref says display - if (new Date().before(strDate) && displayFeedbackPopup && (appStartCounter == 4)) { + if (new Date().before(popupMessageEndDate) && displayFeedbackPopup && (appStartCounter == 4)) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(getResources().getString(R.string.feedback_popup_title)); - builder.setMessage(getResources().getString(R.string.feedback_popup_description)); - builder.setPositiveButton(getResources().getString(R.string.feedback_popup_accept), + new AlertDialog.Builder(this) + .setTitle(getResources().getString(R.string.feedback_popup_title)) + .setMessage(getResources().getString(R.string.feedback_popup_description)) + .setPositiveButton(getResources().getString(R.string.feedback_popup_accept), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Go to the page @@ -393,8 +393,8 @@ public class ContributionsActivity prefs.edit().putBoolean("display_feedbak_popup" , false).commit(); dialog.dismiss(); } - }); - builder.setNegativeButton(getResources().getString(R.string.feedback_popup_decline), + }) + .setNegativeButton(getResources().getString(R.string.feedback_popup_decline), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -402,9 +402,8 @@ public class ContributionsActivity prefs.edit().putBoolean("display_feedbak_popup", false).commit(); dialog.dismiss(); } - }); - AlertDialog alert = builder.create(); - alert.show(); + }) + .create().show(); } } }