Skip to content

Commit f6155a9

Browse files
committed
beautify push demo
1 parent 969626d commit f6155a9

File tree

7 files changed

+76
-23
lines changed

7 files changed

+76
-23
lines changed

Diff for: AVOSCloud-Push/res/drawable/blue_btn.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:state_pressed="true" android:drawable="@drawable/blue_btn_pressed" />
5+
<item android:drawable="@drawable/blue_btn_normal" />
6+
</selector>

Diff for: AVOSCloud-Push/res/drawable/blue_btn_normal.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
4+
<corners android:radius="5dp" />
5+
<padding
6+
android:left="5dp"
7+
android:right="5dp"
8+
android:bottom="5dp"
9+
android:top="5dp" />
10+
<solid android:color="@android:color/holo_blue_dark" />
11+
</shape>

Diff for: AVOSCloud-Push/res/drawable/blue_btn_pressed.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
4+
<corners android:radius="5dp" />
5+
<padding
6+
android:left="5dp"
7+
android:right="5dp"
8+
android:bottom="5dp"
9+
android:top="5dp" />
10+
<solid android:color="@android:color/holo_blue_light" />
11+
</shape>

Diff for: AVOSCloud-Push/res/layout/main.xml

+43-21
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,73 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="fill_parent"
44
android:layout_height="fill_parent"
5-
android:orientation="vertical" >
5+
android:orientation="vertical"
6+
android:gravity="center">
67

78
<TextView
89
android:id="@+id/mylabel"
9-
android:layout_width="wrap_content"
10+
android:layout_width="300dp"
1011
android:layout_height="wrap_content"
11-
android:text="installationId" />
12+
android:text="installationId"
13+
android:layout_marginBottom="30dp"/>
1214

13-
<TextView
14-
android:layout_width="wrap_content"
15+
<LinearLayout
16+
android:layout_width="300dp"
1517
android:layout_height="wrap_content"
16-
android:text="Channel" />
18+
android:orientation="horizontal">
1719

18-
<EditText
19-
android:id="@+id/channel"
20-
android:layout_width="wrap_content"
21-
android:layout_height="wrap_content"
22-
android:text="public" />
20+
<TextView
21+
android:layout_width="@dimen/title"
22+
android:layout_height="wrap_content"
23+
android:layout_gravity="center_vertical"
24+
android:text="Channel" />
2325

24-
<TextView
25-
android:layout_width="wrap_content"
26-
android:layout_height="wrap_content"
27-
android:text="Message" />
26+
<EditText
27+
android:id="@+id/channel"
28+
android:layout_width="wrap_content"
29+
android:layout_height="wrap_content"
30+
android:text="public" />
31+
</LinearLayout>
32+
33+
<LinearLayout
34+
android:layout_width="300dp"
35+
android:layout_height="wrap_content">
36+
37+
<TextView
38+
android:layout_width="@dimen/title"
39+
android:layout_height="wrap_content"
40+
android:layout_gravity="center_vertical"
41+
android:text="Message" />
42+
43+
<EditText
44+
android:id="@+id/message"
45+
android:layout_width="wrap_content"
46+
android:layout_height="wrap_content"
47+
android:text="hello world from avoscloud." />
48+
</LinearLayout>
2849

29-
<EditText
30-
android:id="@+id/message"
31-
android:layout_width="wrap_content"
32-
android:layout_height="wrap_content"
33-
android:text="hello world from avoscloud." />
3450

3551
<LinearLayout
3652
android:layout_width="wrap_content"
3753
android:layout_height="wrap_content"
38-
android:orientation="vertical" >
54+
android:orientation="vertical"
55+
android:layout_marginTop="20dp">
3956

4057
<Button
4158
android:id="@+id/pushBtn"
4259
android:layout_width="match_parent"
4360
android:layout_height="wrap_content"
61+
android:textColor="#fff"
62+
android:background="@drawable/blue_btn"
4463
android:text="@string/push" />
4564

4665
<Button
4766
android:id="@+id/customPush"
4867
android:layout_width="match_parent"
68+
android:layout_marginTop="20dp"
4969
android:layout_height="wrap_content"
70+
android:textColor="#fff"
71+
android:background="@drawable/blue_btn"
5072
android:text="@string/pushToChannel" />
5173
</LinearLayout>
5274

Diff for: AVOSCloud-Push/res/values/dimens.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<dimen name="title">80dp</dimen>
4+
</resources>

Diff for: AVOSCloud-Push/src/com/avos/avoscloud/PushDemo/PushDemo.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void onCreate(Bundle savedInstanceState) {
3131

3232
final TextView t = (TextView) this.findViewById(R.id.mylabel);
3333
// 显示的设备的 installationId,用于推送的设备标示
34-
t.setText("id: " + AVInstallation.getCurrentInstallation().getInstallationId());
34+
t.setText("这个设备的 id: " + AVInstallation.getCurrentInstallation().getInstallationId());
3535
// 保存 installation 到服务器
3636
AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
3737
@Override

Diff for: AVOSCloud-Push/src/com/avos/avoscloud/PushDemo/PushDemoApp.java

-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ public void onCreate() {
1818
"7gd2zom3ht3vx6jkcmaamm1p2pkrn8hdye2pn4qjcwux1hl1");
1919
// 启用崩溃错误统计
2020
AVAnalytics.enableCrashReport(this.getApplicationContext(), true);
21-
2221
}
2322
}

0 commit comments

Comments
 (0)