From 05bdfb588ee2a43caa7ab7710bb6726ad8e2fbe9 Mon Sep 17 00:00:00 2001 From: mebr1416 Date: Fri, 28 Jul 2017 12:19:37 +0300 Subject: [PATCH 1/4] Information by upload fields --- .../commons/upload/SingleUploadFragment.java | 66 +++++++++++++++++++ .../res/layout/fragment_single_upload.xml | 10 +-- app/src/main/res/values/strings.xml | 2 + 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java b/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java index 12ace6b3b..7f59c1e54 100644 --- a/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java @@ -1,6 +1,7 @@ package fr.free.nrw.commons.upload; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; @@ -8,8 +9,10 @@ import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; +import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -22,8 +25,10 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; +import android.widget.Toast; import java.util.ArrayList; @@ -175,6 +180,8 @@ public class SingleUploadFragment extends Fragment { editor.commit(); } + + @OnTouch(R.id.share_license_summary) boolean showLicence(View view, MotionEvent motionEvent) { if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) { Intent intent = new Intent(); @@ -198,6 +205,65 @@ public class SingleUploadFragment extends Fragment { descEdit.setText(desc); } + /** + * Copied from https://stackoverflow.com/a/26269435/8065933 + * @param view + * @param motionEvent + * @return + */ + @OnTouch(R.id.titleEdit) boolean titleInfo(View view, MotionEvent motionEvent){ + + final int DRAWABLE_RIGHT = 2; + + if(motionEvent.getAction() == MotionEvent.ACTION_UP) { + if(motionEvent.getRawX() >= (titleEdit.getRight() - titleEdit.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { + + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle(R.string.media_detail_title); + builder.setMessage(R.string.title_info); + builder.setCancelable(true); + builder.setNeutralButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + + AlertDialog alert = builder.create(); + alert.show(); + return true; + } + } + return false; + } + + @OnTouch(R.id.descEdit) boolean descriptionInfo(View view, MotionEvent motionEvent){ + + final int DRAWABLE_RIGHT = 2; + + if(motionEvent.getAction() == MotionEvent.ACTION_UP) { + if(motionEvent.getRawX() >= (titleEdit.getRight() - titleEdit.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { + + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle(R.string.media_detail_description); + builder.setMessage(R.string.description_info); + builder.setCancelable(true); + builder.setNeutralButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + + AlertDialog alert = builder.create(); + alert.show(); + return true; + } + } + return false; + } + + private void setLicenseSummary(String license) { licenseSummaryView.setText(getString(R.string.share_license_summary, getString(Utils.licenseNameFor(license)))); } diff --git a/app/src/main/res/layout/fragment_single_upload.xml b/app/src/main/res/layout/fragment_single_upload.xml index 911943116..dad6ce91f 100644 --- a/app/src/main/res/layout/fragment_single_upload.xml +++ b/app/src/main/res/layout/fragment_single_upload.xml @@ -18,20 +18,22 @@ android:id="@+id/titleEdit" android:layout_width="match_parent" android:layout_height="wrap_content" + android:drawableEnd="@drawable/mapbox_info_icon_default" + android:drawableRight="@drawable/mapbox_info_icon_default" android:scrollHorizontally="false" android:maxLines="1" android:hint="@string/share_title_hint" - android:imeOptions="flagNoExtractUi" - /> + android:imeOptions="flagNoExtractUi" /> + android:imeOptions="flagNoExtractUi" /> Commons file page Wikidata item 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. From b32320b344176d74fe18c77274f4e1f07707eb70 Mon Sep 17 00:00:00 2001 From: mebr1416 Date: Fri, 28 Jul 2017 16:26:56 +0300 Subject: [PATCH 2/4] - Information by upload fields - Fixed conflicts --- .../commons/upload/SingleUploadFragment.java | 54 ++++++++----------- app/src/main/res/values/strings.xml | 4 +- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java b/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java index 7f59c1e54..9f2ab5ba5 100644 --- a/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java @@ -12,7 +12,6 @@ import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -25,10 +24,8 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; -import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; -import android.widget.Toast; import java.util.ArrayList; @@ -207,42 +204,37 @@ public class SingleUploadFragment extends Fragment { /** * Copied from https://stackoverflow.com/a/26269435/8065933 - * @param view - * @param motionEvent - * @return */ - @OnTouch(R.id.titleEdit) boolean titleInfo(View view, MotionEvent motionEvent){ + @OnTouch + (R.id.titleEdit) boolean titleInfo(View view, MotionEvent motionEvent) { + //Should replace right with end to support different right-to-left languages as well + final int value = titleEdit.getRight() - titleEdit.getCompoundDrawables()[2].getBounds().width(); - final int DRAWABLE_RIGHT = 2; + if (motionEvent.getAction() == motionEvent.ACTION_UP && motionEvent.getRawX() >= value) { - if(motionEvent.getAction() == MotionEvent.ACTION_UP) { - if(motionEvent.getRawX() >= (titleEdit.getRight() - titleEdit.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle(R.string.media_detail_title); + builder.setMessage(R.string.title_info); + builder.setCancelable(true); + builder.setNeutralButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); - builder.setTitle(R.string.media_detail_title); - builder.setMessage(R.string.title_info); - builder.setCancelable(true); - builder.setNeutralButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - } - }); - - AlertDialog alert = builder.create(); - alert.show(); - return true; - } + AlertDialog alert = builder.create(); + alert.show(); + return true; } return false; } - @OnTouch(R.id.descEdit) boolean descriptionInfo(View view, MotionEvent motionEvent){ + @OnTouch + (R.id.descEdit) boolean descriptionInfo(View view, MotionEvent motionEvent) { + final int value = descEdit.getRight() - descEdit.getCompoundDrawables()[2].getBounds().width(); - final int DRAWABLE_RIGHT = 2; - - if(motionEvent.getAction() == MotionEvent.ACTION_UP) { - if(motionEvent.getRawX() >= (titleEdit.getRight() - titleEdit.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { + if (motionEvent.getAction() == motionEvent.ACTION_UP && motionEvent.getRawX() >= value) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(R.string.media_detail_description); @@ -258,7 +250,7 @@ public class SingleUploadFragment extends Fragment { AlertDialog alert = builder.create(); alert.show(); return true; - } + } return false; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d7f0b99ee..6ac024f23 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -203,8 +203,8 @@ Tap this message (or hit back) to skip this step. no description found Commons file page Wikidata item - 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 + 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. From a27ad4a8e84574cb0de0b636b7deeb3601163873 Mon Sep 17 00:00:00 2001 From: mebr1416 Date: Fri, 28 Jul 2017 17:04:50 +0300 Subject: [PATCH 3/4] - Information by upload fields - Fixed conflicts --- app/src/main/res/values/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6ac024f23..2b92bf480 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -198,7 +198,6 @@ Tap this message (or hit back) to skip this step. Feedback Logout Tutorial - Nearby places cannot be displayed without location permissions no description found Commons file page From c69a1b397cade1054d61b1e1ac09ac904a948f75 Mon Sep 17 00:00:00 2001 From: mebr1416 Date: Fri, 28 Jul 2017 17:30:38 +0300 Subject: [PATCH 4/4] - Fixed conflicts --- app/src/main/res/values/strings.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2b92bf480..3dff3c26f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -205,5 +205,10 @@ Tap this message (or hit back) to skip this step. 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. - + Feedback wanted + 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/User_feedback + Developer plans