Merge branch 'master' of https://github.com/commons-app/apps-android-commons into delete-request

This commit is contained in:
Suchit Kar 2018-03-17 19:36:12 +05:30
commit c303525508
29 changed files with 595 additions and 364 deletions

View file

@ -33,3 +33,7 @@ You can find this information by going to the navigation drawer in the app and t
**Screen-shots:** **Screen-shots:**
Can be created by pressing the Volume Down and Power Button at the same time on Android 4.0 and higher. Can be created by pressing the Volume Down and Power Button at the same time on Android 4.0 and higher.
**Would you like to work on the issue?**
Please let us know whether you want to fix the issue by yourself. If not, anyone can get the issue assigned to them.

View file

@ -99,6 +99,7 @@ dependencies {
kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION" kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION"
compile 'com.borjabravo:readmoretextview:2.1.0' compile 'com.borjabravo:readmoretextview:2.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
} }
android { android {

View file

@ -58,37 +58,18 @@ public class AboutActivity extends NavigationBaseActivity {
intent.setPackage("com.facebook.katana"); intent.setPackage("com.facebook.katana");
startActivity(intent); startActivity(intent);
} catch (Exception e) { } catch (Exception e) {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" + "1921335171459985\\"));
if(intent.resolveActivity(this.getPackageManager()) != null){
Utils.handleWebUrl(this,Uri.parse("https://www.facebook.com/" + "1921335171459985")); Utils.handleWebUrl(this,Uri.parse("https://www.facebook.com/" + "1921335171459985"));
} else {
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
} }
} }
@OnClick(R.id.github_launch_icon) @OnClick(R.id.github_launch_icon)
public void launchGithub(View view) { public void launchGithub(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons\\"));
//check if web browser available
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons\\")); Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons\\"));
} else {
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
} }
@OnClick(R.id.website_launch_icon) @OnClick(R.id.website_launch_icon)
public void launchWebsite(View view) { public void launchWebsite(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://commons-app.github.io/\\"));
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
Utils.handleWebUrl(this,Uri.parse("https://commons-app.github.io/\\")); Utils.handleWebUrl(this,Uri.parse("https://commons-app.github.io/\\"));
} else {
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
} }
@OnClick(R.id.about_rate_us) @OnClick(R.id.about_rate_us)
@ -98,29 +79,16 @@ public class AboutActivity extends NavigationBaseActivity {
@OnClick(R.id.about_credits) @OnClick(R.id.about_credits)
public void launchCredits(View view) { public void launchCredits(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\")); Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));
} else {
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
} }
@OnClick(R.id.about_privacy_policy) @OnClick(R.id.about_privacy_policy)
public void launchPrivacyPolicy(View view) { public void launchPrivacyPolicy(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\")); Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
} else {
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
} }
@OnClick(R.id.about_faq) @OnClick(R.id.about_faq)
public void launchFrequentlyAskedQuesions(View view) { public void launchFrequentlyAskedQuesions(View view) {
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Frequently-Asked-Questions\\")); Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Frequently-Asked-Questions\\"));
} }
} }

View file

@ -7,6 +7,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.support.multidex.MultiDexApplication; import android.support.multidex.MultiDexApplication;
import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.stetho.Stetho; import com.facebook.stetho.Stetho;
import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher; import com.squareup.leakcanary.RefWatcher;
@ -25,7 +26,6 @@ import fr.free.nrw.commons.category.CategoryDao;
import fr.free.nrw.commons.contributions.ContributionDao; import fr.free.nrw.commons.contributions.ContributionDao;
import fr.free.nrw.commons.data.DBOpenHelper; import fr.free.nrw.commons.data.DBOpenHelper;
import fr.free.nrw.commons.di.ApplicationlessInjection; import fr.free.nrw.commons.di.ApplicationlessInjection;
import fr.free.nrw.commons.di.CommonsApplicationComponent;
import fr.free.nrw.commons.modifications.ModifierSequenceDao; import fr.free.nrw.commons.modifications.ModifierSequenceDao;
import fr.free.nrw.commons.utils.FileUtils; import fr.free.nrw.commons.utils.FileUtils;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
@ -72,8 +72,11 @@ public class CommonsApplication extends MultiDexApplication {
.getInstance(this) .getInstance(this)
.getCommonsApplicationComponent() .getCommonsApplicationComponent()
.inject(this); .inject(this);
// Set DownsampleEnabled to True to downsample the image in case it's heavy
Fresco.initialize(this); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setDownsampleEnabled(true)
.build();
Fresco.initialize(this,config);
if (setupLeakCanary() == RefWatcher.DISABLED) { if (setupLeakCanary() == RefWatcher.DISABLED) {
return; return;
} }

View file

@ -7,6 +7,7 @@ import android.preference.PreferenceManager;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.customtabs.CustomTabsIntent; import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.widget.Toast;
import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
@ -15,7 +16,6 @@ import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -24,6 +24,8 @@ import java.util.regex.Pattern;
import fr.free.nrw.commons.settings.Prefs; import fr.free.nrw.commons.settings.Prefs;
import timber.log.Timber; import timber.log.Timber;
import static android.widget.Toast.LENGTH_SHORT;
public class Utils { public class Utils {
/** /**
@ -176,6 +178,13 @@ public class Utils {
} }
public static void handleWebUrl(Context context,Uri url){ public static void handleWebUrl(Context context,Uri url){
Intent browserIntent = new Intent(Intent.ACTION_VIEW, url);
if (browserIntent.resolveActivity(context.getPackageManager()) == null) {
Toast toast = Toast.makeText(context, context.getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
return;
}
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setToolbarColor(ContextCompat.getColor(context, R.color.primaryColor)); builder.setToolbarColor(ContextCompat.getColor(context, R.color.primaryColor));
builder.setSecondaryToolbarColor(ContextCompat.getColor(context, R.color.primaryDarkColor)); builder.setSecondaryToolbarColor(ContextCompat.getColor(context, R.color.primaryDarkColor));

View file

@ -37,6 +37,7 @@ import javax.inject.Named;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
import fr.free.nrw.commons.BuildConfig; import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.PageTitle; import fr.free.nrw.commons.PageTitle;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
@ -83,6 +84,9 @@ public class LoginActivity extends AccountAuthenticatorActivity {
private AppCompatDelegate delegate; private AppCompatDelegate delegate;
private LoginTextWatcher textWatcher = new LoginTextWatcher(); private LoginTextWatcher textWatcher = new LoginTextWatcher();
private Boolean loginCurrentlyInProgress = false;
private static final String LOGING_IN = "logingIn";
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
setTheme(Utils.isDarkTheme(this) ? R.style.DarkAppTheme : R.style.LightAppTheme); setTheme(Utils.isDarkTheme(this) ? R.style.DarkAppTheme : R.style.LightAppTheme);
@ -132,6 +136,10 @@ public class LoginActivity extends AccountAuthenticatorActivity {
Utils.handleWebUrl(this, Uri.parse(BuildConfig.FORGOT_PASSWORD_URL)); Utils.handleWebUrl(this, Uri.parse(BuildConfig.FORGOT_PASSWORD_URL));
} }
@OnClick(R.id.about_privacy_policy)
void onPrivacyPolicyClicked() {
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
}
public void hideKeyboard(View view) { public void hideKeyboard(View view) {
InputMethodManager inputMethodManager =(InputMethodManager)this.getSystemService(Activity.INPUT_METHOD_SERVICE); InputMethodManager inputMethodManager =(InputMethodManager)this.getSystemService(Activity.INPUT_METHOD_SERVICE);
@ -175,6 +183,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
} }
private void performLogin() { private void performLogin() {
loginCurrentlyInProgress = true;
Timber.d("Login to start!"); Timber.d("Login to start!");
final String username = canonicializeUsername(usernameEdit.getText().toString()); final String username = canonicializeUsername(usernameEdit.getText().toString());
final String password = passwordEdit.getText().toString(); final String password = passwordEdit.getText().toString();
@ -205,6 +214,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
if (result.equals("PASS")) { if (result.equals("PASS")) {
handlePassResult(username, password); handlePassResult(username, password);
} else { } else {
loginCurrentlyInProgress = false;
handleOtherResults(result); handleOtherResults(result);
} }
} }
@ -327,6 +337,21 @@ public class LoginActivity extends AccountAuthenticatorActivity {
return getDelegate().getMenuInflater(); return getDelegate().getMenuInflater();
} }
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(LOGING_IN, loginCurrentlyInProgress);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
loginCurrentlyInProgress = savedInstanceState.getBoolean(LOGING_IN, false);
if(loginCurrentlyInProgress){
performLogin();
}
}
public void askUserForTwoFactorAuth() { public void askUserForTwoFactorAuth() {
progressDialog.dismiss(); progressDialog.dismiss();
twoFactorContainer.setVisibility(VISIBLE); twoFactorContainer.setVisibility(VISIBLE);

View file

@ -108,10 +108,10 @@ public class CategoryDao {
Category fromCursor(Cursor cursor) { Category fromCursor(Cursor cursor) {
// Hardcoding column positions! // Hardcoding column positions!
return new Category( return new Category(
CategoryContentProvider.uriForId(cursor.getInt(0)), CategoryContentProvider.uriForId(cursor.getInt(cursor.getColumnIndex(Table.COLUMN_ID))),
cursor.getString(1), cursor.getString(cursor.getColumnIndex(Table.COLUMN_NAME)),
new Date(cursor.getLong(2)), new Date(cursor.getLong(cursor.getColumnIndex(Table.COLUMN_LAST_USED))),
cursor.getInt(3) cursor.getInt(cursor.getColumnIndex(Table.COLUMN_TIMES_USED))
); );
} }

View file

@ -8,6 +8,7 @@ import android.net.Uri;
import android.os.RemoteException; import android.os.RemoteException;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import java.util.Date; import java.util.Date;
@ -115,23 +116,30 @@ public class ContributionDao {
// Hardcoding column positions! // Hardcoding column positions!
//Check that cursor has a value to avoid CursorIndexOutOfBoundsException //Check that cursor has a value to avoid CursorIndexOutOfBoundsException
if (cursor.getCount() > 0) { if (cursor.getCount() > 0) {
int index;
if (cursor.getColumnIndex(Table.COLUMN_LICENSE) == -1){
index = 15;
} else {
index = cursor.getColumnIndex(Table.COLUMN_LICENSE);
}
return new Contribution( return new Contribution(
uriForId(cursor.getInt(0)), uriForId(cursor.getInt(cursor.getColumnIndex(Table.COLUMN_ID))),
cursor.getString(1), cursor.getString(cursor.getColumnIndex(Table.COLUMN_FILENAME)),
parseUri(cursor.getString(2)), parseUri(cursor.getString(cursor.getColumnIndex(Table.COLUMN_LOCAL_URI))),
cursor.getString(3), cursor.getString(cursor.getColumnIndex(Table.COLUMN_IMAGE_URL)),
parseTimestamp(cursor.getLong(4)), parseTimestamp(cursor.getLong(cursor.getColumnIndex(Table.COLUMN_TIMESTAMP))),
cursor.getInt(5), cursor.getInt(cursor.getColumnIndex(Table.COLUMN_STATE)),
cursor.getLong(6), cursor.getLong(cursor.getColumnIndex(Table.COLUMN_LENGTH)),
parseTimestamp(cursor.getLong(7)), parseTimestamp(cursor.getLong(cursor.getColumnIndex(Table.COLUMN_UPLOADED))),
cursor.getLong(8), cursor.getLong(cursor.getColumnIndex(Table.COLUMN_TRANSFERRED)),
cursor.getString(9), cursor.getString(cursor.getColumnIndex(Table.COLUMN_SOURCE)),
cursor.getString(10), cursor.getString(cursor.getColumnIndex(Table.COLUMN_DESCRIPTION)),
cursor.getString(11), cursor.getString(cursor.getColumnIndex(Table.COLUMN_CREATOR)),
cursor.getInt(12) == 1, cursor.getInt(cursor.getColumnIndex(Table.COLUMN_MULTIPLE)) == 1,
cursor.getInt(13), cursor.getInt(cursor.getColumnIndex(Table.COLUMN_WIDTH)),
cursor.getInt(14), cursor.getInt(cursor.getColumnIndex(Table.COLUMN_HEIGHT)),
cursor.getString(15)); cursor.getString(index)
);
} }
return null; return null;

View file

@ -26,6 +26,7 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.HandlerService; import fr.free.nrw.commons.HandlerService;
import fr.free.nrw.commons.Media; import fr.free.nrw.commons.Media;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
@ -139,9 +140,13 @@ public class ContributionsActivity
requestAuthToken(); requestAuthToken();
initDrawer(); initDrawer();
setTitle(getString(R.string.title_activity_contributions)); setTitle(getString(R.string.title_activity_contributions));
if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
setUploadCount(); setUploadCount();
} }
}
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
@ -279,6 +284,12 @@ public class ContributionsActivity
)); ));
} }
public void betaSetUploadCount(int betaUploadCount){
getSupportActionBar().setSubtitle(getResources()
.getQuantityString(R.plurals.contributions_subtitle, betaUploadCount, betaUploadCount));
}
@Override @Override
public void notifyDatasetChanged() { public void notifyDatasetChanged() {
// Do nothing for now // Do nothing for now

View file

@ -27,6 +27,7 @@ import javax.inject.Named;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
import fr.free.nrw.commons.nearby.NearbyActivity; import fr.free.nrw.commons.nearby.NearbyActivity;
@ -56,6 +57,7 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
private ContributionController controller; private ContributionController controller;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_contributions, container, false); View v = inflater.inflate(R.layout.fragment_contributions, container, false);
@ -87,6 +89,10 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
public void setAdapter(ListAdapter adapter) { public void setAdapter(ListAdapter adapter) {
this.contributionsList.setAdapter(adapter); this.contributionsList.setAdapter(adapter);
if(BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
((ContributionsActivity) getActivity()).betaSetUploadCount(adapter.getCount());
}
} }
public void changeProgressBarVisibility(boolean isVisible) { public void changeProgressBarVisibility(boolean isVisible) {

View file

@ -54,12 +54,12 @@ public class ModifierSequenceDao {
// Hardcoding column positions! // Hardcoding column positions!
ModifierSequence ms; ModifierSequence ms;
try { try {
ms = new ModifierSequence(Uri.parse(cursor.getString(1)), ms = new ModifierSequence(Uri.parse(cursor.getString(cursor.getColumnIndex(Table.COLUMN_MEDIA_URI))),
new JSONObject(cursor.getString(2))); new JSONObject(cursor.getString(cursor.getColumnIndex(Table.COLUMN_DATA))));
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
ms.setContentUri( ModificationsContentProvider.uriForId(cursor.getInt(0))); ms.setContentUri( ModificationsContentProvider.uriForId(cursor.getInt(cursor.getColumnIndex(Table.COLUMN_ID))));
return ms; return ms;
} }

View file

@ -274,7 +274,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
LatLng lastLocation = locationManager.getLastLocation(); LatLng lastLocation = locationManager.getLastLocation();
if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed
if (isHardRefresh) { if (isHardRefresh) {
ViewUtil.showLongToast(this, R.string.nearby_location_has_not_changed); ViewUtil.showSnackbar(findViewById(R.id.container), R.string.nearby_location_has_not_changed);
} }
return; return;
} }
@ -301,9 +301,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
String gsonCurLatLng = gson.toJson(curLatLang); String gsonCurLatLng = gson.toJson(curLatLang);
if (placeList.size() == 0) { if (placeList.size() == 0) {
int duration = Toast.LENGTH_SHORT; ViewUtil.showSnackbar(findViewById(R.id.container), R.string.no_nearby);
Toast toast = Toast.makeText(this, R.string.no_nearby, duration);
toast.show();
} }
bundle.clear(); bundle.clear();

View file

@ -44,8 +44,10 @@ class PlaceRenderer extends Renderer<Place> {
Place place = getContent(); Place place = getContent();
tvName.setText(place.name); tvName.setText(place.name);
String descriptionText = place.getLongDescription(); String descriptionText = place.getLongDescription();
tvDesc.setVisibility(View.VISIBLE);
if (descriptionText.equals("?")) { if (descriptionText.equals("?")) {
descriptionText = getContext().getString(R.string.no_description_found); descriptionText = getContext().getString(R.string.no_description_found);
tvDesc.setVisibility(View.INVISIBLE);
} }
tvDesc.setText(descriptionText); tvDesc.setText(descriptionText);
distance.setText(place.distance); distance.setText(place.distance);

View file

@ -1,6 +1,7 @@
package fr.free.nrw.commons.notification; package fr.free.nrw.commons.notification;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.FragmentManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
@ -12,7 +13,6 @@ import android.widget.Toast;
import com.pedrogomez.renderers.RVRendererAdapter; import com.pedrogomez.renderers.RVRendererAdapter;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
@ -39,12 +39,16 @@ public class NotificationActivity extends NavigationBaseActivity {
@Inject NotificationController controller; @Inject NotificationController controller;
private static final String TAG_NOTIFICATION_WORKER_FRAGMENT = "NotificationWorkerFragment";
private NotificationWorkerFragment mNotificationWorkerFragment;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification); setContentView(R.layout.activity_notification);
ButterKnife.bind(this); ButterKnife.bind(this);
mNotificationWorkerFragment = (NotificationWorkerFragment) getFragmentManager()
.findFragmentByTag(TAG_NOTIFICATION_WORKER_FRAGMENT);
initListView(); initListView();
initDrawer(); initDrawer();
} }
@ -60,14 +64,18 @@ public class NotificationActivity extends NavigationBaseActivity {
private void addNotifications() { private void addNotifications() {
Timber.d("Add notifications"); Timber.d("Add notifications");
if(mNotificationWorkerFragment == null){
Observable.fromCallable(() -> controller.getNotifications()) Observable.fromCallable(() -> controller.getNotifications())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(notificationList -> { .subscribe(notificationList -> {
Collections.reverse(notificationList);
Timber.d("Number of notifications is %d", notificationList.size()); Timber.d("Number of notifications is %d", notificationList.size());
initializeAndSetNotificationList(notificationList);
setAdapter(notificationList); setAdapter(notificationList);
}, throwable -> Timber.e(throwable, "Error occurred while loading notifications")); }, throwable -> Timber.e(throwable, "Error occurred while loading notifications"));
} else {
setAdapter(mNotificationWorkerFragment.getNotificationList());
}
} }
private void handleUrl(String url) { private void handleUrl(String url) {
@ -98,4 +106,12 @@ public class NotificationActivity extends NavigationBaseActivity {
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent); context.startActivity(intent);
} }
private void initializeAndSetNotificationList(List<Notification> notificationList){
FragmentManager fm = getFragmentManager();
mNotificationWorkerFragment = new NotificationWorkerFragment();
fm.beginTransaction().add(mNotificationWorkerFragment, TAG_NOTIFICATION_WORKER_FRAGMENT)
.commit();
mNotificationWorkerFragment.setNotificationList(notificationList);
}
} }

View file

@ -0,0 +1,29 @@
package fr.free.nrw.commons.notification;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import java.util.List;
/**
* Created by knightshade on 25/2/18.
*/
public class NotificationWorkerFragment extends Fragment {
private List<Notification> notificationList;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
public void setNotificationList(List<Notification> notificationList){
this.notificationList = notificationList;
}
public List<Notification> getNotificationList(){
return notificationList;
}
}

View file

@ -3,10 +3,13 @@ package fr.free.nrw.commons.settings;
import android.Manifest; import android.Manifest;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.ComponentName;
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.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -21,6 +24,8 @@ import android.support.v4.content.FileProvider;
import android.widget.Toast; import android.widget.Toast;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
@ -141,19 +146,24 @@ public class SettingsFragment extends PreferenceFragment {
appLogsFile appLogsFile
); );
Intent feedbackIntent = new Intent(Intent.ACTION_SEND); //initialize the emailSelectorIntent
feedbackIntent.setType("message/rfc822"); Intent emailSelectorIntent = new Intent(Intent.ACTION_SENDTO);
feedbackIntent.putExtra(Intent.EXTRA_EMAIL, emailSelectorIntent.setData(Uri.parse("mailto:"));
new String[]{CommonsApplication.LOGS_PRIVATE_EMAIL}); //initialize the emailIntent
feedbackIntent.putExtra(Intent.EXTRA_SUBJECT, final Intent emailIntent = new Intent(Intent.ACTION_SEND);
String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT, emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{CommonsApplication.FEEDBACK_EMAIL});
BuildConfig.VERSION_NAME)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT, BuildConfig.VERSION_NAME));
feedbackIntent.putExtra(Intent.EXTRA_STREAM,appLogsFilePath); emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
emailIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
emailIntent.setSelector( emailSelectorIntent );
//adding the attachment to the intent
emailIntent.putExtra(Intent.EXTRA_STREAM, appLogsFilePath);
try { try {
startActivity(feedbackIntent); startActivity(Intent.createChooser(emailIntent, "Send mail.."));
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
Toast.makeText(getActivity(), R.string.no_email_client, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.no_email_client, Toast.LENGTH_SHORT).show();
} }
} }
} }

