Merge pull request #820 from mebr1416/master

Fix for issue #701
This commit is contained in:
Josephine Lim 2017-07-30 19:17:18 +10:00 committed by GitHub
commit ca46d4f516
3 changed files with 67 additions and 7 deletions

View file

@ -1,6 +1,7 @@
package fr.free.nrw.commons.upload; package fr.free.nrw.commons.upload;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
@ -8,6 +9,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -175,6 +177,8 @@ public class SingleUploadFragment extends Fragment {
editor.commit(); editor.commit();
} }
@OnTouch(R.id.share_license_summary) boolean showLicence(View view, MotionEvent motionEvent) { @OnTouch(R.id.share_license_summary) boolean showLicence(View view, MotionEvent motionEvent) {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) { if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) {
Intent intent = new Intent(); Intent intent = new Intent();
@ -198,6 +202,60 @@ public class SingleUploadFragment extends Fragment {
descEdit.setText(desc); descEdit.setText(desc);
} }
/**
* Copied from https://stackoverflow.com/a/26269435/8065933
*/
@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();
if (motionEvent.getAction() == motionEvent.ACTION_UP && motionEvent.getRawX() >= value) {
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 value = descEdit.getRight() - descEdit.getCompoundDrawables()[2].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);
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) { private void setLicenseSummary(String license) {
licenseSummaryView.setText(getString(R.string.share_license_summary, getString(Utils.licenseNameFor(license)))); licenseSummaryView.setText(getString(R.string.share_license_summary, getString(Utils.licenseNameFor(license))));
} }

View file

@ -18,20 +18,22 @@
android:id="@+id/titleEdit" android:id="@+id/titleEdit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableEnd="@drawable/mapbox_info_icon_default"
android:drawableRight="@drawable/mapbox_info_icon_default"
android:scrollHorizontally="false" android:scrollHorizontally="false"
android:maxLines="1" android:maxLines="1"
android:hint="@string/share_title_hint" android:hint="@string/share_title_hint"
android:imeOptions="flagNoExtractUi" android:imeOptions="flagNoExtractUi" />
/>
<EditText <EditText
android:id="@+id/descEdit" android:id="@+id/descEdit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableEnd="@drawable/mapbox_info_icon_default"
android:drawableRight="@drawable/mapbox_info_icon_default"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:hint="@string/share_description_hint" android:hint="@string/share_description_hint"
android:imeOptions="flagNoExtractUi" android:imeOptions="flagNoExtractUi" />
/>
<Spinner <Spinner
android:id="@+id/licenseSpinner" android:id="@+id/licenseSpinner"

View file

@ -196,17 +196,17 @@ Tap this message (or hit back) to skip this step.</string>
<string name="navigation_item_feedback">Feedback</string> <string name="navigation_item_feedback">Feedback</string>
<string name="navigation_item_logout">Logout</string> <string name="navigation_item_logout">Logout</string>
<string name="navigation_item_info">Tutorial</string> <string name="navigation_item_info">Tutorial</string>
<string name="navigation_item_developer_plans">Developer plans</string>
<string name="nearby_needs_permissions">Nearby places cannot be displayed without location permissions</string> <string name="nearby_needs_permissions">Nearby places cannot be displayed without location permissions</string>
<string name="no_description_found">no description found</string> <string name="no_description_found">no description found</string>
<string name="nearby_info_menu_commons_article">Commons file page</string> <string name="nearby_info_menu_commons_article">Commons file page</string>
<string name="nearby_info_menu_wikidata_article">Wikidata item</string> <string name="nearby_info_menu_wikidata_article">Wikidata item</string>
<string name="error_while_cache">Error while caching pictures</string> <string name="error_while_cache">Error while caching pictures</string>
<string name="title_info">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</string>
<string name="description_info">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.</string>
<string name="feedback_popup_title">Feedback wanted</string> <string name="feedback_popup_title">Feedback wanted</string>
<string name="feedback_popup_description">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)</string> <string name="feedback_popup_description">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)</string>
<string name="feedback_popup_decline">No thanks</string> <string name="feedback_popup_decline">No thanks</string>
<string name="feedback_popup_accept">Sure, take me there!</string> <string name="feedback_popup_accept">Sure, take me there!</string>
<string name="feedback_page_url">https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal/User_feedback</string> <string name="feedback_page_url">https://meta.wikimedia.org/wiki/Grants:Project/Improve_\'Upload_to_Commons\'_Android_App/Renewal/User_feedback</string>
<string name="navigation_item_developer_plans">Developer plans</string>
</resources> </resources>