Commit 5ade1fb7aa1a32cfea3ec2a36f832d042ace21ac
1 parent
5d31a3b8
Exists in
yxb_dev
and in
2 other branches
no message
Showing
14 changed files
with
314 additions
and
10 deletions
Show diff stats
app/src/main/AndroidManifest.xml
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | android:supportsRtl="true" | 45 | android:supportsRtl="true" |
46 | android:theme="@style/AppTheme"> | 46 | android:theme="@style/AppTheme"> |
47 | 47 | ||
48 | - <activity android:name=".ui.activity.LoginAndRegistActivity"> | 48 | + <activity android:name=".ui.MainActivity"> |
49 | <intent-filter> | 49 | <intent-filter> |
50 | <action android:name="android.intent.action.MAIN" /> | 50 | <action android:name="android.intent.action.MAIN" /> |
51 | 51 | ||
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | </activity> | 54 | </activity> |
55 | <!--<activity android:name=".ui.activity.LoginAndRegistActivity" />--> | 55 | <!--<activity android:name=".ui.activity.LoginAndRegistActivity" />--> |
56 | <activity android:name=".ui.activity.StartActivity"></activity> | 56 | <activity android:name=".ui.activity.StartActivity"></activity> |
57 | - <activity android:name=".ui.MainActivity" | 57 | + <activity android:name=".ui.activity.LoginAndRegistActivity" |
58 | android:screenOrientation="portrait" | 58 | android:screenOrientation="portrait" |
59 | /> | 59 | /> |
60 | <activity android:name=".ui.activity.MyChildActivity" | 60 | <activity android:name=".ui.activity.MyChildActivity" |
app/src/main/java/com/shunzhi/parent/AppConfig.java
@@ -61,7 +61,7 @@ public class AppConfig { | @@ -61,7 +61,7 @@ public class AppConfig { | ||
61 | 61 | ||
62 | //保存键值对 | 62 | //保存键值对 |
63 | public void set(String key, String value) { | 63 | public void set(String key, String value) { |
64 | - SharedPreferences.Editor editor = getSharedPreferences(AppContext.getContext()).edit(); | 64 | + SharedPreferences.Editor editor = getSharedPreferences(mContext).edit(); |
65 | if (TextUtils.isEmpty(value)) { | 65 | if (TextUtils.isEmpty(value)) { |
66 | editor.putString(key, value); | 66 | editor.putString(key, value); |
67 | } else { | 67 | } else { |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
@@ -4,13 +4,22 @@ import android.os.Bundle; | @@ -4,13 +4,22 @@ import android.os.Bundle; | ||
4 | import android.support.annotation.NonNull; | 4 | import android.support.annotation.NonNull; |
5 | import android.support.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
6 | import android.view.View; | 6 | import android.view.View; |
7 | +import android.widget.ImageView; | ||
8 | +import android.widget.TextView; | ||
7 | 9 | ||
8 | import com.share.mvpsdk.base.BasePresenter; | 10 | import com.share.mvpsdk.base.BasePresenter; |
9 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | 11 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
10 | import com.shunzhi.parent.R; | 12 | import com.shunzhi.parent.R; |
13 | +import com.shunzhi.parent.views.TextAndImgShowView; | ||
11 | 14 | ||
12 | public class CePingFragment extends BaseMVPCompatFragment { | 15 | public class CePingFragment extends BaseMVPCompatFragment { |
13 | 16 | ||
17 | + TextView tvLocalAddress; | ||
18 | + | ||
19 | + ImageView ivCamera; | ||
20 | + | ||
21 | + TextAndImgShowView textAndImg1,textAndImg2,textAndImg3,textAndImg4; | ||
22 | + | ||
14 | @Override | 23 | @Override |
15 | public int getLayoutId() { | 24 | public int getLayoutId() { |
16 | return R.layout.fragment_ce_ping; | 25 | return R.layout.fragment_ce_ping; |
@@ -18,6 +27,28 @@ public class CePingFragment extends BaseMVPCompatFragment { | @@ -18,6 +27,28 @@ public class CePingFragment extends BaseMVPCompatFragment { | ||
18 | 27 | ||
19 | @Override | 28 | @Override |
20 | public void initUI(View view, @Nullable Bundle savedInstanceState) { | 29 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
30 | + ivCamera=view.findViewById(R.id.ivCamera); | ||
31 | + tvLocalAddress=view.findViewById(R.id.tvLocalAddress); | ||
32 | + textAndImg1=view.findViewById(R.id.textAndImg1); | ||
33 | + textAndImg2=view.findViewById(R.id.textAndImg2); | ||
34 | + textAndImg3=view.findViewById(R.id.textAndImg3); | ||
35 | + textAndImg4=view.findViewById(R.id.textAndImg4); | ||
36 | + | ||
37 | + textAndImg1.setTextColor(R.color.textColor); | ||
38 | + textAndImg1.setText("工具一"); | ||
39 | + textAndImg1.setImgs(R.drawable.play,R.drawable.play); | ||
40 | + | ||
41 | + textAndImg2.setTextColor(R.color.textColor); | ||
42 | + textAndImg2.setText("工具二"); | ||
43 | + textAndImg2.setImgs(R.drawable.play,R.drawable.play); | ||
44 | + | ||
45 | + textAndImg3.setTextColor(R.color.textColor); | ||
46 | + textAndImg3.setText("工具三"); | ||
47 | + textAndImg3.setImgs(R.drawable.play,R.drawable.play); | ||
48 | + | ||
49 | + textAndImg4.setTextColor(R.color.textColor); | ||
50 | + textAndImg4.setText("工具四"); | ||
51 | + textAndImg4.setImgs(R.drawable.play,R.drawable.play); | ||
21 | 52 | ||
22 | } | 53 | } |
23 | 54 |
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
0 → 100644
@@ -0,0 +1,71 @@ | @@ -0,0 +1,71 @@ | ||
1 | +package com.shunzhi.parent.views; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.support.annotation.DrawableRes; | ||
5 | +import android.support.annotation.Nullable; | ||
6 | +import android.util.AttributeSet; | ||
7 | +import android.view.View; | ||
8 | +import android.widget.FrameLayout; | ||
9 | +import android.widget.ImageView; | ||
10 | +import android.widget.LinearLayout; | ||
11 | +import android.widget.TextView; | ||
12 | + | ||
13 | +import com.shunzhi.parent.R; | ||
14 | + | ||
15 | + | ||
16 | +/** | ||
17 | + * Created by ToaHanDong on 2018/1/22. | ||
18 | + */ | ||
19 | + | ||
20 | +public class TextAndImgShowView extends LinearLayout { | ||
21 | + public TextAndImgShowView(Context context) { | ||
22 | + super(context); | ||
23 | + init(context); | ||
24 | + } | ||
25 | + | ||
26 | + public TextAndImgShowView(Context context, @Nullable AttributeSet attrs) { | ||
27 | + super(context, attrs); | ||
28 | + init(context); | ||
29 | + } | ||
30 | + | ||
31 | + public TextAndImgShowView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
32 | + super(context, attrs, defStyleAttr); | ||
33 | + init(context); | ||
34 | + } | ||
35 | + | ||
36 | + ImageView image; | ||
37 | + TextView text; | ||
38 | + FrameLayout layout; | ||
39 | + int[] imgs = null; | ||
40 | + boolean isSelect = false; | ||
41 | + | ||
42 | + private void init(Context context) { | ||
43 | + View view = View.inflate(context, R.layout.text_and_img_show, this); | ||
44 | + image = view.findViewById(R.id.image); | ||
45 | + text = view.findViewById(R.id.text); | ||
46 | + layout = view.findViewById(R.id.layout); | ||
47 | + } | ||
48 | + | ||
49 | + public void setImgs(@DrawableRes int normalDrawable, @DrawableRes int selectDrawable) { | ||
50 | + imgs = new int[]{normalDrawable, selectDrawable}; | ||
51 | + } | ||
52 | + | ||
53 | + public void setSelect(boolean isSelect) { | ||
54 | + if (isSelect) { | ||
55 | + if (imgs != null && imgs.length > 1) | ||
56 | + image.setImageResource(imgs[1]); | ||
57 | + } else { | ||
58 | + if (imgs != null && imgs.length > 1) | ||
59 | + image.setImageResource(imgs[0]); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + | ||
64 | + public void setText(String content) { | ||
65 | + text.setText(content); | ||
66 | + } | ||
67 | + | ||
68 | + public void setTextColor(int color){ | ||
69 | + text.setTextColor(color); | ||
70 | + } | ||
71 | +} |
1.04 KB
2.61 KB
603 Bytes
@@ -0,0 +1,7 @@ | @@ -0,0 +1,7 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | + | ||
4 | + <corners android:radius="@dimen/size_dp_8"/> | ||
5 | + <solid android:color="@color/white"/> | ||
6 | + | ||
7 | +</shape> | ||
0 | \ No newline at end of file | 8 | \ No newline at end of file |
app/src/main/res/layout/fragment_ce_ping.xml
1 | -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | 1 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
2 | xmlns:tools="http://schemas.android.com/tools" | 2 | xmlns:tools="http://schemas.android.com/tools" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | + android:background="@color/bgColor" | ||
5 | tools:context="com.shunzhi.parent.ui.fragment.CePingFragment"> | 6 | tools:context="com.shunzhi.parent.ui.fragment.CePingFragment"> |
6 | 7 | ||
7 | - <!-- TODO: Update blank fragment layout --> | ||
8 | - <TextView | 8 | + <FrameLayout |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | - android:layout_height="match_parent" | ||
11 | - android:text="@string/hello_blank_fragment" /> | 10 | + android:layout_height="?android:actionBarSize" |
11 | + android:background="@color/titleColor" | ||
12 | + > | ||
13 | + <TextView | ||
14 | + android:layout_width="wrap_content" | ||
15 | + android:layout_height="match_parent" | ||
16 | + android:text="杭州" | ||
17 | + android:gravity="center" | ||
18 | + android:textColor="@color/textColor" | ||
19 | + android:paddingLeft="@dimen/size_dp_15" | ||
20 | + android:drawableRight="@drawable/pull" | ||
21 | + android:drawablePadding="@dimen/size_dp_5" | ||
22 | + android:textSize="@dimen/textSize16" | ||
23 | + android:id="@+id/tvLocalAddress" | ||
24 | + /> | ||
12 | 25 | ||
13 | -</FrameLayout> | 26 | + <TextView |
27 | + style="@style/TextView_Wrap_16" | ||
28 | + android:layout_gravity="center" | ||
29 | + android:gravity="center" | ||
30 | + android:text="@string/ceping" | ||
31 | + android:textColor="@color/textColor" | ||
32 | + /> | ||
33 | + | ||
34 | + | ||
35 | + <ImageView | ||
36 | + android:layout_width="wrap_content" | ||
37 | + android:layout_height="match_parent" | ||
38 | + android:src="@drawable/camera" | ||
39 | + android:layout_gravity="right" | ||
40 | + android:paddingRight="@dimen/size_dp_15" | ||
41 | + android:paddingLeft="@dimen/size_dp_15" | ||
42 | + android:id="@+id/ivCamera" | ||
43 | + /> | ||
44 | + | ||
45 | + </FrameLayout> | ||
46 | + | ||
47 | + <LinearLayout | ||
48 | + android:layout_width="match_parent" | ||
49 | + android:layout_height="wrap_content" | ||
50 | + android:background="@drawable/shape_bg_radius8" | ||
51 | + android:orientation="vertical" | ||
52 | + android:layout_margin="@dimen/size_dp_10" | ||
53 | + > | ||
54 | + | ||
55 | + | ||
56 | + <LinearLayout | ||
57 | + android:layout_width="match_parent" | ||
58 | + android:layout_height="wrap_content" | ||
59 | + android:orientation="horizontal" | ||
60 | + > | ||
61 | + | ||
62 | + <com.shunzhi.parent.views.TextAndImgShowView | ||
63 | + android:id="@+id/textAndImg1" | ||
64 | + android:layout_width="0dp" | ||
65 | + android:layout_weight="1" | ||
66 | + android:layout_height="wrap_content"> | ||
67 | + | ||
68 | + </com.shunzhi.parent.views.TextAndImgShowView> | ||
69 | + | ||
70 | + <com.shunzhi.parent.views.TextAndImgShowView | ||
71 | + android:id="@+id/textAndImg2" | ||
72 | + android:layout_width="0dp" | ||
73 | + android:layout_weight="1" | ||
74 | + android:layout_height="wrap_content"> | ||
75 | + | ||
76 | + </com.shunzhi.parent.views.TextAndImgShowView> | ||
77 | + | ||
78 | + <com.shunzhi.parent.views.TextAndImgShowView | ||
79 | + android:id="@+id/textAndImg3" | ||
80 | + android:layout_width="0dp" | ||
81 | + android:layout_weight="1" | ||
82 | + android:layout_height="wrap_content"> | ||
83 | + | ||
84 | + </com.shunzhi.parent.views.TextAndImgShowView> | ||
85 | + | ||
86 | + <com.shunzhi.parent.views.TextAndImgShowView | ||
87 | + android:id="@+id/textAndImg4" | ||
88 | + android:layout_width="0dp" | ||
89 | + android:layout_weight="1" | ||
90 | + android:layout_height="wrap_content"> | ||
91 | + | ||
92 | + </com.shunzhi.parent.views.TextAndImgShowView> | ||
93 | + | ||
94 | + </LinearLayout> | ||
95 | + | ||
96 | + | ||
97 | + </LinearLayout> | ||
98 | + | ||
99 | +</LinearLayout> |
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<FrameLayout | ||
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | ||
4 | + android:id="@+id/layout" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="match_parent" | ||
7 | + android:gravity="center" | ||
8 | + android:orientation="vertical"> | ||
9 | + | ||
10 | + <LinearLayout | ||
11 | + android:layout_width="wrap_content" | ||
12 | + android:layout_height="wrap_content" | ||
13 | + android:layout_gravity="center" | ||
14 | + android:gravity="center" | ||
15 | + android:orientation="vertical"> | ||
16 | + | ||
17 | + <ImageView | ||
18 | + android:id="@+id/image" | ||
19 | + android:layout_width="wrap_content" | ||
20 | + android:layout_height="wrap_content" | ||
21 | + android:scaleType="fitXY" | ||
22 | + /> | ||
23 | + | ||
24 | + <TextView | ||
25 | + android:id="@+id/text" | ||
26 | + android:layout_width="wrap_content" | ||
27 | + android:layout_height="wrap_content" | ||
28 | + android:layout_marginTop="5dp" | ||
29 | + android:gravity="center" | ||
30 | + android:textColor="@color/white" | ||
31 | + android:textSize="14dp"/> | ||
32 | + </LinearLayout> | ||
33 | + | ||
34 | + | ||
35 | +</FrameLayout> | ||
0 | \ No newline at end of file | 36 | \ No newline at end of file |
app/src/main/res/values/colors.xml
@@ -10,5 +10,7 @@ | @@ -10,5 +10,7 @@ | ||
10 | <color name="bg_main">#F0EFF5</color> | 10 | <color name="bg_main">#F0EFF5</color> |
11 | <color name="textRed">#FC5B6A</color> | 11 | <color name="textRed">#FC5B6A</color> |
12 | <color name="back_top">#C6DAFF</color> | 12 | <color name="back_top">#C6DAFF</color> |
13 | - | 13 | + <color name="titleColor">#C6DAFF</color> |
14 | + <color name="bgColor">#F0EFF5</color> | ||
15 | + <color name="textColor">#494947</color> | ||
14 | </resources> | 16 | </resources> |
app/src/main/res/values/dimens.xml
@@ -43,4 +43,49 @@ | @@ -43,4 +43,49 @@ | ||
43 | <dimen name="sp_16">16sp</dimen> | 43 | <dimen name="sp_16">16sp</dimen> |
44 | <dimen name="sp_18">18sp</dimen> | 44 | <dimen name="sp_18">18sp</dimen> |
45 | 45 | ||
46 | + <dimen name="textSize10">10dp</dimen> | ||
47 | + <dimen name="textSize12">12dp</dimen> | ||
48 | + <dimen name="textSize14">14dp</dimen> | ||
49 | + <dimen name="textSize16">16dp</dimen> | ||
50 | + <dimen name="textSize18">18dp</dimen> | ||
51 | + <dimen name="textSize20">20dp</dimen> | ||
52 | + <dimen name="textSize24">24dp</dimen> | ||
53 | + <dimen name="textSize30">30dp</dimen> | ||
54 | + <dimen name="size_dp_1">1dp</dimen> | ||
55 | + <dimen name="size_dp_2">2dp</dimen> | ||
56 | + <dimen name="size_dp_3">3dp</dimen> | ||
57 | + <dimen name="size_dp_4">4dp</dimen> | ||
58 | + <dimen name="size_dp_5">5dp</dimen> | ||
59 | + <dimen name="size_dp_6">6dp</dimen> | ||
60 | + <dimen name="size_dp_7">7dp</dimen> | ||
61 | + <dimen name="size_dp_8">8dp</dimen> | ||
62 | + <dimen name="size_dp_9">9dp</dimen> | ||
63 | + <dimen name="size_dp_10">10dp</dimen> | ||
64 | + <dimen name="size_dp_11">11dp</dimen> | ||
65 | + <dimen name="size_dp_12">12dp</dimen> | ||
66 | + <dimen name="size_dp_13">13dp</dimen> | ||
67 | + <dimen name="size_dp_14">14dp</dimen> | ||
68 | + <dimen name="size_dp_15">15dp</dimen> | ||
69 | + <dimen name="size_dp_16">16dp</dimen> | ||
70 | + <dimen name="size_dp_17">17.0dp</dimen> | ||
71 | + <dimen name="size_dp_18">18.0dp</dimen> | ||
72 | + <dimen name="size_dp_19">19dp</dimen> | ||
73 | + <dimen name="size_dp_20">20dp</dimen> | ||
74 | + <dimen name="size_dp_24">24dp</dimen> | ||
75 | + <dimen name="size_dp_25">25dp</dimen> | ||
76 | + <dimen name="size_dp_30">30dp</dimen> | ||
77 | + <dimen name="size_dp_32">32dp</dimen> | ||
78 | + <dimen name="size_dp_40">40dp</dimen> | ||
79 | + <dimen name="size_dp_50">50dp</dimen> | ||
80 | + <dimen name="size_dp_60">60dp</dimen> | ||
81 | + <dimen name="size_dp_80">80dp</dimen> | ||
82 | + <dimen name="size_dp_100">100dp</dimen> | ||
83 | + <dimen name="size_dp_110">110dp</dimen> | ||
84 | + <dimen name="size_dp_120">120dp</dimen> | ||
85 | + <dimen name="size_dp_150">150dp</dimen> | ||
86 | + <dimen name="size_dp_200">200dp</dimen> | ||
87 | + <dimen name="size_dp_250">250dp</dimen> | ||
88 | + <dimen name="size_dp_300">300dp</dimen> | ||
89 | + <dimen name="size_dp_310">310dp</dimen> | ||
90 | + | ||
46 | </resources> | 91 | </resources> |
47 | \ No newline at end of file | 92 | \ No newline at end of file |
app/src/main/res/values/strings.xml
@@ -3,4 +3,6 @@ | @@ -3,4 +3,6 @@ | ||
3 | 3 | ||
4 | <!-- TODO: Remove or change this placeholder text --> | 4 | <!-- TODO: Remove or change this placeholder text --> |
5 | <string name="hello_blank_fragment">Hello blank fragment</string> | 5 | <string name="hello_blank_fragment">Hello blank fragment</string> |
6 | + | ||
7 | + <string name="ceping">测评</string> | ||
6 | </resources> | 8 | </resources> |
app/src/main/res/values/styles.xml
@@ -8,4 +8,29 @@ | @@ -8,4 +8,29 @@ | ||
8 | <item name="colorAccent">@color/colorAccent</item> | 8 | <item name="colorAccent">@color/colorAccent</item> |
9 | </style> | 9 | </style> |
10 | 10 | ||
11 | + | ||
12 | + <style name="TextView_Wrap_16"> | ||
13 | + <item name="android:layout_width">wrap_content</item> | ||
14 | + <item name="android:layout_height">wrap_content</item> | ||
15 | + <item name="android:textSize">@dimen/textSize16</item> | ||
16 | + </style> | ||
17 | + | ||
18 | + <style name="TextView_Width_Match_16"> | ||
19 | + <item name="android:layout_width">match_parent</item> | ||
20 | + <item name="android:layout_height">wrap_content</item> | ||
21 | + <item name="android:textSize">@dimen/textSize16</item> | ||
22 | + </style> | ||
23 | + | ||
24 | + <style name="TextView_Height_Match_16"> | ||
25 | + <item name="android:layout_width">wrap_content</item> | ||
26 | + <item name="android:layout_height">match_parent</item> | ||
27 | + <item name="android:textSize">@dimen/textSize16</item> | ||
28 | + </style> | ||
29 | + | ||
30 | + <style name="TextView_Match_16"> | ||
31 | + <item name="android:layout_width">match_parent</item> | ||
32 | + <item name="android:layout_height">match_parent</item> | ||
33 | + <item name="android:textSize">@dimen/textSize16</item> | ||
34 | + </style> | ||
35 | + | ||
11 | </resources> | 36 | </resources> |