|
|
@@ -83,8 +83,8 @@ import java.util.List;
|
|
|
public class MainActivity extends BaseActivity implements NetWorkObserver, AuthStateListener {
|
|
|
public final static String SIP_PASSWORD = "ms_2014_0528@sk!@#";
|
|
|
public static String HASHCODE = "MainActivity";
|
|
|
- private static final String TIME_MILL = "TIMEMILL";
|
|
|
- public static long timeMin;
|
|
|
+ private static final String TIME_MAIN = "TIMEMAIN";
|
|
|
+ public static long timeMin=-1;
|
|
|
public static boolean isUnReadWork; //判断我的空间是否有新内容
|
|
|
public final static int SIP_SERVER_PORT = 5060;// 端口
|
|
|
public final static String EXTRAT_SIP_SESSION_ID = "SipSession";
|
|
|
@@ -123,7 +123,7 @@ public class MainActivity extends BaseActivity implements NetWorkObserver, AuthS
|
|
|
private FriendFragment mFriend;// 互相关注
|
|
|
private AttentionFragment mAttention;// 单向关注
|
|
|
private RoomFragment mRoom;// 关注房间
|
|
|
- public static String BAIDU_PUSH ="BAIDUPUSH";
|
|
|
+ public static String BAIDU_PUSH = "BAIDUPUSH";
|
|
|
private boolean mXmppBind;
|
|
|
private CoreService mCoreService;
|
|
|
private boolean isPause = true;// 界面是否暂停
|
|
|
@@ -188,11 +188,11 @@ public class MainActivity extends BaseActivity implements NetWorkObserver, AuthS
|
|
|
}
|
|
|
changeFragment(mWorksFragment, TAG_NEARBY);//附近
|
|
|
getSupportActionBar().setTitle(R.string.nearby);
|
|
|
- PreferenceUtils.putLong(mContext, TIME_MILL, timeMin);
|
|
|
+ PreferenceUtils.putLong(mContext, TIME_MAIN, timeMin);
|
|
|
unWorkReadTV.setVisibility(View.GONE);
|
|
|
}
|
|
|
/* else if (checkedId == R.id.main_tab_four) {
|
|
|
- if (mGroupChatFragment == null) {
|
|
|
+ if (mGroupChatFragment == null) {
|
|
|
mGroupChatFragment = new GroupChatFragment();
|
|
|
}
|
|
|
changeFragment(mGroupChatFragment, TAG_GROUP_CHAT);//群聊
|
|
|
@@ -230,34 +230,47 @@ public class MainActivity extends BaseActivity implements NetWorkObserver, AuthS
|
|
|
@Override
|
|
|
public void onResponse(ArrayResult<CircleMessage> result) {
|
|
|
boolean success = Result.defaultParser(mContext, result, true);
|
|
|
- if (mWorksFragment == null) {
|
|
|
- mWorksFragment = new WorksFragment();
|
|
|
- }
|
|
|
if (success) {
|
|
|
List<CircleMessage> datas = result.getData();
|
|
|
if (datas != null && datas.size() > 0) { // 没有更多数据
|
|
|
- FileDataHelper.writeFileData(mContext, mLoginUserId, FileDataHelper.FILE_BUSINESS_CIRCLE, result);
|
|
|
- if (datas.get(0).getTime() > 0) {
|
|
|
- long time = PreferenceUtils.getLong(mContext, TIME_MILL);
|
|
|
- if (time != datas.get(0).getTime()) {
|
|
|
- unWorkReadTV.setVisibility(View.VISIBLE);
|
|
|
- timeMin = datas.get(0).getTime();
|
|
|
- isUnReadWork = true;
|
|
|
-// mWorksFragment.onClickFragment(true);
|
|
|
- } else {
|
|
|
-// mWorksFragment.onClickFragment(false);
|
|
|
- unWorkReadTV.setVisibility(View.GONE);
|
|
|
-// isUnReadWork = false;
|
|
|
- }
|
|
|
+// FileDataHelper.writeFileData(mContext, mLoginUserId, FileDataHelper.FILE_BUSINESS_CIRCLE, result);
|
|
|
+ long newTime=datas.get(0).getTime(); //获取最新时间
|
|
|
+ long oldTime= PreferenceUtils.getLong(mContext, TIME_MAIN); //获取以前时间
|
|
|
+ if (newTime>oldTime){//当有新消息
|
|
|
+ unWorkReadTV.setVisibility(View.VISIBLE);
|
|
|
+ timeMin=newTime;
|
|
|
+ isUnReadWork = true;
|
|
|
+ }else{
|
|
|
+ unWorkReadTV.setVisibility(View.GONE);
|
|
|
+ isUnReadWork = false;
|
|
|
}
|
|
|
+
|
|
|
+// if (datas.get(0).getTime() > 0) {
|
|
|
+// long time;
|
|
|
+// if (timeMin ==-1) {
|
|
|
+// time = PreferenceUtils.getLong(mContext, TIME_MILL);
|
|
|
+// } else {
|
|
|
+// time = timeMin;
|
|
|
+// }
|
|
|
+// if (time != datas.get(0).getTime()) {
|
|
|
+// unWorkReadTV.setVisibility(View.VISIBLE);
|
|
|
+// timeMin = datas.get(0).getTime();
|
|
|
+// isUnReadWork = true;
|
|
|
+//// mWorksFragment.onClickFragment(true);
|
|
|
+// } else {
|
|
|
+//// mWorksFragment.onClickFragment(false);
|
|
|
+// unWorkReadTV.setVisibility(View.GONE);
|
|
|
+//// isUnReadWork = false;
|
|
|
+// }
|
|
|
+// }
|
|
|
} else {
|
|
|
unWorkReadTV.setVisibility(View.GONE);
|
|
|
-// isUnReadWork = false;
|
|
|
+ isUnReadWork = false;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
unWorkReadTV.setVisibility(View.GONE);
|
|
|
-// isUnReadWork = false;
|
|
|
+ isUnReadWork = false;
|
|
|
}
|
|
|
}
|
|
|
}, CircleMessage.class, params);
|
|
|
@@ -392,10 +405,9 @@ public class MainActivity extends BaseActivity implements NetWorkObserver, AuthS
|
|
|
//TODO 百度开始推送
|
|
|
PushManager.startWork(getApplicationContext(), PushConstants.LOGIN_TYPE_API_KEY, "iF9q4ruTpFwQ9x8pY6Edqm9G");
|
|
|
int isPush = PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.BAIDU_PUSH);
|
|
|
- if (isPush==0) {
|
|
|
- Log.i("MainActivity","关闭百度推送");
|
|
|
+ if (isPush == 0) {
|
|
|
+ Log.i("MainActivity", "关闭百度推送");
|
|
|
PushManager.stopWork(this);
|
|
|
- PushManager.unbind(this);
|
|
|
}
|
|
|
mActivityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
|
|
if (savedInstanceState != null) {
|
|
|
@@ -713,5 +725,4 @@ public class MainActivity extends BaseActivity implements NetWorkObserver, AuthS
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|