集合信息提示

chengzhenyu 8 anos atrás
pai
commit
e94464a8ec

+ 3 - 16
app/src/main/java/ai/pai/client/activity/MainActivity.java

@@ -28,7 +28,6 @@ import android.widget.Toast;
28 28
 
29 29
 import com.android.common.utils.DeviceUtils;
30 30
 import com.android.common.utils.LogHelper;
31
-import com.android.common.utils.TimeUtils;
32 31
 import com.android.views.indicators.Indicator;
33 32
 import com.android.views.indicators.IndicatorViewPager;
34 33
 import com.android.views.indicators.SpringBar;
@@ -49,6 +48,7 @@ import ai.pai.client.services.MyLocationService;
49 48
 import ai.pai.client.utils.Constants;
50 49
 import ai.pai.client.utils.PhotoLoader;
51 50
 import ai.pai.client.utils.UmengEvent;
51
+import ai.pai.client.views.GatherInfoPopup;
52 52
 import ai.pai.client.views.GroupSelectPopup;
53 53
 import ai.pai.client.views.PersonInfoPopup;
54 54
 
@@ -67,7 +67,6 @@ public class MainActivity extends AppCompatActivity
67 67
     private ImageButton gatherBtn;
68 68
     private ImageButton scanQRBtn;
69 69
     private ImageButton addGroupBtn;
70
-    private TextView gatherInfoTextView;
71 70
     private HTextView scanQRHintTextView;
72 71
     private HTextView addGroupHintTextView;
73 72
     private boolean isGuideShow;
@@ -106,7 +105,6 @@ public class MainActivity extends AppCompatActivity
106 105
         ImageView drawerToggle = (ImageView) findViewById(R.id.drawer_toggle);
107 106
         PhotoLoader.getInstance(this).displayImage(Preferences.getInstance(this).getUserAvatar(), drawerToggle,PhotoLoader.getUserAvatarOptions());
108 107
         drawerToggle.setOnClickListener(this);
109
-        gatherInfoTextView = (TextView)findViewById(R.id.tv_gather_info);
110 108
         callGuideBtn = (ImageButton)findViewById(R.id.floating_btn_call);
111 109
         gatherBtn = (ImageButton)findViewById(R.id.floating_btn_gather);
112 110
         findViewById(R.id.floating_btn_add).setOnClickListener(this);
@@ -119,7 +117,7 @@ public class MainActivity extends AppCompatActivity
119 117
     protected void onResume() {
120 118
         super.onResume();
121 119
         callGuideBtn.setVisibility(TextUtils.isEmpty(Preferences.getInstance(this).getTourGuidePhone()) ? View.INVISIBLE : View.VISIBLE);
122
-        gatherBtn.setVisibility(Preferences.getInstance(this).getGatherTime()<System.currentTimeMillis() ? View.INVISIBLE : View.VISIBLE);
120
+        gatherBtn.setVisibility(Preferences.getInstance(this).getGatherTime()+30*60*1000<System.currentTimeMillis() ? View.INVISIBLE : View.VISIBLE);
123 121
     }
124 122
 
125 123
 
