mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
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
This commit is contained in:
parent
d1ee62d08c
commit
6c97d3e01b
23 changed files with 429 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue