|
|
@@ -20,6 +20,7 @@ import android.os.PersistableBundle;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
import android.support.v4.app.FragmentManager;
|
|
|
import android.support.v4.app.FragmentTransaction;
|
|
|
+import android.support.v7.widget.Toolbar;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.DisplayMetrics;
|
|
|
import android.util.Log;
|
|
|
@@ -51,7 +52,6 @@ import com.core.api.wxapi.ApiUtils;
|
|
|
import com.core.app.AppConfig;
|
|
|
import com.core.app.AppConstant;
|
|
|
import com.core.app.MyApplication;
|
|
|
-import com.core.base.BaseActivity;
|
|
|
import com.core.broadcast.MsgBroadcast;
|
|
|
import com.core.dao.SignAutoLogDao;
|
|
|
import com.core.dao.UserDao;
|
|
|
@@ -76,6 +76,7 @@ import com.core.xmpp.listener.AuthStateListener;
|
|
|
import com.core.xmpp.model.SignAutoLogEntity;
|
|
|
import com.modular.appmessages.presenter.MessagePresenter;
|
|
|
import com.modular.apptasks.presenter.AutoPresenter;
|
|
|
+import com.core.base.SupportToolBarActivity;
|
|
|
import com.modular.login.activity.LoginActivity;
|
|
|
import com.uas.appcontact.listener.ImStatusListener;
|
|
|
import com.uas.appcontact.ui.fragment.ContactsFragment;
|
|
|
@@ -107,7 +108,7 @@ import java.util.Map;
|
|
|
import static android.view.View.GONE;
|
|
|
|
|
|
|
|
|
-public class MainActivity extends BaseActivity implements ImStatusListener, NetWorkObservable.NetWorkObserver, MessagePresenter.UnReaderListener, AuthStateListener {
|
|
|
+public class MainActivity extends SupportToolBarActivity implements ImStatusListener, NetWorkObservable.NetWorkObserver, MessagePresenter.UnReaderListener, AuthStateListener {
|
|
|
private static final int LOG_SEND_REQUEST = 17519;
|
|
|
public static String HASHCODE = "MainActivity";
|
|
|
public static boolean isUnReadWork; //判断我的空间是否有新内容
|
|
|
@@ -287,7 +288,7 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
mBusinessCircleFragment = new ContactsFragment();
|
|
|
}
|
|
|
changeFragment(mBusinessCircleFragment, TAG_BusinessCircle);//发现
|
|
|
- getSupportActionBar().setTitle(getString(R.string.contact_title));
|
|
|
+ setTitle(getString(R.string.contact_title));
|
|
|
|
|
|
} else if (checkedId == R.id.main_tab_three) { //点击工作选项
|
|
|
if (mWorksFragment == null) {
|
|
|
@@ -297,9 +298,9 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
String role = com.core.utils.CommonUtil.getUserRole();
|
|
|
if (role.equals("2")) {
|
|
|
String master_ch = CommonUtil.getSharedPreferences(ct, "Master_ch");
|
|
|
- getSupportActionBar().setTitle(TextUtils.isEmpty(master_ch) ? getString(R.string.work_title) : master_ch);
|
|
|
+ setTitle(TextUtils.isEmpty(master_ch) ? getString(R.string.work_title) : master_ch);
|
|
|
} else {
|
|
|
- getSupportActionBar().setTitle(getString(R.string.work_title));
|
|
|
+ setTitle(getString(R.string.work_title));
|
|
|
}
|
|
|
//TODO 当前隐藏新功能提醒红点
|
|
|
main_tab_three_tv.setVisibility(View.INVISIBLE);
|
|
|
@@ -310,7 +311,7 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
mGroupChatFragment = new GroupChatFragment();
|
|
|
}
|
|
|
changeFragment(mGroupChatFragment, TAG_GROUP_CHAT);//群聊
|
|
|
- getSupportActionBar().setTitle(R.string.group_chat);
|
|
|
+ setTitle(R.string.group_chat);
|
|
|
}*/
|
|
|
else if (checkedId == R.id.main_tab_five) {
|
|
|
if (mMeFragment == null) {
|
|
|
@@ -318,7 +319,7 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
}
|
|
|
CommonUtil.setSharedPreferences(ct, com.core.app.Constants.NEW_ME_TAG, true);
|
|
|
changeFragment(mMeFragment, TAG_ME);//我
|
|
|
- getSupportActionBar().setTitle(R.string.me);
|
|
|
+ setTitle(R.string.me);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -488,12 +489,14 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean needNavigation() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
- LogUtil.d("OnCreate start:" + DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
|
|
|
- getSupportActionBar().setDisplayShowHomeEnabled(false);
|
|
|
- getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
|
|
setContentView(R.layout.activity_main);
|
|
|
SIP_USERNAME = MyApplication.getInstance().mLoginUser.getUserId();
|
|
|
String host = mConfig.MeetingHost;
|
|
|
@@ -580,7 +583,7 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
autoPresenter = AutoPresenter.onCreate();
|
|
|
// startService(new Intent(MainActivity.this, AutoErpService.class));
|
|
|
LogUtil.d("OnCreate end:" + DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private AutoPresenter autoPresenter;
|
|
|
@@ -953,6 +956,20 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
if (addFragment.isDetached())
|
|
|
fragmentTransaction.attach(addFragment);
|
|
|
mLastFragment = addFragment;
|
|
|
+
|
|
|
+ if (addFragment == mWorksFragment) {
|
|
|
+ hideToolBar();
|
|
|
+ } else {
|
|
|
+ showToolBar();
|
|
|
+ Toolbar mToolBar = getCommonToolBar();
|
|
|
+ if (mToolBar != null) {
|
|
|
+ if (addFragment == mMessageFragment) {
|
|
|
+ mToolBar.setBackgroundResource(R.drawable.common_toolbar_message_bg);
|
|
|
+ } else {
|
|
|
+ mToolBar.setBackgroundResource(R.drawable.common_toolbar_bg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
fragmentTransaction.commitAllowingStateLoss();
|
|
|
}
|
|
|
|
|
|
@@ -981,12 +998,12 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
*/
|
|
|
private void updateMessageTitle() {
|
|
|
if (mImStatus == AuthStateListener.AUTH_STATE_NOT) {
|
|
|
- getSupportActionBar().setTitle(R.string.msg_offline);
|
|
|
+ setTitle(R.string.msg_offline);
|
|
|
// mMessageFragment.setNetNoticeVisiable(true);
|
|
|
} else if (mImStatus == AuthStateListener.AUTH_STATE_ING) {
|
|
|
- getSupportActionBar().setTitle(R.string.msg_connect);
|
|
|
+ setTitle(R.string.msg_connect);
|
|
|
} else if (mImStatus == AuthStateListener.AUTH_STATE_SUCCESS) {
|
|
|
- getSupportActionBar().setTitle(R.string.msg_online);
|
|
|
+ setTitle(R.string.msg_online);
|
|
|
// mMessageFragment.setNetNoticeVisiable(false);
|
|
|
}
|
|
|
}
|
|
|
@@ -1103,4 +1120,4 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
|
|
|
updateMsgUnReadTv();
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|