@@ -198,18 +196,7 @@ public class MainActivity extends AppCompatActivity
198 196
         switch (v.getId()) {
199 197
             case R.id.floating_btn_gather:
200 198
                 MobclickAgent.onEvent(this, UmengEvent.home_gather_info_btn_click);
201
-                gatherInfoTextView.setVisibility(gatherInfoTextView.getVisibility()== View.VISIBLE?View.INVISIBLE:View.VISIBLE);
202
-                gatherInfoTextView.setText(getString(R.string.gather_info,TimeUtils.getGatherTimeStr(Preferences.getInstance(this).getGatherTime()),Preferences.getInstance(this).getTourGatherLocation()));
203
-                if(gatherInfoTextView.getVisibility()==View.VISIBLE){
204
-                    gatherInfoTextView.postDelayed(new Runnable() {
205
-                        @Override
206
-                        public void run() {
207
-                            if(gatherInfoTextView!=null && gatherInfoTextView.getContext()!=null){
208
-                                gatherInfoTextView.setVisibility(View.INVISIBLE);
209
-                            }
210
-                        }
211
-                    },3000);
212
-                }
199
+                new GatherInfoPopup(this).showPopupWindow();
213 200
                 break;
214 201
             case R.id.floating_btn_add:
215 202
                 MobclickAgent.onEvent(this, UmengEvent.home_new_group_btn_click);

+ 8 - 0
app/src/main/java/ai/pai/client/db/Preferences.java

@@ -73,6 +73,14 @@ public class Preferences {
73 73
         mPrefs.edit().putLong("tourEndTime",tourEndTime).commit();
74 74
     }
75 75
 
76
+    public String getGatherMap(){
77
+        return mPrefs.getString("gatherMap",NullStr);
78
+    }
79
+
80
+    public void setGatherMap(String gatherMap){
81
+        mPrefs.edit().putString("gatherMap",gatherMap).commit();
82
+    }
83
+
76 84
     public long getTourEndTime(){
77 85
         return mPrefs.getLong("tourEndTime",0);
78 86
     }

+ 10 - 5
app/src/main/java/ai/pai/client/fragments/TabRecentPhotoFragment.java

@@ -98,8 +98,6 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh
98 98
         recyclerView.setAdapter(photoAdapter);
99 99
         loadMoreView = LayoutInflater .from(getActivity()).inflate(R.layout.view_load_more, recyclerView, false);
100 100
         RecyclerViewUtils.setFooterView(recyclerView,loadMoreView);
101
-//        photoAdapter.addFooterView(loadMoreView);
102
-//        loadMoreView.setVisibility(View.GONE);
103 101
         swipeRefreshLayout.setOnRefreshListener(this);
104 102
         scrollListener = new EndlessRecyclerOnScrollListener() {
105 103
             @Override
@@ -154,14 +152,20 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh
154 152
                             images[1] = banners.getString("schedules");
155 153
                             String phone = group.getString("phone");
156 154
                             Preferences.getInstance(context).setTourGuidePhone(phone);
157
-                            String gatherTimeStr = group.getString("gather_at");
155
+                             String gatherTimeStr = group.getString("gather_at");
158 156
                             Preferences.getInstance(context).setGatherTime(TimeUtils.getStandardTimeInMiliSec(gatherTimeStr));
159 157
                             if(group.has("gather_location")){
160 158
                                 String location = group.getString("gather_location");
161 159
                                 Preferences.getInstance(context).setTourGatherLocation(location);
162 160
                             }
163
-                            String endTimeStr = group.getString("ended_at");
164
-                            Preferences.getInstance(context).setTourEndTime(TimeUtils.getStandardTimeInMiliSec(endTimeStr));
161
+                            if(group.has("ended_at")){
162
+                                String endTimeStr = group.getString("ended_at");
163
+                                Preferences.getInstance(context).setTourEndTime(TimeUtils.getStandardTimeInMiliSec(endTimeStr));
164
+                            }
165
+                            if(group.has("screenshoot")){
166
+                                String gatherMap = group.getString("screenshoot");
167
+                                Preferences.getInstance(context).setGatherMap(gatherMap);
168
+                            }
165 169
                         }
166 170
                     }else{
167 171
                         Preferences.getInstance(context).setTourMode(false);
@@ -169,6 +173,7 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh
169 173
                         Preferences.getInstance(context).setGatherTime(0);
170 174
                         Preferences.getInstance(context).setTourEndTime(0);
171 175
                         Preferences.getInstance(context).setTourGatherLocation("");
176
+                        Preferences.getInstance(context).setGatherMap("");
172 177
                     }
173 178
                     return true;
