消息
This commit is contained in:
@@ -53,7 +53,6 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
private int myeditcode = 1000;
|
private int myeditcode = 1000;
|
||||||
|
|
||||||
private Loader mGankLoader;
|
private Loader mGankLoader;
|
||||||
private int nowradioId;
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean dispatchTouchEvent(MotionEvent ev) {
|
// public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||||
@@ -69,7 +68,13 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
public void visibilyBottom(int isVisibily) {
|
public void visibilyBottom(int isVisibily) {
|
||||||
findViewById(R.id.rl_bottom).setVisibility(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接口的列表
|
//2. 保存MyOnTouchListener接口的列表
|
||||||
private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<MyOnTouchListener>();
|
private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<MyOnTouchListener>();
|
||||||
|
|
||||||
@@ -184,14 +189,11 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
radioGroup = mDataBinding.radioGroup;
|
findViewById(R.id.rl2).setOnClickListener(this);
|
||||||
for (int i = 0; i < radioGroup.getChildCount(); i++) {
|
findViewById(R.id.button).setOnClickListener(this);
|
||||||
RadioButton myRadioButton = (RadioButton) radioGroup.getChildAt(i);
|
findViewById(R.id.button1).setOnClickListener(this);
|
||||||
myRadioButton.setOnClickListener(this);
|
findViewById(R.id.button4).setOnClickListener(this);
|
||||||
|
|
||||||
}
|
|
||||||
mDataBinding.button.setChecked(true);
|
mDataBinding.button.setChecked(true);
|
||||||
nowradioId = mDataBinding.button.getId();
|
|
||||||
mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||||
changeFragment(mDataBinding.button.getId());
|
changeFragment(mDataBinding.button.getId());
|
||||||
|
|
||||||
@@ -204,6 +206,10 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case R.id.button:
|
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));
|
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||||
if (fragment0 == null) {
|
if (fragment0 == null) {
|
||||||
fragment0 = MainFragment.newInstance("", "");
|
fragment0 = MainFragment.newInstance("", "");
|
||||||
@@ -216,6 +222,10 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
//setSytemBar(R.color.transparent);
|
//setSytemBar(R.color.transparent);
|
||||||
break;
|
break;
|
||||||
case R.id.button1:
|
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));
|
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||||
if (fragment1 == null) {
|
if (fragment1 == null) {
|
||||||
|
|
||||||
@@ -229,8 +239,11 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
currentFragment = fragment1;
|
currentFragment = fragment1;
|
||||||
|
|
||||||
break;
|
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) {
|
if (messageFragment == null) {
|
||||||
messageFragment = MessageFragment.newInstance();
|
messageFragment = MessageFragment.newInstance();
|
||||||
fragmentTransaction.add(R.id.mycontent, messageFragment, "fragment2");
|
fragmentTransaction.add(R.id.mycontent, messageFragment, "fragment2");
|
||||||
@@ -252,7 +265,10 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
currentFragment = fragment3;
|
currentFragment = fragment3;
|
||||||
break;
|
break;
|
||||||
case R.id.button4:
|
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));
|
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.mipmap.beijing));
|
||||||
if (fragment4 == null) {
|
if (fragment4 == null) {
|
||||||
fragment4 = Main4Fragment.newInstance("", "");
|
fragment4 = Main4Fragment.newInstance("", "");
|
||||||
@@ -283,24 +299,19 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (view.getId() == nowradioId) return;
|
|
||||||
RadioButton myRadioButton = (RadioButton) findViewById(nowradioId);
|
|
||||||
if (view.getId() == R.id.button4) {
|
if (view.getId() == R.id.button4) {
|
||||||
if ((Config.getInstance(MainTabActivity.this).getUser() == null)) {
|
if ((Config.getInstance(MainTabActivity.this).getUser() == null)) {
|
||||||
Intent intent = new Intent(MainTabActivity.this, LoginActivity.class);
|
Intent intent = new Intent(MainTabActivity.this, LoginActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
myRadioButton = (RadioButton) view;
|
mDataBinding.button.setChecked(false);
|
||||||
myRadioButton.setChecked(false);
|
mDataBinding.button1.setChecked(false);
|
||||||
myRadioButton = (RadioButton) findViewById(nowradioId);
|
mDataBinding.button2.setChecked(false);
|
||||||
myRadioButton.setChecked(true);
|
mDataBinding.button4.setChecked(false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myRadioButton.setChecked(false);
|
|
||||||
myRadioButton = (RadioButton) view;
|
|
||||||
myRadioButton.setChecked(true);
|
|
||||||
nowradioId = view.getId();
|
|
||||||
changeFragment(view.getId());
|
changeFragment(view.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,15 @@ public class MessageEntity {
|
|||||||
private String url;
|
private String url;
|
||||||
private String ctime;
|
private String ctime;
|
||||||
private String is_dot;
|
private String is_dot;
|
||||||
|
private String contents;
|
||||||
|
|
||||||
|
public String getContents() {
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContents(String contents) {
|
||||||
|
this.contents = contents;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCtime() {
|
public String getCtime() {
|
||||||
return ctime;
|
return ctime;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.internal.LinkedTreeMap;
|
import com.google.gson.internal.LinkedTreeMap;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.sl.house_property.MainTabActivity;
|
||||||
import com.sl.house_property.R;
|
import com.sl.house_property.R;
|
||||||
import com.sl.house_property.WebActivitytwo;
|
import com.sl.house_property.WebActivitytwo;
|
||||||
|
|
||||||
@@ -109,8 +110,11 @@ public class MessageFragment extends Fragment {
|
|||||||
int i = Integer.parseInt(messageEntity.getMsg_count());
|
int i = Integer.parseInt(messageEntity.getMsg_count());
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
tvTitle.setText("消息(" + i + ")");
|
tvTitle.setText("消息(" + i + ")");
|
||||||
|
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||||
|
activity.setMessageCount(true);
|
||||||
} else {
|
} else {
|
||||||
|
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||||
|
activity.setMessageCount(false);
|
||||||
tvTitle.setText("消息");
|
tvTitle.setText("消息");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
android:background="@drawable/background_grey_line"
|
android:background="@drawable/background_grey_line"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<RadioGroup
|
<LinearLayout
|
||||||
android:id="@+id/radioGroup"
|
android:id="@+id/radioGroup"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dip"
|
android:layout_height="50dip"
|
||||||
@@ -63,16 +63,7 @@
|
|||||||
android:text="@string/news"
|
android:text="@string/news"
|
||||||
android:textColor="@color/radiobuttoncolor" />
|
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
|
<RadioButton
|
||||||
android:id="@+id/button1"
|
android:id="@+id/button1"
|
||||||
@@ -84,7 +75,32 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="邻里圈"
|
android:text="邻里圈"
|
||||||
android:textColor="@color/radiobuttoncolor" />
|
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
|
<RadioButton
|
||||||
android:id="@+id/like"
|
android:id="@+id/like"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -131,7 +147,7 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/news4"
|
android:text="@string/news4"
|
||||||
android:textColor="@color/radiobuttoncolor" />
|
android:textColor="@color/radiobuttoncolor" />
|
||||||
</RadioGroup>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user