消息
This commit is contained in:
@@ -53,7 +53,6 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
private int myeditcode = 1000;
|
||||
|
||||
private Loader mGankLoader;
|
||||
private int nowradioId;
|
||||
|
||||
// @Override
|
||||
// public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
@@ -69,7 +68,13 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
public void visibilyBottom(int isVisibily) {
|
||||
findViewById(R.id.rl_bottom).setVisibility(isVisibily);
|
||||
}
|
||||
|
||||
public void setMessageCount(boolean isRed){
|
||||
if (isRed){
|
||||
findViewById(R.id.redview).setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
findViewById(R.id.redview).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
//2. 保存MyOnTouchListener接口的列表
|
||||
private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<MyOnTouchListener>();
|
||||
|
||||
@@ -184,14 +189,11 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
radioGroup = mDataBinding.radioGroup;
|
||||
for (int i = 0; i < radioGroup.getChildCount(); i++) {
|
||||
RadioButton myRadioButton = (RadioButton) radioGroup.getChildAt(i);
|
||||
myRadioButton.setOnClickListener(this);
|
||||
|
||||
}
|
||||
findViewById(R.id.rl2).setOnClickListener(this);
|
||||
findViewById(R.id.button).setOnClickListener(this);
|
||||
findViewById(R.id.button1).setOnClickListener(this);
|
||||
findViewById(R.id.button4).setOnClickListener(this);
|
||||
mDataBinding.button.setChecked(true);
|
||||
nowradioId = mDataBinding.button.getId();
|
||||
mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||
changeFragment(mDataBinding.button.getId());
|
||||
|
||||
@@ -204,6 +206,10 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
|
||||
switch (i) {
|
||||
case R.id.button:
|
||||
mDataBinding.button.setChecked(true);
|
||||
mDataBinding.button1.setChecked(false);
|
||||
mDataBinding.button2.setChecked(false);
|
||||
mDataBinding.button4.setChecked(false);
|
||||
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||
if (fragment0 == null) {
|
||||
fragment0 = MainFragment.newInstance("", "");
|
||||
@@ -216,6 +222,10 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
//setSytemBar(R.color.transparent);
|
||||
break;
|
||||
case R.id.button1:
|
||||
mDataBinding.button.setChecked(false);
|
||||
mDataBinding.button1.setChecked(true);
|
||||
mDataBinding.button2.setChecked(false);
|
||||
mDataBinding.button4.setChecked(false);
|
||||
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||
if (fragment1 == null) {
|
||||
|
||||
@@ -229,8 +239,11 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
currentFragment = fragment1;
|
||||
|
||||
break;
|
||||
case R.id.button2:
|
||||
|
||||
case R.id.rl2:
|
||||
mDataBinding.button.setChecked(false);
|
||||
mDataBinding.button1.setChecked(false);
|
||||
mDataBinding.button2.setChecked(true);
|
||||
mDataBinding.button4.setChecked(false);
|
||||
if (messageFragment == null) {
|
||||
messageFragment = MessageFragment.newInstance();
|
||||
fragmentTransaction.add(R.id.mycontent, messageFragment, "fragment2");
|
||||
@@ -252,7 +265,10 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
currentFragment = fragment3;
|
||||
break;
|
||||
case R.id.button4:
|
||||
|
||||
mDataBinding.button.setChecked(false);
|
||||
mDataBinding.button1.setChecked(false);
|
||||
mDataBinding.button2.setChecked(false);
|
||||
mDataBinding.button4.setChecked(true);
|
||||
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.mipmap.beijing));
|
||||
if (fragment4 == null) {
|
||||
fragment4 = Main4Fragment.newInstance("", "");
|
||||
@@ -283,24 +299,19 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (view.getId() == nowradioId) return;
|
||||
RadioButton myRadioButton = (RadioButton) findViewById(nowradioId);
|
||||
|
||||
if (view.getId() == R.id.button4) {
|
||||
if ((Config.getInstance(MainTabActivity.this).getUser() == null)) {
|
||||
Intent intent = new Intent(MainTabActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
myRadioButton = (RadioButton) view;
|
||||
myRadioButton.setChecked(false);
|
||||
myRadioButton = (RadioButton) findViewById(nowradioId);
|
||||
myRadioButton.setChecked(true);
|
||||
mDataBinding.button.setChecked(false);
|
||||
mDataBinding.button1.setChecked(false);
|
||||
mDataBinding.button2.setChecked(false);
|
||||
mDataBinding.button4.setChecked(false);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
myRadioButton.setChecked(false);
|
||||
myRadioButton = (RadioButton) view;
|
||||
myRadioButton.setChecked(true);
|
||||
nowradioId = view.getId();
|
||||
changeFragment(view.getId());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user