174 179
                 }catch (Exception e){

+ 67 - 0
app/src/main/java/ai/pai/client/views/GatherInfoPopup.java

@@ -0,0 +1,67 @@
1
+package ai.pai.client.views;
2
+
3
+import android.app.Activity;
4
+import android.content.Context;
5
+import android.text.TextUtils;
6
+import android.view.LayoutInflater;
7
+import android.view.View;
8
+import android.view.animation.Animation;
9
+import android.widget.ImageView;
10
+import android.widget.TextView;
11
+
12
+import com.android.common.utils.TimeUtils;
13
+import com.android.views.popup.BasePopupWindow;
14
+
15
+import ai.pai.client.R;
16
+import ai.pai.client.db.Preferences;
17
+import ai.pai.client.utils.PhotoLoader;
18
+
19
+
20
+public class GatherInfoPopup extends BasePopupWindow {
21
+
22
+    private View popupView;
23
+    private ImageView gatherMap;
24
+    private TextView gatherInfoText;
25
+    private Context context;
26
+
27
+
28
+    public GatherInfoPopup(Activity context) {
29
+        super(context);
30
+        this.context = context;
31
+        init();
32
+    }
33
+
34
+    @Override
35
+    protected Animation getShowAnimation() {
36
+        return getDefaultScaleAnimation();
37
+    }
38
+
39
+    @Override
40
+    protected View getClickToDismissView() {
41
+        return popupView.findViewById(R.id.click_to_dismiss);
42
+    }
43
+
44
+    @Override
45
+    public View getPopupView() {
46
+        popupView = LayoutInflater.from(mContext).inflate(R.layout.pop_gather_info, null);
47
+        gatherInfoText = (TextView) popupView.findViewById(R.id.tv_gather_info);
48
+        gatherMap = (ImageView) popupView.findViewById(R.id.iv_gather_map);
49
+        return popupView;
50
+    }
51
+
52
+    private void init(){
53
+        gatherInfoText.setText(context.getString(R.string.gather_info, TimeUtils.getGatherTimeStr(Preferences.getInstance(context).getGatherTime()),Preferences.getInstance(context).getTourGatherLocation()));
54
+        if(!TextUtils.isEmpty(Preferences.getInstance(context).getGatherMap())){
55
+            PhotoLoader.getInstance(context).displayImage(Preferences.getInstance(context).getGatherMap(),gatherMap);
56
+        }else{
57
+            gatherMap.setVisibility(View.GONE);
58
+        }
59
+    }
60
+
61
+    @Override
62
+    public View getAnimaView() {
63
+        return popupView.findViewById(R.id.popup_anima);
64
+    }
65
+
66
+
67
+}

+ 0 - 17
app/src/main/res/layout/app_bar_main.xml

@@ -76,21 +76,4 @@
76 76
         android:visibility="invisible"
77 77
         android:background="@drawable/ic_gather"/>
78 78
     
79
-  
80
-    <TextView
81
-        android:id="@+id/tv_gather_info"
82
-        android:layout_width="wrap_content"
83
-        android:layout_height="wrap_content"
84
-        android:layout_gravity="bottom|start"
85
-        android:gravity="center"
86
-        android:textSize="16sp"
87
-        android:padding="10dp"
88
-        android:minHeight="60dp"
89
-        android:visibility="invisible"
90
-        android:textColor="@color/dark_grey"
91
-        android:layout_marginRight="80dp"
92
-        android:layout_marginLeft="80dp"
93
-        android:layout_marginBottom="66dp"
94
-        android:background="@drawable/round_edittext"/>
95
-
96 79
 </android.support.design.widget.CoordinatorLayout>

+ 44 - 0
app/src/main/res/layout/pop_gather_info.xml

@@ -0,0 +1,44 @@
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
+
12
+        <LinearLayout
13
+            android:id="@+id/popup_anima"
14
+            android:layout_width="match_parent"
15
+            android:layout_height="wrap_content"
16
+            android:layout_margin="20dp"
17
+            android:padding="8dp"
18
+            android:layout_centerInParent="true"
19
+            android:gravity="center"
20
+            android:background="@color/pop_bg_color"
21
+            android:orientation="vertical">
22
+
23
+
24
+
25
+            <TextView
26
+                android:id="@+id/tv_gather_info"
27
+                android:layout_width="wrap_content"
28
+                android:layout_height="wrap_content"
29
+                android:textColor="@color/dark_grey"
30
+                android:layout_marginTop="4dp"
31
+                android:textSize="16sp" />
32
+
33
+
34
+            <ImageView
35
+                android:id="@+id/iv_gather_map"
36
+                android:layout_width="240dp"
37
+                android:layout_height="240dp"
38
+                android:layout_marginTop="16dp"/>
39
+
40
+
41
+        </LinearLayout>
42
+
43
+    </RelativeLayout>
44
+</RelativeLayout>