@@ -53,7 +53,8 @@ import ai.pai.client.views.GroupSelectPopup; |
||
| 53 | 53 |
import ai.pai.client.views.PersonInfoPopup; |
| 54 | 54 |
|
| 55 | 55 |
public class MainActivity extends AppCompatActivity |
| 56 |
- implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener, GroupService.GroupServiceListener,IndicatorViewPager.OnIndicatorPageChangeListener {
|
|
| 56 |
+ implements TabRecentPhotoFragment.TourInfoListener, NavigationView.OnNavigationItemSelectedListener, View.OnClickListener, |
|
| 57 |
+ GroupService.GroupServiceListener,IndicatorViewPager.OnIndicatorPageChangeListener {
|
|
| 57 | 58 |
|
| 58 | 59 |
private DrawerLayout drawer; |
| 59 | 60 |
private Indicator indicator; |
@@ -288,8 +289,13 @@ public class MainActivity extends AppCompatActivity |
||
| 288 | 289 |
|
| 289 | 290 |
@Override |
| 290 | 291 |
public Fragment getFragmentForPage(int position) {
|
| 291 |
- |
|
| 292 |
- return position == 0 ? new TabRecentPhotoFragment() : new TabMessageFragment(); |
|
| 292 |
+ if(position==0){
|
|
| 293 |
+ TabRecentPhotoFragment fragment = new TabRecentPhotoFragment(); |
|
| 294 |
+ fragment.setTourInfoListener(MainActivity.this); |
|
| 295 |
+ return fragment; |
|
| 296 |
+ }else{
|
|
| 297 |
+ return new TabMessageFragment(); |
|
| 298 |
+ } |
|
| 293 | 299 |
} |
| 294 | 300 |
|
| 295 | 301 |
@Override |
@@ -385,6 +391,15 @@ public class MainActivity extends AppCompatActivity |
||
| 385 | 391 |
} |
| 386 | 392 |
} |
| 387 | 393 |
|
| 394 |
+ @Override |
|
| 395 |
+ public void onTourInfoFetched() {
|
|
| 396 |
+ if(isDestroy){
|
|
| 397 |
+ return; |
|
| 398 |
+ } |
|
| 399 |
+ callGuideBtn.setVisibility(TextUtils.isEmpty(Preferences.getInstance(this).getTourGuidePhone()) ? View.INVISIBLE : View.VISIBLE); |
|
| 400 |
+ gatherBtn.setVisibility(Preferences.getInstance(this).getGatherTime()<System.currentTimeMillis() ? View.INVISIBLE : View.VISIBLE); |
|
| 401 |
+ } |
|
| 402 |
+ |
|
| 388 | 403 |
private static class GroupServiceConnection implements ServiceConnection {
|
| 389 | 404 |
|
| 390 | 405 |
private GroupService.GroupServiceListener listener; |
@@ -69,6 +69,7 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
| 69 | 69 |
private ConvenientBanner banner; |
| 70 | 70 |
|
| 71 | 71 |
private String[] images = new String[2]; |
| 72 |
+ private TourInfoListener toutInfoListener; |
|
| 72 | 73 |
|
| 73 | 74 |
@Override |
| 74 | 75 |
public void onCreate( Bundle savedInstanceState) {
|
@@ -99,9 +100,6 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
| 99 | 100 |
loadMoreView = LayoutInflater .from(getActivity()).inflate(R.layout.view_load_more, recyclerView, false); |
| 100 | 101 |
RecyclerViewUtils.setFooterView(recyclerView,loadMoreView); |
| 101 | 102 |
headerView = LayoutInflater .from(getActivity()).inflate(R.layout.recyclerview_header_view, recyclerView, false); |
| 102 |
- RecyclerViewUtils.setHeaderView(recyclerView,headerView); |
|
| 103 |
- headerView.setVisibility(View.GONE); |
|
| 104 |
- banner = (ConvenientBanner)headerView.findViewById(R.id.banner_tour); |
|
| 105 | 103 |
swipeRefreshLayout.setOnRefreshListener(this); |
| 106 | 104 |
scrollListener = new EndlessRecyclerOnScrollListener() {
|
| 107 | 105 |
@Override |
@@ -197,6 +195,9 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
| 197 | 195 |
protected void onPostSuccess(Context context) {
|
| 198 | 196 |
super.onPostSuccess(context); |
| 199 | 197 |
initBanner(); |
| 198 |
+ if(toutInfoListener!=null){
|
|
| 199 |
+ toutInfoListener.onTourInfoFetched(); |
|
| 200 |
+ } |
|
| 200 | 201 |
if(Preferences.getInstance(context).isTourMode()){
|
| 201 | 202 |
LogHelper.d(TAG,"导游定位 当前是旅行模式"); |
| 202 | 203 |
Intent intent = new Intent(context, MyLocationService.class); |
@@ -225,29 +226,29 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
| 225 | 226 |
|
| 226 | 227 |
private void initBanner(){
|
| 227 | 228 |
if(TextUtils.isEmpty(images[0]) && TextUtils.isEmpty(images[1])){
|
| 228 |
- headerView.setVisibility(View.GONE); |
|
| 229 |
+ RecyclerViewUtils.removeHeaderView(recyclerView); |
|
| 229 | 230 |
return; |
| 230 | 231 |
} |
| 231 | 232 |
String[] imageCopy = new String[2]; |
| 232 | 233 |
imageCopy[0] = images[0]; |
| 233 | 234 |
imageCopy[1] = images[1]; |
| 234 | 235 |
if(TextUtils.isEmpty(images[0])||TextUtils.isEmpty(images[1])){
|
| 235 |
- images = new String[1]; |
|
| 236 |
- if(!TextUtils.isEmpty(imageCopy[0])){
|
|
| 237 |
- images[0] = imageCopy[0]; |
|
| 236 |
+ imageCopy = new String[1]; |
|
| 237 |
+ if(!TextUtils.isEmpty(images[0])){
|
|
| 238 |
+ imageCopy[0] = images[0]; |
|
| 238 | 239 |
} |
| 239 |
- if(!TextUtils.isEmpty(imageCopy[1])){
|
|
| 240 |
- images[0] =imageCopy[1]; |
|
| 240 |
+ if(!TextUtils.isEmpty(images[1])){
|
|
| 241 |
+ imageCopy[0] =images[1]; |
|
| 241 | 242 |
} |
| 242 | 243 |
} |
| 243 |
- headerView.setVisibility(View.VISIBLE); |
|
| 244 |
- |
|
| 244 |
+ RecyclerViewUtils.setHeaderView(recyclerView,headerView); |
|
| 245 |
+ banner = (ConvenientBanner)headerView.findViewById(R.id.banner_tour); |
|
| 245 | 246 |
banner.setPages(new CBViewHolderCreator<NetworkImageHolderView>() {
|
| 246 | 247 |
@Override |
| 247 | 248 |
public NetworkImageHolderView createHolder() {
|
| 248 | 249 |
return new NetworkImageHolderView(); |
| 249 | 250 |
} |
| 250 |
- },Arrays.asList(images)).setPageIndicator(new int[]{R.drawable.ic_page_indicator, R.drawable.ic_page_indicator_focused}).setOnItemClickListener(this);
|
|
| 251 |
+ },Arrays.asList(imageCopy)).setPageIndicator(new int[]{R.drawable.ic_page_indicator, R.drawable.ic_page_indicator_focused}).setOnItemClickListener(this);
|
|
| 251 | 252 |
banner.startTurning(3000); |
| 252 | 253 |
} |
| 253 | 254 |
|
@@ -374,9 +375,16 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh |
||
| 374 | 375 |
|
| 375 | 376 |
@Override |
| 376 | 377 |
public void UpdateUI(Context context,int position, String data) {
|
| 377 |
- imageView.setImageResource(R.drawable.default_img); |
|
| 378 | 378 |
ImageLoader.getInstance().displayImage(data,imageView,PhotoLoader.getPhotoOptions()); |
| 379 | 379 |
} |
| 380 | 380 |
} |
| 381 | 381 |
|
| 382 |
+ public void setTourInfoListener(TourInfoListener listener){
|
|
| 383 |
+ this.toutInfoListener = listener; |
|
| 384 |
+ } |
|
| 385 |
+ |
|
| 386 |
+ public interface TourInfoListener{
|
|
| 387 |
+ void onTourInfoFetched(); |
|
| 388 |
+ } |
|
| 389 |
+ |
|
| 382 | 390 |
} |
@@ -49,7 +49,7 @@ public class GatherInfoPopup extends BasePopupWindow {
|
||
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
private void init(){
|
| 52 |
- String time = TimeUtils.getGatherTimeStr(Preferences.getInstance(context).getGatherTime()); |
|
| 52 |
+ String time = TimeUtils.getGatherTimeStr(Preferences.getInstance(context).getGatherTime()-30*60*1000); |
|
| 53 | 53 |
if(time.length()==0){
|
| 54 | 54 |
time = context.getString(R.string.gather_no_time); |
| 55 | 55 |
} |