1
This commit is contained in:
@@ -25,8 +25,8 @@ android {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion '27.0.3'
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion '28.0.3'
|
||||
aaptOptions.cruncherEnabled = false
|
||||
aaptOptions.useNewCruncher = false
|
||||
defaultConfig {
|
||||
@@ -35,7 +35,7 @@ android {
|
||||
// multiDexEnabled true
|
||||
applicationId "com.sl.HouseProperty"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 27
|
||||
targetSdkVersion 28
|
||||
// multiDexEnabled true
|
||||
versionCode 1
|
||||
versionName "1.1.0"
|
||||
@@ -106,14 +106,14 @@ android {
|
||||
|
||||
implementation 'fm.jiecao:jiecaovideoplayer:4.6.3'
|
||||
//noinspection GradleCompatible
|
||||
implementation 'com.android.support:appcompat-v7:27.0.2'
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
implementation 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
|
||||
implementation 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
|
||||
implementation 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
|
||||
implementation 'com.truizlop.sectionedrecyclerview:library:1.0.0'
|
||||
implementation 'tech.wangjie:qrcodetools:1.0.0'
|
||||
|
||||
implementation 'com.android.support:recyclerview-v7:27.0.2'
|
||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
|
||||
@@ -125,12 +125,18 @@ android {
|
||||
implementation 'com.github.bumptech.glide:glide:4.5.0'
|
||||
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
|
||||
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
implementation 'com.android.support:design:28.0.0'
|
||||
|
||||
implementation 'net.dankito.richtexteditor:richtexteditor-android:2.0.8'
|
||||
implementation(name: 'alipaySdk-15.5.9', ext: 'aar')
|
||||
implementation files('libs/pldroid-player-2.1.9.jar')
|
||||
implementation project(':ninegridview')
|
||||
implementation 'com.lxj:xpopup:1.8.10'
|
||||
// 添加下面这句即可
|
||||
implementation 'com.android.support:support-v4:28.0.0'
|
||||
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0' //1.0.5及以前版本的老用户升级需谨慎,API改动过大
|
||||
// 基础依赖包,必须要依赖
|
||||
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
|
||||
<uses-permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
@@ -67,11 +66,11 @@
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<application
|
||||
|
||||
android:name="com.sl.house_property.MyApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:theme="@style/AppTheme">
|
||||
<provider
|
||||
@@ -106,8 +105,8 @@
|
||||
<activity
|
||||
android:name="com.sl.house_property.MainTabActivity"
|
||||
android:launchMode="standard"
|
||||
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
|
||||
android:theme="@style/TAppTheme" />
|
||||
<activity
|
||||
android:name="com.sl.house_property.LogoActivity"
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import android.widget.AdapterView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import entity.DiscoveryListEntity;
|
||||
|
||||
|
||||
public class BaseRecycleViewAdapter<T1, T2 extends ViewDataBinding> extends RecyclerView.Adapter<BaseRecycleViewAdapter.BaseViewHolder> {
|
||||
private ArrayList<T1> list;
|
||||
@@ -29,7 +31,6 @@ public class BaseRecycleViewAdapter<T1, T2 extends ViewDataBinding> extends Recy
|
||||
private static OnLongItemClickListener longItemClickListener;
|
||||
|
||||
|
||||
|
||||
public BaseRecycleViewAdapter(Context context, @LayoutRes int layout) {
|
||||
inflater = LayoutInflater.from(context);
|
||||
this.context = context;
|
||||
@@ -40,10 +41,11 @@ public class BaseRecycleViewAdapter<T1, T2 extends ViewDataBinding> extends Recy
|
||||
|
||||
public void setData(ArrayList<T1> list) {
|
||||
this.list.clear();
|
||||
this.list=new ArrayList<>();
|
||||
this.list = new ArrayList<>();
|
||||
this.list.addAll(list);
|
||||
notifyDataSetChanged();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addData(ArrayList<T1> list) {
|
||||
this.list = list;
|
||||
this.list.addAll(list);
|
||||
@@ -51,6 +53,11 @@ public class BaseRecycleViewAdapter<T1, T2 extends ViewDataBinding> extends Recy
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void upDateOne(int position, T1 bean) {
|
||||
this.list.set(position, bean);
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
public void setOnBindViewHolder(BindView bindView) {
|
||||
this.bindView = bindView;
|
||||
}
|
||||
@@ -68,6 +75,11 @@ public class BaseRecycleViewAdapter<T1, T2 extends ViewDataBinding> extends Recy
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
@@ -76,15 +88,19 @@ public class BaseRecycleViewAdapter<T1, T2 extends ViewDataBinding> extends Recy
|
||||
public interface BindView<T2> {
|
||||
void onBindViewHolder(T2 b, int position);
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View itemView, int position);
|
||||
}
|
||||
|
||||
public interface OnLongItemClickListener {
|
||||
void onItemLongClick(View itemView, int position);
|
||||
}
|
||||
|
||||
public void setOnItemLongClickListener(OnLongItemClickListener longClickListener) {
|
||||
this.longItemClickListener = longClickListener;
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
@@ -104,25 +120,26 @@ public class BaseRecycleViewAdapter<T1, T2 extends ViewDataBinding> extends Recy
|
||||
|
||||
});
|
||||
|
||||
itemView.setOnLongClickListener(new View.OnLongClickListener(){
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
|
||||
if (longItemClickListener != null)
|
||||
longItemClickListener.onItemLongClick(itemView,getLayoutPosition());
|
||||
return true;
|
||||
}
|
||||
if (longItemClickListener != null)
|
||||
longItemClickListener.onItemLongClick(itemView, getLayoutPosition());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public ViewDataBinding getBinding() {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class BaseActivity<VDB extends ViewDataBinding> extends RxAppCom
|
||||
}
|
||||
mDataBinding = DataBindingUtil.setContentView(this, getLayoutResId());
|
||||
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||
fullScreen(this);
|
||||
// fullScreen(this);
|
||||
progressDialog = new ProgressDialog(this);
|
||||
|
||||
if (mDataBinding != null) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sl.house_property;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.databinding.ViewDataBinding;
|
||||
import android.os.Bundle;
|
||||
@@ -10,6 +11,7 @@ import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
/**
|
||||
* Created by ximsfei on 17-1-7.
|
||||
@@ -41,6 +43,7 @@ public ProgressDialog progressDialog;
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected abstract void loadData();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,21 +6,26 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.sl.house_property.databinding.ActivityMainTabBinding;
|
||||
import com.sl.house_property.discovery.DiscoveryFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tools.Config;
|
||||
import utils.UtilHelpers;
|
||||
|
||||
public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
implements View.OnClickListener,MainFragment.OnFragmentInteractionListener,
|
||||
implements View.OnClickListener, MainFragment.OnFragmentInteractionListener,
|
||||
Main1Fragment.OnFragmentInteractionListener,
|
||||
Main2Fragment.OnFragmentInteractionListener,
|
||||
Main3Fragment.OnFragmentInteractionListener,
|
||||
Main4Fragment.OnFragmentInteractionListener{
|
||||
Main4Fragment.OnFragmentInteractionListener {
|
||||
|
||||
/*定义的全局返回码,例如在主界面的某个Fragment点击某一项后进入下一个界面后
|
||||
如果在下一个界面有数据更改,需要Fragment刷新时,通过setResult方法通知主界面,主界面的
|
||||
@@ -30,58 +35,96 @@ implements View.OnClickListener,MainFragment.OnFragmentInteractionListener,
|
||||
public static final int RESUlT_CODE_0 = 201;//首页
|
||||
public static final int RESUlT_CODE_1 = 202;//发现
|
||||
public static final int RESUlT_CODE_2 = 203;//购物车
|
||||
// public static final int RESUlT_CODE_3 = 204;//
|
||||
// public static final int RESUlT_CODE_3 = 204;//
|
||||
public static final int RESUlT_CODE_4 = 205;//我的
|
||||
private RadioGroup radioGroup;
|
||||
private MainFragment fragment0;
|
||||
private DiscoveryFragment fragment1;
|
||||
private Main3Fragment fragment2;
|
||||
private Main2Fragment fragment3;
|
||||
private Main4Fragment fragment4;
|
||||
private RadioGroup radioGroup;
|
||||
private MainFragment fragment0;
|
||||
private DiscoveryFragment fragment1;
|
||||
private Main3Fragment fragment2;
|
||||
private Main2Fragment fragment3;
|
||||
private Main4Fragment fragment4;
|
||||
private Fragment currentFragment;
|
||||
|
||||
private int myeditcode=1000;
|
||||
private int myeditcode = 1000;
|
||||
|
||||
|
||||
private int nowradioId;
|
||||
|
||||
private int nowradioId;
|
||||
|
||||
// @Override
|
||||
// public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
// switch (ev.getAction()) {
|
||||
// case MotionEvent.ACTION_DOWN:
|
||||
//
|
||||
// UtilHelpers.hideKeyboard(ev, getCurrentFocus(), this);
|
||||
// break;
|
||||
// }
|
||||
// return super.dispatchTouchEvent(ev);
|
||||
//
|
||||
// }
|
||||
public void visibilyBottom(int isVisibily){
|
||||
findViewById(R.id.rl_bottom).setVisibility(isVisibily);
|
||||
}
|
||||
//2. 保存MyOnTouchListener接口的列表
|
||||
private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<MyOnTouchListener>();
|
||||
//1.触摸事件接口
|
||||
public interface MyOnTouchListener {
|
||||
public boolean onTouch(MotionEvent ev);
|
||||
}
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
for (MyOnTouchListener listener : onTouchListeners) {
|
||||
// listener.onTouch(ev);
|
||||
}
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
//4.提供给Fragment通过getActivity()方法来注册自己的触摸事件的方法
|
||||
public void registerMyOnTouchListener(MyOnTouchListener myOnTouchListener) {
|
||||
onTouchListeners.add(myOnTouchListener);
|
||||
}
|
||||
//5.提供给Fragment通过getActivity()方法来注销自己的触摸事件的方法
|
||||
public void unregisterMyOnTouchListener(MyOnTouchListener myOnTouchListener) {
|
||||
onTouchListeners.remove(myOnTouchListener);
|
||||
}
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
|
||||
|
||||
return R.layout.activity_main_tab;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Config.getInstance(MainTabActivity.this).put("MainTabActivity",true);
|
||||
Config.getInstance(MainTabActivity.this).put("MainTabActivity", true);
|
||||
//setPhotoSysyrmbar();
|
||||
//setSytemBar(R.color.colorPrimary);//设置主题样式
|
||||
//setFramentMarginTop();
|
||||
|
||||
//setSytemBar(R.color.colorPrimary);//设置主题样式
|
||||
//setFramentMarginTop();
|
||||
ImmersionBar.with(this)
|
||||
.keyboardEnable(true) //解决软键盘与底部输入框冲突问题
|
||||
// .keyboardEnable(true, WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
|
||||
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
|
||||
.init();
|
||||
initView();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressLint("MissingSuperCall")
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
radioGroup= mDataBinding.radioGroup;
|
||||
for (int i = 0; i <radioGroup.getChildCount() ; i++) {
|
||||
RadioButton myRadioButton= (RadioButton) radioGroup.getChildAt(i);
|
||||
radioGroup = mDataBinding.radioGroup;
|
||||
for (int i = 0; i < radioGroup.getChildCount(); i++) {
|
||||
RadioButton myRadioButton = (RadioButton) radioGroup.getChildAt(i);
|
||||
myRadioButton.setOnClickListener(this);
|
||||
|
||||
}
|
||||
mDataBinding.button.setChecked(true);
|
||||
nowradioId= mDataBinding.button.getId();
|
||||
nowradioId = mDataBinding.button.getId();
|
||||
mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||
changeFragment( mDataBinding.button.getId());
|
||||
changeFragment(mDataBinding.button.getId());
|
||||
|
||||
}
|
||||
|
||||
@@ -159,26 +202,27 @@ implements View.OnClickListener,MainFragment.OnFragmentInteractionListener,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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);
|
||||
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 = (RadioButton) view;
|
||||
myRadioButton.setChecked(false);
|
||||
myRadioButton=(RadioButton)findViewById(nowradioId);
|
||||
myRadioButton = (RadioButton) findViewById(nowradioId);
|
||||
myRadioButton.setChecked(true);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
myRadioButton.setChecked(false);
|
||||
myRadioButton=(RadioButton)view;
|
||||
myRadioButton = (RadioButton) view;
|
||||
myRadioButton.setChecked(true);
|
||||
nowradioId=view.getId();
|
||||
nowradioId = view.getId();
|
||||
changeFragment(view.getId());
|
||||
}
|
||||
|
||||
@@ -190,8 +234,8 @@ implements View.OnClickListener,MainFragment.OnFragmentInteractionListener,
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||
if(resultCode==RESUlT_CODE_4){
|
||||
if(currentFragment==fragment4){
|
||||
if (resultCode == RESUlT_CODE_4) {
|
||||
if (currentFragment == fragment4) {
|
||||
// if(fragment0!=null){
|
||||
// fragmentTransaction.remove(fragment0);
|
||||
// fragment0 = null;
|
||||
@@ -219,16 +263,16 @@ implements View.OnClickListener,MainFragment.OnFragmentInteractionListener,
|
||||
// }
|
||||
// fragmentTransaction.show(fragment4);
|
||||
// currentFragment = fragment4;
|
||||
fragment4.refreshData();
|
||||
}
|
||||
fragment4.refreshData();
|
||||
}
|
||||
try {
|
||||
// fragmentTransaction.commit();
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
fragmentTransaction.commitAllowingStateLoss();
|
||||
}
|
||||
}else if(resultCode==myeditcode){
|
||||
if(currentFragment==fragment1){
|
||||
} else if (resultCode == myeditcode) {
|
||||
if (currentFragment == fragment1) {
|
||||
fragment1.loadData();
|
||||
}
|
||||
}
|
||||
@@ -237,7 +281,7 @@ implements View.OnClickListener,MainFragment.OnFragmentInteractionListener,
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Config.getInstance(MainTabActivity.this).put("MainTabActivity",false);
|
||||
Config.getInstance(MainTabActivity.this).put("MainTabActivity", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,48 +2,63 @@ package com.sl.house_property.discovery;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.dalong.refreshlayout.OnRefreshListener;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lzy.ninegrid.ImageInfo;
|
||||
import com.lzy.ninegrid.preview.NineGridViewClickAdapter;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.BaseFragment;
|
||||
import com.sl.house_property.MainTabActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.FragmentDiscoveryBinding;
|
||||
import com.sl.house_property.databinding.ItemCommentBinding;
|
||||
import com.sl.house_property.databinding.ItemDiscoveryBinding;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.squareup.picasso.Target;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
import entity.DiscoveryListEntity;
|
||||
import entity.RegisterUser;
|
||||
import http.ApiConfig;
|
||||
import my_loader.Loader;
|
||||
import my_loader.Resultcode;
|
||||
import my_view.CommentDialog;
|
||||
import my_view.tao_bao_refresh.FullyGridLayoutManager;
|
||||
import rx.Subscription;
|
||||
import rx.functions.Action1;
|
||||
import tools.Config;
|
||||
import tools.PicassoRoundTransform;
|
||||
import utils.CommonUtils;
|
||||
import utils.DateUtils;
|
||||
import utils.KeyboardUtil;
|
||||
import utils.Md5;
|
||||
import utils.UtilHelpers;
|
||||
|
||||
public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> implements MainTabActivity.MyOnTouchListener {
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
private String mParam1;
|
||||
@@ -69,21 +84,75 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
super.onCreateVew(inflater, savedInstanceState);
|
||||
baseActivity = (BaseActivity) getActivity();
|
||||
progressDialog = new ProgressDialog(baseActivity);
|
||||
mDataBinding.rl.setOnRefreshListener(new OnRefreshListener() {
|
||||
mDataBinding.dw.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
getlist(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
getlist(page);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
|
||||
}
|
||||
});
|
||||
mDataBinding.rl.setAutoRefresh(true);
|
||||
mDataBinding.dw.autoRefresh();
|
||||
intRecycleView();
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.registerMyOnTouchListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.unregisterMyOnTouchListener(this);
|
||||
}
|
||||
|
||||
public void updateEditTextBodyVisible(int visibility) {
|
||||
mDataBinding.llComment.setVisibility(visibility);
|
||||
if (View.VISIBLE == visibility) {
|
||||
mDataBinding.llComment.requestFocus();
|
||||
//弹出键盘
|
||||
CommonUtils.showSoftInput(mDataBinding.etComment.getContext(), mDataBinding.etComment);
|
||||
|
||||
} else if (View.GONE == visibility) {
|
||||
//隐藏键盘
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
CommonUtils.hideSoftInput(mDataBinding.etComment.getContext(), mDataBinding.etComment);
|
||||
}
|
||||
}
|
||||
|
||||
private int currentKeyboardH;
|
||||
private int editTextBodyHeight;
|
||||
|
||||
private void setViewTreeObserver() {
|
||||
final ViewTreeObserver swipeRefreshLayoutVTO = mDataBinding.rl.getViewTreeObserver();
|
||||
swipeRefreshLayoutVTO.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
Rect r = new Rect();
|
||||
mDataBinding.rl.getWindowVisibleDisplayFrame(r);
|
||||
int statusBarH = ImmersionBar.getStatusBarHeight(DiscoveryFragment.this);//状态栏高度
|
||||
int screenH = mDataBinding.rl.getRootView().getHeight();
|
||||
if (r.top != statusBarH) {
|
||||
//r.top代表的是状态栏高度,在沉浸式状态栏时r.top=0,通过getStatusBarHeight获取状态栏高度
|
||||
r.top = statusBarH;
|
||||
}
|
||||
int keyboardH = screenH - (r.bottom - r.top);
|
||||
|
||||
if (keyboardH == currentKeyboardH) {//有变化时才处理,否则会陷入死循环
|
||||
return;
|
||||
}
|
||||
currentKeyboardH = keyboardH;
|
||||
editTextBodyHeight = mDataBinding.llComment.getHeight();
|
||||
if (keyboardH < 150) {//说明是隐藏键盘的情况
|
||||
updateEditTextBodyVisible(View.GONE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Loader mGankLoader;
|
||||
@@ -104,24 +173,234 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
getGankList(ApiConfig.BASE_URL, map, getResources().getString(R.string.requsting), mypage);
|
||||
}
|
||||
|
||||
private void like(String goodsId, final int position) {
|
||||
final 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", "Goods");
|
||||
map.put("class", "AddUp");
|
||||
map.put("goods_id", goodsId);
|
||||
map.put("sign", Md5.md5("Goods" + "AddUp" + Md5.secret));
|
||||
progressDialog.setMessage("提交中");
|
||||
progressDialog.setCancelable(false);
|
||||
// progressDialog.show();
|
||||
|
||||
mGankLoader = new Loader();
|
||||
Subscription subscription = mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
baseActivity.setToast(1, resultcode.msg);
|
||||
}
|
||||
if (resultcode.status == 0) {
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
if (discoveryListEntities.get(position).getIs_like() == 1) {
|
||||
discoveryListEntities.get(position).setIs_like(0);
|
||||
ArrayList<DiscoveryListEntity.Like> like = discoveryListEntities.get(position).getLike();
|
||||
for (int i = 0; i < like.size(); i++) {
|
||||
if (user.getUserid().equals(like.get(i).getUserid())) {
|
||||
like.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
discoveryListEntities.get(position).setLike(like);
|
||||
} else {
|
||||
discoveryListEntities.get(position).setIs_like(1);
|
||||
DiscoveryListEntity.Like like = new DiscoveryListEntity.Like();
|
||||
like.setNickname(user.getNickname());
|
||||
like.setUserid(user.getUserid());
|
||||
discoveryListEntities.get(position).getLike().add(like);
|
||||
}
|
||||
|
||||
adapter.upDateOne(position, discoveryListEntities.get(position));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
baseActivity.setToast(2, "提交失败");
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
baseActivity.addSubscription(subscription);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取控件左上顶点Y坐标
|
||||
*
|
||||
* @param view
|
||||
* @return
|
||||
*/
|
||||
private int getCoordinateY(View view) {
|
||||
int[] coordinate = new int[2];
|
||||
view.getLocationOnScreen(coordinate);
|
||||
return coordinate[1];
|
||||
}
|
||||
|
||||
|
||||
private void intRecycleView() {
|
||||
FullyGridLayoutManager mgr = new FullyGridLayoutManager(getActivity(), 1);
|
||||
mgr.setOrientation(FullyGridLayoutManager.VERTICAL);
|
||||
mgr.setSmoothScrollbarEnabled(true);
|
||||
mDataBinding.recyView.setLayoutManager(mgr);
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setViewTreeObserver();
|
||||
}
|
||||
});
|
||||
mDataBinding.sv.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (mDataBinding.llComment.getVisibility() == View.VISIBLE) {
|
||||
updateEditTextBodyVisible(View.GONE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(baseActivity);
|
||||
mDataBinding.recyView.setNestedScrollingEnabled(false);//禁止rcyc嵌套滑动
|
||||
mDataBinding.recyView.setLayoutManager(linearLayoutManager);
|
||||
BaseRecycleViewAdapter<DiscoveryListEntity, ItemDiscoveryBinding> baseRecycleViewAdapter = new BaseRecycleViewAdapter(getActivity(), R.layout.item_discovery);
|
||||
baseRecycleViewAdapter.setHasStableIds(true);
|
||||
|
||||
discoveryListEntities = new ArrayList<>();
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, int position) {
|
||||
public void onBindViewHolder(Object b, final int position) {
|
||||
if (!(position >= discoveryListEntities.size())) {
|
||||
ItemDiscoveryBinding homeGridAdapterItemBinding = (ItemDiscoveryBinding) b;
|
||||
final ItemDiscoveryBinding homeGridAdapterItemBinding = (ItemDiscoveryBinding) b;
|
||||
// homeGridAdapterItemBinding.setMyentity(discoveryListEntities.get(position));
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
final DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
homeGridAdapterItemBinding.tvNikeName.setText(discoveryListEntity.getNickname());
|
||||
homeGridAdapterItemBinding.tvContent.setText(discoveryListEntity.getGoods_detail());
|
||||
|
||||
// Picasso.with(getActivity()).load(discoveryListEntity.getAvatar())
|
||||
// .placeholder(R.mipmap.icon_default_rectangle)
|
||||
// .transform(new PicassoRoundTransform())
|
||||
// .into(homeGridAdapterItemBinding.imageHead);
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.e("click", "comment");
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
CommonUtils.hideSoftInput(getContext(),mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
comment(discoveryListEntity.getGoods_id(), position, "", mDataBinding.etComment.getText().toString());
|
||||
}
|
||||
});
|
||||
homeGridAdapterItemBinding.ivComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final CommentDialog commentDialog = new CommentDialog(baseActivity);
|
||||
commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
commentDialog.setOnCommentOperateListener(new CommentDialog.OnCommentOperateListener() {
|
||||
@Override
|
||||
public void click(int type) {
|
||||
|
||||
if (type == 1 || type == 2) {
|
||||
//点赞/取消
|
||||
commentDialog.dismiss();
|
||||
like(discoveryListEntity.getGoods_id(), position);
|
||||
} else if (type == 3) {
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("评论");
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
KeyboardUtil.showSoftInput(getContext());
|
||||
activity.visibilyBottom(View.GONE);
|
||||
|
||||
commentDialog.dismiss();
|
||||
mDataBinding.etComment.setText("");
|
||||
homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int y = getCoordinateY(mDataBinding.llComment) - 20;
|
||||
//评论时滑动到对应item底部和输入框顶部对齐
|
||||
mDataBinding.sv.smoothScrollBy(0, mBottomY - y);
|
||||
}
|
||||
}, 300);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(baseActivity).hasShadowBg(false).atView(homeGridAdapterItemBinding.ivComment).asCustom(commentDialog)
|
||||
.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (discoveryListEntity.getLike().isEmpty()) {
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.GONE);
|
||||
} else {
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.VISIBLE);
|
||||
StringBuilder likeString = new StringBuilder();
|
||||
for (int i = 0; i < discoveryListEntity.getLike().size(); i++) {
|
||||
if (i == 0) {
|
||||
likeString.append("❤");
|
||||
|
||||
} else {
|
||||
likeString.append(",");
|
||||
}
|
||||
likeString.append(discoveryListEntity.getLike().get(i).getNickname());
|
||||
}
|
||||
homeGridAdapterItemBinding.tvLike.setText(likeString.toString());
|
||||
|
||||
homeGridAdapterItemBinding.tvTime.setText(DateUtils.getDate(discoveryListEntity.getCtime()));
|
||||
|
||||
}
|
||||
if (discoveryListEntity.getDis_content().isEmpty()) {
|
||||
homeGridAdapterItemBinding.rvComment.setVisibility(View.GONE);
|
||||
} else {
|
||||
homeGridAdapterItemBinding.rvComment.setVisibility(View.VISIBLE);
|
||||
FullyGridLayoutManager mgr = new FullyGridLayoutManager(getActivity(), 1);
|
||||
mgr.setOrientation(FullyGridLayoutManager.VERTICAL);
|
||||
mgr.setSmoothScrollbarEnabled(true);
|
||||
homeGridAdapterItemBinding.rvComment.setLayoutManager(mgr);
|
||||
BaseRecycleViewAdapter<DiscoveryListEntity.Dis_content, ItemCommentBinding> baseRecycleViewAdapter = new BaseRecycleViewAdapter(getActivity(), R.layout.item_comment);
|
||||
homeGridAdapterItemBinding.rvComment.setAdapter(baseRecycleViewAdapter);
|
||||
final ArrayList<DiscoveryListEntity.Dis_content> dis_content = discoveryListEntity.getDis_content();
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, int position) {
|
||||
ItemCommentBinding itemCommentBinding = (ItemCommentBinding) b;
|
||||
itemCommentBinding.tvName.setText(dis_content.get(position).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(position).getContents());
|
||||
if (dis_content.get(position).getReply().isEmpty()) {
|
||||
itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||
|
||||
} else {
|
||||
itemCommentBinding.llHf.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName2.setText(discoveryListEntity.getNickname());
|
||||
itemCommentBinding.tvInfo2.setText("回复");
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(position).getNickname() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
baseRecycleViewAdapter.setData(dis_content);
|
||||
|
||||
}
|
||||
|
||||
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.error(R.mipmap.icon_default_rectangle);
|
||||
@@ -160,14 +439,6 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
}
|
||||
|
||||
private void addRecycleVerization(ArrayList<DiscoveryListEntity> lsit) {
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
|
||||
discoveryListEntities = lsit;
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
|
||||
}
|
||||
|
||||
private void getGankList(String myurl, Map<String, String> map, String msg, final int requstecode) {
|
||||
progressDialog.setMessage(msg);
|
||||
progressDialog.setCancelable(false);
|
||||
@@ -180,8 +451,8 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
|
||||
mDataBinding.rl.stopRefresh(true);
|
||||
mDataBinding.rl.stopLoadMore(true);
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
baseActivity.setToast(1, resultcode.msg);
|
||||
@@ -191,22 +462,37 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
String s = gs.toJson(adta);
|
||||
try {
|
||||
|
||||
JSONObject jsonObject = new JSONObject(s);
|
||||
org.json.JSONArray array = jsonObject.getJSONArray("info");
|
||||
Type type = new TypeToken<ArrayList<DiscoveryListEntity>>() {
|
||||
}.getType();
|
||||
String fengmian = jsonObject.getString("fengmian");
|
||||
String avatar = jsonObject.getString("avatar");
|
||||
Picasso.with(getActivity()).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
Picasso.with(getActivity()).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
.into(mDataBinding.head);
|
||||
discoveryListEntities = new Gson().fromJson(array.toString(), type);
|
||||
addRecycleVerization(discoveryListEntities);
|
||||
if (page == 1) {
|
||||
String fengmian = jsonObject.getString("fengmian");
|
||||
String avatar = jsonObject.getString("avatar");
|
||||
Picasso.with(getActivity()).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
Picasso.with(getActivity()).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
.into(mDataBinding.head);
|
||||
discoveryListEntities = new Gson().fromJson(array.toString(), type);
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
page++;
|
||||
} else {
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.addAll(o);
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
int count = jsonObject.getInt("count");
|
||||
if (discoveryListEntities.size() == count || o.isEmpty()) {
|
||||
mDataBinding.dw.finishLoadMoreWithNoMoreData();
|
||||
} else {
|
||||
page++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -214,36 +500,6 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
}
|
||||
}
|
||||
|
||||
// if (resultcode.status == 0) {
|
||||
//// baseActivity.setToast(0, resultcode.msg);
|
||||
// if (requstecode == 0) {
|
||||
// Gson gs = new Gson();
|
||||
// LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
// String s = gs.toJson(adta);
|
||||
//
|
||||
// ArrayList<Advertorial_listEntity> list = null;
|
||||
// try {
|
||||
// JSONObject jsonObject = new JSONObject(s);
|
||||
// org.json.JSONArray array1 = jsonObject.getJSONArray("advert_info");
|
||||
// if (array1.length() > 0) {
|
||||
// String img = array1.getJSONObject(0).optString("advert_img");
|
||||
// configTopImage(img);
|
||||
// imgme = img;
|
||||
//
|
||||
// }
|
||||
// org.json.JSONArray array = jsonObject.getJSONArray("advertorial_list");
|
||||
// Type type = new TypeToken<ArrayList<Advertorial_listEntity>>() {
|
||||
// }.getType();
|
||||
// list = new Gson().fromJson(array.toString(), type);
|
||||
// //addRecycleVerization(list);
|
||||
//
|
||||
//
|
||||
// } catch (JSONException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -251,8 +507,8 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
mDataBinding.rl.stopRefresh(true);
|
||||
mDataBinding.rl.stopLoadMore(true);
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
baseActivity.setToast(2, getString(R.string.getdatafailure));
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
@@ -298,4 +554,86 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(MotionEvent ev) {
|
||||
switch (ev.getAction()) {
|
||||
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
//点击空白处隐藏键盘,隐藏输入框相关
|
||||
if (getActivity().getCurrentFocus()!=null&&getActivity().getCurrentFocus().getId() == R.id.tv_send_comment) {
|
||||
return false;
|
||||
}
|
||||
boolean b = UtilHelpers.hideKeyboard(ev, getActivity().getCurrentFocus(), getActivity());
|
||||
if (b) {
|
||||
CommonUtils.hideSoftInput( mDataBinding.etComment.getContext(), mDataBinding.etComment);
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void comment(String goodsId, final int position, String reply_id, final String content) {
|
||||
final 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", "Goods");
|
||||
map.put("class", "DisGoods");
|
||||
map.put("goods_id", goodsId);
|
||||
if (!TextUtils.isEmpty(reply_id)) {
|
||||
map.put("reply_id", reply_id);
|
||||
}
|
||||
|
||||
map.put("contents", content);
|
||||
map.put("sign", Md5.md5("Goods" + "DisGoods" + Md5.secret));
|
||||
progressDialog.setMessage("提交中");
|
||||
progressDialog.setCancelable(false);
|
||||
// progressDialog.show();
|
||||
|
||||
mGankLoader = new Loader();
|
||||
Subscription subscription = mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
baseActivity.setToast(1, resultcode.msg);
|
||||
}
|
||||
if (resultcode.status == 0) {
|
||||
|
||||
// BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
// if (discoveryListEntities.get(position).getDis_content().isEmpty()) {
|
||||
// DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
// dis_content.setContents(content);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// adapter.upDateOne(position, discoveryListEntities.get(position));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
baseActivity.setToast(2, "提交失败");
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
baseActivity.addSubscription(subscription);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,10 +126,7 @@ public class ClipImageView extends AppCompatImageView {
|
||||
rf = new RectF(r);
|
||||
}
|
||||
// 画入前景圆形蒙板层
|
||||
int sc = canvas.saveLayer(rf, null, Canvas.MATRIX_SAVE_FLAG
|
||||
| Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG
|
||||
| Canvas.FULL_COLOR_LAYER_SAVE_FLAG
|
||||
| Canvas.CLIP_TO_LAYER_SAVE_FLAG | Canvas.ALL_SAVE_FLAG);
|
||||
int sc = canvas.saveLayer(rf, null, Canvas.ALL_SAVE_FLAG);
|
||||
//画入矩形黑色半透明蒙板层
|
||||
canvas.drawRect(r, mFrontGroundPaint);
|
||||
//设置Xfermode,目的是为了去除矩形黑色半透明蒙板层和圆形的相交部分
|
||||
|
||||
90
app/src/main/java/my_view/CommentDialog.java
Normal file
90
app/src/main/java/my_view/CommentDialog.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package my_view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.lxj.xpopup.core.HorizontalAttachPopupView;
|
||||
import com.sl.house_property.R;
|
||||
|
||||
public class CommentDialog extends HorizontalAttachPopupView {
|
||||
private boolean isPraise;
|
||||
private OnCommentOperateListener listener;
|
||||
private final TextView tvZan;
|
||||
|
||||
public CommentDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
tvZan = findViewById(R.id.tv_zan);
|
||||
|
||||
|
||||
tvZan.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isPraise) {
|
||||
if (listener != null) {
|
||||
listener.click(1);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (listener != null) {
|
||||
listener.click(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
findViewById(R.id.tv_comment).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
listener.click(3);
|
||||
}
|
||||
}
|
||||
});
|
||||
findViewById(R.id.tv_bug).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
listener.click(4);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setShowBug(boolean type) {
|
||||
|
||||
if (type) {
|
||||
findViewById(R.id.tv_bug).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.v).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
findViewById(R.id.tv_bug).setVisibility(View.GONE);
|
||||
findViewById(R.id.v).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPraise(boolean type) {
|
||||
isPraise=type;
|
||||
if (type) {
|
||||
tvZan.setText("取消");
|
||||
} else {
|
||||
tvZan.setText("赞");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnCommentOperateListener(OnCommentOperateListener li) {
|
||||
listener = li;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_comment;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public interface OnCommentOperateListener {
|
||||
void click(int type);
|
||||
}
|
||||
}
|
||||
50
app/src/main/java/my_view/MyFrameLayout.java
Normal file
50
app/src/main/java/my_view/MyFrameLayout.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package my_view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.text.Layout;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class MyFrameLayout extends FrameLayout {
|
||||
|
||||
|
||||
public MyFrameLayout(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MyFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public MyFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public MyFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean fitSystemWindows(Rect insets) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
insets.left = 0;
|
||||
insets.top = 0;
|
||||
insets.right = 0;
|
||||
insets.bottom=0;
|
||||
}
|
||||
return super.fitSystemWindows(insets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
||||
return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class BottomNavigationViewHelper {
|
||||
for (int i = 0; i < menuView.getChildCount(); i++) {
|
||||
BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
|
||||
//noinspection RestrictedApi
|
||||
item.setShiftingMode(false);
|
||||
// item.setShiftingMode(false);
|
||||
// set once again checked value, so view will be updated
|
||||
//noinspection RestrictedApi
|
||||
item.setChecked(item.getItemData().isChecked());
|
||||
|
||||
42
app/src/main/java/utils/CommonUtils.java
Normal file
42
app/src/main/java/utils/CommonUtils.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
/**
|
||||
* @author yiw
|
||||
* @ClassName: CommonUtils
|
||||
* @Description:
|
||||
* @date 2015-12-28 下午4:16:01
|
||||
*/
|
||||
public class CommonUtils {
|
||||
|
||||
|
||||
public static void showSoftInput(Context context, View view) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
//imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
|
||||
}
|
||||
|
||||
public static void hideSoftInput(Context context, View view) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); //强制隐藏键盘
|
||||
}
|
||||
|
||||
public static boolean isShowSoftInput(Context context) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
//获取状态信息
|
||||
return imm.isActive();//true 打开
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否显示,显示则关闭,没显示则显示
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void isShow(Context context) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
}
|
||||
480
app/src/main/java/utils/DateUtils.java
Normal file
480
app/src/main/java/utils/DateUtils.java
Normal file
@@ -0,0 +1,480 @@
|
||||
package utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 日期:2017.01.12
|
||||
* <p>
|
||||
* 作者:chigan
|
||||
* <p>
|
||||
* 描述:目期工具类
|
||||
*/
|
||||
public class DateUtils {
|
||||
|
||||
private static final String TAG = "DateUtils";
|
||||
|
||||
|
||||
public static String getTimeStart(String timeString) {
|
||||
String timeStamp = "";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
Date d = new Date();
|
||||
try {
|
||||
d = sdf.parse(timeString);
|
||||
long l = d.getTime();
|
||||
if (String.valueOf(l).length() > 10) {
|
||||
l = l / 10;
|
||||
}
|
||||
timeStamp = String.valueOf(l);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public static String getTimeEnd(String timeString) {
|
||||
String timeStamp = "";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日HH:mm");
|
||||
Date d = new Date();
|
||||
try {
|
||||
d = sdf.parse((timeString + "23:59"));
|
||||
long l = d.getTime();
|
||||
if (String.valueOf(l).length() > 10) {
|
||||
l = l / 10;
|
||||
}
|
||||
timeStamp = String.valueOf(l);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
|
||||
public static String getDate(String mtime) {
|
||||
return getTimeStrByLong(dataOne(mtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时间串
|
||||
*
|
||||
* @param longStr 秒
|
||||
* @return 1月前 1周前 1天前 1小时前 1分钟前
|
||||
*/
|
||||
public static String getTimeStrByLong(String longStr) {
|
||||
try {
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
Date date = calendar.getTime();
|
||||
Long clv = date.getTime();
|
||||
Long olv = Long.valueOf(longStr);
|
||||
|
||||
calendar.setTimeInMillis(olv); // 转毫秒
|
||||
Date date2 = calendar.getTime();
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String curtime = format.format(date2);
|
||||
|
||||
Long belv = clv - olv;
|
||||
String retStr = "";
|
||||
// 24 * 60 * 60 * 1000;
|
||||
Long daylong = Long.valueOf("86400000");
|
||||
Long hourlong = Long.valueOf("3600000");
|
||||
Long minlong = Long.valueOf("60000");
|
||||
Long seclong = Long.valueOf("1000");
|
||||
|
||||
if (belv >= daylong * 30) {// 月
|
||||
|
||||
Long mul = belv / (daylong * 30);
|
||||
retStr = retStr + mul + "月";
|
||||
belv = belv % (daylong * 30);
|
||||
return retStr + "前";
|
||||
}
|
||||
if (belv >= daylong * 7) {// 周
|
||||
|
||||
Long mul = belv / (daylong * 7);
|
||||
retStr = retStr + mul + "周";
|
||||
belv = belv % (daylong * 7);
|
||||
return retStr + "前";
|
||||
}
|
||||
if (belv >= daylong) {// 天
|
||||
|
||||
Long mul = belv / daylong;
|
||||
retStr = retStr + mul + "天";
|
||||
belv = belv % daylong;
|
||||
return retStr + "前";
|
||||
}
|
||||
if (belv >= hourlong) {// 时
|
||||
Long mul = belv / hourlong;
|
||||
retStr = retStr + mul + "小时";
|
||||
belv = belv % hourlong;
|
||||
return retStr + "前";
|
||||
}
|
||||
if (belv >= minlong) {// 分
|
||||
Long mul = belv / minlong;
|
||||
retStr = retStr + mul + "分钟";
|
||||
return retStr + "前";
|
||||
}
|
||||
if (belv >= seclong) {
|
||||
Long mul = belv / seclong;
|
||||
retStr = retStr + mul + "秒";
|
||||
return retStr + "前";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("ttterr", longStr);
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回xxxx年-xx月xx日 xx时:xx分:xx秒
|
||||
*
|
||||
* @param strMis 毫秒的字符串形式
|
||||
* @return
|
||||
*/
|
||||
public static String getStringDataMilli(String strMis) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new Date(Long.parseLong(strMis)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回xx月xx日 xx时:xx分
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getStringDataMilliNoy() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
|
||||
return sdf.format(new Date(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回xxxx年-xx月xx日 xx时:xx分:xx秒
|
||||
*
|
||||
* @param strSecond 秒的字符串形式所以要*1000
|
||||
* @return
|
||||
*/
|
||||
public static String getStringDataSecond(String strSecond) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new Date(Long.parseLong(strSecond) * 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回xxxx年-xx月xx日
|
||||
*
|
||||
* @param strMis
|
||||
* @return
|
||||
*/
|
||||
public static String getStringYMD(String strMis) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
if (TextUtils.isEmpty(strMis)) {
|
||||
return "";
|
||||
}
|
||||
return sdf.format(new Date(Long.parseLong(strMis) * 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回xxxx年-xx月xx日
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String getStringYMD(Date date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回xxxx年-xx月xx日 xx时xx分
|
||||
*
|
||||
* @param strMis
|
||||
* @return
|
||||
*/
|
||||
public static String getStringYMDHM(String strMis) {
|
||||
// Log.d(TAG, "getStringYMDHM: " + strMis);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
return sdf.format(new Date(Long.parseLong(strMis) * 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回xxxx年-xx月xx日 xx时xx分
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String getStringYMDHM(Date date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前是哪一天
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getCurrentDay() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd");
|
||||
return Integer.parseInt(sdf.format(new Date(System.currentTimeMillis())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前是哪个月
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getCurrentMonth() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM");
|
||||
return Integer.parseInt(sdf.format(new Date(System.currentTimeMillis()))) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前是哪一年
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getCurrentYear() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
|
||||
return Integer.parseInt(sdf.format(new Date(System.currentTimeMillis())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据一个时间磋,获取是多少天
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static int getDay(long time) {
|
||||
long day = (time * 1000) / (24 * 60 * 60 * 1000);
|
||||
return (int) day;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时间戳 是多少分钟
|
||||
*
|
||||
* @param timestamp
|
||||
* @return
|
||||
*/
|
||||
public static int getMinute(long timestamp) {
|
||||
long minute = timestamp * 1000 / (60 * 1000);
|
||||
return (int) minute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算多少天开始
|
||||
*
|
||||
* @param starTime 时间轴
|
||||
* @return 天数
|
||||
*/
|
||||
public static int beginDate(String starTime) {
|
||||
long now = System.currentTimeMillis();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH");
|
||||
String d = format.format(Long.valueOf(starTime) * 1000);
|
||||
Long start = null;
|
||||
try {
|
||||
start = format.parse(d).getTime();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long b = start - now;
|
||||
float f = (float) (b * 1.0 / 60 / 60 / 24 / 1000);
|
||||
double days = (b * 1.0 / 60 / 60 / 24 / 1000);
|
||||
return (int) Math.ceil(days);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回一个时间轴和现在的相隔时间 如果时间在当前时间之前则返回空
|
||||
*
|
||||
* @param longStr
|
||||
* @return
|
||||
*/
|
||||
public static String getTimeStrToBegin(String longStr) {
|
||||
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
Date date = calendar.getTime();
|
||||
Long clv = date.getTime();
|
||||
Long olv = Long.valueOf(longStr);
|
||||
|
||||
calendar.setTimeInMillis(olv); // 转毫秒
|
||||
Date date2 = calendar.getTime();
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String curtime = format.format(date2);
|
||||
|
||||
Long belv = olv * 1000 - clv;
|
||||
String retStr = "";
|
||||
// 24 * 60 * 60 * 1000;
|
||||
Long daylong = Long.valueOf("86400000");
|
||||
Long hourlong = Long.valueOf("3600000");
|
||||
Long minlong = Long.valueOf("60000");
|
||||
Long seclong = Long.valueOf("1000");
|
||||
|
||||
if (belv >= daylong * 30) {// 月
|
||||
|
||||
Long mul = belv / (daylong * 30);
|
||||
retStr = retStr + mul + "月";
|
||||
belv = belv % (daylong * 30);
|
||||
return retStr;
|
||||
}
|
||||
if (belv >= daylong * 7) {// 周
|
||||
|
||||
Long mul = belv / (daylong * 7);
|
||||
retStr = retStr + mul + "周";
|
||||
belv = belv % (daylong * 7);
|
||||
return retStr;
|
||||
}
|
||||
if (belv >= daylong) {// 天
|
||||
|
||||
Long mul = belv / daylong;
|
||||
retStr = retStr + mul + "天";
|
||||
belv = belv % daylong;
|
||||
return retStr;
|
||||
}
|
||||
if (belv >= hourlong) {// 时
|
||||
Long mul = belv / hourlong;
|
||||
retStr = retStr + mul + "小时";
|
||||
belv = belv % hourlong;
|
||||
return retStr;
|
||||
}
|
||||
if (belv >= minlong) {// 分
|
||||
Long mul = belv / minlong;
|
||||
retStr = retStr + mul + "分钟";
|
||||
return retStr;
|
||||
}
|
||||
if (belv >= seclong) {
|
||||
Long mul = belv / seclong;
|
||||
retStr = retStr + mul + "秒";
|
||||
return retStr;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 调此方法输入所要转换的时间输入例如("2014-06-14-16-09-00")返回时间戳
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static String dataOne(String time) {
|
||||
SimpleDateFormat sdr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",
|
||||
Locale.CHINA);
|
||||
Date date = null;
|
||||
try {
|
||||
date = sdr.parse(time);
|
||||
return date.getTime() + "";
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
public static Long getUnitDate(String time){
|
||||
SimpleDateFormat sdr = new SimpleDateFormat("yyyy-MM-dd",
|
||||
Locale.CHINA);
|
||||
Date date = null;
|
||||
try {
|
||||
date = sdr.parse(time);
|
||||
return date.getTime() ;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
public static String getSpecifiedDayAfter(String specifiedDay) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat("yy-MM-dd").parse(specifiedDay);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int day = c.get(Calendar.DATE);
|
||||
c.set(Calendar.DATE, day + 1);
|
||||
String dayAfter = new SimpleDateFormat("yyyy-MM-dd")
|
||||
.format(c.getTime());
|
||||
return dayAfter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 月份+i
|
||||
*
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
public static String getmonthAdd(int i, String specifiedDay) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat("yy-MM-dd").parse(specifiedDay);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int month = c.get(Calendar.MONTH);
|
||||
c.set(Calendar.MONTH, month + i);
|
||||
String dayAfter = new SimpleDateFormat("yyyy-MM-dd")
|
||||
.format(c.getTime());
|
||||
return dayAfter;
|
||||
}
|
||||
|
||||
|
||||
public static Calendar getParkingStart(String info) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat("yy-MM-dd").parse(DateUtils.getSpecifiedDayAfter(info));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
return c;
|
||||
}
|
||||
|
||||
public static Calendar getParkingMaxEnd(String info) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
Date date = null;
|
||||
try {
|
||||
date = new SimpleDateFormat("yy-MM-dd").parse(DateUtils.getSpecifiedDayAfter(info));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
c.setTime(date);
|
||||
int month = c.get(Calendar.MONTH);
|
||||
c.set(Calendar.MONTH, month + 12);
|
||||
return c;
|
||||
}
|
||||
|
||||
public static String getUnit(String info) {
|
||||
if (TextUtils.isEmpty(info)) {
|
||||
return "";
|
||||
}
|
||||
boolean numericZidai = isNumericZidai(info);
|
||||
if (numericZidai) {
|
||||
return info + "单元";
|
||||
} else {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNumericZidai(String str) {
|
||||
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
System.out.println(str.charAt(i));
|
||||
if (!Character.isDigit(str.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
package utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.inputmethodservice.KeyboardView;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.sl.house_property.R;
|
||||
@@ -144,6 +146,16 @@ public class KeyboardUtil {
|
||||
mKeyboardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 显示软键盘
|
||||
*
|
||||
* @param context 当前Activity
|
||||
*/
|
||||
public static void showSoftInput(Context context) {
|
||||
InputMethodManager inputMethodManager =
|
||||
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 软键盘隐藏
|
||||
|
||||
@@ -5,12 +5,18 @@ import android.graphics.Bitmap;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.lzy.ninegrid.NineGridView;
|
||||
import com.sl.house_property.R;
|
||||
|
||||
public class NineImageLoader implements NineGridView.ImageLoader {
|
||||
@Override
|
||||
public void onDisplayImage(Context context, ImageView imageView, String url) {
|
||||
Glide.with(context).load(url).into(imageView);
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.error(R.mipmap.icon_default_rectangle);
|
||||
requestOptions .skipMemoryCache(false);
|
||||
Glide.with(context).load(url).apply(requestOptions).into(imageView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
42
app/src/main/java/utils/UtilHelpers.java
Normal file
42
app/src/main/java/utils/UtilHelpers.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.IBinder;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class UtilHelpers {
|
||||
/**
|
||||
* 根据传入控件的坐标和用户的焦点坐标,判断是否隐藏键盘,如果点击的位置在控件内,则不隐藏键盘
|
||||
*
|
||||
* @param view 控件view
|
||||
* @param event 焦点位置
|
||||
* @return 是否隐藏
|
||||
*/
|
||||
public static boolean hideKeyboard(MotionEvent event, View view,
|
||||
Activity activity) {
|
||||
|
||||
try {
|
||||
if (view != null && view instanceof EditText) {
|
||||
int[] location = {0, 0};
|
||||
view.getLocationInWindow(location);
|
||||
int left = location[0], top = location[1], right = left
|
||||
+ view.getWidth(), bootom = top + view.getHeight();
|
||||
// 判断焦点位置坐标是否在空间内,如果位置在控件外,则隐藏键盘
|
||||
if (event.getRawX() < left || event.getRawX() > right
|
||||
|| event.getY() < top || event.getRawY() > bootom) {
|
||||
// // 隐藏键盘
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
24
app/src/main/res/drawable/shape_comment.xml
Normal file
24
app/src/main/res/drawable/shape_comment.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_focused="true">
|
||||
<shape>
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="#15a97e"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="#15a97e"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="#1bc593"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
11
app/src/main/res/drawable/shape_comment_bg.xml
Normal file
11
app/src/main/res/drawable/shape_comment_bg.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size android:width="2dp" />
|
||||
|
||||
<!--<corners android:radius="3dip"/>-->
|
||||
<stroke
|
||||
android:width="1dip"
|
||||
android:color="@color/gray" />
|
||||
|
||||
</shape>
|
||||
@@ -1,101 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
|
||||
tools:context=".MainTabActivity">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="50dip"
|
||||
android:layout_height="match_parent">
|
||||
<FrameLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:id="@+id/mycontent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
android:layout_height="match_parent"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/mycontent"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_height="wrap_content">
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_alignTop="@+id/radioGroup"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/background_grey_line"
|
||||
android:layout_height="10dip"/>
|
||||
<RadioGroup
|
||||
android:layout_width="match_parent"
|
||||
android:paddingTop="7dip"
|
||||
android:id="@+id/radioGroup"
|
||||
|
||||
android:background="@color/white"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="50dip">
|
||||
<RadioButton
|
||||
<LinearLayout
|
||||
android:id="@+id/rl_bottom"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:checked="true"
|
||||
android:button="@null"
|
||||
android:drawableTop="@drawable/main_bottom_0"
|
||||
android:id="@+id/button"
|
||||
android:textColor="@color/radiobuttoncolor"
|
||||
android:text="@string/news"
|
||||
android:layout_height="match_parent"/>
|
||||
<RadioButton
|
||||
android:layout_height="10dip"
|
||||
android:layout_alignTop="@+id/radioGroup"
|
||||
android:background="@drawable/background_grey_line"
|
||||
android:visibility="gone" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:drawableTop="@drawable/main_bottom_1"
|
||||
android:button="@null"
|
||||
android:id="@+id/button1"
|
||||
android:textColor="@color/radiobuttoncolor"
|
||||
android:text="发现"
|
||||
android:layout_height="match_parent"/>
|
||||
<RadioButton
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:drawableTop="@drawable/main_bottom_2"
|
||||
android:id="@+id/button3"
|
||||
android:text="购物车"
|
||||
android:textColor="@color/radiobuttoncolor"
|
||||
android:layout_height="match_parent"/>
|
||||
<RadioButton
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:drawableTop="@drawable/main_bottom_3"
|
||||
android:id="@+id/button2"
|
||||
android:textColor="@color/radiobuttoncolor"
|
||||
android:text="@string/news3"
|
||||
android:layout_height="match_parent"/>
|
||||
<RadioButton
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/news4"
|
||||
android:drawableTop="@drawable/main_bottom_4"
|
||||
android:button="@null"
|
||||
android:id="@+id/button4"
|
||||
android:textColor="@color/radiobuttoncolor"
|
||||
android:gravity="center"
|
||||
android:layout_height="match_parent"/>
|
||||
</RadioGroup>
|
||||
android:layout_height="50dip"
|
||||
|
||||
android:background="@color/white"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="7dip">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:drawableTop="@drawable/main_bottom_0"
|
||||
android:gravity="center"
|
||||
android:text="@string/news"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/button1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:drawableTop="@drawable/main_bottom_1"
|
||||
android:gravity="center"
|
||||
android:text="发现"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/button3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:drawableTop="@drawable/main_bottom_2"
|
||||
android:gravity="center"
|
||||
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:visibility="gone" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/button4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:drawableTop="@drawable/main_bottom_4"
|
||||
android:gravity="center"
|
||||
android:text="@string/news4"
|
||||
android:textColor="@color/radiobuttoncolor" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
70
app/src/main/res/layout/dialog_comment.xml
Normal file
70
app/src/main/res/layout/dialog_comment.xml
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_zan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@mipmap/xin"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="赞"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:background="@color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_comment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@mipmap/pl2"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="评论"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v"
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bug"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@mipmap/buy"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="购买"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
@@ -1,84 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
<LinearLayout
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".discovery.DiscoveryFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/mystatusbar"
|
||||
android:background="@color/backcolorAccent"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/mystatusbar"
|
||||
android:background="@color/backcolorAccent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="发现"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_add"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="16dp"
|
||||
android:src="@drawable/ic_photo_camera" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/dw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="发现"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:background="@color/white"
|
||||
app:srlEnableLoadMore="true"
|
||||
app:srlEnableLoadMoreWhenContentNotFull="true">
|
||||
|
||||
/>
|
||||
<ScrollView
|
||||
android:id="@+id/sv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_add"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="16dp"
|
||||
android:src="@drawable/ic_photo_camera" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/v"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/head"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_below="@id/v"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="-30dp"
|
||||
android:layout_marginRight="16dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recy_view"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<my_view.tao_bao_refresh.TaoBaoRefreshLayout
|
||||
android:id="@+id/rl"
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/ll_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="45dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="#f6f6f6"
|
||||
android:elevation="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<my_view.tao_bao_refresh.ScrollViewExtend
|
||||
<EditText
|
||||
android:id="@+id/et_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_comment_bg"
|
||||
android:ellipsize="end"
|
||||
android:hint="说点什么"
|
||||
android:maxLength="300"
|
||||
android:paddingLeft="10dp"
|
||||
android:singleLine="true"
|
||||
android:textColorHint="#a2a2a2"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:background="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/tv_send_comment"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/shape_comment"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="发送"
|
||||
android:textColor="#fff"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/v"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp"/>
|
||||
<ImageView
|
||||
android:id="@+id/head"
|
||||
android:layout_below="@id/v"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="-30dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"/>
|
||||
</RelativeLayout>
|
||||
<my_view.tao_bao_refresh.RecyView
|
||||
android:id="@+id/recy_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</my_view.tao_bao_refresh.RecyView>
|
||||
</LinearLayout>
|
||||
</my_view.tao_bao_refresh.ScrollViewExtend>
|
||||
</my_view.tao_bao_refresh.TaoBaoRefreshLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
69
app/src/main/res/layout/item_comment.xml
Normal file
69
app/src/main/res/layout/item_comment.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/light_color_blue"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/tv_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_hf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/light_color_blue"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/tv_info2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/light_color_blue"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/tv_info3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -23,13 +23,14 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nikeName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/light_color_blue"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
@@ -51,6 +52,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@@ -61,6 +63,7 @@
|
||||
android:textSize="12sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_comment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:layout_gravity="right"
|
||||
@@ -72,6 +75,7 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:padding="3dp"
|
||||
android:id="@+id/tv_like"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -79,6 +83,7 @@
|
||||
android:text="❤ 哈哈哈,呵呵呵" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:paddingLeft="3dp"
|
||||
android:id="@+id/rv_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
BIN
app/src/main/res/mipmap-xhdpi/buy.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/buy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 693 B |
BIN
app/src/main/res/mipmap-xhdpi/pl2.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/pl2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 484 B |
BIN
app/src/main/res/mipmap-xhdpi/xin.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/xin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 952 B |
@@ -29,14 +29,19 @@
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
|
||||
<style name="MyThemeactonbar" parent="@style/Theme.AppCompat.DayNight">
|
||||
<style name="MyThemeactonbar" parent="@style/Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- <style name="MyTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
|
||||
<style name="TAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="main_publishdialog_style" parent="android:Theme.Holo.Light.Dialog">
|
||||
|
||||
@@ -61,7 +61,7 @@ public class NineGridViewClickAdapter extends NineGridViewAdapter {
|
||||
bundle.putInt(ImagePreviewActivity.CURRENT_ITEM, index);
|
||||
intent.putExtras(bundle);
|
||||
context.startActivity(intent);
|
||||
((Activity) context).overridePendingTransition(0, 0);
|
||||
// ((Activity) context).overridePendingTransition(0, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user