Yuvipanda has submitted this change and it was merged. Change subject: Bug 48995: Add acceptable use 'tutorial' to app ......................................................................
Bug 48995: Add acceptable use 'tutorial' to app Initial port of the acceptable use tutorial from iOS app. This version uses static images and is not yet animated. Indicator circles on the pager are done using Apache-licensed https://github.com/JakeWharton/Android-ViewPagerIndicator -- imported via maven. Currently the tutorial launches when we reach the login screen (as when first installing the app or creating a new account from system settings). You can either 'back' out of it or page through and hit the 'yes' button. GitHub: https://github.com/wikimedia/apps-android-commons/pull/20 Change-Id: Ibc444102e28a55bfa7bbae601ff0c56268a0c7dd --- M commons/AndroidManifest.xml M commons/pom.xml A commons/res/drawable-hdpi/welcome_copyright.png A commons/res/drawable-hdpi/welcome_wikipedia.png A commons/res/drawable-ldpi/welcome_copyright.png A commons/res/drawable-ldpi/welcome_wikipedia.png A commons/res/drawable-mdpi/welcome_copyright.png A commons/res/drawable-mdpi/welcome_wikipedia.png A commons/res/drawable-xhdpi/welcome_copyright.png A commons/res/drawable-xhdpi/welcome_wikipedia.png A commons/res/layout-land/welcome_copyright.xml A commons/res/layout-land/welcome_final.xml A commons/res/layout-land/welcome_wikipedia.xml A commons/res/layout/activity_welcome.xml A commons/res/layout/welcome_copyright.xml A commons/res/layout/welcome_final.xml A commons/res/layout/welcome_wikipedia.xml M commons/res/menu/fragment_contributions_list.xml M commons/res/values-qq/strings.xml M commons/res/values/strings.xml A commons/src/main/java/org/wikimedia/commons/WelcomeActivity.java M commons/src/main/java/org/wikimedia/commons/auth/LoginActivity.java M commons/src/main/java/org/wikimedia/commons/contributions/ContributionsListFragment.java 23 files changed, 429 insertions(+), 4 deletions(-) Approvals: Yuvipanda: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/commons/AndroidManifest.xml b/commons/AndroidManifest.xml index 7d31e28..917b781 100644 --- a/commons/AndroidManifest.xml +++ b/commons/AndroidManifest.xml @@ -35,6 +35,10 @@ android:theme="@style/NoTitle" > </activity> <activity + android:name=".WelcomeActivity" + android:theme="@style/NoTitle" > + </activity> + <activity android:name=".ShareActivity" android:icon="@drawable/ic_launcher" android:label="@string/app_name" diff --git a/commons/pom.xml b/commons/pom.xml index c66d489..b9d8c00 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -69,6 +69,18 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>com.viewpagerindicator</groupId> + <artifactId>library</artifactId> + <version>2.4.1</version> + <type>apklib</type> + <exclusions> + <exclusion> + <groupId>com.google.android</groupId> + <artifactId>support-v4</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> <build> diff --git a/commons/res/drawable-hdpi/welcome_copyright.png b/commons/res/drawable-hdpi/welcome_copyright.png new file mode 100644 index 0000000..48f90bf --- /dev/null +++ b/commons/res/drawable-hdpi/welcome_copyright.png Binary files differ diff --git a/commons/res/drawable-hdpi/welcome_wikipedia.png b/commons/res/drawable-hdpi/welcome_wikipedia.png new file mode 100644 index 0000000..6e1a8ae --- /dev/null +++ b/commons/res/drawable-hdpi/welcome_wikipedia.png Binary files differ diff --git a/commons/res/drawable-ldpi/welcome_copyright.png b/commons/res/drawable-ldpi/welcome_copyright.png new file mode 100644 index 0000000..6cdf252 --- /dev/null +++ b/commons/res/drawable-ldpi/welcome_copyright.png Binary files differ diff --git a/commons/res/drawable-ldpi/welcome_wikipedia.png b/commons/res/drawable-ldpi/welcome_wikipedia.png new file mode 100644 index 0000000..e55b564 --- /dev/null +++ b/commons/res/drawable-ldpi/welcome_wikipedia.png Binary files differ diff --git a/commons/res/drawable-mdpi/welcome_copyright.png b/commons/res/drawable-mdpi/welcome_copyright.png new file mode 100644 index 0000000..65462b9 --- /dev/null +++ b/commons/res/drawable-mdpi/welcome_copyright.png Binary files differ diff --git a/commons/res/drawable-mdpi/welcome_wikipedia.png b/commons/res/drawable-mdpi/welcome_wikipedia.png new file mode 100644 index 0000000..8d1e8e3 --- /dev/null +++ b/commons/res/drawable-mdpi/welcome_wikipedia.png Binary files differ diff --git a/commons/res/drawable-xhdpi/welcome_copyright.png b/commons/res/drawable-xhdpi/welcome_copyright.png new file mode 100644 index 0000000..973fb45 --- /dev/null +++ b/commons/res/drawable-xhdpi/welcome_copyright.png Binary files differ diff --git a/commons/res/drawable-xhdpi/welcome_wikipedia.png b/commons/res/drawable-xhdpi/welcome_wikipedia.png new file mode 100644 index 0000000..2f8dfb3 --- /dev/null +++ b/commons/res/drawable-xhdpi/welcome_wikipedia.png Binary files differ diff --git a/commons/res/layout-land/welcome_copyright.xml b/commons/res/layout-land/welcome_copyright.xml new file mode 100644 index 0000000..ca6c9c1 --- /dev/null +++ b/commons/res/layout-land/welcome_copyright.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0c609c" + android:gravity="center" + > + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/welcome_copyright" + android:adjustViewBounds="true" + android:layout_gravity="center" + /> + + <LinearLayout android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center_vertical" + > + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_copyright_text" + android:layout_gravity="center" + android:textStyle="bold" + android:textAlignment="center" + android:paddingTop="24dp" + android:gravity="center_horizontal" + android:textColor="@android:color/white"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_copyright_subtext" + android:layout_gravity="center" + android:textAlignment="center" + android:paddingTop="16dp" + android:gravity="center_horizontal"/> + </LinearLayout> +</LinearLayout> diff --git a/commons/res/layout-land/welcome_final.xml b/commons/res/layout-land/welcome_final.xml new file mode 100644 index 0000000..89b3418 --- /dev/null +++ b/commons/res/layout-land/welcome_final.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0c609c" + android:gravity="center" + > + + <!-- Sorry about the hardcoded sizes here. They're image-related. --> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="180dp" + android:gravity="center_horizontal"> + + <ImageView + android:layout_width="150dp" + android:layout_height="180dp" + android:src="@drawable/welcome_wikipedia"/> + + <ImageView + android:layout_width="160dp" + android:layout_height="120dp" + android:layout_gravity="center" + android:src="@drawable/welcome_copyright"/> + + </LinearLayout> + + <LinearLayout android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center_vertical" + > + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_final_text" + android:layout_gravity="center" + android:textStyle="bold" + android:textAlignment="center" + android:gravity="center_horizontal" + android:textColor="@android:color/white" + android:singleLine="false"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:layout_gravity="center" + android:textAlignment="center" + android:paddingTop="16dp" + android:gravity="center_horizontal"/> + + <Button + android:layout_width="120dp" + android:layout_height="40dp" + android:text="@string/welcome_final_button_text" + android:id="@+id/welcomeYesButton" + android:layout_gravity="center" + android:background="@android:color/white" + android:textColor="#0c609c" + android:textStyle="bold" + /> + </LinearLayout> + +</LinearLayout> \ No newline at end of file diff --git a/commons/res/layout-land/welcome_wikipedia.xml b/commons/res/layout-land/welcome_wikipedia.xml new file mode 100644 index 0000000..c580c0c --- /dev/null +++ b/commons/res/layout-land/welcome_wikipedia.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0c609c" + android:gravity="center" + > + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:src="@drawable/welcome_wikipedia" + android:adjustViewBounds="true"/> + + <LinearLayout android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center_vertical" + > + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_wikipedia_text" + android:layout_gravity="center" + android:textStyle="bold" + android:textAlignment="center" + android:paddingTop="24dp" + android:gravity="center_horizontal" + android:textColor="@android:color/white"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_wikipedia_subtext" + android:layout_gravity="center" + android:textAlignment="center" + android:paddingTop="16dp" + android:gravity="center_horizontal"/> + </LinearLayout> +</LinearLayout> diff --git a/commons/res/layout/activity_welcome.xml b/commons/res/layout/activity_welcome.xml new file mode 100644 index 0000000..60553bd --- /dev/null +++ b/commons/res/layout/activity_welcome.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0c609c"> + + <android.support.v4.view.ViewPager + android:id="@+id/welcomePager" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:fadingEdge="none" + > + + </android.support.v4.view.ViewPager> + + <com.viewpagerindicator.CirclePageIndicator + android:id="@+id/welcomePagerIndicator" + android:layout_height="24dp" + android:layout_width="fill_parent" + android:layout_gravity="bottom" /> + +</FrameLayout> \ No newline at end of file diff --git a/commons/res/layout/welcome_copyright.xml b/commons/res/layout/welcome_copyright.xml new file mode 100644 index 0000000..9ad9c31 --- /dev/null +++ b/commons/res/layout/welcome_copyright.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0c609c" + android:gravity="center_vertical" + > + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/welcome_copyright" + android:adjustViewBounds="true" + android:layout_gravity="center" + /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_copyright_text" + android:layout_gravity="center" + android:textStyle="bold" + android:textAlignment="center" + android:paddingTop="24dp" + android:gravity="center_horizontal" + android:textColor="@android:color/white"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_copyright_subtext" + android:layout_gravity="center" + android:textAlignment="center" + android:paddingTop="16dp" + android:gravity="center_horizontal"/> +</LinearLayout> \ No newline at end of file diff --git a/commons/res/layout/welcome_final.xml b/commons/res/layout/welcome_final.xml new file mode 100644 index 0000000..cd12fed --- /dev/null +++ b/commons/res/layout/welcome_final.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0c609c" + android:gravity="center_vertical" + > + + <!-- Sorry about the hardcoded sizes here. They're image-related. --> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="180dp" + android:gravity="center_horizontal"> + + <ImageView + android:layout_width="150dp" + android:layout_height="180dp" + android:src="@drawable/welcome_wikipedia"/> + + <ImageView + android:layout_width="160dp" + android:layout_height="120dp" + android:layout_gravity="center" + android:src="@drawable/welcome_copyright"/> + + </LinearLayout> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_final_text" + android:layout_gravity="center" + android:textStyle="bold" + android:textAlignment="center" + android:gravity="center_horizontal" + android:textColor="@android:color/white" + android:singleLine="false"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:layout_gravity="center" + android:textAlignment="center" + android:paddingTop="16dp" + android:gravity="center_horizontal"/> + + <Button + android:layout_width="120dp" + android:layout_height="40dp" + android:text="@string/welcome_final_button_text" + android:id="@+id/welcomeYesButton" + android:layout_gravity="center" + android:background="@android:color/white" + android:textColor="#0c609c" + android:textStyle="bold" + /> + +</LinearLayout> \ No newline at end of file diff --git a/commons/res/layout/welcome_wikipedia.xml b/commons/res/layout/welcome_wikipedia.xml new file mode 100644 index 0000000..b957fc6 --- /dev/null +++ b/commons/res/layout/welcome_wikipedia.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0c609c" + android:gravity="center_vertical" + > + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:src="@drawable/welcome_wikipedia" + android:adjustViewBounds="true"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_wikipedia_text" + android:layout_gravity="center" + android:textStyle="bold" + android:textAlignment="center" + android:paddingTop="24dp" + android:gravity="center_horizontal" + android:textColor="@android:color/white"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxWidth="240dp" + android:text="@string/welcome_wikipedia_subtext" + android:layout_gravity="center" + android:textAlignment="center" + android:paddingTop="16dp" + android:gravity="center_horizontal"/> +</LinearLayout> \ No newline at end of file diff --git a/commons/res/menu/fragment_contributions_list.xml b/commons/res/menu/fragment_contributions_list.xml index d8fa0ef..b9382fa 100644 --- a/commons/res/menu/fragment_contributions_list.xml +++ b/commons/res/menu/fragment_contributions_list.xml @@ -27,5 +27,4 @@ android:icon="@android:drawable/ic_menu_send" /> - </menu> diff --git a/commons/res/values-qq/strings.xml b/commons/res/values-qq/strings.xml index bcd204f..177a57f 100644 --- a/commons/res/values-qq/strings.xml +++ b/commons/res/values-qq/strings.xml @@ -78,7 +78,14 @@ <string name="share_license_summary">Text label telling user the license of the current upload in progress. %1$s refers to appropriate display text for the chosen CC license</string> <string name="menu_download">Menu item text prompting user to download a selected photo or media file locally. {{Identical|Download}}</string> - <string name="license_name_cc_by_sa">CC Attribution-Sharelike License display name. Use the non-breaking space character(u00A0) between \'CC\' and \'Attribution-Sharealike\'</string> - <string name="license_name_cc_by">CC Attribution License display name. Use the non-breaking space character(u00A0) between \'CC\' and \'Attribution\'</string> - <string name="license_name_cc0">CC0 License display name.</string> + <string name="license_name_cc_by_sa">CC Attribution-Sharelike License display name. Use the non-breaking space character(\u00A0) between \'CC\' and \'Attribution-Sharealike\'</string> + <string name="license_name_cc_by">CC Attribution License display name. Use the non-breaking space character(\u00A0) between \'CC\' and \'Attribution\'</string> + <string name="license_name_cc0">CC0 License display name.</string> + <string name="welcome_wikipedia_text">Message inviting users to contribute their images.</string> + <string name="welcome_wikipedia_subtext">Message explaining that Wikipedia images Wikimedia Commons.</string> + <string name="welcome_copyright_text">Message explaining the educational benefit of contributing images.</string> + <string name="welcome_copyright_subtext">Message explaining what kind of images not to submit.</string> + <string name="welcome_final_text">Message asking user if they understand what kinds of images to upload.</string> + <string name="welcome_final_button_text">Button text for confirming the user understands what kinds of images to upload. +{{Identical|Yes}}</string> </resources> diff --git a/commons/res/values/strings.xml b/commons/res/values/strings.xml index 64f6140..80208b8 100644 --- a/commons/res/values/strings.xml +++ b/commons/res/values/strings.xml @@ -96,4 +96,10 @@ <string name="license_name_cc_by_sa">CC\u00A0Attribution-ShareAlike</string> <string name="license_name_cc_by">CC\u00A0Attribution</string> <string name="license_name_cc0">CC0</string> + <string name="welcome_wikipedia_text">Contribute your images. Help Wikipedia articles come to life!</string> + <string name="welcome_wikipedia_subtext">Images on Wikipedia come from Wikimedia Commons.</string> + <string name="welcome_copyright_text">Your images help educate people around the world.</string> + <string name="welcome_copyright_subtext">Avoid copyrighted materials you found from the Internet as well as images of posters, book covers, etc.</string> + <string name="welcome_final_text">You think you got it?</string> + <string name="welcome_final_button_text">Yes!</string> </resources> diff --git a/commons/src/main/java/org/wikimedia/commons/WelcomeActivity.java b/commons/src/main/java/org/wikimedia/commons/WelcomeActivity.java new file mode 100644 index 0000000..62c9563 --- /dev/null +++ b/commons/src/main/java/org/wikimedia/commons/WelcomeActivity.java @@ -0,0 +1,68 @@ +package org.wikimedia.commons; + +import android.app.Activity; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; + +import com.viewpagerindicator.CirclePageIndicator; + +public class WelcomeActivity extends Activity { + static final int PAGE_WIKIPEDIA = 0, + PAGE_COPYRIGHT = 1, + PAGE_FINAL = 2; + static final int[] pageLayouts = new int[] { + R.layout.welcome_wikipedia, + R.layout.welcome_copyright, + R.layout.welcome_final + }; + + private ViewPager pager; + private Button yesButton; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_welcome); + + pager = (ViewPager)findViewById(R.id.welcomePager); + pager.setAdapter(new PagerAdapter() { + @Override + public int getCount() { + return pageLayouts.length; + } + + @Override + public boolean isViewFromObject(View view, Object o) { + return (view == o); + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + View view = getLayoutInflater().inflate(pageLayouts[position], null); + container.addView(view); + if (position == PAGE_FINAL) { + yesButton = (Button)view.findViewById(R.id.welcomeYesButton); + yesButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + finish(); + } + }); + } + return view; + } + + @Override + public void destroyItem(ViewGroup container, int position, Object obj) { + yesButton = null; + container.removeView((View)obj); + } + }); + + CirclePageIndicator indicator = (CirclePageIndicator)findViewById(R.id.welcomePagerIndicator); + indicator.setViewPager(pager); + } +} diff --git a/commons/src/main/java/org/wikimedia/commons/auth/LoginActivity.java b/commons/src/main/java/org/wikimedia/commons/auth/LoginActivity.java index 37bab5c..d4730d7 100644 --- a/commons/src/main/java/org/wikimedia/commons/auth/LoginActivity.java +++ b/commons/src/main/java/org/wikimedia/commons/auth/LoginActivity.java @@ -168,6 +168,11 @@ that.performLogin(); } }); + + if (savedInstanceState == null) { + Intent welcomeIntent = new Intent(this, WelcomeActivity.class); + startActivity(welcomeIntent); + } } private void performLogin() { diff --git a/commons/src/main/java/org/wikimedia/commons/contributions/ContributionsListFragment.java b/commons/src/main/java/org/wikimedia/commons/contributions/ContributionsListFragment.java index 101f4ee..5372152 100644 --- a/commons/src/main/java/org/wikimedia/commons/contributions/ContributionsListFragment.java +++ b/commons/src/main/java/org/wikimedia/commons/contributions/ContributionsListFragment.java @@ -256,6 +256,7 @@ feedbackIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { CommonsApplication.FEEDBACK_EMAIL }); feedbackIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT, CommonsApplication.APPLICATION_VERSION)); startActivity(feedbackIntent); + return true; default: return super.onOptionsItemSelected(item); -- To view, visit https://gerrit.wikimedia.org/r/69606 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibc444102e28a55bfa7bbae601ff0c56268a0c7dd Gerrit-PatchSet: 8 Gerrit-Project: apps/android/commons Gerrit-Branch: master Gerrit-Owner: SuchABot <[email protected]> Gerrit-Reviewer: Brion VIBBER <[email protected]> Gerrit-Reviewer: Yuvipanda <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
