diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index f58c9225b..34078f07e 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -4,6 +4,12 @@ Fixes #{GitHub issue number} {Describe the changes made and why they were made.} +## Tests performed + +Tested on {API level & name of device/emulator}, with {build variant, e.g. ProdDebug}. + +{Please test your PR at least once before submitting.} + ## Screenshots showing what changed {Only for user interface changes, otherwise remove this section. See [how to take a screenshot](https://android.stackexchange.com/questions/1759/how-to-take-a-screenshot-with-an-android-device)} diff --git a/app/build.gradle b/app/build.gradle index 5ae2e70df..550019cc5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,8 +48,11 @@ dependencies { compile 'com.facebook.fresco:fresco:1.3.0' compile 'com.facebook.stetho:stetho:1.5.0' + compile 'com.android.support:multidex:1.0.3' + testCompile 'junit:junit:4.12' testCompile 'org.robolectric:robolectric:3.7.1' + testCompile "org.robolectric:multidex:3.4.2" testCompile 'com.squareup.okhttp3:mockwebserver:3.8.1' androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.8.1' @@ -151,6 +154,7 @@ android { buildConfigField "String", "EVENTLOG_WIKI", "\"commonswiki\"" buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\"" buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Main_Page&welcome=yes\"" + buildConfigField "String", "FORGOT_PASSWORD_URL", "\"https://commons.wikimedia.org/wiki/Special:PasswordReset\"" dimension 'tier' } @@ -165,6 +169,7 @@ android { buildConfigField "String", "EVENTLOG_WIKI", "\"commonswiki\"" buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\"" buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Main_Page&welcome=yes\"" + buildConfigField "String", "FORGOT_PASSWORD_URL", "\"https://commons.wikimedia.beta.wmflabs.org/wiki/Special:PasswordReset\"" dimension 'tier' } } diff --git a/app/src/androidTest/java/fr/free/nrw/commons/SettingsActivityTest.java b/app/src/androidTest/java/fr/free/nrw/commons/SettingsActivityTest.java index 5be309252..80caf0010 100644 --- a/app/src/androidTest/java/fr/free/nrw/commons/SettingsActivityTest.java +++ b/app/src/androidTest/java/fr/free/nrw/commons/SettingsActivityTest.java @@ -5,6 +5,7 @@ import android.preference.PreferenceManager; import android.support.test.espresso.Espresso; import android.support.test.espresso.action.ViewActions; import android.support.test.espresso.assertion.ViewAssertions; +import android.support.test.espresso.matcher.PreferenceMatchers; import android.support.test.espresso.matcher.ViewMatchers; import android.support.test.filters.LargeTest; import android.support.test.rule.ActivityTestRule; @@ -61,7 +62,7 @@ public class SettingsActivityTest { @Test public void oneLicenseIsChecked() { // click "License" (the first item) - Espresso.onData(Matchers.anything()) + Espresso.onData(PreferenceMatchers.withKey("defaultLicense")) .inAdapterView(ViewMatchers.withId(android.R.id.list)) .atPosition(0) .perform(ViewActions.click()); @@ -74,7 +75,7 @@ public class SettingsActivityTest { @Test public void afterClickingCcby4ItWillStay() { // click "License" (the first item) - Espresso.onData(Matchers.anything()) + Espresso.onData(PreferenceMatchers.withKey("defaultLicense")) .inAdapterView(ViewMatchers.withId(android.R.id.list)) .atPosition(0) .perform(ViewActions.click()); @@ -85,7 +86,7 @@ public class SettingsActivityTest { ).perform(ViewActions.click()); // click "License" (the first item) - Espresso.onData(Matchers.anything()) + Espresso.onData(PreferenceMatchers.withKey("defaultLicense")) .inAdapterView(ViewMatchers.withId(android.R.id.list)) .atPosition(0) .perform(ViewActions.click()); @@ -96,4 +97,4 @@ public class SettingsActivityTest { ViewMatchers.withText(R.string.license_name_cc_by_four) )); } -} \ No newline at end of file +} diff --git a/app/src/main/java/fr/free/nrw/commons/AboutActivity.java b/app/src/main/java/fr/free/nrw/commons/AboutActivity.java index bb7b1fc1e..97fe27aa4 100644 --- a/app/src/main/java/fr/free/nrw/commons/AboutActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/AboutActivity.java @@ -4,6 +4,8 @@ import android.annotation.SuppressLint; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.text.SpannableString; +import android.text.style.UnderlineSpan; import android.util.Log; import android.support.customtabs.CustomTabsIntent; import android.support.v4.content.ContextCompat; @@ -25,6 +27,7 @@ import static android.widget.Toast.LENGTH_SHORT; public class AboutActivity extends NavigationBaseActivity { @BindView(R.id.about_version) TextView versionText; @BindView(R.id.about_license) HtmlTextView aboutLicenseText; + @BindView(R.id.about_faq) TextView faqText; /** * This method helps in the creation About screen @@ -40,7 +43,9 @@ public class AboutActivity extends NavigationBaseActivity { ButterKnife.bind(this); String aboutText = getString(R.string.about_license); aboutLicenseText.setHtmlText(aboutText); - + SpannableString content = new SpannableString(getString(R.string.about_faq)); + content.setSpan(new UnderlineSpan(), 0, content.length(), 0); + faqText.setText(content); versionText.setText(BuildConfig.VERSION_NAME); initDrawer(); } @@ -113,4 +118,9 @@ public class AboutActivity extends NavigationBaseActivity { } } + @OnClick(R.id.about_faq) + public void launchFrequentlyAskedQuesions(View view) { + Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Frequently-Asked-Questions\\")); + } + } diff --git a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java index bac2ced4f..77ffcfbfc 100644 --- a/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java +++ b/app/src/main/java/fr/free/nrw/commons/CommonsApplication.java @@ -4,6 +4,7 @@ import android.app.Application; import android.content.Context; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; +import android.support.multidex.MultiDexApplication; import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.stetho.Stetho; @@ -40,7 +41,7 @@ import timber.log.Timber; resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, resDialogOkToast = R.string.crash_dialog_ok_toast ) -public class CommonsApplication extends Application { +public class CommonsApplication extends MultiDexApplication { @Inject SessionManager sessionManager; @Inject DBOpenHelper dbOpenHelper; diff --git a/app/src/main/java/fr/free/nrw/commons/WelcomePagerAdapter.java b/app/src/main/java/fr/free/nrw/commons/WelcomePagerAdapter.java index a346655cf..705de23da 100644 --- a/app/src/main/java/fr/free/nrw/commons/WelcomePagerAdapter.java +++ b/app/src/main/java/fr/free/nrw/commons/WelcomePagerAdapter.java @@ -5,6 +5,7 @@ import android.support.v4.view.PagerAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import butterknife.ButterKnife; import butterknife.OnClick; @@ -54,10 +55,18 @@ public class WelcomePagerAdapter extends PagerAdapter { public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); ViewGroup layout = (ViewGroup) inflater.inflate(PAGE_LAYOUTS[position], container, false); - - if (position == PAGE_FINAL) { + if( BuildConfig.FLAVOR == "beta"){ + TextView textView = (TextView) layout.findViewById(R.id.welcomeYesButton); + if( textView.getVisibility() != View.VISIBLE){ + textView.setVisibility(View.VISIBLE); + } ViewHolder holder = new ViewHolder(layout); layout.setTag(holder); + } else { + if (position == PAGE_FINAL) { + ViewHolder holder = new ViewHolder(layout); + layout.setTag(holder); + } } container.addView(layout); return layout; @@ -92,5 +101,6 @@ public class WelcomePagerAdapter extends PagerAdapter { callback.onYesClicked(); } } + } } diff --git a/app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java b/app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java index cbdff2e0b..8a41664a9 100644 --- a/app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java @@ -8,6 +8,7 @@ import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Bundle; import android.support.annotation.ColorRes; import android.support.annotation.NonNull; @@ -27,6 +28,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; +import android.widget.Toast; import java.io.IOException; @@ -44,6 +46,7 @@ import fr.free.nrw.commons.contributions.ContributionsActivity; import fr.free.nrw.commons.di.ApplicationlessInjection; import fr.free.nrw.commons.mwapi.MediaWikiApi; import fr.free.nrw.commons.theme.NavigationBaseActivity; +import fr.free.nrw.commons.ui.widget.HtmlTextView; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; @@ -73,7 +76,9 @@ public class LoginActivity extends AccountAuthenticatorActivity { @BindView(R.id.error_message_container) ViewGroup errorMessageContainer; @BindView(R.id.error_message) TextView errorMessage; @BindView(R.id.login_credentials) TextView loginCredentials; - @BindView(R.id.two_factor_container)TextInputLayout twoFactorContainer; + @BindView(R.id.two_factor_container) TextInputLayout twoFactorContainer; + @BindView(R.id.forgotPassword) HtmlTextView forgotPasswordText; + ProgressDialog progressDialog; private AppCompatDelegate delegate; private LoginTextWatcher textWatcher = new LoginTextWatcher(); @@ -114,6 +119,8 @@ public class LoginActivity extends AccountAuthenticatorActivity { loginButton.setOnClickListener(view -> performLogin()); signupButton.setOnClickListener(view -> signUp()); + forgotPasswordText.setOnClickListener(view -> forgotPassword()); + if(BuildConfig.FLAVOR == "beta"){ loginCredentials.setText(getString(R.string.login_credential)); } else { @@ -121,6 +128,10 @@ public class LoginActivity extends AccountAuthenticatorActivity { } } + private void forgotPassword() { + Utils.handleWebUrl(this, Uri.parse(BuildConfig.FORGOT_PASSWORD_URL)); + } + public void hideKeyboard(View view) { InputMethodManager inputMethodManager =(InputMethodManager)this.getSystemService(Activity.INPUT_METHOD_SERVICE); diff --git a/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java b/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java index 66be88e3f..c7ee3df48 100644 --- a/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/settings/SettingsFragment.java @@ -10,7 +10,7 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.preference.CheckBoxPreference; +import android.preference.SwitchPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; @@ -59,7 +59,7 @@ public class SettingsFragment extends PreferenceFragment { return true; }); - CheckBoxPreference themePreference = (CheckBoxPreference) findPreference("theme"); + SwitchPreference themePreference = (SwitchPreference) findPreference("theme"); themePreference.setOnPreferenceChangeListener((preference, newValue) -> { getActivity().recreate(); return true; diff --git a/app/src/main/res/layout-land/activity_login.xml b/app/src/main/res/layout-land/activity_login.xml index 2914f9530..deb295438 100644 --- a/app/src/main/res/layout-land/activity_login.xml +++ b/app/src/main/res/layout-land/activity_login.xml @@ -187,12 +187,23 @@ + + + + + + + + + - diff --git a/app/src/main/res/layout/welcome_do_upload.xml b/app/src/main/res/layout/welcome_do_upload.xml index fab6452df..bf2401913 100644 --- a/app/src/main/res/layout/welcome_do_upload.xml +++ b/app/src/main/res/layout/welcome_do_upload.xml @@ -1,5 +1,5 @@ - + + + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/welcome_dont_upload.xml b/app/src/main/res/layout/welcome_dont_upload.xml index d819bc035..3e244e1fa 100644 --- a/app/src/main/res/layout/welcome_dont_upload.xml +++ b/app/src/main/res/layout/welcome_dont_upload.xml @@ -1,11 +1,18 @@ - + + - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/welcome_image_details.xml b/app/src/main/res/layout/welcome_image_details.xml index e38eb5979..7202df4c0 100644 --- a/app/src/main/res/layout/welcome_image_details.xml +++ b/app/src/main/res/layout/welcome_image_details.xml @@ -1,12 +1,18 @@ - - + + - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/welcome_wikipedia.xml b/app/src/main/res/layout/welcome_wikipedia.xml index ece52628e..0708b5ea9 100644 --- a/app/src/main/res/layout/welcome_wikipedia.xml +++ b/app/src/main/res/layout/welcome_wikipedia.xml @@ -1,11 +1,18 @@ - + - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 15db0cab5..4b343bce2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,12 +1,17 @@ + Appearance + General + Feedback + Location Commons Settings Username Password - Log in to your Commons Beta account + Log in to your Commons Beta account Log in + Forgot Password? Sign up Logging in Please wait… @@ -93,7 +98,7 @@ This image will be licensed under %1$s By submitting this picture, I declare that this is my own work, that it does not contain copyrighted material or selfies, and otherwise adheres to <a href=\"https://commons.wikimedia.org/wiki/Commons:Policies_and_guidelines\">Wikimedia Commons policies</a>. Download - License + Default License Use previous title/description Automatically get current location Retrieve current location to offer category suggestions if image is not geotagged @@ -169,8 +174,6 @@ Become a Beta Tester Opt-in to our beta channel on Google Play and get early access to new features and bug fixes https://play.google.com/apps/testing/fr.free.nrw.commons - Use Wikidata - (Warning: disabling this may cause large mobile data consumption) mapbox://styles/mapbox/traffic-day-v2 mapbox://styles/mapbox/traffic-night-v2 pk.eyJ1IjoibWFza2FyYXZpdmVrIiwiYSI6ImNqMmxvdzFjMTAwMHYzM283ZWM3eW5tcDAifQ.ib5SZ9EVjwJe6GSKve0bcg @@ -240,4 +243,6 @@ %1$s mentioned you on %2$s. Toggle view Rate Us + Frequently Asked Questions + Skip Tutorial diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index b7b63d39c..70ab2736f 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,61 +1,68 @@ + xmlns:android="http://schemas.android.com/apk/res/android"> - + - + - - - + - + - + - + - + - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f16d26666..c25f3eb11 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sat Mar 03 13:58:47 IST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip