所有依赖
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.7'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//加载图片Fresco
compile 'com.facebook.fresco:fresco:0.12.0'
// 支持 GIF 动图,需要添加
compile 'com.facebook.fresco:animated-gif:0.12.0'
// 支持 WebP (静态图+动图),需要添加
compile 'com.facebook.fresco:animated-webp:0.12.0'
compile 'com.facebook.fresco:webpsupport:0.12.0'
// 仅支持 WebP 静态图,需要添加
compile 'com.facebook.fresco:webpsupport:0.12.0'
// 使用EventBus
compile 'org.greenrobot:eventbus:3.1.1'
权限加入
<uses-permission android:name="android.permission.INTERNET" />
就一个网络权限 读写的权限也可以加进去
布局文件 不少啊 好好看看
activity_details
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="demo.sharesdk.cn.test01.mvp.view.activity.DetailsActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<VideoView
android:layout_width="match_parent"
android:layout_height="180dp"
android:id="@+id/videoView"
/>
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/simpleDetails"
android:layout_width="match_parent"
android:layout_height="200dp" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="标题"
android:textSize="20sp"
/>
<TextView
android:textColor="#FEB016"
android:id="@+id/price"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="价格"
android:textSize="20sp"
/>
LinearLayout>
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<ImageView
android:layout_width="0dp"
android:src="@mipmap/ic_launcher"
android:layout_height="30dp"
android:layout_weight="1"
/>
<ImageView
android:layout_width="0dp"
android:src="@mipmap/ic_launcher"
android:layout_height="30dp"
android:layout_weight="1"
/>
<ImageView
android:layout_width="0dp"
android:src="@mipmap/ic_launcher"
android:layout_height="30dp"
android:layout_weight="1"
/>
LinearLayout>
<LinearLayout
android:layout_marginLeft="25dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/addCart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:background="#ff0"
android:text="加入购物车"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:background="#f00"
android:text="立即购买"
/>
LinearLayout>
LinearLayout>
RelativeLayout>
activity_main
xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="demo.sharesdk.cn.test01.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="淘宝登录"
android:textColor="#000"
android:textSize="20sp"
android:layout_centerInParent="true"
/>
RelativeLayout>
<LinearLayout
android:layout_marginTop="60dp"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账号"
/>
<EditText
android:id="@+id/adminFive"
android:layout_marginRight="20dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="请输入你的账号"
/>
LinearLayout>
<LinearLayout
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码"
/>
<EditText
android:id="@+id/pwdFive"
android:layout_marginRight="20dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="请输入你的密码"
/>
LinearLayout>
<Button
android:id="@+id/loginFive"
android:textColor="#888888"
android:layout_gravity="center_horizontal"
android:background="@drawable/shape_activity"
android:layout_marginTop="30dp"
android:layout_width="350dp"
android:layout_height="50sp"
android:textSize="20sp"
android:text="登录"
/>
<RelativeLayout
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/regFive"
android:padding="10dp"
android:text="注册账号"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/forgetFive"
android:padding="10dp"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="忘记密码"
/>
RelativeLayout>
LinearLayout>
activity_register
xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="demo.sharesdk.cn.test01.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="淘宝注册"
android:textColor="#000"
android:textSize="20sp"
android:layout_centerInParent="true"
/>
RelativeLayout>
<LinearLayout
android:layout_marginTop="60dp"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账号"
/>
<EditText
android:id="@+id/adminFive"
android:layout_marginRight="20dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="请输入你的账号"
/>
LinearLayout>
<LinearLayout
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码"
/>
<EditText
android:id="@+id/pwdFive"
android:layout_marginRight="20dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="请输入你的密码"
/>
LinearLayout>
<LinearLayout
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认密码"
/>
<EditText
android:id="@+id/affirm"
android:layout_marginRight="20dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="请再次输入你的密码"
/>
LinearLayout>
<LinearLayout
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="邮箱"
/>
<EditText
android:id="@+id/email"
android:layout_marginRight="20dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="请输入你的邮箱"
/>
LinearLayout>
<Button
android:id="@+id/loginFive"
android:textColor="#888888"
android:layout_gravity="center_horizontal"
android:background="@drawable/shape_activity"
android:layout_marginTop="30dp"
android:layout_width="350dp"
android:layout_height="50sp"
android:textSize="20sp"
android:text="注册"
/>
LinearLayout>
activity_second
xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context="demo.sharesdk.cn.test01.mvp.view.activity.SecondActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent">
android.support.v7.widget.RecyclerView>
LinearLayout>
activity_shop_cart.xml
xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".mvp.view.activity.ShopCartActivity">
<RelativeLayout
android:id="@+id/linear2"
android:background="#000"
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:layout_centerInParent="true"
android:textColor="#fff"
android:textSize="20sp"
android:text="购物车"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/bianji"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="编辑"
android:textColor="#fff"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
/>
RelativeLayout>
<ExpandableListView
android:layout_below="@+id/linear2"
android:groupIndicator="@null"
android:layout_above="@+id/linear"
android:id="@+id/expandView"
android:layout_width="match_parent"
android:layout_height="match_parent">
ExpandableListView>
<RelativeLayout
android:background="#AAAAAA"
android:id="@+id/linear"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="70dp">
<CheckBox
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="全选"
android:id="@+id/checkAll"
/>
<TextView
android:id="@+id/zprice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="总计:0.0¥"
android:layout_centerInParent="true"
/>
<Button
android:id="@+id/zcount"
android:textColor="#fff"
android:background="#FF0000"
android:text="结算(0)"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
/>
RelativeLayout>
RelativeLayout>
custom_linearlayout.xml
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<Button
android:layout_width="35dp"
android:layout_height="35dp"
android:text="-"
android:id="@+id/jian"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edit"
/>
<Button
android:text="+"
android:id="@+id/jia"
android:layout_width="35dp"
android:layout_height="35dp" />
LinearLayout>
item_expandable_listview
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/groupChecked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/groupTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="标题"
/>
LinearLayout>
item_listview
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:orientation="horizontal"
android:id="@+id/linearLayoutItem"
android:gravity="center_vertical"
android:layout_height="match_parent">
<CheckBox
android:layout_marginLeft="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/childChecked"
/>
<com.facebook.drawee.view.SimpleDraweeView
android:layout_marginLeft="5dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/simpleDraw"
fresco:placeholderImage="@mipmap/ic_launcher"
fresco:retryImage="@mipmap/ic_launcher"
/>
<LinearLayout
android:layout_marginLeft="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:textSize="16sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/childTitle"
android:text="标题"
/>
<TextView
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:text="描述"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/miaoShu"
/>
<LinearLayout
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textSize="16sp"
android:textColor="#FCB950"
android:text="价格"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/childPrice"
/>
<TextView
android:text="优惠"
android:id="@+id/childPriceY"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
/>
<demo.sharesdk.cn.test01.widget.CustomLinearLayout
android:id="@+id/customLinearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
demo.sharesdk.cn.test01.widget.CustomLinearLayout>
LinearLayout>
LinearLayout>
LinearLayout>
product_recycler_itemxml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:id="@+id/linear"
android:layout_height="match_parent">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/simpleDrawee"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/price"
android:text="价格"
/>
<TextView
android:layout_marginTop="20dp"
android:text="标题"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/titleTextview"
/>
LinearLayout>
LinearLayout>
布局文件已经完事 上代码了 看仔细了啊 不要漏掉
IApplication
package demo.sharesdk.cn.test01;
import android.app.Application;
import com.facebook.drawee.backends.pipeline.Fresco;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class IApplication extends Application{
@Override
public void onCreate() {
super.onCreate();
Fresco.initialize(this);
}
}
MainActivity
package demo.sharesdk.cn.test01;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import demo.sharesdk.cn.test01.mvp.presenter.LoginPresenter;
import demo.sharesdk.cn.test01.mvp.view.LoginPresenterListener;
import demo.sharesdk.cn.test01.mvp.view.activity.SecondActivity;
import demo.sharesdk.cn.test01.util.LoginMD5;
public class MainActivity extends AppCompatActivity implements LoginPresenterListener {
private long exitTime = 0;
@BindView(R.id.adminFive)
EditText mAdminFive;
@BindView(R.id.pwdFive)
EditText mPwdFive;
@BindView(R.id.loginFive)
Button mLoginFive;
@BindView(R.id.regFive)
TextView mRegFive;
@BindView(R.id.forgetFive)
TextView mForgetFive;
private LoginPresenter loginPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
//调用presenter层的数据
loginPresenter = new LoginPresenter(this);
}
@OnClick({R.id.loginFive, R.id.regFive})
public void onClick(View v) {
switch (v.getId()) {
default:
break;
case R.id.loginFive:
//登录
loginPresenter.getData(mAdminFive.getText().toString().trim(),mPwdFive.getText().toString().trim());
break;
case R.id.regFive:
//跳转注册页面
startActivity(new Intent(MainActivity.this,RegisterActivity.class));
break;
}
}
//接口返回的数据
@Override
public void success(String s) {
if(("登录成功").equals(s)) {
LoginMD5.getMD5(mPwdFive.getText().toString().trim());
Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);
finish();
}else{
Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
}
}
@Override
public void failed(String s) {
Toast.makeText(MainActivity.this,s,Toast.LENGTH_SHORT).show();
}
@Override
public void adminEmpty(String s) {
Toast.makeText(MainActivity.this,s,Toast.LENGTH_SHORT).show();
}
@Override
public void pwdEmpty(String s) {
Toast.makeText(MainActivity.this,s,Toast.LENGTH_SHORT).show();
}
//销毁防止内存泄露
@Override
protected void onDestroy() {
super.onDestroy();
loginPresenter.detach();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
exit();
return false;
}
return super.onKeyDown(keyCode, event);
}
public void exit() {
if ((System.currentTimeMillis() - exitTime) > 2000) {
Toast.makeText(getApplicationContext(), "再按一次退出程序",
Toast.LENGTH_SHORT).show();
exitTime = System.currentTimeMillis();
} else {
finish();
System.exit(0);
}
}
}
RegisterActivity
package demo.sharesdk.cn.test01;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import demo.sharesdk.cn.test01.mvp.presenter.RegisterPresenter;
import demo.sharesdk.cn.test01.mvp.view.RegisterPresenterListener;
public class RegisterActivity extends AppCompatActivity implements RegisterPresenterListener {
@BindView(R.id.adminFive)
EditText mAdminFive;
@BindView(R.id.pwdFive)
EditText mPwdFive;
@BindView(R.id.loginFive)
Button mLoginFive;
@BindView(R.id.affirm)
EditText mAffirm;
@BindView(R.id.email)
EditText mEmail;
private RegisterPresenter registerPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
ButterKnife.bind(this);
//告诉presenter层
registerPresenter = new RegisterPresenter(this);
}
//点击注册
@OnClick({R.id.loginFive, R.id.affirm, R.id.email})
public void onClick(View v) {
switch (v.getId()) {
default:
break;
case R.id.loginFive:
String admin = mAdminFive.getText().toString().trim();
String pwd = mPwdFive.getText().toString().trim();
String maff = mAffirm.getText().toString().trim();
String email = mEmail.getText().toString().trim();
//点击注册
registerPresenter.getData(admin,pwd,maff,email);
break;
}
}
//返回的数据
@Override
public void success(String s) {
if (("注册成功").equals(s)) {
Toast.makeText(RegisterActivity.this, s, Toast.LENGTH_SHORT).show();
finish();
} else {
Toast.makeText(RegisterActivity.this, s, Toast.LENGTH_SHORT).show();
}
}
@Override
public void failed(String s) {
Toast.makeText(RegisterActivity.this, s, Toast.LENGTH_SHORT).show();
}
@Override
public void adminEmpty(String s) {
Toast.makeText(RegisterActivity.this, s, Toast.LENGTH_SHORT).show();
}
@Override
public void pwdEmpty(String s) {
Toast.makeText(RegisterActivity.this, s, Toast.LENGTH_SHORT).show();
}
@Override
public void email(String s) {
Toast.makeText(RegisterActivity.this, s, Toast.LENGTH_SHORT).show();
}
@Override
public void confrim(String s) {
Toast.makeText(RegisterActivity.this, s, Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy() {
super.onDestroy();
registerPresenter.detach();
}
}
retrofit包
ApiService
package demo.sharesdk.cn.test01.retrofit;
import java.util.Map;
import io.reactivex.Observable;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;
/**
* Created by QinQinBaoBei on 2018/1/12.
*/
public interface ApiService {
@GET
Observable<String> get(@Url String url , @QueryMap Map<String,String> map);
@FormUrlEncoded
@POST
Observable<String> post(@Url String url, @FieldMap Map<String,String> map);
}
BaseObserver
package demo.sharesdk.cn.test01.retrofit;
import com.google.gson.Gson;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.SocketException;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import retrofit2.HttpException;
/**
* Created by QinQinBaoBei on 2018/1/12.
*/
public abstract class BaseObserver<T> implements Observer<String> {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(String s) {
try {
Type genType = getClass().getGenericSuperclass();
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
Class entityClass = (Class) params[0];
Gson gson = new Gson();
T t = (T)gson.fromJson(s,entityClass);
success(t);
} catch (Exception e) {
failure(1001);
e.printStackTrace();
}
}
@Override
public void onError(Throwable e) {
try {
if(e != null){
if(e instanceof HttpException){
failure(HTTP_ERROR);
} else if(e instanceof SocketException){
failure(NET_WORK_ERROR);
}else {
failure(UNKNOW_ERROR);
}
}else {
failure(UNKNOW_ERROR);
}
e.printStackTrace() ;
} catch (Exception e1) {
failure(UNKNOW_ERROR);
e1.printStackTrace();
}
}
@Override
public void onComplete() {
}
//
/**
* code
* 1000 UNKNOW_ERROR 未知错误
* 1001 json 转化异常 parse error
* 1002 当前网络不可用 java.net.SocketException: Network is unreachable 超时
* 1003 服务器不可用 401 402 403 500 502 503 504
* @param code
*/
public static final int UNKNOW_ERROR = 1000;
public static final int JSON_FORMAT_ERROR = 1001;
public static final int NET_WORK_ERROR = 1002;
public static final int HTTP_ERROR = 1003;
public abstract void success(T t);
public abstract void failure(int code);
}
package demo.sharesdk.cn.test01.retrofit;
import java.util.Map;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
/**
* Created by QinQinBaoBei on 2018/1/12.
*/
public class RetrofitManager {
public static OkHttpClient client = new OkHttpClient.Builder()
.build();
public static ApiService apiService = new Retrofit.Builder()
.baseUrl("http://120.27.23.105/")
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(ScalarsConverterFactory.create())
.client(client)
.build()
.create(ApiService.class);
public static void get(String url, Map<String,String> map,Observer observer){
apiService.get(url,map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(observer);
}
public static void post(String url,Map<String,String> map,Observer observer){
apiService.post(url,map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(observer);
}
}
RetrofitManager
package demo.sharesdk.cn.test01.retrofit;
import java.util.Map;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
/**
* Created by QinQinBaoBei on 2018/1/12.
*/
public class RetrofitManager {
public static OkHttpClient client = new OkHttpClient.Builder()
.build();
public static ApiService apiService = new Retrofit.Builder()
.baseUrl("http://120.27.23.105/")
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(ScalarsConverterFactory.create())
.client(client)
.build()
.create(ApiService.class);
public static void get(String url, Map<String,String> map,Observer observer){
apiService.get(url,map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(observer);
}
public static void post(String url,Map<String,String> map,Observer observer){
apiService.post(url,map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(observer);
}
}
CustomLinearLayout
package demo.sharesdk.cn.test01.widget;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import demo.sharesdk.cn.test01.R;
public class CustomLinearLayout extends LinearLayout {
private int i=1;
private EditText et;
public CustomLinearLayout(Context context) {
super(context);
}
public CustomLinearLayout(final Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
View view = View.inflate(context, R.layout.custom_linearlayout,null);
addView(view);
Button jia = view.findViewById(R.id.jia);
Button jian = view.findViewById(R.id.jian);
et = view.findViewById(R.id.edit);
et.setText("1");
jia.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
i = Integer.parseInt(et.getText().toString().trim());
i++;
et.setText(i+"");
if(countListener!=null){
countListener.setCount(i);
}
}
});
jian.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(i>1){
i = Integer.parseInt(et.getText().toString().trim());
i--;
}else{
Toast.makeText(context,"数量不能小于1",Toast.LENGTH_SHORT).show();
}
et.setText(i+"");
if(countListener!=null){
countListener.setCount(i);
}
}
});
}
public CustomLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
CountListener countListener;
public void getCount(CountListener countListener){
this.countListener = countListener;
}
public interface CountListener{
void setCount(int i);
}
public void setText(String count){
et.setText(count);
}
}
LoginMD5
package demo.sharesdk.cn.test01.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class LoginMD5 {
/**
* 对外提供getMD5(String)方法
* @author randyjia
*
*/
public static String getMD5(String val){
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
md5.update(val.getBytes());
byte[] m = md5.digest();//加密
return getString(m);
}
private static String getString(byte[] b){
StringBuffer sb = new StringBuffer();
for(int i = 0; i < b.length; i ++){
sb.append(b[i]);
}
return sb.toString();
}
}
adapter包
MyAdapter
package demo.sharesdk.cn.test01.adapter;
import android.content.Context;
import android.graphics.Paint;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;
import demo.sharesdk.cn.test01.R;
import demo.sharesdk.cn.test01.bean.CartBean;
import demo.sharesdk.cn.test01.widget.CustomLinearLayout;
public class MyAdapter extends BaseExpandableListAdapter {
Context context;
List<CartBean.DataBean> group;
List<List<CartBean.DataBean.ListBean>> child;
private Holder1 holder1;
private Holder2 holder2;
public MyAdapter(Context context, List<CartBean.DataBean> group, List<List<CartBean.DataBean.ListBean>> child) {
this.context = context;
this.group = group;
this.child = child;
}
@Override
public int getGroupCount() {
return group.size();
}
@Override
public int getChildrenCount(int groupPosition) {
return child.get(groupPosition).size();
}
@Override
public Object getGroup(int groupPosition) {
return group.get(groupPosition);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return child.get(groupPosition).get(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
if(convertView==null){
convertView = LayoutInflater.from(context).inflate(R.layout.item_expandable_listview, null);
holder1 = new Holder1();
holder1.checkBox = convertView.findViewById(R.id.groupChecked);
holder1.textview = convertView.findViewById(R.id.groupTitle);
convertView.setTag(holder1);
}else{
holder1 = (Holder1) convertView.getTag();
}
//设置显示数据
holder1.textview.setText(group.get(groupPosition).getSellerName());
holder1.checkBox.setChecked(group.get(groupPosition).isgChecked());
//设置一级标题的点击事件
holder1.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean b = !group.get(groupPosition).isgChecked();
Toast.makeText(context,b+"",Toast.LENGTH_SHORT).show();
group.get(groupPosition).setgChecked(b);
//拿到你点击孩子的父亲
List<CartBean.DataBean.ListBean> listBeans = child.get(groupPosition);
//遍历看看他有几个孩子
for (int i=0;i<listBeans.size();i++){
listBeans.get(i).setcChecked(group.get(groupPosition).isgChecked());
}
changeListener.setState(isGroup());
notifyDataSetChanged();
sum();
}
});
return convertView;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, final boolean isLastChild, View convertView, ViewGroup parent) {
if(convertView==null){
convertView = LayoutInflater.from(context).inflate(R.layout.item_listview, null);
holder2 = new Holder2();
holder2.imageView = convertView.findViewById(R.id.simpleDraw);
holder2.checkBox = convertView.findViewById(R.id.childChecked);
holder2.title = convertView.findViewById(R.id.childTitle);
holder2.miaoshu= convertView.findViewById(R.id.miaoShu);
holder2.price = convertView.findViewById(R.id.childPrice);
holder2.yprice = convertView.findViewById(R.id.childPriceY);
holder2.linearLayout = convertView.findViewById(R.id.linearLayoutItem);
holder2.customLinearLayout = convertView.findViewById(R.id.customLinearLayout);
convertView.setTag(holder2);
}else{
holder2 = (Holder2) convertView.getTag();
}
final CartBean.DataBean.ListBean listBean = child.get(groupPosition).get(childPosition);
//设置显示数据
holder2.checkBox.setChecked(listBean.iscChecked());
holder2.title.setText(listBean.getTitle());
holder2.price.setText("¥"+listBean.getPrice());
holder2.yprice.setText("¥"+listBean.getBargainPrice());
holder2.customLinearLayout.setText(listBean.getNum()+"");
//中划线
holder2.yprice.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG);
// 设置中划线并加清晰
holder2.yprice.setPaintFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG);
holder2.miaoshu.setText(listBean.getSubhead());
String[] split = listBean.getImages().split("\\|");
holder2.imageView.setImageURI(Uri.parse(split[0]));
holder2.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<CartBean.DataBean.ListBean> listBeans = child.get(groupPosition);
boolean b = !listBeans.get(childPosition).iscChecked();
listBeans.get(childPosition).setcChecked(b);
boolean isno = isChildChange(listBeans);
//设置一级的状态
group.get(groupPosition).setgChecked(isno);
changeListener.setState(isChild());
notifyDataSetChanged();
sum();
}
});
//加减号的点击事件
holder2.customLinearLayout.getCount(new CustomLinearLayout.CountListener() {
@Override
public void setCount(int i) {
listBean.setNum(i);
sum();
}
});
//删除事件
holder2.linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<CartBean.DataBean.ListBean> list = group.get(groupPosition).getList();
for (int i=0;i<list.size();i++) {
if (list.size() > 0) {
list.remove(i);
}
}
if(list.size()==0){
child.remove(childPosition);
group.remove(groupPosition);
}
notifyDataSetChanged();
}
});
return convertView;
}
//计算的方法
public void sum(){
double price = 0;
int count = 0;
for (int i=0;i<group.size();i++){
List<CartBean.DataBean.ListBean> list = group.get(i).getList();
for (int j=0;j<list.size();j++){
if(list.get(j).iscChecked()){
price +=list.get(j).getPrice()*list.get(j).getNum();
count +=list.get(j).getNum();
}
}
}
notifyDataSetChanged();
//接口回调
if(changeListener!=null) {
changeListener.setText(price + "", count + "");
}
}
ChangeListener changeListener;
public void setChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
//接口传值,去改变全选的状态,设置商品的数量价格
public interface ChangeListener{
void setState(boolean flag);
void setText(String price,String count);
}
//子类点击改变全选状态
public boolean isChild(){
for (int i=0;i<group.size();i++){
List<CartBean.DataBean.ListBean> list = group.get(i).getList();
for (int j=0;j<list.size();j++){
if(!child.get(i).get(j).iscChecked()){
return false;
}
}
}
return true;
}
//父类点击改变全选的状态
public boolean isGroup(){
for (int i=0;i<group.size();i++){
if(!group.get(i).isgChecked()){
return false;
}
}
return true;
}
//设置全选
public void checkedAll(boolean flag){
if(flag){
for (int i=0;i<group.size();i++){
List<CartBean.DataBean.ListBean> list = group.get(i).getList();
group.get(i).setgChecked(true);
for (int j=0;j<list.size();j++){
child.get(i).get(j).setcChecked(true);
}
}
}else{
for (int i=0;i<group.size();i++){
List<CartBean.DataBean.ListBean> list = group.get(i).getList();
group.get(i).setgChecked(false);
for (int j=0;j<list.size();j++){
child.get(i).get(j).setcChecked(false);
}
}
}
notifyDataSetChanged();
sum();
}
//如果有意子类没选中就将父类的状态改为true
public boolean isChildChange( List<CartBean.DataBean.ListBean> listBeans){
for (int i=0;i();i++){
if(!listBeans.get(i).iscChecked()){
return false;
}
}
return true;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
class Holder1{
CheckBox checkBox;
TextView textview;
}
class Holder2{
LinearLayout linearLayout;
CustomLinearLayout customLinearLayout;
CheckBox checkBox;
SimpleDraweeView imageView;
TextView title;
TextView miaoshu;
TextView price;
TextView yprice;
}
}
MyProductAdapter
package demo.sharesdk.cn.test01.adapter;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.facebook.cache.disk.DiskCacheConfig;
import com.facebook.common.internal.Supplier;
import com.facebook.common.util.ByteConstants;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.cache.MemoryCacheParams;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.imagepipeline.listener.RequestListener;
import com.facebook.imagepipeline.listener.RequestLoggingListener;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import demo.sharesdk.cn.test01.R;
import demo.sharesdk.cn.test01.bean.DataDataBean;
import demo.sharesdk.cn.test01.mvp.view.activity.DetailsActivity;
import demo.sharesdk.cn.test01.mvp.view.activity.SecondActivity;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class MyProductAdapter extends RecyclerView.Adapter{
Context context;
List<DataDataBean.DataBean> dataDataBean;
private static final int MAX_HEAP_SIZE = (int) Runtime.getRuntime().maxMemory();
public static final int MAX_DISK_CACHE_SIZE = 40 * ByteConstants.MB;
public static final int MAX_MEMORY_CACHE_SIZE = MAX_HEAP_SIZE / 4;
private static final String IMAGE_PIPELINE_CACHE_DIR = "imagepipeline_cache";
private static ImagePipelineConfig sImagePipelineConfig;
private static ImagePipelineConfig sOkHttpImagePipelineConfig;
public MyProductAdapter(Context context, List<DataDataBean.DataBean> dataDataBean) {
this.context = context;
this.dataDataBean = dataDataBean;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = View.inflate(context, R.layout.product_recycler_item,null);
return new ViewHolder1(view);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
ViewHolder1 holder1 = (ViewHolder1) holder;
//设置数据
String[] split = dataDataBean.get(position).getImages().split("\\|");
holder1.imageView.setImageURI(Uri.parse(split[0]));
holder1.price.setText(dataDataBean.get(position).getPrice()+"");
holder1.title.setText(dataDataBean.get(position).getTitle());
//点击事件
holder1.linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context,DetailsActivity.class);
intent.putExtra("pid",dataDataBean.get(position).getPscid()+"");
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return dataDataBean.size();
}
class ViewHolder1 extends RecyclerView.ViewHolder {
SimpleDraweeView imageView;
TextView title;
TextView price;
LinearLayout linearLayout;
public ViewHolder1(View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.simpleDrawee);
title = itemView.findViewById(R.id.titleTextview);
price = itemView.findViewById(R.id.price);
linearLayout = itemView.findViewById(R.id.linear);
}
}
/**
* 配置内存缓存和磁盘缓存
*/
private static void configureCaches(
ImagePipelineConfig.Builder configBuilder,
Context context) {
final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
// Max total size of elements in the cache
MAX_MEMORY_CACHE_SIZE,
// Max entries in the cache
Integer.MAX_VALUE,
// Max total size of elements in eviction queue
MAX_MEMORY_CACHE_SIZE,
// Max length of eviction queue
Integer.MAX_VALUE,
// Max cache entry size
Integer.MAX_VALUE);
configBuilder
.setBitmapMemoryCacheParamsSupplier(
new Supplier<MemoryCacheParams>() {
@Override
public MemoryCacheParams get() {
return bitmapCacheParams;
}
})
.setMainDiskCacheConfig(
DiskCacheConfig.newBuilder(context)
.setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
.setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
.setMaxCacheSize(MAX_DISK_CACHE_SIZE)
.build());
}
private static void configureLoggingListeners(ImagePipelineConfig.Builder configBuilder) {
Set<RequestListener> requestListeners = new HashSet<>();
requestListeners.add(new RequestLoggingListener());
configBuilder.setRequestListeners(requestListeners);
}
private static void configureOptions(ImagePipelineConfig.Builder configBuilder) {
configBuilder.setDownsampleEnabled(true);
}
}
MVP模式下的 view model presenter
model包来了
AddCartModule
package demo.sharesdk.cn.test01.mvp.module;
import java.util.HashMap;
import java.util.Map;
import demo.sharesdk.cn.test01.bean.AddCartBean;
import demo.sharesdk.cn.test01.retrofit.BaseObserver;
import demo.sharesdk.cn.test01.retrofit.RetrofitManager;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class AddCartModule {
public void getData(String pid, final CartModuleListener cartModuleListener){
// http://120.27.23.105/product/addCart
Map<String, String> map = new HashMap<>();
map.put("pid",pid);
map.put("uid","100");
map.put("source","android");
//加入购物车
RetrofitManager.get("product/addCart", map, new BaseObserver<AddCartBean>() {
@Override
public void success(AddCartBean addCartBean) {
if(cartModuleListener!=null){
cartModuleListener.success(addCartBean);
}
}
@Override
public void failure(int code) {
}
});
}
public interface CartModuleListener{
void success(AddCartBean addCartBean);
}
}
CartModule
package demo.sharesdk.cn.test01.mvp.module;
import java.util.HashMap;
import java.util.Map;
import demo.sharesdk.cn.test01.bean.CartBean;
import demo.sharesdk.cn.test01.mvp.view.CartModuleListener;
import demo.sharesdk.cn.test01.retrofit.BaseObserver;
import demo.sharesdk.cn.test01.retrofit.RetrofitManager;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class CartModule {
public void getData(final CartModuleListener cartModuleListener){
//http://120.27.23.105/product/getCarts
Map<String, String> map = new HashMap<>();
map.put("uid","100");
map.put("source","android");
RetrofitManager.get("product/getCarts", map, new BaseObserver<CartBean>() {
@Override
public void success(CartBean cartBean) {
if(cartModuleListener!=null){
cartModuleListener.success(cartBean);
}
}
@Override
public void failure(int code) {
}
});
}
}
DetailsModule
package demo.sharesdk.cn.test01.mvp.module;
import java.util.HashMap;
import java.util.Map;
import demo.sharesdk.cn.test01.bean.DetailsBean;
import demo.sharesdk.cn.test01.mvp.view.DetailsModuleListener;
import demo.sharesdk.cn.test01.retrofit.BaseObserver;
import demo.sharesdk.cn.test01.retrofit.RetrofitManager;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class DetailsModule {
public void getData(String pid, final DetailsModuleListener moduleListener){
//http://120.27.23.105/product/getProductDetail?pid=1&source=android
Map<String,String> map = new HashMap<>();
map.put("pid",pid);
map.put("source","android");
RetrofitManager.get("product/getProductDetail", map, new BaseObserver<DetailsBean>() {
@Override
public void success(DetailsBean detailsBean) {
if(moduleListener!=null){
moduleListener.success(detailsBean);
}
}
@Override
public void failure(int code) {
}
});
}
}
LoginModule
package demo.sharesdk.cn.test01.mvp.module;
import java.util.HashMap;
import java.util.Map;
import demo.sharesdk.cn.test01.bean.LoginBean;
import demo.sharesdk.cn.test01.mvp.view.LoginModuleListener;
import demo.sharesdk.cn.test01.retrofit.BaseObserver;
import demo.sharesdk.cn.test01.retrofit.RetrofitManager;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public class LoginModule {
public void getData(String admin, String password, final LoginModuleListener loginListener){
Map<String,String> map = new HashMap<>();
map.put("mobile",admin);
map.put("password",password);
RetrofitManager.get("user/login", map, new BaseObserver<LoginBean>() {
@Override
public void success(LoginBean loginBean) {
if(loginListener!=null){
loginListener.success(loginBean);
}
}
@Override
public void failure(int code) {
}
});
}
}
ProducetsModule
package demo.sharesdk.cn.test01.mvp.module;
import java.util.HashMap;
import java.util.Map;
import demo.sharesdk.cn.test01.bean.DataDataBean;
import demo.sharesdk.cn.test01.mvp.view.ProductModuleListener;
import demo.sharesdk.cn.test01.retrofit.BaseObserver;
import demo.sharesdk.cn.test01.retrofit.RetrofitManager;
import io.reactivex.internal.schedulers.NewThreadScheduler;
import retrofit2.Retrofit;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class ProducetsModule {
//列表页的接口
public void getData(final ProductModuleListener productModuleListener){
Map<String,String> map = new HashMap<>();
map.put("pscid","1");
map.put("page","1");
map.put("source","android");
RetrofitManager.get("product/getProducts", map, new BaseObserver<DataDataBean>() {
@Override
public void success(DataDataBean dataDataBean) {
if(productModuleListener!=null){
//将数据返回
productModuleListener.success(dataDataBean);
}
}
@Override
public void failure(int code) {
}
});
}
}
RegisterModule
package demo.sharesdk.cn.test01.mvp.module;
import java.util.HashMap;
import java.util.Map;
import demo.sharesdk.cn.test01.bean.LoginBean;
import demo.sharesdk.cn.test01.bean.RegisterBean;
import demo.sharesdk.cn.test01.mvp.view.LoginModuleListener;
import demo.sharesdk.cn.test01.mvp.view.RegModuleListener;
import demo.sharesdk.cn.test01.retrofit.BaseObserver;
import demo.sharesdk.cn.test01.retrofit.RetrofitManager;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public class RegisterModule {
public void getData(String admin, String password, final RegModuleListener regModuleListener){
Map<String,String> map = new HashMap<>();
map.put("mobile",admin);
map.put("password",password);
RetrofitManager.get("user/reg", map, new BaseObserver<RegisterBean>() {
@Override
public void success(RegisterBean registerBean) {
if(regModuleListener!=null){
regModuleListener.success(registerBean);
}
}
@Override
public void failure(int code) {
}
});
}
}
presenter包下的东西 用于交互的桥梁
AddCartPresenter
package demo.sharesdk.cn.test01.mvp.presenter;
import demo.sharesdk.cn.test01.bean.AddCartBean;
import demo.sharesdk.cn.test01.mvp.module.AddCartModule;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class AddCartPresenter {
AddCartPresenterListener addCartPresenterListener;
private final AddCartModule addCartModule;
public AddCartPresenter(AddCartPresenterListener addCartPresenterListener) {
this.addCartPresenterListener = addCartPresenterListener;
addCartModule = new AddCartModule();
}
public void getData(String pid){
addCartModule.getData(pid, new AddCartModule.CartModuleListener() {
@Override
public void success(AddCartBean addCartBean) {
if(addCartPresenterListener!=null){
addCartPresenterListener.success(addCartBean.getMsg());
}
}
});
}
public void detach(){
addCartPresenterListener=null;
}
public interface AddCartPresenterListener{
void success(String s);
}
}
CartPresenterpackage demo.sharesdk.cn.test01.mvp.presenter;
import java.util.ArrayList;
import java.util.List;
import demo.sharesdk.cn.test01.bean.CartBean;
import demo.sharesdk.cn.test01.mvp.module.CartModule;
import demo.sharesdk.cn.test01.mvp.view.CartModuleListener;
import demo.sharesdk.cn.test01.mvp.view.CartPresenterListener;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class CartPresenter {
CartPresenterListener cartPresenterListener;
private final CartModule cartModule;
public CartPresenter(CartPresenterListener cartPresenterListener) {
this.cartPresenterListener = cartPresenterListener;
cartModule = new CartModule();
}
//获取数据
public void getData(){
cartModule.getData(new CartModuleListener() {
@Override
public void success(CartBean cartBean) {
//拿到一级二级数据返回去
List<CartBean.DataBean> group = cartBean.getData();
List<List<CartBean.DataBean.ListBean>> child = new ArrayList<>();
for (int i=0;i<group.size();i++){
child.add(group.get(i).getList());
}
if(cartPresenterListener!=null){
cartPresenterListener.success(group,child);
}
}
});
}
public void detach(){
cartPresenterListener=null;
}
}
DetailsPresenter
package demo.sharesdk.cn.test01.mvp.presenter;
import demo.sharesdk.cn.test01.bean.DetailsBean;
import demo.sharesdk.cn.test01.mvp.module.DetailsModule;
import demo.sharesdk.cn.test01.mvp.view.DetailsModuleListener;
import demo.sharesdk.cn.test01.mvp.view.DetailsPresenterListener;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class DetailsPresenter {
private DetailsPresenterListener presenterListener;
private final DetailsModule detailsModule;
public DetailsPresenter(DetailsPresenterListener presenterListener) {
this.presenterListener = presenterListener;
detailsModule = new DetailsModule();
}
public void getData(String pid){
detailsModule.getData(pid, new DetailsModuleListener() {
@Override
public void success(DetailsBean deatails) {
if(presenterListener!=null){
presenterListener.success(deatails.getData());
}
}
});
}
public void detach(){
presenterListener=null;
}
}
LoginPresenter
package demo.sharesdk.cn.test01.mvp.presenter;
import android.text.TextUtils;
import demo.sharesdk.cn.test01.bean.LoginBean;
import demo.sharesdk.cn.test01.mvp.module.LoginModule;
import demo.sharesdk.cn.test01.mvp.view.LoginModuleListener;
import demo.sharesdk.cn.test01.mvp.view.LoginPresenterListener;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public class LoginPresenter {
LoginPresenterListener loginPresenterListener;
private final LoginModule loginModule;
public LoginPresenter(LoginPresenterListener loginPresenterListener) {
this.loginPresenterListener = loginPresenterListener;
loginModule = new LoginModule();
}
public void getData(String admin,String pwd){
//判断用户名不用为空
if(TextUtils.isEmpty(admin)){
if(loginPresenterListener!=null){
loginPresenterListener.adminEmpty("用户名不能为空");
return;
}
}
//判断密码不用为空
if(TextUtils.isEmpty(pwd)){
if(loginPresenterListener!=null){
loginPresenterListener.adminEmpty("密码不能为空");
return;
}
}
//调用m层的数据
loginModule.getData(admin, pwd, new LoginModuleListener() {
@Override
public void success(LoginBean loginBean) {
if(loginPresenterListener!=null){
loginPresenterListener.success(loginBean.getMsg());
}
}
});
}
//防止内存泄露
public void detach(){
loginPresenterListener=null;
}
}
ProductPresenter
package demo.sharesdk.cn.test01.mvp.presenter;
import java.util.List;
import demo.sharesdk.cn.test01.bean.DataDataBean;
import demo.sharesdk.cn.test01.mvp.module.ProducetsModule;
import demo.sharesdk.cn.test01.mvp.view.ProductModuleListener;
import demo.sharesdk.cn.test01.mvp.view.ProductPresenterListener;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class ProductPresenter {
ProductPresenterListener productPresenterListener;
private final ProducetsModule producetsModule;
public ProductPresenter(ProductPresenterListener productPresenterListener) {
this.productPresenterListener = productPresenterListener;
producetsModule = new ProducetsModule();
}
//获取数据回传到vire层
public void getData(){
producetsModule.getData(new ProductModuleListener() {
@Override
public void success(DataDataBean dataDataBean) {
if(productPresenterListener!=null){
productPresenterListener.success(dataDataBean.getData());
}
}
});
}
public void detach(){
productPresenterListener=null;
}
}
RegisterPresenter
package demo.sharesdk.cn.test01.mvp.presenter;
import android.text.TextUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import demo.sharesdk.cn.test01.bean.RegisterBean;
import demo.sharesdk.cn.test01.mvp.module.RegisterModule;
import demo.sharesdk.cn.test01.mvp.view.LoginPresenterListener;
import demo.sharesdk.cn.test01.mvp.view.RegModuleListener;
import demo.sharesdk.cn.test01.mvp.view.RegisterPresenterListener;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public class RegisterPresenter {
RegisterPresenterListener registerPresenterListener;
private final RegisterModule registerModule;
public RegisterPresenter(RegisterPresenterListener registerPresenterListener) {
this.registerPresenterListener = registerPresenterListener;
registerModule = new RegisterModule();
}
public void getData(String admin,String pwd,String mpwd,String email){
//判断用户名不用为空
if(TextUtils.isEmpty(admin)){
if(registerPresenterListener!=null){
registerPresenterListener.adminEmpty("用户名不能为空");
return;
}
}
//判断密码不用为空
if(TextUtils.isEmpty(pwd)){
if(registerPresenterListener!=null){
registerPresenterListener.pwdEmpty("密码不能为空");
return;
}
//判断二次输入密码
if(TextUtils.isEmpty(mpwd)) {
if (registerPresenterListener != null) {
registerPresenterListener.confrim("密码不能为空");
return;
}
if(!mpwd.equals(pwd)){
if (registerPresenterListener != null) {
registerPresenterListener.confrim("两次密码不一样");
return;
}
}
}
boolean email1 = isEmail(email);
if(!email1){
if (registerPresenterListener != null) {
registerPresenterListener.email("邮箱格式不正确");
return;
}
}
}
//调用m层的数据
registerModule.getData(admin, pwd, new RegModuleListener() {
@Override
public void success(RegisterBean registerBean) {
if(registerPresenterListener!=null){
registerPresenterListener.success(registerBean.getMsg());
}
}
});
}
//防止内存泄露
public void detach(){
registerPresenterListener=null;
}
public boolean isEmail(String email) {
String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
Pattern p = Pattern.compile(str);
Matcher m = p.matcher(email);
return m.matches();
}
}
view层只做一些视图的处理
Activity
DetailsActivity
package demo.sharesdk.cn.test01.mvp.view.activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;
import com.facebook.drawee.view.SimpleDraweeView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import demo.sharesdk.cn.test01.R;
import demo.sharesdk.cn.test01.bean.DetailsBean;
import demo.sharesdk.cn.test01.mvp.presenter.AddCartPresenter;
import demo.sharesdk.cn.test01.mvp.presenter.DetailsPresenter;
import demo.sharesdk.cn.test01.mvp.view.DetailsPresenterListener;
public class DetailsActivity extends AppCompatActivity implements DetailsPresenterListener, AddCartPresenter.AddCartPresenterListener {
@BindView(R.id.videoView)
VideoView mVideoView;
@BindView(R.id.simpleDetails)
SimpleDraweeView mSimpleDetails;
@BindView(R.id.title)
TextView mTitle;
@BindView(R.id.price)
TextView mPrice;
@BindView(R.id.addCart)
Button mAddCart;
private DetailsPresenter detailsPresenter;
private String pid;
private AddCartPresenter addCartPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
ButterKnife.bind(this);
//加入购物车
addCartPresenter = new AddCartPresenter(this);
//得到pid
pid = getIntent().getStringExtra("pid");
detailsPresenter = new DetailsPresenter(this);
detailsPresenter.getData(pid);
String path = Environment.getExternalStorageDirectory()+"/miniony.mp4";
//视频播放
MediaController mediaController = new MediaController(this);
mVideoView.setMediaController(mediaController);
mVideoView.setVideoURI(Uri.parse(path));
mVideoView.requestFocus();
}
@Override
public void success(DetailsBean.DataBean data) {
//设置数据
String[] split = data.getImages().split("\\|");
mSimpleDetails.setImageURI(Uri.parse(split[0]));
mTitle.setText(data.getTitle());
mPrice.setText(data.getPrice()+"");
}
//防止内存泄露
@Override
protected void onDestroy() {
super.onDestroy();
detailsPresenter.detach();
}
@OnClick(R.id.addCart)
public void onClick(View v) {
switch (v.getId()) {
default:
break;
case R.id.addCart:
//加入购物车
addCartPresenter.getData(pid);
break;
}
}
@Override
public void success(String s) {
if(s.equals("加购成功")){
Intent intent = new Intent(DetailsActivity.this,ShopCartActivity.class);
//intent.putExtra("pid",pid);
startActivity(intent);
}else{
Toast.makeText(DetailsActivity.this,s,Toast.LENGTH_SHORT).show();
}
}
}
SecondActivity
package demo.sharesdk.cn.test01.mvp.view.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import demo.sharesdk.cn.test01.R;
import demo.sharesdk.cn.test01.adapter.MyProductAdapter;
import demo.sharesdk.cn.test01.bean.DataDataBean;
import demo.sharesdk.cn.test01.mvp.presenter.ProductPresenter;
import demo.sharesdk.cn.test01.mvp.view.ProductPresenterListener;
public class SecondActivity extends AppCompatActivity implements ProductPresenterListener {
@BindView(R.id.recyclerView)
RecyclerView mRecyclerView;
private ProductPresenter productPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
ButterKnife.bind(this);
//调用数据
productPresenter = new ProductPresenter(this);
productPresenter.getData();
}
@Override
public void success(List<DataDataBean.DataBean> dataDataBean) {
mRecyclerView.setLayoutManager(new LinearLayoutManager(SecondActivity.this));
MyProductAdapter myProductAdapter = new MyProductAdapter(SecondActivity.this,dataDataBean);
mRecyclerView.setAdapter(myProductAdapter);
}
//防止内存泄露
@Override
protected void onDestroy() {
super.onDestroy();
productPresenter.detach();
}
}
ShopCartActivity
package demo.sharesdk.cn.test01.mvp.view.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ExpandableListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import demo.sharesdk.cn.test01.MainActivity;
import demo.sharesdk.cn.test01.R;
import demo.sharesdk.cn.test01.adapter.MyAdapter;
import demo.sharesdk.cn.test01.bean.CartBean;
import demo.sharesdk.cn.test01.mvp.presenter.CartPresenter;
import demo.sharesdk.cn.test01.mvp.view.CartPresenterListener;
public class ShopCartActivity extends AppCompatActivity implements CartPresenterListener {
@BindView(R.id.expandView)
ExpandableListView expandView;
@BindView(R.id.checkAll)
CheckBox mCheckAll;
@BindView(R.id.zprice)
TextView mZprice;
@BindView(R.id.zcount)
Button mZcount;
@BindView(R.id.linear)
RelativeLayout mLinear;
@BindView(R.id.bianji)
TextView mBianji;
private MyAdapter myAdapter;
private String edit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shop_cart);
ButterKnife.bind(this);
CartPresenter myPresenter = new CartPresenter(this);
myPresenter.getData();
}
@OnClick({R.id.checkAll, R.id.bianji,R.id.zcount})
public void onClick(View v) {
switch (v.getId()) {
default:
break;
case R.id.checkAll:
myAdapter.checkedAll(mCheckAll.isChecked());
break;
case R.id.bianji:
break;
case R.id.zcount:
break;
}
}
@Override
public void success(List<CartBean.DataBean> group, List<List<CartBean.DataBean.ListBean>> child) {
myAdapter = new MyAdapter(ShopCartActivity.this, group, child);
myAdapter.setChangeListener(new MyAdapter.ChangeListener() {
@Override
public void setState(boolean flag) {
mCheckAll.setChecked(flag);
}
@Override
public void setText(String price, String count) {
mZcount.setText("结算(" + count + ")");
mZprice.setText("总计:" + price + "¥");
}
});
expandView.setAdapter(myAdapter);
//默认展开
for (int i = 0; i < group.size(); i++) {
expandView.expandGroup(i);
}
}
}
提供数据的一些接口 来看看吧
CartModuleListener
package demo.sharesdk.cn.test01.mvp.view;
import demo.sharesdk.cn.test01.bean.CartBean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public interface CartModuleListener {
void success(CartBean cartBean);
}
package demo.sharesdk.cn.test01.mvp.view;
import java.util.List;
import demo.sharesdk.cn.test01.bean.CartBean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public interface CartPresenterListener {
void success(List<CartBean.DataBean> group,List<List<CartBean.DataBean.ListBean>> child);
}
package demo.sharesdk.cn.test01.mvp.view;
import demo.sharesdk.cn.test01.bean.DetailsBean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public interface DetailsModuleListener {
void success(DetailsBean deatails);
}
package demo.sharesdk.cn.test01.mvp.view;
import java.util.List;
import demo.sharesdk.cn.test01.bean.DetailsBean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public interface DetailsPresenterListener {
void success(DetailsBean.DataBean list);
}
package demo.sharesdk.cn.test01.mvp.view;
import demo.sharesdk.cn.test01.bean.LoginBean;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public interface LoginModuleListener {
void success(LoginBean loginBean);
}
package demo.sharesdk.cn.test01.mvp.view;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public interface LoginPresenterListener {
void success(String s);
void failed(String s);
void adminEmpty(String s);
void pwdEmpty(String s);
}
package demo.sharesdk.cn.test01.mvp.view;
import demo.sharesdk.cn.test01.bean.DataDataBean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public interface ProductModuleListener {
void success(DataDataBean dataDataBean);
}
package demo.sharesdk.cn.test01.mvp.view;
import java.util.List;
import demo.sharesdk.cn.test01.bean.DataDataBean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public interface ProductPresenterListener {
void success(List<DataDataBean.DataBean> dataDataBean);
}
package demo.sharesdk.cn.test01.mvp.view;
import android.icu.text.StringSearch;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public interface RegisterPresenterListener {
void success(String s);
void failed(String s);
void adminEmpty(String s);
void pwdEmpty(String s);
void email(String s);
void confrim(String s);
}
package demo.sharesdk.cn.test01.mvp.view;
import demo.sharesdk.cn.test01.bean.RegisterBean;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public interface RegModuleListener {
void success(RegisterBean registerBean);
}
还没提供数据了啊 bean的处理 一个gsonfromt 直接搞定
AddCartBean
package demo.sharesdk.cn.test01.bean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class AddCartBean {
/**
* msg : 加购成功
* code : 0
*/
private String msg;
private String code;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
CartBean
package demo.sharesdk.cn.test01.bean;
import java.util.List;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class CartBean {
/**
* msg : 请求成功
* code : 0
* data : [{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":2,"pid":1,"price":118,"pscid":1,"selected":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家17","sellerid":"17"}]
*/
private String msg;
private String code;
private List<DataBean> data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* list : [{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":2,"pid":1,"price":118,"pscid":1,"selected":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}]
* sellerName : 商家17
* sellerid : 17
*/
private String sellerName;
private String sellerid;
private List<ListBean> list;
private boolean gChecked;
public boolean isgChecked() {
return gChecked;
}
public void setgChecked(boolean gChecked) {
this.gChecked = gChecked;
}
public String getSellerName() {
return sellerName;
}
public void setSellerName(String sellerName) {
this.sellerName = sellerName;
}
public String getSellerid() {
return sellerid;
}
public void setSellerid(String sellerid) {
this.sellerid = sellerid;
}
public List<ListBean> getList() {
return list;
}
public void setList(List<ListBean> list) {
this.list = list;
}
public static class ListBean {
/**
* bargainPrice : 111.99
* createtime : 2017-10-14T21:39:05
* detailUrl : https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends
* images : https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg
* num : 2
* pid : 1
* price : 118.0
* pscid : 1
* selected : 0
* sellerid : 17
* subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下
* title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g
*/
private double bargainPrice;
private String createtime;
private String detailUrl;
private String images;
private int num;
private int pid;
private double price;
private int pscid;
private int selected;
private int sellerid;
private String subhead;
private String title;
private boolean cChecked;
public boolean iscChecked() {
return cChecked;
}
public void setcChecked(boolean cChecked) {
this.cChecked = cChecked;
}
public double getBargainPrice() {
return bargainPrice;
}
public void setBargainPrice(double bargainPrice) {
this.bargainPrice = bargainPrice;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public String getDetailUrl() {
return detailUrl;
}
public void setDetailUrl(String detailUrl) {
this.detailUrl = detailUrl;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getPscid() {
return pscid;
}
public void setPscid(int pscid) {
this.pscid = pscid;
}
public int getSelected() {
return selected;
}
public void setSelected(int selected) {
this.selected = selected;
}
public int getSellerid() {
return sellerid;
}
public void setSellerid(int sellerid) {
this.sellerid = sellerid;
}
public String getSubhead() {
return subhead;
}
public void setSubhead(String subhead) {
this.subhead = subhead;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}
}
DataDataBean
package demo.sharesdk.cn.test01.bean;
import java.util.List;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class DataDataBean {
/**
* msg : 请求成功
* code : 0
* data : [{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","itemtype":1,"pid":45,"price":2999,"pscid":39,"salenum":4666,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"},{"bargainPrice":6666,"createtime":"2017-10-10T16:01:31","detailUrl":"https://item.m.jd.com/product/5089273.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8284/363/1326459580/71585/6d3e8013/59b857f2N6ca75622.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9346/182/1406837243/282106/68af5b54/59b8480aNe8af7f5c.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8434/54/1359766007/56140/579509d9/59b85801Nfea207db.jpg!q70.jpg","itemtype":0,"pid":46,"price":234,"pscid":39,"salenum":868,"sellerid":2,"subhead":"【iPhone新品上市】新一代iPhone,让智能看起来更不一样","title":"Apple iPhone 8 Plus (A1864) 64GB 金色 移动联通电信4G手机"},{"bargainPrice":1599,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/1993026402.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t5863/302/8961270302/97126/41feade1/5981c81cNc1b1fbef.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7003/250/1488538438/195825/53bf31ba/5981c57eN51e95176.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5665/100/8954482513/43454/418611a9/5981c57eNd5fc97ba.jpg!q70.jpg","itemtype":2,"pid":47,"price":111,"pscid":39,"salenum":757,"sellerid":3,"subhead":"碳黑色 32GB 全网通 官方标配 1件","title":"锤子 坚果Pro 特别版 巧克力色 酒红色 全网通 移动联通电信4G手机 双卡双待 碳黑色 32GB 全网通"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":48,"price":222,"pscid":39,"salenum":656,"sellerid":4,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":1999,"createtime":"2017-10-10T16:09:02","detailUrl":"https://item.m.jd.com/product/5025971.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t7210/232/3738666823/232298/9004583e/59c3a9a7N8de42e15.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8356/82/2107423621/109733/c019b8c6/59c3a9a6Ne9a4bdd7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t10219/74/25356012/171379/7d55e296/59c3a9a8N82fa6e02.jpg!q70.jpg","itemtype":0,"pid":49,"price":333,"pscid":39,"salenum":123,"sellerid":5,"subhead":"vivo X20 带你开启全面屏时代!逆光也清晰,照亮你的美!","title":"vivo X20 全面屏手机 全网通 4GB+64GB 金色 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":2,"pid":50,"price":444,"pscid":39,"salenum":54,"sellerid":6,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":51,"price":555,"pscid":39,"salenum":424,"sellerid":7,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":52,"price":666,"pscid":39,"salenum":212,"sellerid":8,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":2999,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2385655.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t2068/298/2448145915/157953/7be197df/56d51a42Nd86f1c8e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2437/128/1687178395/117431/bcc190c1/56d3fcbaNb2963d21.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2467/222/2263160610/95597/927b8a2f/56d3eafeNdecebeb6.jpg!q70.jpg","itemtype":2,"pid":53,"price":777,"pscid":39,"salenum":0,"sellerid":9,"subhead":"Super AMOLED三星双曲面2K 屏,支持无线充电!","title":"三星 Galaxy S7 edge(G9350)4GB+32GB 铂光金 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":54,"price":888,"pscid":39,"salenum":7575,"sellerid":10,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}]
* page : 1
*/
private String msg;
private String code;
private String page;
private List<DataBean> data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* bargainPrice : 99.0
* createtime : 2017-10-14T21:38:26
* detailUrl : https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends
* images : https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg
* itemtype : 1
* pid : 45
* price : 2999.0
* pscid : 39
* salenum : 4666
* sellerid : 1
* subhead : 高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!
* title : 一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机
*/
private double bargainPrice;
private String createtime;
private String detailUrl;
private String images;
private int itemtype;
private int pid;
private double price;
private int pscid;
private int salenum;
private int sellerid;
private String subhead;
private String title;
public double getBargainPrice() {
return bargainPrice;
}
public void setBargainPrice(double bargainPrice) {
this.bargainPrice = bargainPrice;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public String getDetailUrl() {
return detailUrl;
}
public void setDetailUrl(String detailUrl) {
this.detailUrl = detailUrl;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public int getItemtype() {
return itemtype;
}
public void setItemtype(int itemtype) {
this.itemtype = itemtype;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getPscid() {
return pscid;
}
public void setPscid(int pscid) {
this.pscid = pscid;
}
public int getSalenum() {
return salenum;
}
public void setSalenum(int salenum) {
this.salenum = salenum;
}
public int getSellerid() {
return sellerid;
}
public void setSellerid(int sellerid) {
this.sellerid = sellerid;
}
public String getSubhead() {
return subhead;
}
public void setSubhead(String subhead) {
this.subhead = subhead;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}
DetailsBean
package demo.sharesdk.cn.test01.bean;
/**
* Created by QinQinBaoBei on 2018/1/16.
*/
public class DetailsBean {
/**
* msg :
* seller : {"description":"我是商家17","icon":"http://120.27.23.105/images/icon.png","name":"商家17","productNums":999,"score":5,"sellerid":17}
* code : 0
* data : {"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":1,"price":118,"pscid":1,"salenum":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}
*/
private String msg;
private SellerBean seller;
private String code;
private DataBean data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public SellerBean getSeller() {
return seller;
}
public void setSeller(SellerBean seller) {
this.seller = seller;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class SellerBean {
/**
* description : 我是商家17
* icon : http://120.27.23.105/images/icon.png
* name : 商家17
* productNums : 999
* score : 5.0
* sellerid : 17
*/
private String description;
private String icon;
private String name;
private int productNums;
private double score;
private int sellerid;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getProductNums() {
return productNums;
}
public void setProductNums(int productNums) {
this.productNums = productNums;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
public int getSellerid() {
return sellerid;
}
public void setSellerid(int sellerid) {
this.sellerid = sellerid;
}
}
public static class DataBean {
/**
* bargainPrice : 111.99
* createtime : 2017-10-14T21:39:05
* detailUrl : https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends
* images : https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg
* itemtype : 1
* pid : 1
* price : 118.0
* pscid : 1
* salenum : 0
* sellerid : 17
* subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下
* title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g
*/
private double bargainPrice;
private String createtime;
private String detailUrl;
private String images;
private int itemtype;
private int pid;
private double price;
private int pscid;
private int salenum;
private int sellerid;
private String subhead;
private String title;
public double getBargainPrice() {
return bargainPrice;
}
public void setBargainPrice(double bargainPrice) {
this.bargainPrice = bargainPrice;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public String getDetailUrl() {
return detailUrl;
}
public void setDetailUrl(String detailUrl) {
this.detailUrl = detailUrl;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public int getItemtype() {
return itemtype;
}
public void setItemtype(int itemtype) {
this.itemtype = itemtype;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getPscid() {
return pscid;
}
public void setPscid(int pscid) {
this.pscid = pscid;
}
public int getSalenum() {
return salenum;
}
public void setSalenum(int salenum) {
this.salenum = salenum;
}
public int getSellerid() {
return sellerid;
}
public void setSellerid(int sellerid) {
this.sellerid = sellerid;
}
public String getSubhead() {
return subhead;
}
public void setSubhead(String subhead) {
this.subhead = subhead;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}
LoginBean
package demo.sharesdk.cn.test01.bean;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public class LoginBean {
/**
* msg : 登录成功
* code : 0
* data : {"age":null,"appkey":"a3fc5a3a5d4d9391","appsecret":"EE3C8823438F0BE1B992543949D03BC7","createtime":"2018-01-15T19:30:23","email":null,"fans":null,"follow":null,"gender":null,"icon":null,"latitude":null,"longitude":null,"mobile":"13051158859","money":null,"nickname":null,"password":"8F669074CAF5513351A2DE5CC22AC04C","praiseNum":null,"token":"A187F505468DE2E764D5395E0E9A1BF2","uid":1681,"userId":null,"username":"13051158859"}
*/
private String msg;
private String code;
private DataBean data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* age : null
* appkey : a3fc5a3a5d4d9391
* appsecret : EE3C8823438F0BE1B992543949D03BC7
* createtime : 2018-01-15T19:30:23
* email : null
* fans : null
* follow : null
* gender : null
* icon : null
* latitude : null
* longitude : null
* mobile : 13051158859
* money : null
* nickname : null
* password : 8F669074CAF5513351A2DE5CC22AC04C
* praiseNum : null
* token : A187F505468DE2E764D5395E0E9A1BF2
* uid : 1681
* userId : null
* username : 13051158859
*/
private Object age;
private String appkey;
private String appsecret;
private String createtime;
private Object email;
private Object fans;
private Object follow;
private Object gender;
private Object icon;
private Object latitude;
private Object longitude;
private String mobile;
private Object money;
private Object nickname;
private String password;
private Object praiseNum;
private String token;
private int uid;
private Object userId;
private String username;
public Object getAge() {
return age;
}
public void setAge(Object age) {
this.age = age;
}
public String getAppkey() {
return appkey;
}
public void setAppkey(String appkey) {
this.appkey = appkey;
}
public String getAppsecret() {
return appsecret;
}
public void setAppsecret(String appsecret) {
this.appsecret = appsecret;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public Object getEmail() {
return email;
}
public void setEmail(Object email) {
this.email = email;
}
public Object getFans() {
return fans;
}
public void setFans(Object fans) {
this.fans = fans;
}
public Object getFollow() {
return follow;
}
public void setFollow(Object follow) {
this.follow = follow;
}
public Object getGender() {
return gender;
}
public void setGender(Object gender) {
this.gender = gender;
}
public Object getIcon() {
return icon;
}
public void setIcon(Object icon) {
this.icon = icon;
}
public Object getLatitude() {
return latitude;
}
public void setLatitude(Object latitude) {
this.latitude = latitude;
}
public Object getLongitude() {
return longitude;
}
public void setLongitude(Object longitude) {
this.longitude = longitude;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Object getMoney() {
return money;
}
public void setMoney(Object money) {
this.money = money;
}
public Object getNickname() {
return nickname;
}
public void setNickname(Object nickname) {
this.nickname = nickname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Object getPraiseNum() {
return praiseNum;
}
public void setPraiseNum(Object praiseNum) {
this.praiseNum = praiseNum;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public Object getUserId() {
return userId;
}
public void setUserId(Object userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
}
RegisterBean
package demo.sharesdk.cn.test01.bean;
/**
* Created by QinQinBaoBei on 2018/1/15.
*/
public class RegisterBean {
/**
* msg : 天呢!用户已注册
* code : 1
* data : {}
*/
private String msg;
private String code;
private String data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
这么一套玩玩而已的demo就copy出来了 纯属个人需要 兼职太全面了 自己觉得都点过分了