Merge branch 'master' of https://gitee.com/renjianbo0118/HouseProperty
This commit is contained in:
@@ -33,6 +33,7 @@ public ProgressDialog progressDialog;
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(getLayoutId(), null);
|
View view = inflater.inflate(getLayoutId(), null);
|
||||||
|
|
||||||
mDataBinding = DataBindingUtil.bind(view);
|
mDataBinding = DataBindingUtil.bind(view);
|
||||||
onCreateVew(inflater, savedInstanceState);
|
onCreateVew(inflater, savedInstanceState);
|
||||||
progressDialog=new ProgressDialog(getActivity());
|
progressDialog=new ProgressDialog(getActivity());
|
||||||
|
|||||||
@@ -7,39 +7,22 @@ import android.os.Bundle;
|
|||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.internal.LinkedTreeMap;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
import com.selectpicker.OptionsPopupWindow;
|
|
||||||
import com.sl.house_property.cart.CartFragment;
|
import com.sl.house_property.cart.CartFragment;
|
||||||
import com.sl.house_property.databinding.ActivityMainTabBinding;
|
import com.sl.house_property.databinding.ActivityMainTabBinding;
|
||||||
import com.sl.house_property.discovery.DiscoveryFragment;
|
import com.sl.house_property.discovery.DiscoveryFragment;
|
||||||
import com.sl.house_property.discovery.LikeFragment;
|
import com.sl.house_property.message.MessageFragment;
|
||||||
import com.sl.house_property.user.MyPropertyActivity;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import entity.MyHomequEntity;
|
|
||||||
import entity.RegisterUser;
|
|
||||||
import entity.SimpleEntity;
|
|
||||||
import http.ApiConfig;
|
|
||||||
import my_loader.Loader;
|
import my_loader.Loader;
|
||||||
import my_loader.Resultcode;
|
|
||||||
import rx.Subscription;
|
|
||||||
import rx.functions.Action1;
|
|
||||||
import tools.Config;
|
import tools.Config;
|
||||||
import utils.Md5;
|
|
||||||
import utils.SPUtils;
|
|
||||||
|
|
||||||
public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||||
implements View.OnClickListener,
|
implements View.OnClickListener,
|
||||||
@@ -64,13 +47,13 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
private Main3Fragment fragment2;
|
private Main3Fragment fragment2;
|
||||||
private CartFragment fragment3;
|
private CartFragment fragment3;
|
||||||
private Main4Fragment fragment4;
|
private Main4Fragment fragment4;
|
||||||
|
private MessageFragment messageFragment;
|
||||||
// private LikeFragment likeFragment;
|
// private LikeFragment likeFragment;
|
||||||
private Fragment currentFragment;
|
private Fragment currentFragment;
|
||||||
|
|
||||||
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) {
|
||||||
@@ -86,7 +69,15 @@ 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(int num){
|
||||||
|
TextView viewById = findViewById(R.id.redview);
|
||||||
|
if (num>0){
|
||||||
|
viewById.setText(num);
|
||||||
|
viewById .setVisibility(View.VISIBLE);
|
||||||
|
}else {
|
||||||
|
viewById.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
//2. 保存MyOnTouchListener接口的列表
|
//2. 保存MyOnTouchListener接口的列表
|
||||||
private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<MyOnTouchListener>();
|
private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<MyOnTouchListener>();
|
||||||
|
|
||||||
@@ -201,14 +192,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());
|
||||||
|
|
||||||
@@ -221,6 +209,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("", "");
|
||||||
@@ -233,6 +225,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) {
|
||||||
|
|
||||||
@@ -246,16 +242,19 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
|||||||
currentFragment = fragment1;
|
currentFragment = fragment1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case R.id.button2:
|
case R.id.rl2:
|
||||||
|
mDataBinding.button.setChecked(false);
|
||||||
if (fragment2 == null) {
|
mDataBinding.button1.setChecked(false);
|
||||||
fragment2 = Main3Fragment.newInstance("", "");
|
mDataBinding.button2.setChecked(true);
|
||||||
fragmentTransaction.add(R.id.mycontent, fragment2, "fragment2");
|
mDataBinding.button4.setChecked(false);
|
||||||
|
if (messageFragment == null) {
|
||||||
|
messageFragment = MessageFragment.newInstance();
|
||||||
|
fragmentTransaction.add(R.id.mycontent, messageFragment, "fragment2");
|
||||||
} else {
|
} else {
|
||||||
fragmentTransaction.show(fragment2);
|
fragmentTransaction.show(messageFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFragment = fragment2;
|
currentFragment = messageFragment;
|
||||||
break;
|
break;
|
||||||
case R.id.button3:
|
case R.id.button3:
|
||||||
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||||
@@ -269,7 +268,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("", "");
|
||||||
@@ -300,24 +302,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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,14 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
public class WebActivitytwo extends AppCompatActivity implements View.OnClickListener {
|
public class WebActivitytwo extends AppCompatActivity implements View.OnClickListener {
|
||||||
public final static String URL = "url";
|
public final static String URL = "url";
|
||||||
public final static String TITLE = "title";
|
public final static String TITLE = "title";
|
||||||
private WebView webView;
|
private WebView webView;
|
||||||
private ProgressBar pb;
|
private ProgressBar pb;
|
||||||
private RelativeLayout mLayTopLeftTv;
|
private ImageView mLayTopLeftTv;
|
||||||
private TextView mLayTopTitle;
|
private TextView mLayTopTitle;
|
||||||
private TextView mRight;
|
private TextView mRight;
|
||||||
private ImageView mIvCode;
|
private ImageView mIvCode;
|
||||||
@@ -40,6 +42,11 @@ public class WebActivitytwo extends AppCompatActivity implements View.OnClickLis
|
|||||||
setContentView(R.layout.activity_webtwo);
|
setContentView(R.layout.activity_webtwo);
|
||||||
String url = getIntent().getStringExtra(URL);
|
String url = getIntent().getStringExtra(URL);
|
||||||
String title = getIntent().getStringExtra(TITLE);
|
String title = getIntent().getStringExtra(TITLE);
|
||||||
|
ImmersionBar.with(this)
|
||||||
|
.keyboardEnable(false) //解决软键盘与底部输入框冲突问题
|
||||||
|
// .keyboardEnable(true, WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
|
||||||
|
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
|
||||||
|
.barColor(R.color.colorPrimary).init();
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
pb.setMax(100);
|
pb.setMax(100);
|
||||||
@@ -80,11 +87,11 @@ public class WebActivitytwo extends AppCompatActivity implements View.OnClickLis
|
|||||||
webView = (WebView) findViewById(R.id.webView);
|
webView = (WebView) findViewById(R.id.webView);
|
||||||
webView.setOnClickListener(this);
|
webView.setOnClickListener(this);
|
||||||
pb = (ProgressBar) findViewById(R.id.pb);
|
pb = (ProgressBar) findViewById(R.id.pb);
|
||||||
mLayTopLeftTv = (RelativeLayout) findViewById(R.id.layTop_left_tv);
|
mLayTopLeftTv = (ImageView) findViewById(R.id.layTop_left_tv);
|
||||||
mLayTopLeftTv.setOnClickListener(this);
|
mLayTopLeftTv.setOnClickListener(this);
|
||||||
mLayTopTitle = (TextView) findViewById(R.id.layTop_title);
|
mLayTopTitle = (TextView) findViewById(R.id.layTop_title);
|
||||||
mRight = (TextView) findViewById(R.id.right);
|
// mRight = (TextView) findViewById(R.id.right);
|
||||||
mIvCode = (ImageView) findViewById(R.id.iv_code);
|
// mIvCode = (ImageView) findViewById(R.id.iv_code);
|
||||||
mPb = (ProgressBar) findViewById(R.id.pb);
|
mPb = (ProgressBar) findViewById(R.id.pb);
|
||||||
mWebView = (WebView) findViewById(R.id.webView);
|
mWebView = (WebView) findViewById(R.id.webView);
|
||||||
mLayTopTitle.setText("智慧豆豆");
|
mLayTopTitle.setText("智慧豆豆");
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.sl.house_property.message;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapShader;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.RectF;
|
||||||
|
import android.graphics.Shader;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
|
public class GlideRoundTransform extends BitmapTransformation {
|
||||||
|
|
||||||
|
private int dp;
|
||||||
|
|
||||||
|
public GlideRoundTransform(int dp) {
|
||||||
|
this.dp = dp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Bitmap transform(@NonNull @NotNull BitmapPool bitmapPool, @NonNull @NotNull Bitmap bitmap, int outWidth, int outHeight) {
|
||||||
|
Bitmap bitmap1 = TransformationUtils.centerCrop(bitmapPool, bitmap, outWidth, outHeight);
|
||||||
|
return roundCrop(bitmapPool, bitmap1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bitmap roundCrop(BitmapPool pool, Bitmap source) {
|
||||||
|
|
||||||
|
if (source == null) return null;
|
||||||
|
Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
if (result == null) {
|
||||||
|
result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas canvas = new Canvas(result);
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setShader(new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
|
||||||
|
paint.setAntiAlias(true);
|
||||||
|
RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
|
||||||
|
canvas.drawRoundRect(rectF, dp, dp, paint);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDiskCacheKey(@NonNull @NotNull MessageDigest messageDigest) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.sl.house_property.message;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.sl.house_property.R;
|
||||||
|
|
||||||
|
public class MessageAdapter extends BaseQuickAdapter<MessageEntity.StoreInfo, BaseViewHolder> {
|
||||||
|
public MessageAdapter() {
|
||||||
|
super(R.layout.item_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder baseViewHolder, MessageEntity.StoreInfo messageEntity) {
|
||||||
|
Glide.with(mContext).load(messageEntity.getImg()).apply(new RequestOptions().transform(new GlideRoundTransform(16)))
|
||||||
|
.into(baseViewHolder.itemView.<ImageView>findViewById(R.id.iv));
|
||||||
|
baseViewHolder.setText(R.id.tv_name, messageEntity.getStore_name());
|
||||||
|
baseViewHolder.setText(R.id.tv_title, messageEntity.getTitle());
|
||||||
|
baseViewHolder.setText(R.id.tv_time, messageEntity.getCtime());
|
||||||
|
if (messageEntity.getIs_dot().equals("1")) {
|
||||||
|
baseViewHolder.getView(R.id.view).setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
baseViewHolder.getView(R.id.view).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.sl.house_property.message;
|
||||||
|
|
||||||
|
import android.support.annotation.Keep;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public class MessageEntity {
|
||||||
|
private ArrayList<StoreInfo> storeInfo;
|
||||||
|
private String userid;
|
||||||
|
private String Msg_count;
|
||||||
|
|
||||||
|
public String getMsg_count() {
|
||||||
|
return Msg_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg_count(String msg_count) {
|
||||||
|
Msg_count = msg_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<StoreInfo> getStoreInfo() {
|
||||||
|
return storeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoreInfo(ArrayList<StoreInfo> storeInfo) {
|
||||||
|
this.storeInfo = storeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserid() {
|
||||||
|
return userid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserid(String userid) {
|
||||||
|
this.userid = userid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class StoreInfo{
|
||||||
|
private String title;
|
||||||
|
private String img;
|
||||||
|
private String store_name;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCtime(String ctime) {
|
||||||
|
this.ctime = ctime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIs_dot() {
|
||||||
|
return is_dot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_dot(String is_dot) {
|
||||||
|
this.is_dot = is_dot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(String img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStore_name() {
|
||||||
|
return store_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStore_name(String store_name) {
|
||||||
|
this.store_name = store_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.sl.house_property.message;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
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.gyf.immersionbar.ImmersionBar;
|
||||||
|
import com.sl.house_property.MainTabActivity;
|
||||||
|
import com.sl.house_property.R;
|
||||||
|
import com.sl.house_property.WebActivitytwo;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import entity.RegisterUser;
|
||||||
|
import http.ApiConfig;
|
||||||
|
import my_loader.Loader;
|
||||||
|
import my_loader.Resultcode;
|
||||||
|
import rx.functions.Action1;
|
||||||
|
import tools.Config;
|
||||||
|
import utils.Md5;
|
||||||
|
|
||||||
|
public class MessageFragment extends Fragment {
|
||||||
|
// private int pageIndex = 0;
|
||||||
|
private MessageAdapter adapter = null;
|
||||||
|
private TextView tvTitle;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_message, null);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MessageFragment newInstance() {
|
||||||
|
MessageFragment fragment = new MessageFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
RecyclerView rv = view.findViewById(R.id.rv);
|
||||||
|
tvTitle = view.findViewById(R.id.tv_title);
|
||||||
|
adapter = new MessageAdapter();
|
||||||
|
rv.setAdapter(adapter);
|
||||||
|
rv.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
|
||||||
|
WebActivitytwo.runActivity(getContext(), adapter.getData().get(i).getTitle(), adapter.getData().get(i).getUrl());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getData() {
|
||||||
|
RegisterUser user =
|
||||||
|
Config.getInstance(getContext()).getUser();
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
if (user != null) {
|
||||||
|
map.put("userid", user.getUserid());
|
||||||
|
} else {
|
||||||
|
map.put("userid", 0 + "");
|
||||||
|
}
|
||||||
|
map.put("app", "Store");
|
||||||
|
map.put("class", "GetMsgList");
|
||||||
|
map.put("sign", Md5.md5("Store" + "GetMsgList" + Md5.secret));
|
||||||
|
Loader mGankLoader = new Loader();
|
||||||
|
mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||||
|
@Override
|
||||||
|
public void call(Resultcode resultcode) {
|
||||||
|
if (!(resultcode.status == 0)) {
|
||||||
|
// getActivity().setToast(1, resultcode.msg);
|
||||||
|
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
Gson gs = new Gson();
|
||||||
|
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||||
|
String s = gs.toJson(adta);
|
||||||
|
Log.e("json", s);
|
||||||
|
|
||||||
|
|
||||||
|
MessageEntity messageEntity = gs.fromJson(s, MessageEntity.class);
|
||||||
|
int i = Integer.parseInt(messageEntity.getMsg_count());
|
||||||
|
if (i > 0) {
|
||||||
|
tvTitle.setText("消息(" + i + ")");
|
||||||
|
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||||
|
activity.setMessageCount(i);
|
||||||
|
} else {
|
||||||
|
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||||
|
activity.setMessageCount(i);
|
||||||
|
tvTitle.setText("消息");
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.setNewData(messageEntity.getStoreInfo());
|
||||||
|
}
|
||||||
|
}, new Action1<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void call(Throwable throwable) {
|
||||||
|
throwable.fillInStackTrace();
|
||||||
|
Toast.makeText(getContext(), getString(R.string.getdatafailure), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
9
app/src/main/res/drawable/circle_red.xml
Normal file
9
app/src/main/res/drawable/circle_red.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval"
|
||||||
|
android:useLevel="false">
|
||||||
|
|
||||||
|
<solid android:color="#F00" />
|
||||||
|
|
||||||
|
|
||||||
|
</shape>
|
||||||
@@ -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,6 +63,8 @@
|
|||||||
android:text="@string/news"
|
android:text="@string/news"
|
||||||
android:textColor="@color/radiobuttoncolor" />
|
android:textColor="@color/radiobuttoncolor" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/button1"
|
android:id="@+id/button1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -73,9 +75,36 @@
|
|||||||
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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:gravity="center"
|
||||||
|
android:id="@+id/redview"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:textSize="6dp"
|
||||||
|
android:layout_height="12dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:layout_marginLeft="-8dp"
|
||||||
|
android:layout_toRightOf="@id/button2"
|
||||||
|
android:background="@drawable/circle_red" />
|
||||||
|
</RelativeLayout>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/like"
|
android:id="@+id/like"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -84,10 +113,10 @@
|
|||||||
android:drawableTop="@drawable/main_bottom_like"
|
android:drawableTop="@drawable/main_bottom_like"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="点赞"
|
android:text="点赞"
|
||||||
android:textColor="@color/radiobuttoncolor" />
|
android:textColor="@color/radiobuttoncolor"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/button3"
|
android:id="@+id/button3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -96,19 +125,20 @@
|
|||||||
android:drawableTop="@drawable/main_bottom_2"
|
android:drawableTop="@drawable/main_bottom_2"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="购物车"
|
android:text="购物车"
|
||||||
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="@string/news3"
|
|
||||||
android:textColor="@color/radiobuttoncolor"
|
android:textColor="@color/radiobuttoncolor"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
<!--
|
||||||
|
<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="@string/news3"
|
||||||
|
android:textColor="@color/radiobuttoncolor"
|
||||||
|
android:visibility="gone" />-->
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/button4"
|
android:id="@+id/button4"
|
||||||
@@ -120,7 +150,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>
|
||||||
|
|||||||
@@ -6,7 +6,34 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
<include layout="@layout/title_top" />
|
<RelativeLayout
|
||||||
|
android:id="@+id/ll"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:layout_marginTop="@dimen/mystatusbar"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/layTop_left_tv"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:src="@mipmap/fanhui" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:id="@+id/layTop_title"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/pb"
|
android:id="@+id/pb"
|
||||||
|
|||||||
52
app/src/main/res/layout/fragment_message.xml
Normal file
52
app/src/main/res/layout/fragment_message.xml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/ll"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginTop="@dimen/mystatusbar">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="消息"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||||
|
android:id="@+id/sr"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/white"
|
||||||
|
app:srlEnableLoadMore="true"
|
||||||
|
app:srlDisableContentWhenLoading="true">
|
||||||
|
|
||||||
|
<com.scwang.smartrefresh.layout.header.ClassicsHeader
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/rv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||||
|
</LinearLayout>
|
||||||
73
app/src/main/res/layout/item_message.xml
Normal file
73
app/src/main/res/layout/item_message.xml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
|
||||||
|
android:layout_height="60dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:src="@color/black" />
|
||||||
|
<View
|
||||||
|
android:id="@+id/view"
|
||||||
|
android:layout_width="10dp"
|
||||||
|
android:layout_height="10dp"
|
||||||
|
android:background="@drawable/circle_red"
|
||||||
|
android:layout_marginLeft="57dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_toRightOf="@id/iv">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:lines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="#333333"
|
||||||
|
android:text="哈哈哈" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_time"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="201615三d5sd"
|
||||||
|
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="#999999"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:lines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:text="哈哈哈哈哈" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:background="#b2b2b2" />
|
||||||
|
</RelativeLayout>
|
||||||
Reference in New Issue
Block a user