群退出确认

chengzhenyu 8 anos atrás
pai
commit
a12c06788d

+ 10 - 7
app/src/main/java/ai/pai/client/activity/GroupSettingActivity.java

@@ -26,11 +26,11 @@ import java.util.ArrayList;
26 26
 import ai.pai.client.R;
27 27
 import ai.pai.client.beans.GroupMemberInfo;
28 28
 import ai.pai.client.db.DBService;
29
-import ai.pai.client.db.Preferences;
30 29
 import ai.pai.client.services.GroupService;
31 30
 import ai.pai.client.utils.PhotoLoader;
32 31
 import ai.pai.client.utils.SystemUtils;
33 32
 import ai.pai.client.utils.UmengEvent;
33
+import ai.pai.client.views.ExitGroupConfirmPopup;
34 34
 import ai.pai.client.views.GroupExitPopup;
35 35
 import ai.pai.client.views.GroupQRPopup;
36 36
 
@@ -132,18 +132,21 @@ public class GroupSettingActivity extends BaseActivity implements View.OnClickLi
132 132
                 break;
133 133
             case R.id.tv_pop_exit_group:
134 134
                 if (!isAdmin) {
135
-                    Intent intent = new Intent(GroupSettingActivity.this, GroupService.class);
136
-                    Bundle bundle = new Bundle();
137
-                    bundle.putString("group_id", groupId);
138
-                    bundle.putInt("command", GroupService.GroupCommand.COMMAND_QUIT_GROUP);
139
-                    intent.putExtras(bundle);
140
-                    startService(intent);
135
+                    new ExitGroupConfirmPopup(this,this).showPopupWindow();
141 136
                 } else {
142 137
                     Toast.makeText(this, R.string.can_not_delete_self, Toast.LENGTH_SHORT).show();
143 138
                 }
144 139
             case R.id.tv_pop_cancel:
145 140
                 exitPopup.dismiss();
146 141
                 break;
142
+            case R.id.btn_exit_group_confirm:
143
+                Intent exitIntent = new Intent(GroupSettingActivity.this, GroupService.class);
144
+                Bundle bundle = new Bundle();
145
+                bundle.putString("group_id", groupId);
146
+                bundle.putInt("command", GroupService.GroupCommand.COMMAND_QUIT_GROUP);
147
+                exitIntent.putExtras(bundle);
148
+                startService(exitIntent);
149
+                break;
147 150
             case R.id.layout_group_qr:
148 151
                 MobclickAgent.onEvent(this, UmengEvent.groupconfig_qrcode_layout_click);
149 152
                 new GroupQRPopup(this, groupId, groupName, avatarId).showPopupWindow();

+ 68 - 0
app/src/main/java/ai/pai/client/views/ExitGroupConfirmPopup.java

@@ -0,0 +1,68 @@
1
+package ai.pai.client.views;
2
+
3
+import android.app.Activity;
4
+import android.view.LayoutInflater;
5
+import android.view.View;
6
+import android.view.animation.Animation;
7
+
8
+import com.android.views.popup.BasePopupWindow;
9
+
10
+import ai.pai.client.R;
11
+
12
+/**
13
+ * Created by chengzhenyu on 2016/3/4.
14
+ */
15
+public class ExitGroupConfirmPopup extends BasePopupWindow implements View.OnClickListener{
16
+
17
+    private View popupView;
18
+    private View.OnClickListener listener;
19
+
20
+    public ExitGroupConfirmPopup(Activity context, View.OnClickListener clickListener) {
21
+        super(context);
22
+        this.listener = clickListener;
23
+        bindEvent();
24
+    }
25
+
26
+    @Override
27
+    protected Animation getShowAnimation() {
28
+        return getDefaultScaleAnimation();
29
+    }
30
+
31
+    @Override
32
+    protected View getClickToDismissView() {
33
+        return popupView.findViewById(R.id.click_to_dismiss);
34
+    }
35
+
36
+    @Override
37
+    public View getPopupView() {
38
+        popupView= LayoutInflater.from(mContext).inflate(R.layout.popup_exit_group_confirm,null);
39
+        return popupView;
40
+    }
41
+
42
+    @Override
43
+    public View getAnimaView() {
44
+        return popupView.findViewById(R.id.popup_anima);
45
+    }
46
+
47
+    private void bindEvent() {
48
+        if (popupView!=null){
49
+            popupView.findViewById(R.id.btn_cancel_delete).setOnClickListener(this);
50
+            popupView.findViewById(R.id.btn_exit_group_confirm).setOnClickListener(this);
51
+        }
52
+    }
53
+
54
+    @Override
55
+    public void onClick(View v) {
56
+        switch (v.getId()){
57
+            case R.id.btn_cancel_delete:
58
+                dismiss();
59
+                break;
60
+            case R.id.btn_exit_group_confirm:
61
+                dismiss();
62
+                if(listener!=null){
63
+                    listener.onClick(v);
64
+                }
65
+                break;
66
+        }
67
+    }
68
+}