View file

@ -88,8 +88,11 @@ public abstract class NavigationBaseActivity extends BaseActivity
private void setDrawerPaneWidth() { private void setDrawerPaneWidth() {
ViewGroup.LayoutParams params = navigationView.getLayoutParams(); ViewGroup.LayoutParams params = navigationView.getLayoutParams();
// set width to lowerBound of 80% of the screen size // set width to lowerBound of 70% of the screen size in portrait mode
params.width = (getResources().getDisplayMetrics().widthPixels * 70) / 100; // set width to lowerBound of 50% of the screen size in landscape mode
int percentageWidth = getResources().getInteger(R.integer.drawer_width);
params.width = (getResources().getDisplayMetrics().widthPixels * percentageWidth) / 100;
navigationView.setLayoutParams(params); navigationView.setLayoutParams(params);
} }

View file

@ -1,11 +1,13 @@
package fr.free.nrw.commons.upload; package fr.free.nrw.commons.upload;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import java.io.IOException; import java.io.IOException;
import java.lang.ref.WeakReference;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
import fr.free.nrw.commons.contributions.ContributionsActivity; import fr.free.nrw.commons.contributions.ContributionsActivity;
@ -28,12 +30,14 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
DUPLICATE_CANCELLED DUPLICATE_CANCELLED
} }
private final WeakReference<Activity> activity;
private final MediaWikiApi api; private final MediaWikiApi api;
private final String fileSha1; private final String fileSha1;
private final Context context; private final WeakReference<Context> context;
private final Callback callback; private final Callback callback;
public ExistingFileAsync(String fileSha1, Context context, Callback callback, MediaWikiApi mwApi) { public ExistingFileAsync(WeakReference<Activity> activity, String fileSha1, WeakReference<Context> context, Callback callback, MediaWikiApi mwApi) {
this.activity = activity;
this.fileSha1 = fileSha1; this.fileSha1 = fileSha1;
this.context = context; this.context = context;
this.callback = callback; this.callback = callback;
@ -69,19 +73,21 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
// If file exists, display warning to user. // If file exists, display warning to user.
// Use soft warning for now (user able to choose to proceed) until have determined that implementation works without bugs // Use soft warning for now (user able to choose to proceed) until have determined that implementation works without bugs
if (fileExists) { if (fileExists) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context.get());
builder.setMessage(R.string.file_exists) builder.setMessage(R.string.file_exists)
.setTitle(R.string.warning); .setTitle(R.string.warning);
builder.setPositiveButton(R.string.no, (dialog, id) -> { builder.setPositiveButton(R.string.no, (dialog, id) -> {
//Go back to ContributionsActivity //Go back to ContributionsActivity
Intent intent = new Intent(context, ContributionsActivity.class); Intent intent = new Intent(context.get(), ContributionsActivity.class);
context.startActivity(intent); context.get().startActivity(intent);
callback.onResult(Result.DUPLICATE_CANCELLED); callback.onResult(Result.DUPLICATE_CANCELLED);
}); });
builder.setNegativeButton(R.string.yes, (dialog, id) -> callback.onResult(Result.DUPLICATE_PROCEED)); builder.setNegativeButton(R.string.yes, (dialog, id) -> callback.onResult(Result.DUPLICATE_PROCEED));
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
if (!activity.get().isFinishing()) {
dialog.show(); dialog.show();
}
} else { } else {
callback.onResult(Result.NO_DUPLICATE); callback.onResult(Result.NO_DUPLICATE);
} }

