+import android.view.animation.Animation;
12
+import android.widget.Button;
13
+import android.widget.EditText;
14
+
15
+import com.android.views.popup.BasePopupWindow;
16
+
17
+import ai.pai.client.R;
18
+
19
+public class PersonInfoPopup extends BasePopupWindow {
20
+
21
+    private Button mJoinBtn;
22
+    private EditText mNameEdit;
23
+    private EditText mPhoneEdit;
24
+
25
+    public PersonInfoPopup(Activity context, View.OnClickListener listener) {
26
+        super(context);
27
+        mJoinBtn = (Button) mPopupView.findViewById(R.id.btn_info_confirm);
28
+        mNameEdit = (EditText) mPopupView.findViewById(R.id.et_user_name);
29
+        mPhoneEdit = (EditText)mPopupView.findViewById(R.id.et_user_phone);
30
+
31
+        mPhoneEdit.addTextChangedListener(new TextWatcher() {
32
+            @Override
33
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
34
+
35
+            }
36
+
37
+            @Override
38
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
39
+
40
+            }
41
+
42
+            @Override
43
+            public void afterTextChanged(Editable s) {
44
+                mJoinBtn.setEnabled(s.toString().length()==11);
45
+            }
46
+        });
47
+        setAutoShowInputMethod(true);
48
+        mJoinBtn.setOnClickListener(listener);
49
+    }
50
+
51
+    public String getInputName(){
52
+        if(mNameEdit.getText()!=null){
53
+            return mNameEdit.getText().toString();
54
+        }
55
+        return null;
56
+    }
57
+
58
+    public String getInputPhone(){
59
+        if(mPhoneEdit.getText()!=null){
60
+            return mPhoneEdit.getText().toString();
61
+        }
62
+        return null;
63
+    }
64
+
65
+    @Override
66
+    protected Animation getShowAnimation() {
67
+         return getDefaultScaleAnimation();
68
+    }
69
+
70
+    @Override
71
+    public Animator getShowAnimator() {
72
+        return getDefaultSlideFromBottomAnimationSet();
73
+    }
74
+
75
+    @Override
76
+    public View getInputView() {
77
+        return mNameEdit;
78
+    }
79
+
80
+    @Override
81
+    protected View getClickToDismissView() {
82
+        return mPopupView;
83
+    }
84
+
85
+    @Override
86
+    public View getPopupView() {
87
+        return LayoutInflater.from(mContext).inflate(R.layout.popup_comment_input,null);
88
+    }
89
+
90
+    @Override
91
+    public View getAnimaView() {
92
+        return mPopupView.findViewById(R.id.popup_anima);
93
+    }
94
+
95
+    @Override
96
+    public Animator getExitAnimator() {
97
+        AnimatorSet set = null;
98
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
99
+            set = new AnimatorSet();
100
+            if (getAnimaView() != null) {
101
+                set.playTogether(
102
+                        ObjectAnimator.ofFloat(getAnimaView(), "translationY", 0, 250).setDuration(400),
103
+                        ObjectAnimator.ofFloat(getAnimaView(), "alpha", 1, 0.4f).setDuration(250 * 3 / 2));
104
+            }
105
+        }
106
+        return set;
107
+    }
108
+}

+ 58 - 0
app/src/main/res/layout/popup_person_info.xml

@@ -0,0 +1,58 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="match_parent"
5
+    android:background="@color/popup_bg">
6
+
7
+    <LinearLayout
8
+        android:id="@+id/popup_anima"
9
+        android:layout_width="match_parent"
10
+        android:layout_height="wrap_content"
11
+        android:layout_margin="20dp"
12
+        android:layout_centerInParent="true"
13
+        android:orientation="vertical"
14
+        android:background="@color/white"
15
+        android:padding="6dp">
16
+
17
+
18
+        <EditText
19
+            android:id="@+id/et_user_name"
20
+            android:layout_width="match_parent"
21
+            android:textSize="16sp"
22
+            android:textColorHint="@color/grey"
23
+            android:background="@drawable/round_edittext"
24
+            android:textColor="@color/dark_grey"
25
+            android:hint="@string/guide_app_input_name"
26
+            android:paddingLeft="12dp"
27
+            android:gravity="center_vertical"
28
+            android:layout_height="40dp" />
29
+
30
+        <EditText
31
+            android:id="@+id/et_user_phone"
32
+            android:layout_width="match_parent"
33
+            android:textSize="16sp"
34
+            android:textColorHint="@color/grey"
35
+            android:layout_marginTop="12dp"
36
+            android:background="@drawable/round_edittext"
37
+            android:textColor="@color/dark_grey"
38
+            android:hint="@string/guide_app_input_phone"
39
+            android:paddingLeft="12dp"
40
+            android:gravity="center_vertical"
41
+            android:layout_height="40dp" />
42
+
43
+        <Button
44
+            android:id="@+id/btn_info_confirm"
45
+            android:layout_width="match_parent"
46
+            android:layout_height="40dp"
47
+            android:textColor="@color/white"
48
+            android:layout_margin="12dp"
49
+            android:paddingRight="10dp"
50
+            android:paddingLeft="10dp"
51
+            android:textSize="16sp"
52
+            android:enabled="false"
53
+            android:background="@drawable/send_btn_bg_selector"
54
+            android:text="@string/guide_app_join_tour"/>
55
+
56
+    </LinearLayout>
57
+
58
+</RelativeLayout>

+ 6 - 0
app/src/main/res/values/strings.xml

@@ -238,4 +238,10 @@
238 238
     <string name="no_orders_found_tip">暂无您的订单信息</string>
239 239
 
240 240
     <string name="no_more_content">暂时没有更多啦</string>
241
+
242
+    <string name="guide_app_input_name">请输入姓名以便导游更好地服务</string>
243
+
244
+    <string name="guide_app_input_phone">请输入电话以便导游途中联系</string>
245
+
246
+    <string name="guide_app_join_tour">加入旅行团</string>
241 247
 </resources>

kodo - Gogs: Go Git Service

暫無描述

Brightcells: 4defb80fdc gogs first init 10 年之前
..
__init__.py 4defb80fdc gogs first init 10 年之前