+ 86 - 0
app/src/main/res/layout/popup_exit_group_confirm.xml

@@ -0,0 +1,86 @@
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
+
6
+    <RelativeLayout
7
+        android:id="@+id/click_to_dismiss"
8
+        android:layout_width="match_parent"
9
+        android:layout_height="match_parent"
10
+        android:background="@color/popup_bg"
11
+        android:paddingLeft="25dp"
12
+        android:paddingRight="25dp">
13
+
14
+        <LinearLayout
15
+            android:id="@+id/popup_anima"
16
+            android:layout_width="280dp"
17
+            android:layout_height="148dp"
18
+            android:layout_centerInParent="true"
19
+            android:background="@color/pop_bg_color"
20
+            android:orientation="vertical">
21
+
22
+
23
+            <RelativeLayout
24
+                android:layout_width="match_parent"
25
+                android:layout_height="match_parent">
26
+
27
+                <TextView
28
+                    android:id="@+id/tv_pop_delete_title"
29
+                    android:layout_width="match_parent"
30
+                    android:layout_height="wrap_content"
31
+                    android:layout_marginTop="20dp"
32
+                    android:text="@string/exit_group_confirm"
33
+                    android:textColor="@color/black"
34
+                    android:layout_marginLeft="24dp"
35
+                    android:textSize="18sp" />
36
+
37
+
38
+                <TextView
39
+                    android:id="@+id/tv_pop_delete_hint"
40
+                    android:layout_width="match_parent"
41
+                    android:layout_height="wrap_content"
42
+                    android:layout_marginTop="56dp"
43
+                    android:layout_marginLeft="24dp"
44
+                    android:text="@string/exit_group_hint"
45
+                    android:textColor="@color/grey"
46
+                    android:textSize="16sp" />
47
+
48
+
49
+
50
+                <LinearLayout
51
+                    android:layout_width="match_parent"
52
+                    android:layout_height="wrap_content"
53
+                    android:layout_alignParentBottom="true"
54
+                    android:paddingBottom="14dp"
55
+                    android:gravity="center"
56
+                    android:orientation="horizontal">
57
+
58
+
59
+                    <Button
60
+                        android:id="@+id/btn_cancel_delete"
61
+                        android:layout_width="120dp"
62
+                        android:layout_height="36dp"
63
+                        android:gravity="center"
64
+                        android:textColor="@color/dark_grey"
65
+                        android:background="@drawable/pop_btn_cancel_selector"
66
+                        android:text="@string/cancel"
67
+                        android:textSize="16sp" />
68
+
69
+                    <Button
70
+                        android:id="@+id/btn_exit_group_confirm"
71
+                        android:layout_width="120dp"
72
+                        android:layout_height="36dp"
73
+                        android:gravity="center"
74
+                        android:textColor="@color/white"
75
+                        android:layout_marginLeft="8dp"
76
+                        android:background="@drawable/pop_btn_ok_selector"
77
+                        android:text="@string/ok"
78
+                        android:textSize="16sp" />
79
+
80
+                </LinearLayout>
81
+
82
+            </RelativeLayout>
83
+        </LinearLayout>
84
+    </RelativeLayout>
85
+
86
+</RelativeLayout>

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

@@ -70,6 +70,9 @@
70 70
     <string name="delete_group_member">删除群成员</string>
71 71
 
72 72
     <string name="delete_member_hint">删除后将不再能看到群内照片</string>
73
+
74
+    <string name="exit_group_hint">退出群后将不再能看到群内照片</string>
75
+
73 76
     <string name="delete_member_processing">成员删除进行中</string>
74 77
 
75 78
     <string name="delete_member_success">成员删除成功</string>
@@ -266,4 +269,6 @@
266 269
     <string name="no_photo_in_group">暂无照片</string>
267 270
 
268 271
     <string name="photo_in_group">有%d张照片</string>
272
+
273
+    <string name="exit_group_confirm">群退出提示</string>
269 274
 </resources>