View file

@ -1,7 +1,9 @@
package fr.free.nrw.commons.upload; package fr.free.nrw.commons.upload;
import android.Manifest; import android.Manifest;
import android.app.Activity;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -32,6 +34,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -371,7 +374,7 @@ public class ShareActivity
Timber.d("File SHA1 is: %s", fileSHA1); Timber.d("File SHA1 is: %s", fileSHA1);
ExistingFileAsync fileAsyncTask = ExistingFileAsync fileAsyncTask =
new ExistingFileAsync(fileSHA1, this, result -> { new ExistingFileAsync(new WeakReference<Activity>(this), fileSHA1, new WeakReference<Context>(this), result -> {
Timber.d("%s duplicate check: %s", mediaUri.toString(), result); Timber.d("%s duplicate check: %s", mediaUri.toString(), result);
duplicateCheckPassed = (result == DUPLICATE_PROCEED duplicateCheckPassed = (result == DUPLICATE_PROCEED
|| result == NO_DUPLICATE); || result == NO_DUPLICATE);

View file

@ -101,6 +101,14 @@ public class SingleUploadFragment extends CommonsDaggerSupportFragment {
View rootView = inflater.inflate(R.layout.fragment_single_upload, container, false); View rootView = inflater.inflate(R.layout.fragment_single_upload, container, false);
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
Intent activityIntent = getActivity().getIntent();
if (activityIntent.hasExtra("title")) {
titleEdit.setText(activityIntent.getStringExtra("title"));
}
if (activityIntent.hasExtra("description")) {
descEdit.setText(activityIntent.getStringExtra("description"));
}
ArrayList<String> licenseItems = new ArrayList<>(); ArrayList<String> licenseItems = new ArrayList<>();
licenseItems.add(getString(R.string.license_name_cc0)); licenseItems.add(getString(R.string.license_name_cc0));
licenseItems.add(getString(R.string.license_name_cc_by)); licenseItems.add(getString(R.string.license_name_cc_by));

View file

@ -1,12 +1,12 @@
package fr.free.nrw.commons.utils; package fr.free.nrw.commons.utils;
import android.content.Context; import android.support.design.widget.Snackbar;
import android.support.annotation.StringRes; import android.view.View;
import android.widget.Toast;
public class ViewUtil { public class ViewUtil {
public static void showLongToast(final Context context, @StringRes final int stringResId) { public static void showSnackbar(View view, int messageResourceId) {
ExecutorUtils.uiExecutor().execute(() -> Toast.makeText(context, context.getString(stringResId), Toast.LENGTH_LONG).show()); Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show();
} }
} }

View file

@ -1,163 +1,189 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#0c609c" android:background="#0c609c"
android:gravity="center"> android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/welcomeYesButton"
android:layout_width="wrap_content"
android:layout_height="@dimen/overflow_button_dimen"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:layout_marginTop="@dimen/standard_gap"
android:text="@string/welcome_skip_button"
android:textColor="#fff"
android:textSize="@dimen/normal_text"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/center_guideline"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.55" />
<GridLayout <GridLayout
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/standard_gap" android:layout_marginBottom="8dp"
android:layout_marginRight="@dimen/standard_gap" android:layout_marginTop="8dp"
android:columnCount="2" android:columnCount="2"
> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/center_guideline">
<ImageView <ImageView
android:src="@drawable/mount_zao"
android:id="@+id/mount_zao" android:id="@+id/mount_zao"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="118dp" android:layout_height="118dp"
android:scaleType="fitXY"
android:contentDescription="@string/welcome_image_mount_zao" android:contentDescription="@string/welcome_image_mount_zao"
/> android:scaleType="fitXY"
android:src="@drawable/mount_zao" />
<ImageView <ImageView
android:src="@drawable/llamas"
android:id="@+id/llamas" android:id="@+id/llamas"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="118dp" android:layout_height="118dp"
android:scaleType="fitXY"
android:contentDescription="@string/welcome_image_llamas" android:contentDescription="@string/welcome_image_llamas"
/> android:scaleType="fitXY"
android:src="@drawable/llamas" />
<ImageView <ImageView
android:src="@drawable/rainbow_bridge"
android:id="@+id/rainbow_bridge" android:id="@+id/rainbow_bridge"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="118dp" android:layout_height="118dp"
android:scaleType="fitXY"
android:contentDescription="@string/welcome_image_rainbow_bridge" android:contentDescription="@string/welcome_image_rainbow_bridge"
/> android:scaleType="fitXY"
android:src="@drawable/rainbow_bridge" />
<ImageView <ImageView
android:src="@drawable/tulip"
android:id="@+id/tulip" android:id="@+id/tulip"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="118dp" android:layout_height="118dp"
android:scaleType="fitXY"
android:contentDescription="@string/welcome_image_tulip" android:contentDescription="@string/welcome_image_tulip"
/> android:scaleType="fitXY"
android:src="@drawable/tulip" />
</GridLayout> </GridLayout>
<LinearLayout android:orientation="vertical" <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
> android:orientation="vertical"
android:layout_marginStart="@dimen/standard_gap"
android:layout_marginLeft="@dimen/standard_gap"
app:layout_constraintStart_toEndOf="@id/center_guideline"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_2_text" android:text="@string/tutorial_2_text"
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="@dimen/normal_text"
android:textAlignment="center" android:textAlignment="center"
android:gravity="center_horizontal" android:textColor="@android:color/white"
android:textColor="@android:color/white"/> android:textSize="@dimen/normal_text"
android:textStyle="bold" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:layout_gravity="center" android:layout_gravity="center"
android:maxWidth="240dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp"
android:paddingTop="@dimen/standard_gap" android:paddingTop="@dimen/standard_gap"
android:textColor="@android:color/white"/> android:text="@string/bullet"
android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:text="@string/tutorial_2_subtext_1"
android:layout_gravity="center" android:layout_gravity="center"
android:textAlignment="textStart"
android:paddingTop="@dimen/standard_gap"
android:gravity="start" android:gravity="start"
android:textColor="@android:color/white" android:maxWidth="240dp"
/> android:paddingTop="@dimen/standard_gap"
android:text="@string/tutorial_2_subtext_1"
android:textAlignment="textStart"
android:textColor="@android:color/white" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:layout_gravity="center" android:layout_gravity="center"
android:maxWidth="240dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp" android:text="@string/bullet"
android:textColor="@android:color/white"/> android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_2_subtext_2" android:text="@string/tutorial_2_subtext_2"
android:layout_gravity="center"
android:textAlignment="textStart" android:textAlignment="textStart"
android:gravity="start" android:textColor="@android:color/white" />
android:textColor="@android:color/white"
/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:layout_gravity="center" android:layout_gravity="center"
android:maxWidth="240dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp" android:text="@string/bullet"
android:textColor="@android:color/white"/> android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_2_subtext_3" android:text="@string/tutorial_2_subtext_3"
android:layout_gravity="center"
android:textAlignment="textStart" android:textAlignment="textStart"
android:gravity="start" android:textColor="@android:color/white" />
android:textColor="@android:color/white"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -1,59 +1,82 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#0c609c" xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center" android:background="#0c609c">
>
<RelativeLayout <TextView
android:layout_gravity="center" android:id="@+id/welcomeYesButton"
android:layout_width="240dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="@dimen/overflow_button_dimen"
android:layout_marginEnd="@dimen/standard_gap" android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap" android:layout_marginRight="@dimen/standard_gap"
> android:layout_marginTop="@dimen/standard_gap"
android:text="@string/welcome_skip_button"
android:textColor="#fff"
android:textSize="@dimen/normal_text"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/center_guideline"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.50" />
<LinearLayout
android:layout_width="240dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/center_guideline"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap">
<ImageView <ImageView
android:src="@drawable/selfie_x"
android:id="@+id/selfie_x" android:id="@+id/selfie_x"
android:layout_width="110dp" android:layout_width="110dp"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:contentDescription="@string/welcome_image_no_selfies" android:contentDescription="@string/welcome_image_no_selfies"
/> android:src="@drawable/selfie_x" />
<ImageView <ImageView
android:src="@drawable/proprietary_x"
android:id="@+id/proprietary_x" android:id="@+id/proprietary_x"
android:layout_marginStart="@dimen/standard_gap"
android:layout_marginLeft="@dimen/standard_gap"
android:layout_width="110dp" android:layout_width="110dp"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/selfie_x" android:layout_marginLeft="@dimen/standard_gap"
android:layout_marginStart="@dimen/standard_gap"
android:contentDescription="@string/welcome_image_proprietary" android:contentDescription="@string/welcome_image_proprietary"
/> android:src="@drawable/proprietary_x" />
</RelativeLayout> </LinearLayout>
<LinearLayout android:orientation="vertical" <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/center_guideline"
app:layout_constraintTop_toTopOf="parent"
android:orientation="vertical">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_3_text" android:text="@string/tutorial_3_text"
android:layout_gravity="center"
android:textStyle="bold"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/normal_text" android:textSize="@dimen/normal_text"
android:gravity="center_horizontal" android:textStyle="bold" />
android:textColor="@android:color/white"/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -64,51 +87,49 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp"
android:paddingTop="@dimen/standard_gap" android:paddingTop="@dimen/standard_gap"
android:textColor="@android:color/white"/> android:text="@string/bullet"
android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:text="@string/tutorial_3_subtext_1"
android:layout_gravity="center" android:layout_gravity="center"
android:textAlignment="textStart"
android:paddingTop="@dimen/standard_gap"
android:gravity="start" android:gravity="start"
android:textColor="@android:color/white" android:maxWidth="240dp"
/> android:paddingTop="@dimen/standard_gap"
android:text="@string/tutorial_3_subtext_1"
android:textAlignment="textStart"
android:textColor="@android:color/white" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:layout_gravity="center" android:layout_gravity="center"
android:maxWidth="240dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp" android:text="@string/bullet"
android:textColor="@android:color/white"/> android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_3_subtext_2" android:text="@string/tutorial_3_subtext_2"
android:layout_gravity="center"
android:textAlignment="textStart" android:textAlignment="textStart"
android:gravity="start" android:textColor="@android:color/white" />
android:textColor="@android:color/white"
/>
</LinearLayout> </LinearLayout>
@ -121,24 +142,23 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp" android:text="@string/bullet"
android:textColor="@android:color/white"/> android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_3_subtext_3" android:text="@string/tutorial_3_subtext_3"
android:layout_gravity="center"
android:textAlignment="textStart" android:textAlignment="textStart"
android:gravity="start" android:textColor="@android:color/white" />
android:textColor="@android:color/white"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </android.support.constraint.ConstraintLayout>

View file

@ -1,42 +1,72 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#0c609c" android:background="#0c609c"
android:gravity="center" android:gravity="center"
> android:orientation="horizontal">
<ImageView <TextView
android:id="@+id/welcomeYesButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="@dimen/overflow_button_dimen"
android:src="@drawable/sydney_opera_house" android:layout_marginEnd="@dimen/standard_gap"
android:paddingLeft="@dimen/large_gap" android:layout_marginRight="@dimen/standard_gap"
android:paddingRight="@dimen/standard_gap" android:layout_marginTop="@dimen/standard_gap"
android:paddingTop="@dimen/large_gap" android:text="@string/welcome_skip_button"
android:paddingBottom="@dimen/large_gap" android:textColor="#fff"
android:adjustViewBounds="true" android:textSize="@dimen/normal_text"
android:layout_gravity="center" android:textStyle="bold"
android:contentDescription="@string/welcome_image_sydney_opera_house" android:visibility="gone"
/> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout android:orientation="vertical" <android.support.constraint.Guideline
android:id="@+id/center_guideline"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical" android:orientation="vertical"
> app:layout_constraintGuide_percent="0.60" />
<ImageView
android:layout_width="370dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/welcome_image_sydney_opera_house"
android:paddingBottom="@dimen/large_gap"
android:paddingLeft="@dimen/tiny_gap"
android:paddingStart="@dimen/tiny_gap"
android:paddingRight="@dimen/standard_gap"
android:paddingEnd="@dimen/standard_gap"
android:paddingTop="@dimen/large_gap"
android:src="@drawable/sydney_opera_house"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/center_guideline"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
app:layout_constraintStart_toEndOf="@id/center_guideline"
app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_4_text" android:text="@string/tutorial_4_text"
android:layout_gravity="center"
android:textStyle="bold"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="@dimen/normal_text" android:textSize="@dimen/normal_text"
android:gravity="center_horizontal" android:textStyle="bold" />
android:textColor="@android:color/white"/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -47,23 +77,22 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp"
android:paddingTop="@dimen/standard_gap" android:paddingTop="@dimen/standard_gap"
android:textColor="@android:color/white"/> android:text="@string/bullet"
android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:text="@string/tutorial_4_subtext_1"
android:layout_gravity="center" android:layout_gravity="center"
android:textAlignment="textStart"
android:paddingTop="@dimen/standard_gap"
android:gravity="start" android:gravity="start"
android:textColor="@android:color/white" android:maxWidth="240dp"
/> android:paddingTop="@dimen/standard_gap"
android:text="@string/tutorial_4_subtext_1"
android:textAlignment="textStart"
android:textColor="@android:color/white" />
</LinearLayout> </LinearLayout>
@ -76,21 +105,20 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp" android:text="@string/bullet"
android:textColor="@android:color/white"/> android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_4_subtext_2" android:text="@string/tutorial_4_subtext_2"
android:layout_gravity="center"
android:textAlignment="textStart" android:textAlignment="textStart"
android:gravity="start" android:textColor="@android:color/white" />
android:textColor="@android:color/white"
/>
</LinearLayout> </LinearLayout>
@ -103,24 +131,23 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/bullet"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textSize="16sp" android:text="@string/bullet"
android:textColor="@android:color/white"/> android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_4_subtext_3" android:text="@string/tutorial_4_subtext_3"
android:layout_gravity="center"
android:textAlignment="textStart" android:textAlignment="textStart"
android:gravity="start" android:textColor="@android:color/white" />
android:textColor="@android:color/white"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </android.support.constraint.ConstraintLayout>

View file

@ -1,51 +1,76 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#0c609c" android:background="#0c609c">
android:gravity="center"
> <TextView
android:id="@+id/welcomeYesButton"
android:layout_width="wrap_content"
android:layout_height="@dimen/overflow_button_dimen"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:layout_marginTop="@dimen/standard_gap"
android:text="@string/welcome_skip_button"
android:textColor="#fff"
android:textSize="@dimen/normal_text"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/center_guideline"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.50" />
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/welcome_wikipedia"
android:layout_marginEnd="@dimen/standard_gap" android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap" android:layout_marginRight="@dimen/standard_gap"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="@string/welcome_image_welcome_wikipedia" android:contentDescription="@string/welcome_image_welcome_wikipedia"
/> android:src="@drawable/welcome_wikipedia"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/center_guideline"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout android:orientation="vertical" <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:gravity="center_vertical" android:layout_marginLeft="@dimen/standard_gap"
> android:layout_marginStart="@dimen/standard_gap"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/center_guideline"
app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:maxWidth="240dp" android:maxWidth="240dp"
android:text="@string/tutorial_1_text" android:text="@string/tutorial_1_text"
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="@dimen/normal_text"
android:textAlignment="center" android:textAlignment="center"
android:gravity="center_horizontal" android:textColor="@android:color/white"
android:textColor="@android:color/white"/> android:textSize="@dimen/normal_text"
android:textStyle="bold" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxWidth="240dp"
android:text="@string/tutorial_1_subtext"
android:layout_gravity="center" android:layout_gravity="center"
android:textAlignment="center" android:maxWidth="240dp"
android:paddingTop="@dimen/standard_gap" android:paddingTop="@dimen/standard_gap"
android:gravity="center_horizontal" android:text="@string/tutorial_1_subtext"
android:textColor="@android:color/white" android:textAlignment="center"
/> android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -1,20 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="fill"
android:orientation="vertical"
android:background="?attr/fragmentCategorisationBackground" android:background="?attr/fragmentCategorisationBackground"
android:paddingBottom="@dimen/small_gap"
android:paddingLeft="@dimen/standard_gap"
android:paddingStart="@dimen/standard_gap"
android:paddingRight="@dimen/standard_gap"
android:paddingEnd="@dimen/standard_gap"
android:paddingTop="@dimen/small_gap"
android:theme="@style/DarkAppTheme"
android:clickable="true" android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
> android:paddingBottom="@dimen/small_gap"
android:paddingEnd="@dimen/standard_gap"
android:paddingLeft="@dimen/standard_gap"
android:paddingRight="@dimen/standard_gap"
android:paddingStart="@dimen/standard_gap"
android:paddingTop="@dimen/small_gap"
android:theme="@style/DarkAppTheme">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText <EditText
android:id="@+id/titleEdit" android:id="@+id/titleEdit"
@ -22,10 +30,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableEnd="@drawable/mapbox_info_icon_default" android:drawableEnd="@drawable/mapbox_info_icon_default"
android:drawableRight="@drawable/mapbox_info_icon_default" android:drawableRight="@drawable/mapbox_info_icon_default"
android:scrollHorizontally="false" android:maxLines="1"
android:inputType="textMultiLine" android:maxLength="80"
android:hint="@string/share_title_hint" android:hint="@string/share_title_hint"
android:imeOptions="flagNoExtractUi" /> android:imeOptions="flagNoExtractUi"
android:inputType="text"
android:scrollHorizontally="false" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText <EditText
android:id="@+id/descEdit" android:id="@+id/descEdit"
@ -33,41 +49,40 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableEnd="@drawable/mapbox_info_icon_default" android:drawableEnd="@drawable/mapbox_info_icon_default"
android:drawableRight="@drawable/mapbox_info_icon_default" android:drawableRight="@drawable/mapbox_info_icon_default"
android:inputType="textMultiLine"
android:hint="@string/share_description_hint" android:hint="@string/share_description_hint"
android:imeOptions="flagNoExtractUi" /> android:imeOptions="flagNoExtractUi"
android:inputType="textMultiLine" />
</android.support.design.widget.TextInputLayout>
<Spinner <Spinner
android:id="@+id/licenseSpinner" android:id="@+id/licenseSpinner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="?attr/spinnerTheme" android:theme="?attr/spinnerTheme" />
/>
<Button <Button
android:text="@string/use_previous" android:id="@+id/titleDescButton"
android:background="?attr/buttonBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/titleDescButton" android:background="?attr/buttonBackground"
/> android:text="@string/use_previous" />
<TextView <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/share_license_summary"
android:id="@+id/share_license_summary" android:id="@+id/share_license_summary"
android:gravity="center" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_gap" android:layout_marginTop="@dimen/standard_gap"
/> android:gravity="center"
android:text="@string/share_license_summary" />
<fr.free.nrw.commons.ui.widget.HtmlTextView <fr.free.nrw.commons.ui.widget.HtmlTextView
android:id="@+id/media_upload_policy"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/media_upload_policy"
android:text="@string/media_upload_policy"
android:gravity="start"
android:layout_marginTop="@dimen/standard_gap" android:layout_marginTop="@dimen/standard_gap"
/> android:gravity="start"
android:text="@string/media_upload_policy" />
</LinearLayout> </LinearLayout>
</ScrollView>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="drawer_width">50</integer>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="drawer_width">70</integer>
</resources>

View file

@ -85,8 +85,8 @@
<string name="about_license">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. </string> <string name="about_license">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. </string>
<string name="trademarked_name" translatable="false">Wikimedia Commons</string> <string name="trademarked_name" translatable="false">Wikimedia Commons</string>
<string name="about_improve">Create a new &lt;a href=\"https://github.com/commons-app/apps-android-commons/issues\"&gt;GitHub issue&lt;/a&gt; for bug reports and suggestions.</string> <string name="about_improve">Create a new &lt;a href=\"https://github.com/commons-app/apps-android-commons/issues\"&gt;GitHub issue&lt;/a&gt; for bug reports and suggestions.</string>
<string name="about_privacy_policy"><![CDATA[<u>Privacy policy</u>]]></string> <string name="about_privacy_policy"><u>Privacy policy</u></string>
<string name="about_credits"><![CDATA[<u>Credits</u>]]></string> <string name="about_credits"><u>Credits</u></string>
<string name="title_activity_about">About</string> <string name="title_activity_about">About</string>
<string name="menu_feedback">Send Feedback (via Email)</string> <string name="menu_feedback">Send Feedback (via Email)</string>
<string name="no_email_client">No email client installed</string> <string name="no_email_client">No email client installed</string>