权限
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<!-- 允许程序设置内置sd卡的写权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 允许程序获取网络状态 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 允许程序访问WiFi网络信息 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 允许程序读写手机状态和身份 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- 允许程序访问CellID或WiFi热点来获取粗略的位置 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 用于访问GPS定位 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- 用于获取wifi的获取权限,wifi信息会用来进行网络定位 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- 用于申请调用A-GPS模块 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<!-- 用于申请获取蓝牙信息进行室内定位 -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<activity android:name=".Main2Activity" /> <activity android:name=".Xq" /> <activity android:name=".Dl_Zc.Dl" /> <activity android:name=".Dl_Zc.Zc" /> <service android:name="com.amap.api.location.APSService" /> <activity android:name=".Grxq.Gr_xq" /> <activity android:name=".DD.DD" />
依赖
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.2'
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 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okio:okio:1.11.0'
compile 'com.youth.banner:banner:1.4.9'
compile 'com.github.open-android:Zxing:v1.0.3'
implementation 'com.android.support:recyclerview-v7:27.0.2'
//3D地图so及jar
compile 'com.amap.api:3dmap:latest.integration'
//定位功能
compile 'com.amap.api:location:latest.integration'
//搜索功能
compile 'com.amap.api:search:latest.integration'
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-7'
compile 'com.amap.api:location:latest.integration'
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
MainActivity
public class MainActivity extends AppCompatActivity {
Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
Intent intent=new Intent(MainActivity.this, Main2Activity.class);
startActivity(intent);
finish();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
handler.sendEmptyMessageDelayed(0,3000);
}
}
Main2Activity
public class Main2Activity extends AppCompatActivity { private FrameLayout fl; private RadioGroup rg; private RadioButton shouye; private RadioButton fenlei; private RadioButton faxian; private RadioButton gwc; private RadioButton wode; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); fl = findViewById(R.id.fl); rg = findViewById(R.id.rg); // shouye = findViewById(R.id.shouye); // fenlei = findViewById(R.id.fenlei); // faxian = findViewById(R.id.faxian); gwc = findViewById(R.id.gwc); wode = findViewById(R.id.wode); // shouye.setChecked(true); rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { if(i==R.id.gwc){ addFragment(new Gouwuche()); }else if(i==R.id.wode){ addFragment(new Wode()); } } }); addFragment(new Wode()); } public void addFragment(Fragment fragment){ getSupportFragmentManager().beginTransaction().replace(R.id.fl,fragment).commit(); } // @Override // protected void onResume() { // int id = getIntent().getIntExtra("fenye", 0); // if (id == 1) { // // Fenlei fenlei=new Fenlei(); // FragmentManager fmanger = getSupportFragmentManager(); // FragmentTransaction transaction = fmanger.beginTransaction(); // transaction.replace(R.id.fl, fenlei); // transaction.commit(); // // } // super.onResume(); // } }OkHttp3Util
public class OkHttp3Util {
private static OkHttpClient okHttpClient = null;
private OkHttp3Util() {
}
public static OkHttpClient getInstance() {
if (okHttpClient == null) {
//加同步安全
synchronized (OkHttp3Util.class) {
if (okHttpClient == null) {
//okhttp可以缓存数据....指定缓存路径
File sdcache = new File(Environment.getExternalStorageDirectory(), "cache");
//指定缓存大小
int cacheSize = 10 * 1024 * 1024;
okHttpClient = new OkHttpClient.Builder()//构建器
.connectTimeout(15, TimeUnit.SECONDS)//连接超时
.writeTimeout(20, TimeUnit.SECONDS)//写入超时
.readTimeout(20, TimeUnit.SECONDS)//读取超时
//.addInterceptor(new CommonParamsInterceptor())//添加的是应用拦截器...公共参数
//.addNetworkInterceptor(new CacheInterceptor())//添加的网络拦截器
.cache(new Cache(sdcache.getAbsoluteFile(), cacheSize))//设置缓存
.build();
}
}
}
return okHttpClient;
}
/**
* get请求
* 参数1 url
* 参数2 回调Callback
*/
public static void doGet(String oldUrl, Callback callback) {
//要添加的公共参数...map
Map<String,String> map = new HashMap<>();
map.put("source","android");
StringBuilder stringBuilder = new StringBuilder();//创建一个stringBuilder
stringBuilder.append(oldUrl);
if (oldUrl.contains("?")){
//?在最后面....2类型
if (oldUrl.indexOf("?") == oldUrl.length()-1){
}else {
//3类型...拼接上&
stringBuilder.append("&");
}
}else {
//不包含? 属于1类型,,,先拼接上?号
stringBuilder.append("?");
}
//添加公共参数....
for (Map.Entry<String,String> entry: map.entrySet()) {
//拼接
stringBuilder.append(entry.getKey())
.append("=")
.append(entry.getValue())
.append("&");
}
//删掉最后一个&符号
if (stringBuilder.indexOf("&") != -1){
stringBuilder.deleteCharAt(stringBuilder.lastIndexOf("&"));
}
String newUrl = stringBuilder.toString();//新的路径
//创建OkHttpClient请求对象
OkHttpClient okHttpClient = getInstance();
//创建Request
Request request = new Request.Builder().url(newUrl).build();
//得到Call对象
Call call = okHttpClient.newCall(request);
//执行异步请求
call.enqueue(callback);
}
/**
* post请求
* 参数1 url
* 参数2 Map<String, String> params post请求的时候给服务器传的数据
* add..("","")
* add()
*/
public static void doPost(String url, Map<String, String> params, Callback callback) {
//要添加的公共参数...map
Map<String,String> map = new HashMap<>();
map.put("source","android");
//创建OkHttpClient请求对象
OkHttpClient okHttpClient = getInstance();
//3.x版本post请求换成FormBody 封装键值对参数
FormBody.Builder builder = new FormBody.Builder();
//遍历集合
for (String key : params.keySet()) {
builder.add(key, params.get(key));
}
//添加公共参数
for (Map.Entry<String,String> entry: map.entrySet()) {
builder.add(entry.getKey(),entry.getValue());
}
//创建Request
Request request = new Request.Builder().url(url).post(builder.build()).build();
Call call = okHttpClient.newCall(request);
call.enqueue(callback);
}
/**
* post请求上传文件....包括图片....流的形式传任意文件...
* 参数1 url
* file表示上传的文件
* fileName....文件的名字,,例如aaa.jpg
* params ....传递除了file文件 其他的参数放到map集合
*
*/
public static void uploadFile(String url, File file, String fileName,Map<String,String> params) {
//创建OkHttpClient请求对象
OkHttpClient okHttpClient = getInstance();
MultipartBody.Builder builder = new MultipartBody.Builder();
builder.setType(MultipartBody.FORM);
//参数
if (params != null){
for (String key : params.keySet()){
builder.addFormDataPart(key,params.get(key));
}
}
//文件...参数name指的是请求路径中所接受的参数...如果路径接收参数键值是fileeeee,此处应该改变
builder.addFormDataPart("file",fileName, RequestBody.create(MediaType.parse("application/octet-stream"),file));
//构建
MultipartBody multipartBody = builder.build();
//创建Request
Request request = new Request.Builder().url(url).post(multipartBody).build();
//得到Call
Call call = okHttpClient.newCall(request);
//执行请求
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.e("upload",e.getLocalizedMessage());
}
@Override
public void onResponse(Call call, Response response) throws IOException {
//上传成功回调 目前不需要处理
if (response.isSuccessful()){
String s = response.body().string();
Log.e("upload","上传--"+s);
}
}
});
}
/**
* Post请求发送JSON数据....{"name":"zhangsan","pwd":"123456"}
* 参数一:请求Url
* 参数二:请求的JSON
* 参数三:请求回调
*/
public static void doPostJson(String url, String jsonParams, Callback callback) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), jsonParams);
Request request = new Request.Builder().url(url).post(requestBody).build();
Call call = getInstance().newCall(request);
call.enqueue(callback);
}
/**
* 下载文件 以流的形式把apk写入的指定文件 得到file后进行安装
* 参数er:请求Url
* 参数san:保存文件的文件夹....download
*/
public static void download(final Activity context, final String url, final String saveDir) {
Request request = new Request.Builder().url(url).build();
Call call = getInstance().newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
//com.orhanobut.logger.Logger.e(e.getLocalizedMessage());
}
@Override
public void onResponse(Call call, final Response response) throws IOException {
InputStream is = null;
byte[] buf = new byte[2048];
int len = 0;
FileOutputStream fos = null;
try {
is = response.body().byteStream();//以字节流的形式拿回响应实体内容
//apk保存路径
final String fileDir = isExistDir(saveDir);
//文件
File file = new File(fileDir, getNameFromUrl(url));
fos = new FileOutputStream(file);
while ((len = is.read(buf)) != -1) {
fos.write(buf, 0, len);
}
fos.flush();
context.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(context, "下载成功:" + fileDir + "," + getNameFromUrl(url), Toast.LENGTH_SHORT).show();
}
});
//apk下载完成后 调用系统的安装方法
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
context.startActivity(intent);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) is.close();
if (fos != null) fos.close();
}
}
});
}
/**
* 判断下载目录是否存在......并返回绝对路径
*
* @param saveDir
* @return
* @throws IOException
*/
public static String isExistDir(String saveDir) throws IOException {
// 下载位置
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
File downloadFile = new File(Environment.getExternalStorageDirectory(), saveDir);
if (!downloadFile.mkdirs()) {
downloadFile.createNewFile();
}
String savePath = downloadFile.getAbsolutePath();
Log.e("savePath", savePath);
return savePath;
}
return null;
}
/**
* @param url
* @return 从下载连接中解析出文件名
*/
private static String getNameFromUrl(String url) {
return url.substring(url.lastIndexOf("/") + 1);
}
/**
* 公共参数拦截器
*/
private static class CommonParamsInterceptor implements Interceptor {
//拦截的方法
@Override
public Response intercept(Chain chain) throws IOException {
//获取到请求
Request request = chain.request();
//获取请求的方式
String method = request.method();
//获取请求的路径
String oldUrl = request.url().toString();
Log.e("---拦截器",request.url()+"---"+request.method()+"--"+request.header("User-agent"));
//要添加的公共参数...map
Map<String,String> map = new HashMap<>();
map.put("source","android");
if ("GET".equals(method)){
// 1.http://www.baoidu.com/login --------? key=value&key=value
// 2.http://www.baoidu.com/login? --------- key=value&key=value
// 3.http://www.baoidu.com/login?mobile=11111 -----&key=value&key=value
StringBuilder stringBuilder = new StringBuilder();//创建一个stringBuilder
stringBuilder.append(oldUrl);
if (oldUrl.contains("?")){
//?在最后面....2类型
if (oldUrl.indexOf("?") == oldUrl.length()-1){
}else {
//3类型...拼接上&
stringBuilder.append("&");
}
}else {
//不包含? 属于1类型,,,先拼接上?号
stringBuilder.append("?");
}
//添加公共参数....
for (Map.Entry<String,String> entry: map.entrySet()) {
//拼接
stringBuilder.append(entry.getKey())
.append("=")
.append(entry.getValue())
.append("&");
}
//删掉最后一个&符号
if (stringBuilder.indexOf("&") != -1){
stringBuilder.deleteCharAt(stringBuilder.lastIndexOf("&"));
}
String newUrl = stringBuilder.toString();//新的路径
//拿着新的路径重新构建请求
request = request.newBuilder()
.url(newUrl)
.build();
}else if ("POST".equals(method)){
//先获取到老的请求的实体内容
RequestBody oldRequestBody = request.body();//....之前的请求参数,,,需要放到新的请求实体内容中去
//如果请求调用的是上面doPost方法
if (oldRequestBody instanceof FormBody){
FormBody oldBody = (FormBody) oldRequestBody;
//构建一个新的请求实体内容
FormBody.Builder builder = new FormBody.Builder();
//1.添加老的参数
for (int i=0;i<oldBody.size();i++){
builder.add(oldBody.name(i),oldBody.value(i));
}
//2.添加公共参数
for (Map.Entry<String,String> entry:map.entrySet()) {
builder.add(entry.getKey(),entry.getValue());
}
FormBody newBody = builder.build();//新的请求实体内容
//构建一个新的请求
request = request.newBuilder()
.url(oldUrl)
.post(newBody)
.build();
}
}
Response response = chain.proceed(request);
return response;
}
}
/**
* 网络缓存的拦截器......注意在这里更改cache-control头是很危险的,一般客户端不进行更改,,,,服务器端直接指定
*
* 没网络取缓存的时候,一般都是在数据库或者sharedPerfernce中取出来的
*
*
*
*/
/*private static class CacheInterceptor implements Interceptor{
@Override
public Response intercept(Chain chain) throws IOException {
//老的响应
Response oldResponse = chain.proceed(chain.request());
*//*if (NetUtils.isNetworkConnected(DashApplication.getAppContext())){
int maxAge = 120; // 在线缓存在2分钟内可读取
return oldResponse.newBuilder()
.removeHeader("Pragma")
.removeHeader("Cache-Control")
.header("Cache-Control", "public, max-age=" + maxAge)
.build();
}else {
int maxStale = 60 * 60 * 24 * 14; // 离线时缓存保存2周
return oldResponse.newBuilder()
.removeHeader("Pragma")
.removeHeader("Cache-Control")
.header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale)
.build();
}*//*
}
}*/
}
网址
public class Wz { public static final String sy="https://www.zhaoapi.cn/ad/getAd"; public static final String sy_jgg="https://www.zhaoapi.cn/product/getCatagory"; public static final String fl_you="https://www.zhaoapi.cn/product/getProductCatagory"; public static final String Xq="https://www.zhaoapi.cn/product/getProductDetail"; public static final String dl="https://www.zhaoapi.cn/user/login"; public static final String zc="https://www.zhaoapi.cn/user/reg"; public static final String jr="https://www.zhaoapi.cn/product/addCart"; public static final String cxgwc="https://www.zhaoapi.cn/product/getCarts"; public static final String gxgwc = "https://www.zhaoapi.cn/product/updateCarts"; public static String scgwc ="https://www.zhaoapi.cn/product/deleteCart"; public static String cxdd ="https://www.zhaoapi.cn/product/getOrders"; public static String qxdd="https://www.zhaoapi.cn/product/updateOrder"; }
详情
public class Xq extends AppCompatActivity implements Xq_Vi, AMapLocationListener {
private Banner banner;
private TextView xq_bt;
private Button xq_jr;
private TextView xq_price;
private TextView xq_yhprice;
private List<String> list = new ArrayList<>();;
private String pid;
private TextView dw;
private AMapLocationClient mLocationClient;
private String uid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_xq);
banner = findViewById(R.id.xq_banner);
xq_bt = findViewById(R.id.xq_bt);
xq_jr = findViewById(R.id.xq_jr);
xq_price = findViewById(R.id.xq_price);
dw = findViewById(R.id.dw);
xq_yhprice = findViewById(R.id.xq_yhprice);
Intent intent = getIntent();
pid = intent.getStringExtra("pid");
//1.初始化定位
mLocationClient = new AMapLocationClient(this);
//2.设置定位回调监听
mLocationClient.setLocationListener(this);
//2....2给定位客户端对象设置定位参数
AMapLocationClientOption mLocationOption = new AMapLocationClientOption();
//设置定位模式为AMapLocationMode.Hight_Accuracy,高精度模式。
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//获取一次定位结果:
mLocationOption.setOnceLocation(true);
//获取最近3s内精度最高的一次定位结果:
mLocationOption.setOnceLocationLatest(true);
mLocationClient.setLocationOption(mLocationOption);
//3.启动定位
mLocationClient.startLocation();
SharedPreferences dl = getSharedPreferences("dl", MODE_PRIVATE);
uid = dl.getString("uid", "3360");
Xq_Pc xq_pc=new Xq_Pc(this);
xq_pc.xqinfo(pid);
xq_jr.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Map<String,String> map=new HashMap<>();
map.put("uid",uid);
map.put("pid",pid);
OkHttp3Util.doPost(Wz.jr,map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, final Response response) throws IOException {
runOnUiThread(new Runnable() {
@Override
public void run() {
if(response.isSuccessful()){
String string = null;
try {
string = response.body().string();
Jr_bean jr_bean = new Gson().fromJson(string, Jr_bean.class);
String msg = jr_bean.getMsg();
Toast.makeText(Xq.this, ""+msg, Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}
}
});
}
});
}
});
}
@Override
public void Xq_Success(final Xq_bean xqBean) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Xq_bean.DataBean data = xqBean.getData();
String images = data.getImages();
final String[] split = images.split("\\|");
for (String str:split){
Log.d(">>>",str);
list.add(str);
}
banner.setImageLoader(new Xq_image());
banner.setImages(list);
banner.isAutoPlay(false);
banner.start();
xq_bt.setText(xqBean.getData().getTitle());
xq_price.setText(xqBean.getData().getPrice()+"");
xq_yhprice.setText(xqBean.getData().getBargainPrice()+"");
}
});
}
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
Log.e("---", "onLocationChanged: "+ aMapLocation.getErrorInfo()+"---"+aMapLocation.getErrorCode());
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("地址:"+aMapLocation.getCity()+"--");
stringBuilder.append(""+aMapLocation.getDistrict()+"--");
stringBuilder.append(""+aMapLocation.getStreet()+"--");
stringBuilder.append(""+aMapLocation.getStreetNum()+"");
dw.setText(stringBuilder.toString());
}
}
订单页
public class DD extends AppCompatActivity implements View.OnClickListener {
private ImageView image_btn;
private TextView text_daizhi;
private TextView text_yizhi;
private TextView text_yiqu;
private FrameLayout frame_layout;
private View item_popup;
private View view;
private PopupWindow popupWindow;
private TextView btn_daizhi;
private TextView btn_yizhi;
private TextView btn_yiqu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dd);
image_btn = findViewById(R.id.img_btn);
text_daizhi = findViewById(R.id.text_daizhi);
text_yizhi = findViewById(R.id.text_yizhi);
text_yiqu = findViewById(R.id.text_yiqu);
frame_layout = findViewById(R.id.frame_layout);
//https://www.zhaoapi.cn/product/updateOrder?uid=4427&status=1
//https://www.zhaoapi.cn/product/updateOrder?uid=4427&orderId=
//https://www.zhaoapi.cn/product/getOrders?uid=4427&status2
text_daizhi.setOnClickListener(this);
text_yizhi.setOnClickListener(this);
text_yiqu.setOnClickListener(this);
Frag_Daizhi frag_daizhi = new Frag_Daizhi();
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout,frag_daizhi).commit();
item_popup = View.inflate(this, R.layout.item_popup, null);
view = View.inflate(this, R.layout.activity_main, null);
popupWindow = new PopupWindow(item_popup
, ActionBar.LayoutParams.WRAP_CONTENT,ActionBar.LayoutParams.WRAP_CONTENT);
popupWindow.setTouchable(true);
btn_daizhi = item_popup.findViewById(R.id.btn_daizhi);
btn_yizhi = item_popup.findViewById(R.id.btn_yizhi);
btn_yiqu = item_popup.findViewById(R.id.btn_yiqu);
btn_daizhi.setOnClickListener(this);
btn_yizhi.setOnClickListener(this);
btn_yiqu.setOnClickListener(this);
image_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//popupWindow.showAtLocation(view, Gravity.BOTTOM,0,0);
popupWindow.showAsDropDown(image_btn);
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.text_daizhi:
Frag_Daizhi frag_daizhi = new Frag_Daizhi();
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout,frag_daizhi).commit();
break;
case R.id.text_yizhi:
Frag_YiZhi frag_yiZhi = new Frag_YiZhi();
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout,frag_yiZhi).commit();
break;
case R.id.text_yiqu:
Frag_YiQu frag_yiQu = new Frag_YiQu();
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout,frag_yiQu).commit();
break;
case R.id.btn_daizhi:
Frag_Daizhi frag_daizhi2 = new Frag_Daizhi();
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout,frag_daizhi2).commit();
popupWindow.dismiss();
break;
case R.id.btn_yizhi:
Frag_YiZhi frag_yiZhi2 = new Frag_YiZhi();
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout,frag_yiZhi2).commit();
popupWindow.dismiss();
break;
case R.id.btn_yiqu:
Frag_YiQu frag_yiQu2 = new Frag_YiQu();
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout,frag_yiQu2).commit();
popupWindow.dismiss();
break;
}
}
}
public class Frag_Daizhi extends Fragment implements Main{ private List<MyDingDanBean.DataBean> list = new ArrayList<>(); private View view; private RecyclerView recycler_daizhi; private int status=0; private Presenter presenter; private RelativeLayout relative_bar; private SmartRefreshLayout smart_refresh; private int page=0; private int a=0; private Handler handler=new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what==0){ page++; a=1; } } }; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.frag_daizhi, container, false); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); recycler_daizhi = view.findViewById(R.id.recycler_daizhi); relative_bar = view.findViewById(R.id.relative_bar); smart_refresh = view.findViewById(R.id.smart_refresh); presenter = new Presenter(this); } @Override public void onResume() { super.onResume(); relative_bar.setVisibility(View.VISIBLE); if (a==1){ //page++; // presenter.getDingUrl(ApiUtil.dingdan,page); } presenter.getDingUrl(Wz.cxdd,page); } @Override public void getDingDanBean(final MyDingDanBean myDingDanBean) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (myDingDanBean!=null){ list.addAll(myDingDanBean.getData()); myAdapter(); relative_bar.setVisibility(View.GONE); smart_refresh.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh(RefreshLayout refreshlayout) { list.clear(); list.addAll(0,myDingDanBean.getData()); myAdapter(); smart_refresh.finishRefresh(); } }); smart_refresh.setOnLoadmoreListener(new OnLoadmoreListener() { @Override public void onLoadmore(RefreshLayout refreshlayout) { handler.sendEmptyMessage(0); list.clear(); page++; presenter.getDingUrl(Wz.cxdd,page); onResume(); list.addAll(myDingDanBean.getData()); myAdapter(); smart_refresh.finishLoadmore(); } }); } } }); } public void myAdapter(){ recycler_daizhi.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false)); MyDingDanAdapter adapter = new MyDingDanAdapter(getActivity(), list,presenter,page); recycler_daizhi.setAdapter(adapter); //adapter.notifyDataSetChanged(); } }
public class Frag_YiQu extends Fragment {
private View view;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.frag_yiqu, container, false);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
}
public class Frag_YiZhi extends Fragment { private View view; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.frag_yizhi, container, false); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } }
ublic interface Main {
void getDingDanBean(MyDingDanBean myDingDanBean);
}
public class Model { private Presenter presenter; public Model(Presenter presenter) { this.presenter = presenter; } public void getDingUrl(String dingdan, int page) { Map<String, String> params=new HashMap<>(); params.put("uid","3690"); params.put("page",page+""); OkHttp3Util.doPost(dingdan, params, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()){ String json = response.body().string(); MyDingDanBean myDingDanBean = new Gson().fromJson(json, MyDingDanBean.class); presenter.getDingDanBean(myDingDanBean); } } }); } }
public class MyDingDanAdapter extends RecyclerView.Adapter<MyDingDanHolder> {
private final Context context;
private final List<MyDingDanBean.DataBean> list;
private Presenter presenter;
private int page;
public MyDingDanAdapter(Context context, List<MyDingDanBean.DataBean> list, Presenter presenter, int page) {
this.context = context;
this.list = list;
this.presenter = presenter;
this.page = page;
}
@Override
public MyDingDanHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.item_dingdan,parent, false);
MyDingDanHolder holder = new MyDingDanHolder(view);
return holder;
}
@Override
public void onBindViewHolder(MyDingDanHolder holder, final int position) {
holder.text_title.setText(list.get(position).getTitle());
holder.text_price.setText("价格: "+list.get(position).getPrice());
holder.text_tame.setText(list.get(position).getCreatetime());
if (list.get(position).getStatus()==0){
holder.text_daizhifu.setText("待支付");
holder.text_daizhifu.setTextColor(Color.RED);
holder.text_btn.setText("取消订单");
holder.text_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("提示");
builder.setMessage("确定要取消订单吗?");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Map<String, String> params=new HashMap<>();
params.put("uid","3690");
params.put("orderId", String.valueOf(list.get(position).getOrderid()));
params.put("status", String.valueOf(2));
OkHttp3Util.doPost(Wz.qxdd, params, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.isSuccessful()){
Log.d("+++++++++响哥1", String.valueOf(list.get(position).getStatus()));
presenter.getDingUrl(Wz.cxdd,page);
}
}
});
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.show();
}
});
}else if (list.get(position).getStatus()==1){
holder.text_daizhifu.setText("已支付");
holder.text_daizhifu.setTextColor(Color.BLACK);
holder.text_btn.setText("查看订单");
}else {
holder.text_daizhifu.setText("已取消");
holder.text_daizhifu.setTextColor(Color.BLACK);
holder.text_btn.setText("查看订单");
holder.text_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("提示");
builder.setMessage("确定循环利用吗?");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Map<String, String> params = new HashMap<>();
params.put("uid", "3690");
params.put("orderId", String.valueOf(list.get(position).getOrderid()));
params.put("status", String.valueOf(0));
OkHttp3Util.doPost(Wz.qxdd, params, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.isSuccessful()) {
Log.d("+++++++++响哥", String.valueOf(list.get(position).getStatus()));
presenter.getDingUrl(Wz.cxdd, page);
}
}
});
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.show();
}
});
}
}
@Override
public int getItemCount() {
return list.size();
}
}
public class MyDingDanBean { 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 { private String createtime; private int orderid; private double price; private int status; private String title; private int uid; public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public int getOrderid() { return orderid; } public void setOrderid(int orderid) { this.orderid = orderid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } } }
public class MyDingDanHolder extends RecyclerView.ViewHolder {
public TextView text_title;
public TextView text_daizhifu;
public TextView text_price;
public TextView text_tame;
public TextView text_btn;
public MyDingDanHolder(View itemView) {
super(itemView);
text_title = itemView.findViewById(R.id.text_title);
text_daizhifu = itemView.findViewById(R.id.text_daizhifu);
text_price = itemView.findViewById(R.id.text_price);
text_tame = itemView.findViewById(R.id.text_tame);
text_btn = itemView.findViewById(R.id.text_btn);
}
}
public class Presenter implements PresenterPort { private Main main; private final Model model; public Presenter(Main main) { model = new Model(this); this.main = main; } @Override public void getDingDanBean(MyDingDanBean myDingDanBean) { main.getDingDanBean(myDingDanBean); } public void getDingUrl(String dingdan, int page) { model.getDingUrl(dingdan,page); } }
public interface PresenterPort {
void getDingDanBean(MyDingDanBean myDingDanBean);
}
登录注册
public class Dl extends AppCompatActivity implements Vi{
private EditText wd_dl_phone;
private EditText wd_dl_pwd;
private Button wd_dl;
private TextView wd_zc;
private ImageView weixin;
private ImageView qq;
private String s;
private String s1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dl);
wd_dl_phone = findViewById(R.id.wd_dl_phone);
wd_dl_pwd = findViewById(R.id.wd_dl_pwd);
wd_dl = findViewById(R.id.wd_dl);
wd_zc = findViewById(R.id.dl_zc);
weixin = findViewById(R.id.weixin);
qq = findViewById(R.id.qq1);
final Pc pc=new Pc(this);
wd_dl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
s = wd_dl_phone.getText().toString();
s1 = wd_dl_pwd.getText().toString();
pc.dlinfo(s,s1);
}
});
wd_zc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(Dl.this,Zc.class);
startActivity(intent);
}
});
}
@Override
public void dlOnsuccess(final dl_Bean dlBean) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if(dlBean.getMsg().equals("登录成功")){
Toast.makeText(Dl.this, "登录成功", Toast.LENGTH_SHORT).show();
int uid = dlBean.getData().getUid();
SharedPreferences sharedPreferences=getSharedPreferences("dl",MODE_PRIVATE);
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString("name",s);
edit.putString("pwd",s1);
edit.putString("cjsj",dlBean.getData().getCreatetime().toString());
edit.putBoolean("flag",false);
edit.putString("tx",(String) dlBean.getData().getIcon());
edit.putString("uid",dlBean.getData().getUid()+"");
edit.commit();
finish();
}
}
});
}
@Override
public void zcOnsuccess(zc_Bean zcBean) {
}
}
public class Zc extends AppCompatActivity implements Vi{ private EditText zc_phone; private EditText zcPwd; private Button zcZc; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_zc); zc_phone = findViewById(R.id.zc_phone); zcPwd = findViewById(R.id.zc_pwd); zcZc = findViewById(R.id.zc_zc); final Pc pc=new Pc(this); zcZc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String s = zc_phone.getText().toString(); String s1 = zcPwd.getText().toString(); pc.zcinfo(s,s1); } }); } @Override public void dlOnsuccess(dl_Bean dlBean) { } @Override public void zcOnsuccess(final zc_Bean zcBean) { runOnUiThread(new Runnable() { @Override public void run() { if(zcBean.getMsg().equals("注册成功")){ Toast.makeText(Zc.this, "注册成功", Toast.LENGTH_SHORT).show(); finish(); } } }); } }
fragment 购物车/我的
public class Gouwuche extends Fragment implements Gwc_Vi{
private MyExpanableListView myexlv;
private CheckBox check_all;
private TextView text_hj;
private TextView text_buy;
private RelativeLayout re_pro;
private Gwc_Pc gwc_pc;
Handler handler=new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what==0){
slpriceBean slprice= (slpriceBean) msg.obj;
text_hj.setText("人民币:¥"+slprice.getPriceString());
text_buy.setText("去结算:"+slprice.getCount());
}
}
};
private MyAdapter myAdapter;
private String uid;
private SharedPreferences dl;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.gwc, null);
myexlv = v.findViewById(R.id.myexlv);
check_all = v.findViewById(R.id.check_all);
text_hj = v.findViewById(R.id.text_hj);
text_buy = v.findViewById(R.id.text_buy);
re_pro = v.findViewById(R.id.rela_progress);
myexlv.setGroupIndicator(null);
gwc_pc = new Gwc_Pc(this);
dl = getActivity().getSharedPreferences("dl", getActivity().MODE_PRIVATE);
uid = dl.getString("uid", "");
gwc_pc.inof(uid);
text_buy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getActivity(), DD.class);
startActivity(intent);
}
});
return v;
}
@Override
public void Onsuccess(final Gwc_Bean gwc_bean) {
check_all.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.check_all:
if(myAdapter!=null){
myAdapter.setAllchildsChecked(check_all.isChecked());
}
break;
}
}
});
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
re_pro.setVisibility(View.GONE);
if(gwc_bean!=null){
for (int i=0;i<gwc_bean.getData().size();i++){
if(isChildInGroupChecked(i,gwc_bean)){
gwc_bean.getData().get(i).setGroupChecked(true);
}
}
check_all.setChecked(isAllGroupChecked(gwc_bean));
myAdapter = new MyAdapter(re_pro,gwc_pc,handler,gwc_bean,getContext(),dl);
myexlv.setAdapter(myAdapter);
for (int i=0;i<gwc_bean.getData().size();i++){
myexlv.expandGroup(i);
}
myAdapter.sendpriceAndCount();
}else {
Toast.makeText(getContext(), "购物车空,请添加购物车", Toast.LENGTH_SHORT).show();
}
}
});
}
private boolean isAllGroupChecked(Gwc_Bean gwc_bean){
for (int i=0;i<gwc_bean.getData().size();i++){
if(!gwc_bean.getData().get(i).isGroupChecked()){
return false;
}
}
return true;
}
private boolean isChildInGroupChecked(int i,Gwc_Bean gwc_bean){
List<Gwc_Bean.DataBean.ListBean> list = gwc_bean.getData().get(i).getList();
for (int j=0;j<list.size();j++){
if(list.get(j).getSelected()==0){
return false;
}
}
return true;
}
@Override
public void onResume() {
super.onResume();
re_pro.setVisibility(View.VISIBLE);
gwc_pc.inof(uid);
}
}
public class Wode extends Fragment { private ImageView zc; private TextView dlzc; private ImageView tx; private Intent intent; private SharedPreferences dl; private LinearLayout dfk; private LinearLayout dpj; private LinearLayout dsh; private LinearLayout th; private LinearLayout wddd; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.wode, null); zc = v.findViewById(R.id.imageView5); dlzc = v.findViewById(R.id.dlzhuce); tx = v.findViewById(R.id.tx); dfk = v.findViewById(R.id.ll_dfk); dpj = v.findViewById(R.id.ll_dpj); dsh = v.findViewById(R.id.ll_dsh); th = v.findViewById(R.id.ll_th); wddd = v.findViewById(R.id.ll_wddd); intent = getActivity().getIntent(); dl = getActivity().getSharedPreferences("dl", getActivity().MODE_PRIVATE); boolean flag = dl.getBoolean("flag", true); if(flag){ dlzc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(getActivity(), Dl.class); startActivity(intent); } }); } dfk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = dl.getString("name", ""); if(name.equals("")){ Intent intent =new Intent(getActivity(),Dl.class); startActivity(intent); }else{ Intent intent =new Intent(getActivity(),DD.class); startActivity(intent); } } }); dpj.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = dl.getString("name", ""); if(name.equals("")){ Intent intent =new Intent(getActivity(),Dl.class); startActivity(intent); }else{ Intent intent =new Intent(getActivity(),DD.class); startActivity(intent); } } }); dsh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = dl.getString("name", ""); if(name.equals("")){ Intent intent =new Intent(getActivity(),Dl.class); startActivity(intent); }else{ Intent intent =new Intent(getActivity(),DD.class); startActivity(intent); } } }); th.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = dl.getString("name", ""); if(name.equals("")){ Intent intent =new Intent(getActivity(),Dl.class); startActivity(intent); }else{ Intent intent =new Intent(getActivity(),DD.class); startActivity(intent); } } }); wddd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = dl.getString("name", ""); if(name.equals("")){ Intent intent =new Intent(getActivity(),Dl.class); startActivity(intent); }else{ Intent intent =new Intent(getActivity(),DD.class); startActivity(intent); } } }); return v; } @Override public void onResume() { super.onResume(); String name = dl.getString("name", "登录/注册"); String tx1 = dl.getString("tx",""); dlzc.setText(name); Glide.with(getContext()).load(tx1).into(tx); dlzc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { boolean flag = dl.getBoolean("flag", true); if(flag){ Intent intent=new Intent(getActivity(), Dl.class); startActivity(intent); }else { Toast.makeText(getContext(), "个人信息", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(getActivity(), Gr_xq.class); intent.putExtra("yhm",dl.getString("name","")); intent.putExtra("cjsj",dl.getString("cjsj","")); startActivity(intent); } } }); } }个人信息
public class Gr_xq extends AppCompatActivity { private Button tv_dl; private TextView tv_nc; private TextView tv_tx; private TextView tv_yhm; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gr_xq); tv_dl = findViewById(R.id.tv_dl); tv_nc = findViewById(R.id.tv_nc); tv_tx = findViewById(R.id.tv_tx); tv_yhm = findViewById(R.id.tv_yhm); Intent intent = getIntent(); tv_dl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SharedPreferences dl = getSharedPreferences("dl", MODE_PRIVATE); SharedPreferences.Editor editor = dl.edit(); editor.clear(); editor.commit(); editor.putBoolean("flag",true); editor.commit(); finish(); } }); tv_nc.setText("创建时间"+intent.getStringExtra("cjsj")); tv_yhm.setText("用户名"+intent.getStringExtra("yhm")); } }购物车
public class Gwc_Bean { private String code; private String msg; private List<DataBean> data; @Override public String toString() { return "Gwc_Bean{" + "code='" + code + '\'' + ", msg='" + msg + '\'' + ", data=" + data + '}'; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { @Override public String toString() { return "DataBean{" + "groupChecked=" + groupChecked + ", sellerName='" + sellerName + '\'' + ", sellerid='" + sellerid + '\'' + ", list=" + list + '}'; } private boolean groupChecked; public boolean isGroupChecked() { return groupChecked; } public void setGroupChecked(boolean groupChecked) { this.groupChecked = groupChecked; } private String sellerName; private String sellerid; private List<ListBean> list; 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 { 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;//当前的商品子条目是否选中....1表示选中,0未选中 private int sellerid; private String subhead; private String title; @Override public String toString() { return "ListBean{" + "bargainPrice=" + bargainPrice + ", createtime='" + createtime + '\'' + ", detailUrl='" + detailUrl + '\'' + ", images='" + images + '\'' + ", num=" + num + ", pid=" + pid + ", price=" + price + ", pscid=" + pscid + ", selected=" + selected + ", sellerid=" + sellerid + ", subhead='" + subhead + '\'' + ", title='" + 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 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; } } } }
public class Gwc_Mc {
public void inof(String uid, final Gwc_Pi gwcPi){
Map<String,String> map = new HashMap<>();
map.put("uid",uid);
OkHttp3Util.doPost(Wz.cxgwc, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
String string = response.body().string();
Gwc_Bean gwc_bean = new Gson().fromJson(string, Gwc_Bean.class);
Log.d("gwc", "onResponse: "+gwc_bean.toString());
gwcPi.Onsuccess(gwc_bean);
}
}
});
}
}
public class Gwc_Pc implements Gwc_Pi{ Gwc_Vi gwcVi; Gwc_Mc gwcMc; public Gwc_Pc(Gwc_Vi gwcVi) { this.gwcVi = gwcVi; gwcMc=new Gwc_Mc(); } public void inof(String uid){ gwcMc.inof(uid,this); } @Override public void Onsuccess(Gwc_Bean gwc_bean) { gwcVi.Onsuccess(gwc_bean); } }
public interface Gwc_Pi {
void Onsuccess(Gwc_Bean gwc_bean);
}
public interface Gwc_Vi { void Onsuccess(Gwc_Bean gwc_bean); }
public class MyAdapter extends BaseExpandableListAdapter{
RelativeLayout relativeLayout;
Gwc_Pc gwcPc;
Handler handler;
Gwc_Bean gwc_bean;
Context context;
int childIndex;
int allIndex;
SharedPreferences dl;
private String uid;
public MyAdapter(RelativeLayout relativeLayout, Gwc_Pc gwcPc, Handler handler, Gwc_Bean gwc_bean, Context context,SharedPreferences dl) {
this.relativeLayout = relativeLayout;
this.gwcPc = gwcPc;
this.handler = handler;
this.gwc_bean = gwc_bean;
this.context = context;
this.dl=dl;
}
@Override
public int getGroupCount() {
return gwc_bean.getData().size();
}
@Override
public int getChildrenCount(int i) {
return gwc_bean.getData().get(i).getList().size();
}
@Override
public Object getGroup(int i) {
return gwc_bean.getData().get(i);
}
@Override
public Object getChild(int i, int i1) {
return gwc_bean.getData().get(i).getList().get(i1);
}
@Override
public long getGroupId(int i) {
return i;
}
@Override
public long getChildId(int i, int i1) {
return i1;
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public View getGroupView(int i, boolean b, View view, ViewGroup viewGroup) {
uid = dl.getString("uid", "");
final GroupHolder holder;
if(view==null){
view=View.inflate(context, R.layout.father,null);
holder=new GroupHolder();
holder.checkBox=view.findViewById(R.id.group_check);
holder.textView=view.findViewById(R.id.group_text);
view.setTag(holder);
}else{
holder= (GroupHolder) view.getTag();
}
final Gwc_Bean.DataBean dataBean = gwc_bean.getData().get(i);
holder.textView.setText(dataBean.getSellerName());
holder.checkBox.setChecked(dataBean.isGroupChecked());
holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
relativeLayout.setVisibility(View.VISIBLE);
childIndex=0;
gxallchild(dataBean,holder.checkBox.isChecked());
}
});
return view;
}
private void gxallchild(final Gwc_Bean.DataBean dataBean, final boolean checked) {
Gwc_Bean.DataBean.ListBean listBean = dataBean.getList().get(childIndex);
Map<String,String> map = new HashMap<>();
map.put("uid",uid+"");
map.put("sellerid", String.valueOf(listBean.getSellerid()));
map.put("pid", String.valueOf(listBean.getPid()));
map.put("num", String.valueOf(listBean.getNum()));
map.put("selected", String.valueOf(checked?1:0));
OkHttp3Util.doPost(Wz.gxgwc, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
childIndex++;
if(childIndex<dataBean.getList().size()){
gxallchild(dataBean,checked);
}else{
gwcPc.inof(uid);
}
}
}
});
}
@Override
public View getChildView(int i, int i1, boolean b, View view, ViewGroup viewGroup) {
ChildHolder holder;
if(view==null){
view=View.inflate(context, R.layout.chiled,null);
holder=new ChildHolder();
holder.checkBox=view.findViewById(R.id.child_check);
holder.imageView=view.findViewById(R.id.child_image);
holder.text_price=view.findViewById(R.id.child_price);
holder.text_jian=view.findViewById(R.id.text_jian);
holder.text_add=view.findViewById(R.id.text_add);
holder.text_del=view.findViewById(R.id.text_delete);
holder.text_num=view.findViewById(R.id.text_num);
holder.text_title=view.findViewById(R.id.child_title);
view.setTag(holder);
}else{
holder= (ChildHolder) view.getTag();
}
final Gwc_Bean.DataBean.ListBean listBean = gwc_bean.getData().get(i).getList().get(i1);
holder.text_title.setText(listBean.getTitle());
holder.text_price.setText("¥"+listBean.getBargainPrice());
String[] split = listBean.getImages().split("\\|");
Glide.with(context).load(split[0]).into(holder.imageView);
holder.text_num.setText(listBean.getNum()+"");
holder.checkBox.setChecked(listBean.getSelected()==0?false:true);
holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
relativeLayout.setVisibility(View.VISIBLE);
Map<String,String> map = new HashMap<>();
map.put("uid", uid);
map.put("sellerid", String.valueOf(listBean.getSellerid()));
map.put("pid", String.valueOf(listBean.getPid()));
map.put("selected", String.valueOf(listBean.getSelected()==0?1:0));
map.put("num", String.valueOf(listBean.getNum()));
OkHttp3Util.doPost(Wz.gxgwc, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
gwcPc.inof(uid);
}
}
});
}
});
holder.text_add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
relativeLayout.setVisibility(View.VISIBLE);
Map<String,String> map = new HashMap<>();
map.put("uid",uid);
map.put("sellerid", String.valueOf(listBean.getSellerid()));
map.put("pid", String.valueOf(listBean.getPid()));
map.put("selected", String.valueOf(listBean.getSelected()));
map.put("num", String.valueOf(listBean.getNum()+1));
OkHttp3Util.doPost(Wz.gxgwc, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
gwcPc.inof(uid);
}
}
});
}
});
holder.text_jian.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int num = listBean.getNum();
if(num==1){
return;
}
relativeLayout.setVisibility(View.VISIBLE);
Map<String,String> map=new HashMap<>();
map.put("uid",uid);
map.put("sellerid", String.valueOf(listBean.getSellerid()));
map.put("pid", String.valueOf(listBean.getPid()));
map.put("num", String.valueOf(listBean.getNum()-1));
map.put("selected", String.valueOf(listBean.getSelected()));
OkHttp3Util.doPost(Wz.gxgwc, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
gwcPc.inof(uid);
}
}
});
}
});
holder.text_del.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
relativeLayout.setVisibility(View.VISIBLE);
Map<String,String>map = new HashMap<>();
map.put("pid", String.valueOf(listBean.getPid()));
map.put("uid",uid);
OkHttp3Util.doPost(Wz.scgwc, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
gwcPc.inof(uid);
}
}
});
}
});
return view;
}
@Override
public boolean isChildSelectable(int i, int i1) {
return true;
}
public void sendpriceAndCount(){
double price=0;
int count=0;
for (int i=0;i<gwc_bean.getData().size();i++){
List<Gwc_Bean.DataBean.ListBean> list = gwc_bean.getData().get(i).getList();
for (int j=0;j<list.size();j++){
if(list.get(j).getSelected()==1){
price+=list.get(j).getBargainPrice()*list.get(j).getNum();
count+=list.get(j).getNum();
}
}
}
DecimalFormat decimalFormat=new DecimalFormat("0.00");
String format = decimalFormat.format(price);
slpriceBean sljg=new slpriceBean(format,count);
Message msg=Message.obtain();
msg.what=0;
msg.obj=sljg;
handler.sendMessage(msg);
}
public void setAllchildsChecked(boolean checked){
List<Gwc_Bean.DataBean.ListBean> alllist=new ArrayList<>();
for (int i=0;i<gwc_bean.getData().size();i++){
List<Gwc_Bean.DataBean.ListBean> list = gwc_bean.getData().get(i).getList();
for (int j=0;j<list.size();j++){
alllist.add(list.get(j));
}
}
relativeLayout.setVisibility(View.VISIBLE);
allIndex=0;
gxallChexked(alllist,checked);
}
private void gxallChexked(final List<Gwc_Bean.DataBean.ListBean> alllist, final boolean checked) {
Gwc_Bean.DataBean.ListBean listBean = alllist.get(allIndex);
Map<String,String> map=new HashMap<>();
map.put("uid",uid);
map.put("sellerid", String.valueOf(listBean.getSellerid()));
map.put("pid", String.valueOf(listBean.getPid()));
map.put("selected", String.valueOf(checked?1:0));
map.put("num", String.valueOf(listBean.getNum()));
OkHttp3Util.doPost(Wz.gxgwc, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
allIndex++;
if(allIndex<alllist.size()){
gxallChexked(alllist,checked);
}else {
gwcPc.inof(uid);
}
}
}
});
}
class GroupHolder{
CheckBox checkBox;
TextView textView;
}
class ChildHolder{
CheckBox checkBox;
ImageView imageView;
TextView text_title;
TextView text_price;
TextView text_num;
TextView text_jian;
TextView text_add;
TextView text_del;
}
}
public class MyExpanableListView extends ExpandableListView{ public MyExpanableListView(Context context) { super(context); } public MyExpanableListView(Context context, AttributeSet attrs) { super(context, attrs); } public MyExpanableListView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int height = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, height); } }
public class slpriceBean {
String priceString;
int count;
public String getPriceString() {
return priceString;
}
public void setPriceString(String priceString) {
this.priceString = priceString;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public slpriceBean(String priceString, int count) {
this.priceString = priceString;
this.count = count;
}
}
我的public class dl_Bean {
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 {
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;
}
}
}
public class Mc { public void dlinfo(String mobile, String password, final Pi pi){ Map<String,String> map=new HashMap<>(); map.put("mobile",mobile); map.put("password",password); OkHttp3Util.doPost(Wz.dl, map, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if(response.isSuccessful()){ String string = response.body().string(); dl_Bean dl_bean = new Gson().fromJson(string, dl_Bean.class); pi.dlOnsuccess(dl_bean); } } }); } public void zcinfo(String mobile, String password, final Pi pi){ Map<String,String> map=new HashMap<>(); map.put("mobile",mobile); map.put("password",password); OkHttp3Util.doPost(Wz.zc, map, new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if(response.isSuccessful()){ String string = response.body().string(); zc_Bean zc_bean = new Gson().fromJson(string, zc_Bean.class); pi.zcOnsuccess(zc_bean); } } }); } }
public class Pc implements Pi{
Vi vi;
Mc mc;
public Pc(Vi vi) {
this.vi = vi;
mc=new Mc();
}
public void dlinfo(String mobile,String password){
mc.dlinfo(mobile,password,this);
}
public void zcinfo(String mobile,String password){
mc.zcinfo(mobile,password,this);
}
@Override
public void dlOnsuccess(dl_Bean dlBean) {
vi.dlOnsuccess(dlBean);
}
@Override
public void zcOnsuccess(zc_Bean zcBean) {
vi.zcOnsuccess(zcBean);
}
}
public interface Pi { void dlOnsuccess(dl_Bean dlBean); void zcOnsuccess(zc_Bean zcBean); }
public interface Vi {
void dlOnsuccess(dl_Bean dlBean);
void zcOnsuccess(zc_Bean zcBean);
}
public class zc_Bean { 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; } }商品详情
public class Jr_bean { 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; } }
public class Xq_bean {
private String msg;
private SellerBean seller;
private String code;
private DataBean data;
@Override
public String toString() {
return "Xq_bean{" +
"msg='" + msg + '\'' +
", seller=" + seller +
", code='" + code + '\'' +
", data=" + 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 {
private String description;
private String icon;
private String name;
private int productNums;
private double score;
private int sellerid;
@Override
public String toString() {
return "SellerBean{" +
"description='" + description + '\'' +
", icon='" + icon + '\'' +
", name='" + name + '\'' +
", productNums=" + productNums +
", score=" + score +
", sellerid=" + 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 {
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;
}
}
}
public class Xq_image extends ImageLoader { @Override public void displayImage(Context context, Object path, ImageView imageView) { Glide.with(context).load(path).into(imageView); } }
public class Xq_Mc {
public void xq_info(String pid, final Xq_Pi xqPi){
Map<String,String> map = new HashMap<>();
map.put("pid",pid);
OkHttp3Util.doPost(Wz.Xq, map, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.isSuccessful()){
String string = response.body().string();
Xq_bean xq_bean = new Gson().fromJson(string, Xq_bean.class);
Log.d("zzz", "onResponse: "+xq_bean.toString());
xqPi.Xq_Success(xq_bean);
}
}
});
}
}
public class Xq_Pc implements Xq_Pi{ Xq_Vi xq_vi; Xq_Mc xq_mc; public Xq_Pc(Xq_Vi xq_vi) { this.xq_vi = xq_vi; xq_mc=new Xq_Mc(); } public void xqinfo(String pid){ xq_mc.xq_info(pid,this); } @Override public void Xq_Success(Xq_bean xqBean) { xq_vi.Xq_Success(xqBean); } }
public interface Xq_Pi {
void Xq_Success(Xq_bean xqBean);
}
public interface Xq_Vi { void Xq_Success(Xq_bean xqBean); }activity_dd.xml
<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="com.example.jd_11a.DD.DD"> <RelativeLayout android:layout_width="match_parent" android:layout_height="50dp" android:background="#fff" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:textSize="20sp" android:text="订单列表" /> <ImageView android:layout_width="25dp" android:layout_height="25dp" android:id="@+id/img_btn" android:clickable="true" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginLeft="20dp" android:background="@drawable/lv_icon" /> </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:orientation="horizontal" > <TextView android:id="@+id/text_daizhi" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:background="@drawable/biankuang" android:text="待支付" android:textSize="16sp" /> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:id="@+id/text_yizhi" android:text="已支付" android:textSize="16sp" android:background="@drawable/biankuang" android:gravity="center" /> <TextView android:layout_width="0dp" android:layout_height="match_parent" android:id="@+id/text_yiqu" android:layout_weight="1" android:background="@drawable/biankuang" android:text="已取消" android:textSize="16sp" android:gravity="center" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/frame_layout" ></FrameLayout> </LinearLayout>activity_dl.xml
<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="com.example.jd_11a.Dl_Zc.Dl">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登录"
android:gravity="center"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入账号"
android:id="@+id/wd_dl_phone"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
android:id="@+id/wd_dl_pwd"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/wd_dl"
android:text="登录"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dl_zc"
android:text="手机快速注册"
android:layout_weight="1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="忘记密码"
android:layout_weight="1"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/weixin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignTop="@+id/qq1"
android:background="@drawable/weixin" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/mqq"
android:id="@+id/qq1" />
</RelativeLayout>
</LinearLayout>
activity_gr_xq.xml
<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="com.example.jd_11a.Grxq.Gr_xq"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="头像" android:id="@+id/tv_tx" android:layout_marginTop="20dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tv_yhm" android:text="用户名" android:layout_marginTop="20dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tv_nc" android:text="昵称" android:layout_marginTop="20dp" /> <Button android:id="@+id/tv_dl" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="退出登录" android:layout_marginTop="20dp" /></LinearLayout>
activity_lb.xml
<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="com.example.jd_11a.Sy.Lb">
<EditText
android:id="@+id/et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="94dp"
android:focusable="false"
android:hint="请输入搜索关键字" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ss"
android:text="搜索"
android:layout_alignRight="@id/et"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="切换视图"
android:id="@+id/qh"
android:layout_alignRight="@id/ss"
android:layout_alignParentRight="true"
/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_below="@id/et"
android:id="@+id/re"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</RelativeLayout>
activity_main.xml
<android.support.constraint.ConstraintLayout 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="com.example.jd_11a.MainActivity" android:background="@drawable/b1i" > </android.support.constraint.ConstraintLayout>
activity_main2.xml
<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="com.example.jd_11a.Main2Activity">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/rg"
android:layout_alignParentBottom="true"
>
<RadioButton
android:id="@+id/gwc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/gwc"
android:layout_weight="1"
android:button="@null"
/>
<RadioButton
android:id="@+id/wode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/wd"
android:layout_weight="1"
android:button="@null"
/>
</RadioGroup>
<FrameLayout
android:id="@+id/fl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/rg"
android:layout_alignParentTop="true"
></FrameLayout>
</RelativeLayout>
activity_resou.xml
<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="com.example.jd_11a.Sy.Resou"> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:orientation="horizontal"> <TextView android:id="@+id/btn_back" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text=" 返回 "/> <EditText android:id="@+id/et_sou" android:layout_width="0dp" android:layout_weight="4" android:hint="内衣跨店3免1,服装跨店3件7折" android:layout_height="match_parent" /> <TextView android:id="@+id/btn_sou" android:onClick="add" android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:gravity="center" android:text="搜索"/> </LinearLayout> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:text="热搜" android:textSize="18sp" android:textStyle="bold"/> <com.example.jd_11a.Sy.ReSouView android:id="@+id/reSouView" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="100dp"></com.example.jd_11a.Sy.ReSouView> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="历史记录" android:textSize="24dp" /> <ListView android:layout_width="match_parent" android:layout_height="200dp" android:id="@+id/lv" ></ListView> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="清空历史记录" android:layout_gravity="center" android:gravity="center" android:onClick="delall" android:visibility="invisible" android:id="@+id/btn" /> </LinearLayout>
activity_xq.xml
<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="com.example.jd_11a.Xq">
<com.youth.banner.Banner
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/xq_banner"
></com.youth.banner.Banner>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/xq_bt"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/xq_price"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/xq_yhprice"
android:textColor="#f00"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:layout_height="match_parent">
<Button
android:id="@+id/xq_jr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#f00"
android:text="加入购物车"
android:textColor="#fff" />
<TextView
android:id="@+id/dw"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="19dp"
android:text="TextView" />
</RelativeLayout>
</LinearLayout>
activity_zc.xml
<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="com.example.jd_11a.Dl_Zc.Zc"> <TextView android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="注册" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入注册手机号" android:id="@+id/zc_phone" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入注册密码" android:id="@+id/zc_pwd" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="注册" android:id="@+id/zc_zc" /> </LinearLayout>
chiled.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:padding="10dp"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/child_check"
android:layout_centerVertical="true"
android:background="@drawable/check_box_selector"
android:button="@null"
/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/child_check"
android:id="@+id/child_image"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/child_title"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="@+id/text_delete"
android:layout_toRightOf="@+id/child_image"
android:maxLines="2"
android:minLines="2"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/child_price"
android:layout_alignBottom="@+id/child_image"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/child_image"
android:text="¥0.00"
android:textColor="#ff0000"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/linearLayout"
android:layout_alignBottom="@+id/child_image"
android:layout_toLeftOf="@+id/text_delete"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_jian"
android:background="@drawable/bian_kuang"
android:padding="5dp"
android:text="—"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_num"
android:background="@drawable/bian_kuang"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:text="1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bian_kuang"
android:text="+"
android:padding="5dp"
android:id="@+id/text_add"
/>
</LinearLayout>
<TextView
android:layout_width="40dp"
android:layout_height="wrap_content"
android:id="@+id/text_delete"
android:layout_alignBottom="@id/linearLayout"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:background="#ff0000"
android:gravity="center"
android:text="删除"
android:textColor="#ffffff"
/>
</RelativeLayout>
daizhi.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <com.scwang.smartrefresh.layout.SmartRefreshLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/smart_refresh" > <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/recycle_daizhi" ></android.support.v7.widget.RecyclerView> </ScrollView> </com.scwang.smartrefresh.layout.SmartRefreshLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/relative_bar" > <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> </RelativeLayout>
father.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:padding="10dp"
android:orientation="horizontal"
android:layout_height="match_parent">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:background="@drawable/check_box_selector"
android:id="@+id/group_check"
android:layout_gravity="center_vertical"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/group_text"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
/>
</LinearLayout>
faxian.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="发现" /> </LinearLayout>
fenlei.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<include
layout="@layout/ss"
></include>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<ListView
android:layout_width="80dp"
android:layout_height="match_parent"
android:id="@+id/lv"
android:background="@color/colorAccent"
></ListView>
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:id="@+id/fl_re"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
</LinearLayout>
fl_lv.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:orientation="vertical" android:gravity="center" android:layout_height="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:id="@+id/tv" /> </LinearLayout>
fl_re.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:id="@+id/right_name"
android:textSize="25dp"
/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="30dp"
android:id="@+id/fl_you_re"
android:layout_weight="1"
android:background="#fff"
></android.support.v7.widget.RecyclerView>
</LinearLayout>
fl_youshang.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:id="@+id/right_img" android:layout_width="50dp" android:layout_height="48dp" android:layout_gravity="center" android:layout_marginTop="20dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:gravity="center" android:id="@+id/tvname" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="男装" android:textSize="15sp" /> </LinearLayout> </LinearLayout>
frag_daizhi.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/smart_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_daizhi"
android:layout_width="match_parent"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</ScrollView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
<RelativeLayout
android:id="@+id/relative_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
frag_yiqu.xml
<android.support.constraint.ConstraintLayout android:background="#ff0000" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.constraint.ConstraintLayout>
frag_yizhi.xml
<android.support.constraint.ConstraintLayout
android:background="#00ff00"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.constraint.ConstraintLayout>
gwc.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <com.example.jd_11a.Gwc.MyExpanableListView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/myexlv" ></com.example.jd_11a.Gwc.MyExpanableListView> <TextView android:layout_width="match_parent" android:layout_height="400dp" android:text="为你推荐" android:layout_marginTop="10dp" android:gravity="center_horizontal" android:background="#00ff00" /> </LinearLayout> </ScrollView> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/rela_progress" android:layout_above="@+id/linear_bottom" > <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" /> </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:orientation="horizontal" android:id="@+id/linear_bottom" android:layout_alignParentBottom="true" android:background="#fff" > <CheckBox android:id="@+id/check_all" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@drawable/check_box_selector" android:button="@null" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_gravity="center_vertical" android:text="合计:¥0.00" android:layout_weight="1" android:id="@+id/text_hj" /> <TextView android:layout_width="100dp" android:textColor="#ffffff" android:background="#ff0000" android:text="去结算(0)" android:id="@+id/text_buy" android:gravity="center" android:layout_height="match_parent" /> </LinearLayout> </RelativeLayout>
item_dingdan.xml
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/text_title"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="bottom"
android:layout_height="match_parent"
android:text="1111"/>
<TextView
android:id="@+id/text_daizhifu"
android:layout_width="50dp"
android:gravity="bottom"
android:layout_height="match_parent"
android:textColor="#ff0000"
android:text="待支付"/>
</LinearLayout>
<TextView
android:id="@+id/text_price"
android:gravity="bottom"
android:textColor="#ff0000"
android:layout_marginLeft="20dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="1111"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/text_tame"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="bottom"
android:layout_height="match_parent"
android:text="1111"/>
<TextView
android:id="@+id/text_btn"
android:layout_width="70dp"
android:gravity="center"
android:layout_gravity="bottom"
android:layout_height="30dp"
android:background="@drawable/biankuang"
android:text="取消订单"/>
</LinearLayout>
<TextView
android:layout_marginTop="15dp"
android:clickable="true"
android:focusable="false"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#9999"/>
</LinearLayout>
item_popup.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="100dp" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/btn_daizhi" android:layout_width="match_parent" android:layout_weight="1" android:gravity="center" android:layout_height="0dp" android:textSize="16sp" android:padding="15dp" android:background="@drawable/select_dianji" android:text="待支付"/> <TextView android:id="@+id/btn_yizhi" android:layout_width="match_parent" android:layout_weight="1" android:gravity="center" android:layout_height="0dp" android:textSize="16sp" android:padding="15dp" android:background="@drawable/select_dianji" android:text="已支付"/> <TextView android:id="@+id/btn_yiqu" android:layout_width="match_parent" android:layout_weight="1" android:gravity="center" android:layout_height="0dp" android:textSize="16sp" android:padding="15dp" android:background="@drawable/select_dianji" android:text="已取消"/> </LinearLayout> </RelativeLayout>lb_item.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<ImageView
android:id="@+id/img"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/img"
android:gravity="center"
android:text="TextView" />
</RelativeLayout>
quxiao.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> </LinearLayout>re.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/sy_jgg_img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
app:srcCompat="@android:drawable/sym_def_app_icon" />
<TextView
android:id="@+id/sy_jgg_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="TextView" />
</LinearLayout>
re1.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:orientation="vertical" android:layout_height="wrap_content"> <ImageView android:id="@+id/sy_ms_img" android:layout_width="100dp" android:layout_height="100dp" android:layout_weight="1" app:srcCompat="@mipmap/ic_launcher" /> <TextView android:id="@+id/sy_ms_tv" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="TextView" /> </LinearLayout>re2.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/sy_ms_img"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_weight="1"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/sy_ms_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" />
</LinearLayout>
ss.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageView android:id="@+id/sao" android:layout_width="80dp" android:layout_height="match_parent" android:background="@drawable/sao_kind" android:layout_weight="1" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/et" android:focusable="false" android:layout_weight="4" /> <ImageView android:layout_width="80dp" android:layout_height="match_parent" android:background="@drawable/a9v" android:layout_weight="1" /> </LinearLayout> </LinearLayout>shouye.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools">
<include
layout="@layout/ss"
></include>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="200dp"></com.youth.banner.Banner>
<ImageView
android:layout_width="match_parent"
android:src="@drawable/aaa"
android:scaleType="fitXY"
android:layout_height="100dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/re"
android:layout_width="match_parent"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/djs"
android:textColor="#f00"
android:layout_marginLeft="20dp"
android:text="倒计时"
/>
<android.support.v7.widget.RecyclerView
android:id="@+id/re1"
android:layout_width="match_parent"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
<android.support.v7.widget.RecyclerView
android:id="@+id/re2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
</ScrollView>
</LinearLayout>
xp.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:background="#000000" android:layout_height="match_parent" > <android.support.v4.view.ViewPager android:id="@+id/id_viewpager" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout>wode.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@drawable/normal_regbg"
android:id="@+id/relativeLayout">
<ImageView
android:id="@+id/tx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="33dp"
android:layout_marginTop="19dp"
/>
<TextView
android:id="@+id/dlzhuce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/tx"
android:layout_marginStart="41dp"
android:layout_toEndOf="@+id/tx"
android:text="登录/注册>" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="22dp"
android:background="@drawable/my_msg_bai" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginEnd="29dp"
android:layout_toStartOf="@+id/imageView3"
android:background="@drawable/my_set_bai" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/relativeLayout"
android:id="@+id/l1"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_dfk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/dfk"
/>
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/imageView6"
android:layout_below="@+id/imageView6"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="待付款" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_dsh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/dsh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/dsh" />
<TextView
android:id="@+id/dsh_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="待收货" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_dpj"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/dpj"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/dpj" />
<TextView
android:id="@+id/dpj_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="待评价" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_th"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/tk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/th_sh" />
<TextView
android:id="@+id/tk_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="退换/售后" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_wddd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/mydd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:gravity="center"
android:background="@drawable/dsh" />
<TextView
android:id="@+id/mydd_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="17dp"
android:text="我的订单" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/l1"
android:id="@+id/l2"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_jd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/jd"
/>
<TextView
android:id="@+id/jd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/imageView6"
android:layout_below="@+id/imageView6"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="京豆" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/yhq"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/yhq" />
<TextView
android:id="@+id/yhq_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="优惠券" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/bt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/bt" />
<TextView
android:id="@+id/bt_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="白条" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_lpk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/lpk" />
<TextView
android:id="@+id/lpk_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="礼品卡" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/wdqb_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:gravity="center"
android:background="@drawable/wdqb" />
<TextView
android:id="@+id/myqb_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="17dp"
android:text="我的钱包" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/l2"
android:id="@+id/l3"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_spgz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/spgz"
/>
<TextView
android:id="@+id/tv_spgz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/imageView6"
android:layout_below="@+id/imageView6"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="商品关注" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_dpgz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/dp" />
<TextView
android:id="@+id/dpgz_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="店铺关注" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/nrcc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/gz" />
<TextView
android:id="@+id/scnr_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="收藏内容" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_lljl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/lljl" />
<TextView
android:id="@+id/lljl_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="浏览记录" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/l3"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_wdhd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/hd"
/>
<TextView
android:id="@+id/tv_wdhd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/imageView6"
android:layout_below="@+id/imageView6"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="我的活动" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_sq"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/shqz" />
<TextView
android:id="@+id/sq_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="社区" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:id="@+id/img_khfw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:gravity="center"
android:layout_marginStart="31dp"
android:layout_marginTop="17dp"
android:background="@drawable/kh" />
<TextView
android:id="@+id/khfw_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginLeft="10dp"
android:text="客户服务" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
yizhi.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> </LinearLayout>