Help button (#1415)

* Help button added to tutorial

* debug typo removed

* Help changed to more info

* More option moved to bottom

* Alignment changes made
This commit is contained in:
Balakrishnan S 2018-04-30 17:01:27 +05:30 committed by neslihanturan
parent 0223c5ab76
commit 6d2c41b91e
4 changed files with 68 additions and 9 deletions

View file

@ -1,5 +1,6 @@
package fr.free.nrw.commons;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
@ -9,6 +10,7 @@ import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Optional;
public class WelcomePagerAdapter extends PagerAdapter {
static final int[] PAGE_LAYOUTS = new int[]{
@ -20,6 +22,7 @@ public class WelcomePagerAdapter extends PagerAdapter {
};
private static final int PAGE_FINAL = 4;
private Callback callback;
private ViewGroup container;
/**
* Changes callback to provided one
@ -53,6 +56,7 @@ public class WelcomePagerAdapter extends PagerAdapter {
@Override
public Object instantiateItem(ViewGroup container, int position) {
this.container=container;
LayoutInflater inflater = LayoutInflater.from(container.getContext());
ViewGroup layout = (ViewGroup) inflater.inflate(PAGE_LAYOUTS[position], container, false);
if( BuildConfig.FLAVOR == "beta"){
@ -102,5 +106,15 @@ public class WelcomePagerAdapter extends PagerAdapter {
}
}
@Optional
@OnClick(R.id.welcomeInfo)
void onHelpClicked () {
try {
Utils.handleWebUrl(container.getContext(),Uri.parse("https://commons.wikimedia.org/wiki/Help:Contents" ));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}