Skip to content

Commit 6d2c41b

Browse files
97balakrishnanneslihanturan
authored andcommitted
Help button (commons-app#1415)
* Help button added to tutorial * debug typo removed * Help changed to more info * More option moved to bottom * Alignment changes made
1 parent 0223c5a commit 6d2c41b

File tree

4 files changed

+68
-9
lines changed

4 files changed

+68
-9
lines changed

app/src/main/java/fr/free/nrw/commons/WelcomePagerAdapter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.free.nrw.commons;
22

3+
import android.net.Uri;
34
import android.support.annotation.Nullable;
45
import android.support.v4.view.PagerAdapter;
56
import android.view.LayoutInflater;
@@ -9,6 +10,7 @@
910

1011
import butterknife.ButterKnife;
1112
import butterknife.OnClick;
13+
import butterknife.Optional;
1214

1315
public class WelcomePagerAdapter extends PagerAdapter {
1416
static final int[] PAGE_LAYOUTS = new int[]{
@@ -20,6 +22,7 @@ public class WelcomePagerAdapter extends PagerAdapter {
2022
};
2123
private static final int PAGE_FINAL = 4;
2224
private Callback callback;
25+
private ViewGroup container;
2326

2427
/**
2528
* Changes callback to provided one
@@ -53,6 +56,7 @@ public boolean isViewFromObject(View view, Object object) {
5356

5457
@Override
5558
public Object instantiateItem(ViewGroup container, int position) {
59+
this.container=container;
5660
LayoutInflater inflater = LayoutInflater.from(container.getContext());
5761
ViewGroup layout = (ViewGroup) inflater.inflate(PAGE_LAYOUTS[position], container, false);
5862
if( BuildConfig.FLAVOR == "beta"){
@@ -102,5 +106,15 @@ void onClicked() {
102106
}
103107
}
104108

109+
@Optional
110+
@OnClick(R.id.welcomeInfo)
111+
void onHelpClicked () {
112+
try {
113+
Utils.handleWebUrl(container.getContext(),Uri.parse("https://commons.wikimedia.org/wiki/Help:Contents" ));
114+
} catch (Exception e) {
115+
e.printStackTrace();
116+
}
117+
}
118+
105119
}
106120
}

app/src/main/res/layout-land/welcome_final.xml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4-
android:orientation="horizontal"
3+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:orientation="vertical"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
77
android:background="#0c609c"
8-
android:gravity="center"
9-
>
108

9+
>
10+
<TextView
11+
android:layout_alignParentBottom="true"
12+
android:layout_alignParentEnd="true"
13+
android:layout_alignParentRight="true"
14+
android:layout_marginBottom="@dimen/large_gap"
15+
android:layout_width="wrap_content"
16+
android:layout_height="wrap_content"
17+
android:text="@string/welcome_help_button_text"
18+
android:id="@+id/welcomeInfo"
19+
android:layout_gravity="end|top"
20+
android:layout_marginTop="@dimen/standard_gap"
21+
android:layout_marginRight="@dimen/standard_gap"
22+
android:layout_marginEnd="@dimen/standard_gap"
23+
android:textSize="@dimen/normal_text"
24+
android:textColor="@android:color/white"
25+
/>
26+
<LinearLayout
27+
android:layout_width="match_parent"
28+
android:layout_height="match_parent"
29+
android:orientation="horizontal"
30+
android:gravity="center">
1131
<!-- Sorry about the hardcoded sizes here. They're image-related. -->
1232
<LinearLayout
1333
android:layout_width="wrap_content"
@@ -59,6 +79,8 @@
5979
android:textColor="#0c609c"
6080
android:textStyle="bold"
6181
/>
82+
83+
</LinearLayout>
6284
</LinearLayout>
6385

64-
</LinearLayout>
86+
</RelativeLayout>

app/src/main/res/layout/welcome_final.xml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:orientation="vertical"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
66
android:background="#0c609c"
7-
android:gravity="center_vertical"
87
>
98

109
<LinearLayout
11-
android:gravity="center"
10+
android:layout_width="match_parent"
11+
android:layout_height="match_parent"
12+
android:orientation="vertical"
13+
android:gravity="center_vertical">
14+
<LinearLayout
15+
android:gravity="center_vertical"
1216
android:layout_width="wrap_content"
1317
android:layout_gravity="center_horizontal"
1418
android:layout_height="180dp"
@@ -60,4 +64,22 @@
6064
android:textStyle="bold"
6165
/>
6266

63-
</LinearLayout>
67+
</LinearLayout>
68+
<TextView
69+
android:layout_alignParentBottom="true"
70+
android:layout_alignParentEnd="true"
71+
android:layout_alignParentRight="true"
72+
android:layout_width="wrap_content"
73+
android:layout_height="wrap_content"
74+
android:layout_gravity="top|end"
75+
android:layout_marginTop="@dimen/standard_gap"
76+
android:layout_marginRight="@dimen/standard_gap"
77+
android:layout_marginEnd="@dimen/standard_gap"
78+
android:id="@+id/welcomeInfo"
79+
android:textSize="@dimen/normal_text"
80+
android:textColor="@android:color/white"
81+
android:text="@string/welcome_help_button_text"
82+
android:layout_marginBottom="@dimen/large_gap"
83+
android:paddingBottom="@dimen/large_gap"
84+
/>
85+
</RelativeLayout>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
<string name="welcome_copyright_subtext">Avoid copyrighted materials you found from the Internet as well as images of posters, book covers, etc.</string>
150150
<string name="welcome_final_text">You think you got it?</string>
151151
<string name="welcome_final_button_text">Yes!</string>
152+
<string name="welcome_help_button_text"><u>More Information</u></string>
152153
<string name="detail_panel_cats_label">Categories</string>
153154
<string name="detail_panel_cats_loading">Loading…</string>
154155
<string name="detail_panel_cats_none">None selected</string>

0 commit comments

Comments
 (0)