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
|
|
@ -34,6 +34,10 @@
|
|||
android:name=".auth.LoginActivity"
|
||||
android:theme="@style/NoTitle" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".WelcomeActivity"
|
||||
android:theme="@style/NoTitle" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ShareActivity"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
BIN
commons/res/drawable-hdpi/welcome_copyright.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
commons/res/drawable-hdpi/welcome_wikipedia.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
commons/res/drawable-ldpi/welcome_copyright.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
commons/res/drawable-ldpi/welcome_wikipedia.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
commons/res/drawable-mdpi/welcome_copyright.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
commons/res/drawable-mdpi/welcome_wikipedia.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
commons/res/drawable-xhdpi/welcome_copyright.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
commons/res/drawable-xhdpi/welcome_wikipedia.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
46
commons/res/layout-land/welcome_copyright.xml
Normal file
|
|
@ -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>
|
||||
68
commons/res/layout-land/welcome_final.xml
Normal file
|
|
@ -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>
|
||||
45
commons/res/layout-land/welcome_wikipedia.xml
Normal file
|
|
@ -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>
|
||||
23
commons/res/layout/activity_welcome.xml
Normal file
|
|
@ -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>
|
||||
40
commons/res/layout/welcome_copyright.xml
Normal file
|
|
@ -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>
|
||||
62
commons/res/layout/welcome_final.xml
Normal file
|
|
@ -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>
|
||||
39
commons/res/layout/welcome_wikipedia.xml
Normal file
|
|
@ -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>
|
||||
|
|
@ -27,5 +27,4 @@
|
|||
android:icon="@android:drawable/ic_menu_send"
|
||||
/>
|
||||
|
||||
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -168,6 +168,11 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
that.performLogin();
|
||||
}
|
||||
});
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
Intent welcomeIntent = new Intent(this, WelcomeActivity.class);
|
||||
startActivity(welcomeIntent);
|
||||
}
|
||||
}
|
||||
|
||||
private void performLogin() {
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ public class ContributionsListFragment extends SherlockFragment {
|
|||
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);
|
||||
|
|
|
|||