Skip to content

Commit 31d980c

Browse files
author
Vivek Maskara
authored
Merge branch 'master' into featuredImageImpl
2 parents 3bdaf9c + 693c37f commit 31d980c

File tree

16 files changed

+125
-76
lines changed

16 files changed

+125
-76
lines changed

app/src/main/java/fr/free/nrw/commons/AboutActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
135135
public boolean onOptionsItemSelected(MenuItem item) {
136136
switch (item.getItemId()) {
137137
case R.id.share_app_icon:
138+
String shareText = "Upload photos to Wikimedia Commons on your phone\nDownload the Commons app: http://play.google.com/store/apps/details?id=fr.free.nrw.commons";
138139
Intent sendIntent = new Intent();
139140
sendIntent.setAction(Intent.ACTION_SEND);
140-
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details?id=fr.free.nrw.commons");
141+
sendIntent.putExtra(Intent.EXTRA_TEXT, shareText);
141142
sendIntent.setType("text/plain");
142143
startActivity(Intent.createChooser(sendIntent, "Share app via..."));
143144
return true;

app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import fr.free.nrw.commons.mwapi.MediaWikiApi;
4848
import fr.free.nrw.commons.theme.NavigationBaseActivity;
4949
import fr.free.nrw.commons.ui.widget.HtmlTextView;
50+
import fr.free.nrw.commons.utils.ViewUtil;
5051
import io.reactivex.Observable;
5152
import io.reactivex.android.schedulers.AndroidSchedulers;
5253
import io.reactivex.schedulers.Schedulers;
@@ -109,14 +110,14 @@ public void onCreate(Bundle savedInstanceState) {
109110
usernameEdit.addTextChangedListener(textWatcher);
110111
usernameEdit.setOnFocusChangeListener((v, hasFocus) -> {
111112
if (!hasFocus) {
112-
hideKeyboard(v);
113+
ViewUtil.hideKeyboard(v);
113114
}
114115
});
115116

116117
passwordEdit.addTextChangedListener(textWatcher);
117118
passwordEdit.setOnFocusChangeListener((v, hasFocus) -> {
118119
if (!hasFocus) {
119-
hideKeyboard(v);
120+
ViewUtil.hideKeyboard(v);
120121
}
121122
});
122123

@@ -144,16 +145,6 @@ void onPrivacyPolicyClicked() {
144145
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
145146
}
146147

147-
public void hideKeyboard(View view) {
148-
if (view != null) {
149-
InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE);
150-
if (inputMethodManager != null) {
151-
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
152-
}
153-
}
154-
}
155-
156-
157148
@Override
158149
protected void onPostCreate(Bundle savedInstanceState) {
159150
super.onPostCreate(savedInstanceState);

app/src/main/java/fr/free/nrw/commons/category/CategorizationFragment.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package fr.free.nrw.commons.category;
22

33

4-
import android.app.Activity;
54
import android.content.SharedPreferences;
65
import android.os.Bundle;
76
import android.support.v7.app.AlertDialog;
@@ -16,7 +15,6 @@
1615
import android.view.MenuItem;
1716
import android.view.View;
1817
import android.view.ViewGroup;
19-
import android.view.inputmethod.InputMethodManager;
2018
import android.widget.EditText;
2119
import android.widget.ProgressBar;
2220
import android.widget.TextView;
@@ -43,6 +41,7 @@
4341
import fr.free.nrw.commons.mwapi.MediaWikiApi;
4442
import fr.free.nrw.commons.upload.MwVolleyApi;
4543
import fr.free.nrw.commons.utils.StringSortingUtils;
44+
import fr.free.nrw.commons.utils.ViewUtil;
4645
import io.reactivex.Observable;
4746
import io.reactivex.android.schedulers.AndroidSchedulers;
4847
import io.reactivex.schedulers.Schedulers;
@@ -116,7 +115,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
116115

117116
categoriesFilter.setOnFocusChangeListener((v, hasFocus) -> {
118117
if (!hasFocus) {
119-
hideKeyboard(v);
118+
ViewUtil.hideKeyboard(v);
120119
}
121120
});
122121

@@ -128,16 +127,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
128127
return rootView;
129128
}
130129

131-
public void hideKeyboard(View view) {
132-
133-
if (view != null) {
134-
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
135-
if (inputMethodManager != null) {
136-
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
137-
}
138-
}
139-
}
140-
141130
@Override
142131
public void onDestroyView() {
143132
categoriesFilter.removeTextChangedListener(textWatcher);

app/src/main/java/fr/free/nrw/commons/upload/MultipleUploadListFragment.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import fr.free.nrw.commons.R;
3434
import fr.free.nrw.commons.contributions.Contribution;
3535
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
36+
import fr.free.nrw.commons.utils.ViewUtil;
3637

3738
public class MultipleUploadListFragment extends Fragment {
3839

@@ -129,7 +130,7 @@ public void onStop() {
129130

130131
// FIXME: Stops the keyboard from being shown 'stale' while moving out of this fragment into the next
131132
View target = getActivity().getCurrentFocus();
132-
hideKeyboard(target);
133+
ViewUtil.hideKeyboard(target);
133134
}
134135

135136
// FIXME: Wrong result type
@@ -178,22 +179,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
178179

179180
baseTitle.setOnFocusChangeListener((v, hasFocus) -> {
180181
if (!hasFocus) {
181-
hideKeyboard(v);
182+
ViewUtil.hideKeyboard(v);
182183
}
183184
});
184185

185186
return view;
186187
}
187188

188-
public void hideKeyboard(View view) {
189-
if (view != null) {
190-
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
191-
if (inputMethodManager != null) {
192-
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
193-
}
194-
}
195-
}
196-
197189
@Override
198190
public void onDestroyView() {
199191
baseTitle.removeTextChangedListener(textWatcher);

app/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878

7979
import fr.free.nrw.commons.utils.ImageUtils;
8080
import fr.free.nrw.commons.mwapi.MediaWikiApi;
81+
import fr.free.nrw.commons.utils.ViewUtil;
8182
import timber.log.Timber;
8283

8384

@@ -735,7 +736,7 @@ private void zoomImageFromThumb(final View thumbView, Uri imageuri ) {
735736
if (CurrentAnimator != null) {
736737
CurrentAnimator.cancel();
737738
}
738-
hideKeyboard(ShareActivity.this);
739+
ViewUtil.hideKeyboard(ShareActivity.this.findViewById(R.id.titleEdit | R.id.descEdit));
739740
InputStream input = null;
740741
Bitmap scaled = null;
741742
try {
@@ -905,12 +906,5 @@ public void onAnimationCancel(Animator animation) {
905906

906907
});
907908
}
908-
public static void hideKeyboard(Activity activity) {
909-
View view = activity.findViewById(R.id.titleEdit | R.id.descEdit);
910-
if (view != null) {
911-
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
912-
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
913-
}
914-
}
915909

916910
}

app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package fr.free.nrw.commons.upload;
22

33
import android.annotation.SuppressLint;
4-
import android.app.Activity;
5-
64
import android.content.Intent;
75
import android.content.SharedPreferences;
86
import android.graphics.Color;
@@ -11,20 +9,17 @@
119
import android.support.annotation.NonNull;
1210
import android.support.v4.view.ViewCompat;
1311
import android.support.v7.app.AlertDialog;
14-
1512
import android.text.Editable;
1613
import android.text.Html;
1714
import android.text.TextWatcher;
1815
import android.text.method.LinkMovementMethod;
19-
2016
import android.view.LayoutInflater;
2117
import android.view.Menu;
2218
import android.view.MenuInflater;
2319
import android.view.MenuItem;
2420
import android.view.MotionEvent;
2521
import android.view.View;
2622
import android.view.ViewGroup;
27-
import android.view.inputmethod.InputMethodManager;
2823
import android.widget.AdapterView;
2924
import android.widget.ArrayAdapter;
3025
import android.widget.Button;
@@ -47,9 +42,9 @@
4742
import fr.free.nrw.commons.Utils;
4843
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
4944
import fr.free.nrw.commons.settings.Prefs;
45+
import fr.free.nrw.commons.utils.ViewUtil;
5046
import timber.log.Timber;
5147

52-
import static android.view.MotionEvent.ACTION_DOWN;
5348
import static android.view.MotionEvent.ACTION_UP;
5449

5550
public class SingleUploadFragment extends CommonsDaggerSupportFragment {
@@ -168,13 +163,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
168163

169164
titleEdit.setOnFocusChangeListener((v, hasFocus) -> {
170165
if (!hasFocus) {
171-
hideKeyboard(v);
166+
ViewUtil.hideKeyboard(v);
172167
}
173168
});
174169

175170
descEdit.setOnFocusChangeListener((v, hasFocus) -> {
176171
if(!hasFocus){
177-
hideKeyboard(v);
172+
ViewUtil.hideKeyboard(v);
178173
}
179174
});
180175

@@ -183,15 +178,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
183178
return rootView;
184179
}
185180

186-
public void hideKeyboard(View view) {
187-
if (view != null) {
188-
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
189-
if (inputMethodManager != null) {
190-
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
191-
}
192-
}
193-
}
194-
195181
@Override
196182
public void onDestroyView() {
197183
titleEdit.removeTextChangedListener(textWatcher);
@@ -305,7 +291,7 @@ public void onStop() {
305291

306292
// FIXME: Stops the keyboard from being shown 'stale' while moving out of this fragment into the next
307293
View target = getActivity().getCurrentFocus();
308-
hideKeyboard(target);
294+
ViewUtil.hideKeyboard(target);
309295
}
310296

311297
@NonNull

app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.support.design.widget.Snackbar;
66
import android.view.Display;
77
import android.view.View;
8+
import android.view.inputmethod.InputMethodManager;
89
import android.widget.Toast;
910

1011
public class ViewUtil {
@@ -27,4 +28,14 @@ public static boolean isPortrait(Context context) {
2728
}
2829
}
2930

31+
public static void hideKeyboard(View view){
32+
if (view != null) {
33+
InputMethodManager manager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
34+
view.clearFocus();
35+
if (manager != null) {
36+
manager.hideSoftInputFromWindow(view.getWindowToken(), 0);
37+
}
38+
}
39+
}
40+
3041
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<vector android:alpha="0.84" android:height="32dp"
1+
<vector android:alpha="0.84" android:height="24dp"
22
android:viewportHeight="24.0" android:viewportWidth="24.0"
3-
android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
44
<path android:fillColor="#ffffffff" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
55
</vector>

app/src/main/res/menu/menu_about.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<item
99
android:id="@+id/share_app_icon"
10-
android:title="@string/refresh_button"
10+
android:title="@string/share_app_title"
1111
android:icon="@drawable/ic_share_black_24dp"
1212
android:orderInCategory="1"
1313
app:showAsAction="ifRoom"

app/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
<string name="welcome_copyright_subtext">Vermeide urheberrechtlich geschütztes Material, das du im Internet gefunden hast wie Bilder von Postern, Buchcovern etc.</string>
155155
<string name="welcome_final_text">Verstanden?</string>
156156
<string name="welcome_final_button_text">Ja!</string>
157+
<string name="welcome_help_button_text"/>
157158
<string name="detail_panel_cats_label">Kategorien</string>
158159
<string name="detail_panel_cats_loading">Lade …</string>
159160
<string name="detail_panel_cats_none">Keine ausgewählt</string>

0 commit comments

Comments
 (0)