@@ -37,7 +37,7 @@ |
||
37 | 37 |
<ConfirmationsSetting value="0" id="Add" /> |
38 | 38 |
<ConfirmationsSetting value="0" id="Remove" /> |
39 | 39 |
</component> |
40 |
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
|
40 |
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
|
41 | 41 |
<output url="file://$PROJECT_DIR$/build/classes" /> |
42 | 42 |
</component> |
43 | 43 |
<component name="ProjectType"> |
@@ -23,6 +23,7 @@ import org.json.JSONObject; |
||
23 | 23 |
import java.util.ArrayList; |
24 | 24 |
import java.util.HashMap; |
25 | 25 |
|
26 |
+import ai.pai.client.BuildConfig; |
|
26 | 27 |
import ai.pai.client.R; |
27 | 28 |
import ai.pai.client.adapter.RecentPhotoStaggeredAdapter; |
28 | 29 |
import ai.pai.client.beans.GroupPhotoItem; |
@@ -41,6 +42,7 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
41 | 42 |
private View loadMoreView; |
42 | 43 |
|
43 | 44 |
private HttpPostTask fetchPhotosTask; |
45 |
+ private HttpPostTask fetchTourInfoTask; |
|
44 | 46 |
private ArrayList<GroupPhotoItem> photoList; |
45 | 47 |
private boolean isDataRefreshed; |
46 | 48 |
private int left; |
@@ -92,6 +94,60 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
92 | 94 |
return rootView; |
93 | 95 |
} |
94 | 96 |
|
97 |
+ @Override |
|
98 |
+ public void onResume() { |
|
99 |
+ super.onResume(); |
|
100 |
+ fetchTourInfo(); |
|
101 |
+ } |
|
102 |
+ |
|
103 |
+ private void fetchTourInfo(){ |
|
104 |
+ if(!Preferences.getInstance(getActivity()).isTourMode() && !BuildConfig.DEBUG){ |
|
105 |
+ return; |
|
106 |
+ } |
|
107 |
+ if(fetchTourInfoTask!=null && fetchTourInfoTask.getStatus()== AsyncTask.Status.RUNNING){ |
|
108 |
+ return; |
|
109 |
+ } |
|
110 |
+ HashMap<String,String> params = new HashMap<String,String>(); |
|
111 |
+ String userId = Preferences.getInstance(getActivity()).getUserId(); |
|
112 |
+ if(userId.length()==0){ |
|
113 |
+ return; |
|
114 |
+ } |
|
115 |
+ params.put("user_id",userId); |
|
116 |
+ params.put("page",""); |
|
117 |
+ |
|
118 |
+ fetchTourInfoTask = new HttpPostTask(getActivity(),params) { |
|
119 |
+ |
|
120 |
+ |
|
121 |
+ @Override |
|
122 |
+ protected boolean parseResponse(Context context, String response) { |
|
123 |
+ try{ |
|
124 |
+ JSONObject json = new JSONObject(response); |
|
125 |
+ int status = json.getInt("status"); |
|
126 |
+ if(status == 200){ |
|
127 |
+ JSONObject info = json.getJSONObject("data"); |
|
128 |
+ |
|
129 |
+ return true; |
|
130 |
+ } |
|
131 |
+ }catch (Exception e){ |
|
132 |
+ LogHelper.e(TAG,"fetchTourInfo error happen "+e); |
|
133 |
+ } |
|
134 |
+ return false; |
|
135 |
+ } |
|
136 |
+ |
|
137 |
+ @Override |
|
138 |
+ protected void onPostFail(Context context) { |
|
139 |
+ super.onPostFail(context); |
|
140 |
+ } |
|
141 |
+ |
|
142 |
+ @Override |
|
143 |
+ protected void onPostSuccess(Context context) { |
|
144 |
+ super.onPostSuccess(context); |
|
145 |
+ } |
|
146 |
+ }; |
|
147 |
+ fetchTourInfoTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), UrlContainer.TOUR_INFO_URL); |
|
148 |
+ |
|
149 |
+ } |
|
150 |
+ |
|
95 | 151 |
private synchronized void doFetchPhotoTask(){ |
96 | 152 |
if(!isAdded()){ |
97 | 153 |
return; |
@@ -83,4 +83,6 @@ public class UrlContainer { |
||
83 | 83 |
public static final String GUEST_LOGIN_URL = HOST_URL +"u/guest/login"; |
84 | 84 |
|
85 | 85 |
public static final String GEO_LOCATION_URL = HOST_URL+"geo/submit"; |
86 |
+ //TODO |
|
87 |
+ public static final String TOUR_INFO_URL = HOST_URL +"tg/info"; |
|
86 | 88 |
} |
@@ -3,12 +3,16 @@ |
||
3 | 3 |
android:layout_width="match_parent" |
4 | 4 |
android:layout_height="match_parent" |
5 | 5 |
android:background="@color/background_light_grey_color"> |
6 |
+<LinearLayout |
|
7 |
+ android:layout_width="match_parent" |
|
8 |
+ android:layout_height="match_parent" |
|
9 |
+ android:orientation="vertical"> |
|
6 | 10 |
|
7 | 11 |
<android.support.v4.widget.SwipeRefreshLayout |
8 | 12 |
android:id="@+id/swipe_refresh_layout" |
9 | 13 |
android:layout_width="match_parent" |
10 | 14 |
android:layout_height="match_parent" |
11 |
- > |
|
15 |
+ > |
|
12 | 16 |
|
13 | 17 |
<android.support.v7.widget.RecyclerView |
14 | 18 |
android:id="@+id/recycler_view" |
@@ -19,6 +23,9 @@ |
||
19 | 23 |
|
20 | 24 |
</android.support.v4.widget.SwipeRefreshLayout> |
21 | 25 |
|
26 |
+</LinearLayout> |
|
27 |
+ |
|
28 |
+ |
|
22 | 29 |
<LinearLayout |
23 | 30 |
android:id="@+id/layout_no_photo" |
24 | 31 |
android:layout_width="match_parent" |