Skip to content
This repository was archived by the owner on Aug 22, 2020. It is now read-only.

Commit a54edd0

Browse files
committed
MainActivity: Add some menu options
Signed-off-by: Fung <fython@163.com>
1 parent 6a0094e commit a54edd0

8 files changed

Lines changed: 77 additions & 2 deletions

File tree

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ allprojects {
1111
repositories {
1212
jcenter()
1313
maven { url 'https://maven.google.com' }
14+
maven { url "https://jitpack.io" }
1415
}
1516
}
1617

demo/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@ dependencies {
3030

3131
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
3232
compile "com.android.support:design:$supportLibraryVersion"
33+
compile "com.android.support:customtabs:$supportLibraryVersion"
34+
compile "com.android.support:customtabs:$supportLibraryVersion"
35+
compile 'moe.feng:AlipayZeroSdk:1.1'
3336
compile project(':library')
3437
}

demo/src/main/java/moe/feng/common/stepperview/demo/MainActivity.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package moe.feng.common.stepperview.demo;
22

3+
import android.app.AlertDialog;
4+
import android.content.DialogInterface;
5+
import android.net.Uri;
36
import android.support.annotation.NonNull;
7+
import android.support.customtabs.CustomTabsIntent;
48
import android.support.design.widget.NavigationView;
59
import android.support.v4.app.Fragment;
610
import android.support.v4.widget.DrawerLayout;
@@ -9,6 +13,7 @@
913
import android.os.Bundle;
1014
import android.support.v7.widget.Toolbar;
1115
import android.view.MenuItem;
16+
import moe.feng.alipay.zerosdk.AlipayZeroSdk;
1217
import moe.feng.common.stepperview.demo.fragment.VerticalStepperAdapterDemoFragment;
1318
import moe.feng.common.stepperview.demo.fragment.VerticalStepperDemoFragment;
1419

@@ -68,9 +73,35 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
6873
getSupportFragmentManager().beginTransaction()
6974
.replace(R.id.container, mVerticalStepperAdapterDemoFragment).commit();
7075
return true;
76+
case R.id.action_alipay_donate:
77+
if (AlipayZeroSdk.hasInstalledAlipayClient(this)) {
78+
AlipayZeroSdk.startAlipayClient(this, "aehvyvf4taua18zo6e");
79+
} else {
80+
new AlertDialog.Builder(this)
81+
.setTitle(R.string.donate_dialog_title)
82+
.setMessage(R.string.donate_dialog_message)
83+
.setPositiveButton(android.R.string.ok, null)
84+
.setNeutralButton(R.string.doante_dialog_paypal_button, new DialogInterface.OnClickListener() {
85+
@Override
86+
public void onClick(DialogInterface dialogInterface, int i) {
87+
openWebsite("https://paypal.me/fython");
88+
}
89+
})
90+
.show();
91+
}
92+
return true;
93+
case R.id.action_fork_on_github:
94+
openWebsite("https://github.com/fython/MaterialStepperView");
95+
return true;
7196
default:
7297
return false;
7398
}
7499
}
75100

101+
private void openWebsite(String url) {
102+
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
103+
builder.setToolbarColor(getResources().getColor(R.color.colorPrimary));
104+
builder.build().launchUrl(this, Uri.parse(url));
105+
}
106+
76107
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="#FF000000"
8+
android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z"/>
9+
</vector>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="#FF000000"
8+
android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-1.91l-0.01,-0.01L23,10z"/>
9+
</vector>

demo/src/main/res/menu/navigation_main.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,20 @@
1414

1515
</group>
1616

17+
<item android:title="About">
18+
19+
<menu>
20+
21+
<item android:id="@+id/action_alipay_donate"
22+
android:title="Donate me"
23+
android:icon="@drawable/ic_thumb_up_black_24dp"/>
24+
25+
<item android:id="@+id/action_fork_on_github"
26+
android:title="Fork on Github"
27+
android:icon="@drawable/ic_open_in_new_black_24dp"/>
28+
29+
</menu>
30+
31+
</item>
32+
1733
</menu>

demo/src/main/res/values/colors.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
<color name="colorPrimary">@color/material_blue_500</color>
55
<color name="colorPrimaryDark">@color/material_blue_700</color>
6-
<color name="colorAccent">@color/material_lime_a200</color>
6+
<color name="colorAccent">@color/material_deep_purple_a200</color>
77

88
<color name="material_blue_500">#2196F3</color>
99
<color name="material_blue_700">#1976D2</color>
1010

1111
<color name="material_deep_purple_500">#673AB7</color>
12+
<color name="material_deep_purple_a200">#7C4DFF</color>
1213

1314
<color name="material_lime_a200">#EEFF41</color>
1415

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
<string name="app_name">StepperView Demo</string>
44

5+
<!-- Donate dialog -->
6+
<string name="donate_dialog_title">Support me</string>
7+
<string name="donate_dialog_message">If you like this library project and you are willing to support me, you can donate me via Alipay or PayPal.\n\nAlipay: fythonx\@gmail.com\nPayPal: Click PAYPAL button to open a new tab.</string>
8+
<string name="doante_dialog_paypal_button">PayPal</string>
9+
510
<!-- Navigation Menu -->
611
<string name="item_vertical_stepper">Vertical Stepper (Item View)</string>
7-
<string name="item_vertical_stepper_adapter">Vertical Stepper (With Adapter)</string>
12+
<string name="item_vertical_stepper_adapter">Vertical Stepper (Adapter)</string>
813

914
<!-- Vertical Stepper View Sample Item -->
1015
<string name="content_step_0">This is the first step. Click OK button to next step.\n\nTest Message.</string>

0 commit comments

Comments
 (0)