消息
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,15 @@ public class MessageEntity {
|
||||
private String url;
|
||||
private String ctime;
|
||||
private String is_dot;
|
||||
private String contents;
|
||||
|
||||
public String getContents() {
|
||||
return contents;
|
||||
}
|
||||
|
||||
public void setContents(String contents) {
|
||||
this.contents = contents;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sl.house_property.MainTabActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.WebActivitytwo;
|
||||
|
||||
@@ -109,8 +110,11 @@ public class MessageFragment extends Fragment {
|
||||
int i = Integer.parseInt(messageEntity.getMsg_count());
|
||||
if (i > 0) {
|
||||
tvTitle.setText("消息(" + i + ")");
|
||||
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.setMessageCount(true);
|
||||
} else {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.setMessageCount(false);
|
||||
tvTitle.setText("消息");
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
android:background="@drawable/background_grey_line"
|
||||
android:visibility="gone" />
|
||||
|
||||
<RadioGroup
|
||||
<LinearLayout
|
||||
android:id="@+id/radioGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dip"
|
||||
@@ -63,16 +63,7 @@
|
||||
android:text="@string/news"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:drawableTop="@drawable/main_bottom_3"
|
||||
android:gravity="center"
|
||||
android:text="消息"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/button1"
|
||||
@@ -84,7 +75,32 @@
|
||||
android:gravity="center"
|
||||
android:text="邻里圈"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
<RadioButton
|
||||
android:clickable="false"
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@null"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:drawableTop="@drawable/main_bottom_3"
|
||||
android:gravity="center"
|
||||
android:text="消息"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
|
||||
<View
|
||||
android:visibility="gone"
|
||||
android:id="@+id/redview"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginLeft="-8dp"
|
||||
android:layout_toRightOf="@id/button2"
|
||||
android:background="@drawable/circle_red" />
|
||||
</RelativeLayout>
|
||||
<RadioButton
|
||||
android:id="@+id/like"
|
||||
android:layout_width="match_parent"
|
||||
@@ -131,7 +147,7 @@
|
||||
android:gravity="center"
|
||||
android:text="@string/news4"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
Reference in New Issue
Block a user