Android代码12月22日更新
This commit is contained in:
parent
5b5a47bb9f
commit
512fd5f50a
|
@ -1,6 +1,16 @@
|
|||
package com.example.coursedesign;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -8,8 +18,25 @@ import androidx.core.graphics.Insets;
|
|||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class AddCommodityActivity extends AppCompatActivity {
|
||||
|
||||
TextView back;
|
||||
EditText nameET, priceET, descriptionET;
|
||||
Spinner spinner;
|
||||
Button addCommodityBtn;
|
||||
|
||||
CommodityListResult.RowsDTO commodity = new CommodityListResult.RowsDTO();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -20,5 +47,80 @@ public class AddCommodityActivity extends AppCompatActivity {
|
|||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
back = findViewById(R.id.textView22);
|
||||
nameET = findViewById(R.id.editTextText4);
|
||||
priceET = findViewById(R.id.editTextNumber);
|
||||
descriptionET = findViewById(R.id.editTextText3);
|
||||
spinner = findViewById(R.id.spinner2);
|
||||
addCommodityBtn = findViewById(R.id.button6);
|
||||
|
||||
SharedPreferences sharedPreferences = getSharedPreferences("user", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
int userId = sharedPreferences.getInt("id", 0);
|
||||
|
||||
commodity.sellerid = userId;
|
||||
|
||||
//设置item的被选择的监听
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
//当item被选择后调用此方法
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
//获取我们所选中的内容
|
||||
commodity.classification = parent.getItemAtPosition(position).toString();
|
||||
}
|
||||
//只有当patent中的资源没有时,调用此方法
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
back.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
|
||||
addCommodityBtn.setOnClickListener(v -> {
|
||||
// TODO: 提交商品信息
|
||||
commodity.name = nameET.getText().toString();
|
||||
commodity.price = Double.parseDouble(priceET.getText().toString());
|
||||
commodity.description = descriptionET.getText().toString();
|
||||
commodity.state = "在售";
|
||||
// 获取当前时间的毫秒数
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
// 将毫秒数转换为Date对象
|
||||
Date date = new Date(currentTimeMillis);
|
||||
// 定义日期格式
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||
// 格式化Date对象为字符串
|
||||
commodity.time = sdf.format(date);
|
||||
|
||||
//获取数据
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("http://10.138.63.204:8080/")
|
||||
.addConverterFactory(GsonConverterFactory.create()) //返回结果用Gson解析
|
||||
.build();
|
||||
Api api = retrofit.create(Api.class);
|
||||
|
||||
Call<Result> addCommodityCall = api.addCommodity("Bearer ", commodity);
|
||||
addCommodityCall.enqueue(new Callback<Result>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<Result> call, Response<Result> response) {
|
||||
Result result = response.body();
|
||||
if(result.code == 200){
|
||||
Toast.makeText(getApplicationContext(), "添加成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}else {
|
||||
Toast.makeText(getApplicationContext(), "添加失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Result> call, Throwable t) {
|
||||
Log.e("error", t.getMessage());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -45,4 +45,12 @@ public interface Api {
|
|||
//http://127.0.0.1:8080/system/commodity/list
|
||||
@GET("/system/commodity/list2")
|
||||
Call<CommodityListResult> getCommodityListBySellerId(@Header("Authorization") String token, @Query("sellerid") Integer sellerId, @Query("state") String state);
|
||||
|
||||
//http://127.0.0.1:8080/system/commodity
|
||||
@PUT("/system/commodity")
|
||||
Call<Result> updateCommodity(@Header("Authorization") String token, @Body CommodityListResult.RowsDTO rowsDTO);
|
||||
|
||||
//http://127.0.0.1:8080/system/commodity
|
||||
@POST("/system/commodity")
|
||||
Call<Result> addCommodity(@Header("Authorization") String token, @Body CommodityListResult.RowsDTO rowsDTO);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.example.coursedesign;
|
||||
|
||||
import static java.security.AccessController.getContext;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -22,8 +24,15 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter;
|
||||
import com.scwang.smart.refresh.header.ClassicsHeader;
|
||||
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
|
@ -31,6 +40,8 @@ public class CommodityActivity extends AppCompatActivity {
|
|||
|
||||
MyAdapter myAdapter;
|
||||
RecyclerView recyclerView;
|
||||
SmartRefreshLayout smartRefreshLayout;
|
||||
|
||||
TextView back;
|
||||
TextView commodityNameTV;
|
||||
TextView priceTV;
|
||||
|
@ -123,6 +134,35 @@ public class CommodityActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
//列表刷新
|
||||
smartRefreshLayout = findViewById(R.id.smartLayout5);
|
||||
smartRefreshLayout.setRefreshHeader(new ClassicsHeader(getApplicationContext()));
|
||||
smartRefreshLayout.setRefreshFooter(new ClassicsFooter(getApplicationContext()));
|
||||
smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
|
||||
Call<CommentListResult> commentListCall = api.getCommentListByCommodityId("Bearer ", id);
|
||||
commentListCall.enqueue(new retrofit2.Callback<CommentListResult>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<CommentListResult> call, retrofit2.Response<CommentListResult> response) {
|
||||
result = response.body();
|
||||
Log.e("result", result.toString());
|
||||
if(result.code == 200){
|
||||
myAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CommentListResult> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
smartRefreshLayout.finishRefresh(500);
|
||||
}
|
||||
});
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.example.coursedesign;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
@ -9,10 +11,18 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MineFragment extends Fragment {
|
||||
|
||||
Button button, button2;
|
||||
Button logOut;
|
||||
ImageView myRelease;
|
||||
ImageView myOrder;
|
||||
ImageView picture;
|
||||
TextView name;
|
||||
TextView phone;
|
||||
TextView address;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -20,14 +30,46 @@ public class MineFragment extends Fragment {
|
|||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_mine, container, false);
|
||||
|
||||
button = view.findViewById(R.id.button7);
|
||||
button.setOnClickListener(v -> {
|
||||
startActivity(new Intent(getActivity(), MyReleaseActivity.class));
|
||||
logOut = view.findViewById(R.id.button12);
|
||||
myOrder = view.findViewById(R.id.imageView18);
|
||||
myRelease = view.findViewById(R.id.imageView19);
|
||||
picture = view.findViewById(R.id.imageView16);
|
||||
name = view.findViewById(R.id.textView41);
|
||||
phone = view.findViewById(R.id.textView42);
|
||||
address = view.findViewById(R.id.textView43);
|
||||
|
||||
myOrder.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), MyOrderActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
button2 = view.findViewById(R.id.button10);
|
||||
button2.setOnClickListener(v -> {
|
||||
startActivity(new Intent(getActivity(), MyOrderActivity.class));
|
||||
|
||||
myRelease.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), MyReleaseActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
logOut.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("user", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.clear();
|
||||
editor.commit();
|
||||
|
||||
startActivity(new Intent(getActivity(), LoginActivity.class));
|
||||
getActivity().finish();
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -22,6 +22,11 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter;
|
||||
import com.scwang.smart.refresh.header.ClassicsHeader;
|
||||
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Retrofit;
|
||||
|
@ -31,6 +36,8 @@ public class MyOrderActivity extends AppCompatActivity {
|
|||
|
||||
MyAdapter myAdapter;
|
||||
RecyclerView recyclerView;
|
||||
SmartRefreshLayout smartRefreshLayout;
|
||||
|
||||
TextView back;
|
||||
OrderListResult result;
|
||||
|
||||
|
@ -79,6 +86,33 @@ public class MyOrderActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
//列表刷新
|
||||
smartRefreshLayout = findViewById(R.id.smartLayout6);
|
||||
smartRefreshLayout.setRefreshHeader(new ClassicsHeader(getApplicationContext()));
|
||||
smartRefreshLayout.setRefreshFooter(new ClassicsFooter(getApplicationContext()));
|
||||
smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
|
||||
Call<OrderListResult> orderListCall = api.getOrderListByBuyerId("Bearer ", id);
|
||||
orderListCall.enqueue(new retrofit2.Callback<OrderListResult>() {
|
||||
@Override
|
||||
public void onResponse(Call<OrderListResult> call, retrofit2.Response<OrderListResult> response) {
|
||||
result = response.body();
|
||||
if (result.code == 200) {
|
||||
myAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<OrderListResult> call, Throwable t) {
|
||||
Log.e("error", t.getMessage());
|
||||
}
|
||||
});
|
||||
smartRefreshLayout.finishRefresh(500);
|
||||
}
|
||||
});
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -17,8 +17,14 @@ import android.view.ViewGroup;
|
|||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter;
|
||||
import com.scwang.smart.refresh.header.ClassicsHeader;
|
||||
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Retrofit;
|
||||
|
@ -28,6 +34,7 @@ public class NotOnSaleFragment extends Fragment {
|
|||
|
||||
MyAdapter myAdapter;
|
||||
RecyclerView recyclerView;
|
||||
SmartRefreshLayout smartRefreshLayout;
|
||||
|
||||
CommodityListResult result;
|
||||
|
||||
|
@ -69,6 +76,34 @@ public class NotOnSaleFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
//列表刷新
|
||||
smartRefreshLayout = view.findViewById(R.id.smartLayout4);
|
||||
smartRefreshLayout.setRefreshHeader(new ClassicsHeader(getContext()));
|
||||
smartRefreshLayout.setRefreshFooter(new ClassicsFooter(getContext()));
|
||||
smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
|
||||
Call<CommodityListResult> commodityListCall = api.getCommodityListBySellerId("Bearer ", userId, "下架");
|
||||
commodityListCall.enqueue(new retrofit2.Callback<CommodityListResult>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<CommodityListResult> call, retrofit2.Response<CommodityListResult> response) {
|
||||
result = response.body();
|
||||
if(result.code == 200){
|
||||
myAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CommodityListResult> call, Throwable t) {
|
||||
Log.e("error", t.getMessage());
|
||||
}
|
||||
});
|
||||
smartRefreshLayout.finishRefresh(500);
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -88,6 +123,48 @@ public class NotOnSaleFragment extends Fragment {
|
|||
holder.commodityPriceTV.setText("¥" + result.rows.get(position).price);
|
||||
holder.descriptionTV.setText(result.rows.get(position).description);
|
||||
Glide.with(getContext()).load(result.rows.get(position).picture).into(holder.commodityPictureIV);
|
||||
|
||||
holder.switchButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int adapterPosition = holder.getAdapterPosition();
|
||||
if(adapterPosition != RecyclerView.NO_POSITION){
|
||||
CommodityListResult.RowsDTO rowsDTO = result.rows.get(adapterPosition);
|
||||
switch (rowsDTO.state){
|
||||
case "在售":
|
||||
rowsDTO.state = "下架";
|
||||
break;
|
||||
case "下架":
|
||||
rowsDTO.state = "在售";
|
||||
break;
|
||||
}
|
||||
|
||||
//获取数据
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("http://10.138.63.204:8080/")
|
||||
.addConverterFactory(GsonConverterFactory.create()) //返回结果用Gson解析
|
||||
.build();
|
||||
Api api = retrofit.create(Api.class);
|
||||
Call<Result> updateCommodityCall = api.updateCommodity("Bearer ", rowsDTO);
|
||||
updateCommodityCall.enqueue(new retrofit2.Callback<Result>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<Result> call, retrofit2.Response<Result> response) {
|
||||
Result result = response.body();
|
||||
if(result.code == 200){
|
||||
Toast.makeText(getActivity(), "上架成功", Toast.LENGTH_SHORT).show();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Result> call, Throwable t) {
|
||||
Log.e("error", t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,8 +20,15 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter;
|
||||
import com.scwang.smart.refresh.header.ClassicsHeader;
|
||||
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
|
@ -29,6 +36,7 @@ public class OnSaleFragment extends Fragment {
|
|||
|
||||
MyAdapter myAdapter;
|
||||
RecyclerView recyclerView;
|
||||
SmartRefreshLayout smartRefreshLayout;
|
||||
|
||||
CommodityListResult result;
|
||||
|
||||
|
@ -70,6 +78,34 @@ public class OnSaleFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
//列表刷新
|
||||
smartRefreshLayout = view.findViewById(R.id.smartLayout3);
|
||||
smartRefreshLayout.setRefreshHeader(new ClassicsHeader(getContext()));
|
||||
smartRefreshLayout.setRefreshFooter(new ClassicsFooter(getContext()));
|
||||
smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
|
||||
Call<CommodityListResult> commodityListCall = api.getCommodityListBySellerId("Bearer ", userId, "在售");
|
||||
commodityListCall.enqueue(new retrofit2.Callback<CommodityListResult>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<CommodityListResult> call, retrofit2.Response<CommodityListResult> response) {
|
||||
result = response.body();
|
||||
if(result.code == 200){
|
||||
myAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CommodityListResult> call, Throwable t) {
|
||||
Log.e("error", t.getMessage());
|
||||
}
|
||||
});
|
||||
smartRefreshLayout.finishRefresh(500);
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -89,6 +125,48 @@ public class OnSaleFragment extends Fragment {
|
|||
holder.commodityPriceTV.setText("¥" + result.rows.get(position).price);
|
||||
holder.descriptionTV.setText(result.rows.get(position).description);
|
||||
Glide.with(getContext()).load(result.rows.get(position).picture).into(holder.commodityPictureIV);
|
||||
|
||||
holder.switchButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int adapterPosition = holder.getAdapterPosition();
|
||||
if(adapterPosition != RecyclerView.NO_POSITION){
|
||||
CommodityListResult.RowsDTO rowsDTO = result.rows.get(adapterPosition);
|
||||
switch (rowsDTO.state){
|
||||
case "在售":
|
||||
rowsDTO.state = "下架";
|
||||
break;
|
||||
case "下架":
|
||||
rowsDTO.state = "在售";
|
||||
break;
|
||||
}
|
||||
|
||||
//获取数据
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("http://10.138.63.204:8080/")
|
||||
.addConverterFactory(GsonConverterFactory.create()) //返回结果用Gson解析
|
||||
.build();
|
||||
Api api = retrofit.create(Api.class);
|
||||
Call<Result> updateCommodityCall = api.updateCommodity("Bearer ", rowsDTO);
|
||||
updateCommodityCall.enqueue(new retrofit2.Callback<Result>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<Result> call, retrofit2.Response<Result> response) {
|
||||
Result result = response.body();
|
||||
if(result.code == 200){
|
||||
Toast.makeText(getActivity(), "下架成功", Toast.LENGTH_SHORT).show();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Result> call, Throwable t) {
|
||||
Log.e("error", t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
|
@ -52,7 +52,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="70dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ems="15"
|
||||
android:hint="描述一下商品信息"
|
||||
|
@ -80,7 +80,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="价格"
|
||||
android:textColor="#FFEB3B"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/editTextNumber"
|
||||
|
@ -99,6 +98,53 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView36"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="分类"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/spinner2"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView23"
|
||||
app:layout_constraintTop_toTopOf="@+id/spinner2" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape"
|
||||
android:entries="@array/spinner2"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editTextNumber"
|
||||
app:layout_constraintEnd_toEndOf="@+id/editTextNumber" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView37"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="商品名称"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="商品名称"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/textView37"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/textView37"
|
||||
app:layout_constraintTop_toTopOf="@+id/textView37" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<Button
|
||||
|
|
|
@ -161,8 +161,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="联系客服"
|
||||
android:backgroundTint="#4CAF50"
|
||||
android:text="发布评论"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/button5"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@ -180,6 +180,7 @@
|
|||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/smartLayout5"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
tools:context=".MyOrderActivity">
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/smartLayout6"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
|
|
|
@ -10,20 +10,134 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="我的发布"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/shape"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="退出登录"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView22" />
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/imageView16"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:src="@drawable/avatar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView17"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@drawable/a4_1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView16" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView18"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/a4_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView17" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView19"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/a4_3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView18" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView20"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/a4_4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView19" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView21"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/a4_5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView20" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView22"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/a4_6"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView21" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView41"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="用户名"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView16"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView42"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="手机号"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView43"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView16"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView41" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView43"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="地址"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView16"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView16" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="我的订单"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/button7" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
|
@ -11,6 +11,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/smartLayout4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/smartLayout3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
@ -4,6 +4,14 @@
|
|||
<item>全部</item>
|
||||
<item>运动用品</item>
|
||||
<item>书籍</item>
|
||||
<item>深圳</item>
|
||||
<item>数码</item>
|
||||
<item>其他</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="spinner2">
|
||||
<item>运动用品</item>
|
||||
<item>书籍</item>
|
||||
<item>数码</item>
|
||||
<item>其他</item>
|
||||
</string-array>
|
||||
</resources>
|
Loading…
Reference in New Issue