Commit ea9edf2a authored by 杨秀秀's avatar 杨秀秀

基础搭建

1:添加没有更多了数据
功能开发
1:bug 修复
parent f916d771
This diff is collapsed.
......@@ -192,6 +192,7 @@
</application>
<queries>
<package android:name="com.tencent.mm" />
......
......@@ -18,6 +18,7 @@ import io.reactivex.rxjava3.core.Observable
import me.goldze.mvvmhabit.http.ApiParams
import me.goldze.mvvmhabit.http.BaseResponse
import me.goldze.mvvmhabit.utils.StringUtils
import me.goldze.mvvmhabit.utils.ToastUtils
class MerchantEnterRequst: BaseRespons() {
var merchant: MerchantBean? = LocalData.getMerchant();
......@@ -103,17 +104,10 @@ class MerchantEnterRequst: BaseRespons() {
/**
* 修改商品品牌授权信息
*/
fun changeMerchantBrand(name:String, imgs:MutableList<FileBean> ,id:String):Observable<BaseResponse<Object>>
fun changeMerchantBrand(name:String, imgs:MutableList<String> ,id:String):Observable<BaseResponse<Object>>
{
val list:MutableList<String> =ArrayList();
for (bean in imgs)
{
if(!StringUtils.isEmpty(bean.id))
{
list.add(bean.id!!);
}
}
return apiService.putMerchantBrandChange(ApiParams<MerchantBrandBody>().setParams(MerchantBrandBody(name,id,list,merchant?.businessId)) )
return apiService.putMerchantBrandChange(ApiParams<MerchantBrandBody>().setParams(MerchantBrandBody(name,id,imgs,merchant?.businessId)) )
}
......@@ -129,16 +123,11 @@ class MerchantEnterRequst: BaseRespons() {
/**
* 添加商品品牌授权信息
*/
fun addMerchantBrand(name:String, imgs:MutableList<FileBean> ):Observable<BaseResponse<IntegralTypeBean>>
fun addMerchantBrand(name:String, list:MutableList<String> ):Observable<BaseResponse<IntegralTypeBean>>
{
val list:MutableList<String> =ArrayList();
for (bean in imgs)
{
if(!StringUtils.isEmpty(bean.id))
{
list.add(bean.id!!);
}
}
return apiService.postMerchantBrand(ApiParams<MerchantBrandBody>().setParams(MerchantBrandBody(name,null,list,null)) )
}
......@@ -150,6 +139,10 @@ class MerchantEnterRequst: BaseRespons() {
return apiService.checkRegister(ApiParams<checkPhoneBody>().setParams(checkPhoneBody(phone)))
}
fun checkBrandAllow(id:String):Observable<BaseResponse<Boolean>>
{
return apiService.checkBrandAllow(id)
}
data class checkPhoneBody(var phonenumber:String, var userType:String="02")
......@@ -159,6 +152,7 @@ class MerchantEnterRequst: BaseRespons() {
/**
* 注册内容
*/
......
......@@ -37,7 +37,7 @@ class OrderCreateRequest : BaseRespons() {
var orderCommodityList: MutableList<OrderProductBody> = ArrayList();
for (bean in products)
{
orderCommodityList.add(OrderProductBody(bean.businessId,bean.commodityPrice,bean.reCommodityQuantity()))
orderCommodityList.add(OrderProductBody(bean.businessId,bean.price,bean.reCommodityQuantity()))
}
return apiService.postCreateOrder(ApiParams<createOrderBody>().setParams(createOrderBody(memberInfoBean.businessId,memberInfoBean.memberPhone,orderCommodityList)))
}
......
package com.xx.merchanthbh.data.http.respons
import android.util.Log
import androidx.databinding.Observable
import androidx.databinding.ObservableField
import androidx.lifecycle.MutableLiveData
......@@ -7,19 +9,29 @@ import androidx.lifecycle.MutableLiveData
* 商品列表数据
* status :1-待提交 2-待审核 3-已上架 4-未上架 5-已驳回
*/
class ProductForOrderBean(businessId:String, commodityName:String, commodityPrice:Double, commodityPictureFile:Filebean, status:String,):
ProductListBean(businessId,commodityName,commodityPrice,commodityPictureFile,status,null) {
class ProductForOrderBean(businessId:String, commodityName:String, commodityPrice:Double, commodityPictureFile:Filebean, status:String, var selfPrice:MutableLiveData<String> = MutableLiveData("")):
ProductListBean(businessId,commodityName,commodityPrice,commodityPictureFile,status,null,) {
lateinit var total:MutableLiveData<Double> ;
var commodityQuantityStr: ObservableField<String> = ObservableField("1");
var commodityQuantity: Int = 1;
fun reBean(): ProductForOrderBean{
commodityQuantityStr = ObservableField("1");
commodityQuantity = 1;
return this
}
var price:Double = 0.0
get() {return commodityPrice}
get() {
if(selfPrice==null)
{
return commodityPrice
}else{
return selfPrice.value!!.toDouble()
}
}
fun reCommodityQuantity():Int{
if (commodityQuantity<1)
......@@ -33,13 +45,8 @@ class ProductForOrderBean(businessId:String, commodityName:String, commodityPri
{
commodityQuantity++
commodityQuantityStr.set(commodityQuantity.toString())
if (total!=null)
{
val tomerTotal= total.value
if (tomerTotal != null) {
total.postValue(tomerTotal+commodityPrice)
}
}
total.postValue(commodityPrice)
}
fun subCommodityQuantity()
{
......@@ -47,15 +54,9 @@ class ProductForOrderBean(businessId:String, commodityName:String, commodityPri
{
commodityQuantity--
commodityQuantityStr.set(commodityQuantity.toString())
if (total!=null)
{
val tomerTotal= total.value
if (tomerTotal != null) {
total.postValue(tomerTotal-commodityPrice)
}
}
}
}
total.postValue(commodityPrice)
}
fun setTotalValue( t:MutableLiveData<Double>)
......
......@@ -6,6 +6,7 @@ import androidx.lifecycle.Observer
import com.huantansheng.easyphotos.callback.SelectCallback
import com.xx.merchanthbh.R
import com.xx.merchanthbh.data.http.requst.body.Brankbody
import com.xx.merchanthbh.data.staticdata.StaticData
import com.xx.merchanthbh.databinding.ItemAddBrankBinding
import com.xx.xxviewlibrary.base.AppManager
import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter
......@@ -46,14 +47,24 @@ class AddBrankAdapter(context: Context?,var edit:Int=0) : xxBaseRecyclerViewAdap
}else{
vm.initAdapter(this)
dataBind?.ivIabDelete?.visibility= View.GONE;
if(data.edits ==true)
{
vm.completeStatic.set(View.GONE)
vm.editStatic.set(View.VISIBLE)
}else{
vm.completeStatic.set(View.VISIBLE)
vm.editStatic.set(View.GONE)
}
if (StaticData.personType==0)
{ //店长
if(data.edits ==true)
{
vm.completeStatic.set(View.GONE)
vm.editStatic.set(View.VISIBLE)
}else{
vm.completeStatic.set(View.VISIBLE)
vm.editStatic.set(View.GONE)
}
}else{
//店员
vm.completeStatic.set(View.GONE)
vm.editStatic.set(View.GONE)
}
vm.edit.set(data.edits)
vm.appealPicsAdapter.edit= data.edits == true
......
......@@ -140,25 +140,72 @@ public class AddBrankViewModel extends BaseViewModel<MerchantEnterRequst> {
public void goEdit(View view)
{
bean.setEdits(true);
edit.set(true);
editStatic.set(View.VISIBLE);
completeStatic.set(View.GONE);
if (appealPicsAdapter.mList.size()<5)
{
appealPicsAdapter.mList.add(new FileBean("",""));
}
appealPicsAdapter.changeEdit(true);
model.checkBrandAllow(bean.getId()).compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(AddBrankViewModel.this)
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
}).subscribe(new ApiDisposableObserver<Boolean>() {
@Override
public void onSuccess(Boolean resultBean) {
if (resultBean)
{
bean.setEdits(true);
edit.set(true);
editStatic.set(View.VISIBLE);
completeStatic.set(View.GONE);
if (appealPicsAdapter.mList.size()<5)
{
appealPicsAdapter.mList.add(new FileBean("",""));
}
appealPicsAdapter.changeEdit(true);
}else {
ToastUtils.showShort("本品牌有待审核/已上架商品,不能修改");
}
}
@Override
public void onError(String Error) {
}
});
}
public void completeEdit(View view)
{
if(StringUtils.isEmpty(bean.getOBrandName().get()))
{
ToastUtils.showShort("请填写品牌名称");
return ;
}
List<String> list =new ArrayList();
for (FileBean body : bean.getBrankImgs())
{
if(!StringUtils.isEmpty(body.getId()))
{
list.add(body.getId());
}
}
if(list.size()<=0)
{
ToastUtils.showShort("请上传授权图片");
return ;
}
if (StringUtils.isEmpty(bean.getId()))
{
model.addMerchantBrand(bean.getOBrandName().get(),bean.getBrankImgs()).compose(RxUtils.schedulersTransformer()) //线程调度
model.addMerchantBrand(bean.getOBrandName().get(),list).compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(AddBrankViewModel.this)
.doOnSubscribe(new Consumer<Disposable>() {
@Override
......@@ -187,7 +234,7 @@ public class AddBrankViewModel extends BaseViewModel<MerchantEnterRequst> {
}
});
}else {
model.changeMerchantBrand(bean.getOBrandName().get(),bean.getBrankImgs(),bean.getId()).compose(RxUtils.schedulersTransformer()) //线程调度
model.changeMerchantBrand(bean.getOBrandName().get(),list,bean.getId()).compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(AddBrankViewModel.this)
.doOnSubscribe(new Consumer<Disposable>() {
@Override
......@@ -220,6 +267,13 @@ public class AddBrankViewModel extends BaseViewModel<MerchantEnterRequst> {
}
public void checkAllow(String id)
{
}
public void delete(View view)
{
if (StringUtils.isEmpty(bean.getId()))
......
......@@ -302,6 +302,7 @@ public class MerchantEnterViewModel extends BaseViewModel<MerchantEnterRequst> {
}).subscribe(new ApiDisposableObserver<RegisterBean>() {
@Override
public void onSuccess(RegisterBean resultBean) {
dismissDialog();
ToastUtils.showShort("成功");
LocalData.saveUser(new UserBean(resultBean.getUserId(),resultBean.getDeptId(),"","","",resultBean.getPhonenumber(),"","","",null));
Login(view);
......
......@@ -31,9 +31,11 @@ class MaterialInfoActivity : BaseActivity<ActivityMaterialInfoBinding, MerchantI
if (StaticData.personType==0)
{ //店长
binding.llAmeBottom.visibility= View.VISIBLE
binding.tvAmiAddBrand.visibility=View.VISIBLE
}else{
//店员
binding.llAmeBottom.visibility= View.GONE
binding.tvAmiAddBrand.visibility=View.GONE
}
......
......@@ -197,6 +197,15 @@ public class MerchantInfoViewModel extends BaseViewModel<MerchantEnterRequst> {
public void submitMerchantMsg(View view)
{
for (Brankbody brank:adapter.mList)
{
if (brank.getEdits())
{
ToastUtils.showShort("请先保存品牌授权内容");
return;
}
}
MerchantMsgbody body= new MerchantMsgbody(merchantInfo);
body.setBusinessId(LocalData.getMerchant().getBusinessId());
model.postChangeMerchantMsg(body).compose(RxUtils.schedulersTransformer()) //线程调度
......
......@@ -57,6 +57,7 @@ public class OrderViewModel extends ListBaseViewModel<OrderRequest> {
.doOnSubscribe(new Consumer<io.reactivex.rxjava3.disposables.Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
showDialog("");
}
}).subscribe(new ApiDisposablePageObserver<OrderBean>() {
@Override
......@@ -73,7 +74,7 @@ public class OrderViewModel extends ListBaseViewModel<OrderRequest> {
@Override
public void onError(String Error) {
dismissDialog();
}
@Override
......
......@@ -9,8 +9,8 @@ import android.view.ViewGroup
import com.xx.merchanthbh.BR
import com.xx.merchanthbh.R
import com.xx.merchanthbh.databinding.FragmentOrderCreateBinding
import me.goldze.mvvmhabit.base.BaseFragment
import com.xx.xxviewlibrary.utils.priceSTrUtils
import me.goldze.mvvmhabit.base.BaseFragment
class OrderCreatFragment: BaseFragment<FragmentOrderCreateBinding, OrderCreateViewModel>() {
override fun viewModelType(): Int {
......@@ -41,7 +41,18 @@ class OrderCreatFragment: BaseFragment<FragmentOrderCreateBinding, OrderCreateVi
viewModel.total.observe(this)
{
if (it<=0)
if (viewModel.orderProductList.size <= 0) {
viewModel. creatVisibility.set(View.GONE)
} else {
viewModel. creatVisibility.set(View.VISIBLE)
}
var money = 0.0
for (bean in viewModel.orderProductList) {
money = money + bean.reCommodityQuantity() * bean.price
}
if (money<=0)
{
binding.rvFocProduct.visibility=View.GONE
if (viewModel.productAdapter!=null && viewModel.productAdapter.mList!=null)
......@@ -55,7 +66,7 @@ class OrderCreatFragment: BaseFragment<FragmentOrderCreateBinding, OrderCreateVi
}else{
binding.rvFocProduct.visibility=View.VISIBLE
binding.tvOrderTotal.setText(priceSTrUtils(it))
binding.tvOrderTotal.setText(priceSTrUtils(money))
viewModel. productAdapter.notifyDataSetChanged()
......
......@@ -165,7 +165,7 @@ public class OrderCreateViewModel extends ListBaseViewModel<OrderCreateRequest>
public void getTotalMoney()
{
if (orderProductList.size()<=0)
/*if (orderProductList.size()<=0)
{
creatVisibility.set(View.GONE);
}else {
......@@ -175,8 +175,8 @@ public class OrderCreateViewModel extends ListBaseViewModel<OrderCreateRequest>
for (ProductForOrderBean bean:orderProductList)
{
money=money+bean.reCommodityQuantity()*bean.getPrice();
}
total.postValue(money);
}*/
total.postValue(0.0);
}
......
package com.xx.merchanthbh.ui.ordercreate
import android.content.Context
import android.util.Log
import android.widget.ImageView
import androidx.databinding.ObservableField
import androidx.lifecycle.MutableLiveData
import com.xx.merchanthbh.R
import com.xx.merchanthbh.data.http.respons.ProductForOrderBean
import com.xx.merchanthbh.data.http.respons.ProductListBean
import com.xx.merchanthbh.databinding.ItemProductOrderBinding
import com.xx.merchanthbh.databinding.ItemProductSelectBinding
import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter
import com.xx.xxviewlibrary.base.xxBaseRecyclerViewAdapter.OnItemClick
import me.jessyan.autosize.utils.AutoSizeUtils
import java.text.DecimalFormat
class OrderProductAdapter(context: Context,var t: MutableLiveData<Double>):
xxBaseRecyclerViewAdapter<ItemProductOrderBinding, ProductForOrderBean>(context) {
......@@ -30,17 +24,36 @@ class OrderProductAdapter(context: Context,var t: MutableLiveData<Double>):
) {
data?.setTotalValue(t)
if (data?.selfPrice==null)
{
val df = DecimalFormat("###.00")
data?.selfPrice=MutableLiveData(df.format(data?.commodityPrice))
data?.selfPrice?.observe(ownerl){
try {
it.toDouble()
t.postValue(1.0)
}catch (e:Exception)
{
}
}
}
dataBind?.data=data
dataBind?.btnIpoDelete?.setOnClickListener()
{
val tomerTotal= t.value
if (tomerTotal != null) {
t.postValue(tomerTotal-(data?.commodityPrice!!.times(data?.commodityQuantity!!)))
}
// val tomerTotal= t.value
// if (tomerTotal != null) {
// t.postValue(tomerTotal-(data?.commodityPrice!!.times(data?.commodityQuantity!!)))
// }
t.postValue(0.0)
mList.removeAt(position)
notifyDataSetChanged()
......
package com.xx.merchanthbh.ui.productmanager
import android.graphics.Typeface
import android.os.Bundle
import android.text.SpannableString
import android.text.Spanned
import android.text.style.AbsoluteSizeSpan
import android.text.style.StyleSpan
import android.view.View
import com.google.android.material.tabs.TabLayout
import com.scwang.smart.refresh.layout.api.RefreshLayout
......@@ -95,6 +100,13 @@ class ProductManagerActivity: BaseActivity<ActivityProductListBinding, ProductMa
}
})
val tab: TabLayout.Tab? = binding.tabs.getTabAt(0)
val selectTab = tab?.text.toString().trim { it <= ' ' }
val spannableString = SpannableString(selectTab)
val ass = AbsoluteSizeSpan(12, true)
spannableString.setSpan(ass, 0, selectTab.length, Spanned.SPAN_INCLUSIVE_EXCLUSIVE)
tab?.text = spannableString
binding.llAplTime.setOnClickListener()
......
......@@ -333,6 +333,7 @@
android:layout_marginLeft="129dp"
android:onClick="@{viewModel.addBrank}"
android:text="添加品牌授权"
android:id="@+id/tv_ami_add_brand"
android:textSize="16sp"/>
......
......@@ -92,6 +92,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="#00000000"
android:maxLength="20"
android:focusable="@{viewModel.edit}"
android:cursorVisible="@{viewModel.edit}"
android:focusableInTouchMode="@{viewModel.edit}"
......
......@@ -10,6 +10,10 @@
name="adapter"
type="com.xx.merchanthbh.ui.ordercreate.OrderProductAdapter" />
<variable
name="self"
type="androidx.databinding.ObservableField" />
<import type="com.xx.xxviewlibrary.utils.CommUtilsKt"/>
</data>
......@@ -72,11 +76,14 @@
android:text="商品价格:"
android:textColor="@color/text_grey" />
<TextView
<EditText
style="@style/xxTextContent"
android:layout_width="match_parent"
android:background="#00000000"
android:textColor="@color/xx_text_red"
android:textSize="10sp"
android:text="@{CommUtilsKt.priceSTrUtils(data.commodityPrice)}"
android:textSize="16sp"
android:inputType="numberDecimal"
android:text="@={data.selfPrice}"
/>
</LinearLayout>
<LinearLayout
......
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FCFDFC</color>
</resources>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<paths>
<external-path
name="files_root"
path="Android/data/com.xxp.Lawsuit/" />
path="Android/data/com.xx.merchanthbh/" />
<external-path
name="external_storage_root"
path="." />
......
......@@ -22,6 +22,8 @@ public class ListBaseViewModel<M extends BaseModel> extends BaseViewModel<M> {
public ObservableField<String> title = new ObservableField<>("");
public ObservableField<Boolean> loading = new ObservableField<>(true);
public ListBaseViewModel(@NonNull Application application) {
super(application);
......
......@@ -47,6 +47,7 @@ public class MyCommentViewModel extends ListBaseViewModel<MyCommentRequest> {
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
showDialog("");
}
}).subscribe(new ApiDisposablePageObserver<MyCommentBean>() {
@Override
......
......@@ -2,6 +2,7 @@ package com.xx.hbhbcompany.ui.merchantaudit
import android.os.Bundle
import android.view.View
import android.view.View.OnTouchListener
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
import com.scwang.smart.refresh.layout.api.RefreshLayout
......@@ -13,6 +14,8 @@ import com.xx.hbhbcompany.data.http.requst.MerchantAuditListRequst
import com.xx.hbhbcompany.data.staticdata.StaticData
import com.xx.hbhbcompany.databinding.ActivityAuditListBinding
import me.goldze.mvvmhabit.base.BaseActivity
import java.lang.reflect.Field
class MerchantAuditListActivity:
BaseActivity<ActivityAuditListBinding, MerchantAuditListViewModel>(),OnRefreshListener,OnLoadMoreListener {
......@@ -23,6 +26,10 @@ class MerchantAuditListActivity:
@JvmField
public var FOR_MANAGER:Int=1202;
var tabOnClickListener =
OnTouchListener { view, event ->
return@OnTouchListener !viewModel.loading.get()!!
}
override fun initContentView(savedInstanceState: Bundle?): Int {
......@@ -57,6 +64,7 @@ class MerchantAuditListActivity:
override fun onTabSelected(tab: TabLayout.Tab?) {
viewModel.page=1
viewModel.merchantAdapter.mList.clear()
binding.refresh.setEnableLoadMore(true)
when(tab?.position)
{
0->{ viewModel.merchantAdapter.type=0
......@@ -88,6 +96,10 @@ class MerchantAuditListActivity:
}
})
}else{
//店总页面初始
binding.tabs.visibility= View.GONE
......@@ -142,4 +154,6 @@ class MerchantAuditListActivity:
binding.refresh.setEnableLoadMore(true)
}
}
\ No newline at end of file
......@@ -51,10 +51,13 @@ public class MerchantAuditListViewModel extends ListBaseViewModel<MerchantAuditL
.doOnSubscribe (new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
showDialog("");
}
}).subscribe(new ApiDisposablePageObserver<MerchantBean>() {
@Override
public void onSuccess(List<MerchantBean> resultBean) {
dismissDialog();
loading.set(true);
if (page == 1) {
merchantAdapter.mList = resultBean;
......@@ -67,7 +70,7 @@ public class MerchantAuditListViewModel extends ListBaseViewModel<MerchantAuditL
@Override
public void onError(String Error) {
dismissDialog();
}
@Override
......
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FCFDFC</color>
</resources>
\ No newline at end of file
package me.goldze.mvvmhabit.base;
import android.app.ActivityManager;
import android.app.DatePickerDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
......@@ -19,6 +20,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import androidx.annotation.Nullable;
......@@ -32,9 +34,11 @@ import me.goldze.mvvmhabit.base.BaseViewModel.ParameterField;
import me.goldze.mvvmhabit.bus.Messenger;
import com.xx.xxviewlibrary.comm.CommTextDialog;
import com.xx.xxviewlibrary.comm.NUllDialog;
import com.xx.xxviewlibrary.comm.RefuseDialogBean;
import com.xx.xxviewlibrary.utils.GlideEngine;
import me.goldze.mvvmhabit.utils.MaterialDialogUtils;
import me.goldze.mvvmhabit.utils.StringUtils;
import me.goldze.mvvmhabit.utils.ToastUtils;
......@@ -49,6 +53,8 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
private int viewModelId;
private MaterialDialog dialog;
private NUllDialog nullDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -234,18 +240,32 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
public void startPhoto(boolean hasCamera,int count,SelectCallback callback)
{
EasyPhotos.createAlbum(this, hasCamera, false, GlideEngine.getInstance()).setCount(count)
EasyPhotos.createAlbum(this, hasCamera, false, GlideEngine.getInstance()).setCount(count).setFileProviderAuthority(getAppProcessName(this)+".fileProvider")
.start(callback);
}
public void showDialog(String title) {
if (dialog != null) {
dialog = dialog.getBuilder().title(title).build();
dialog.show();
} else {
MaterialDialog.Builder builder = MaterialDialogUtils.showIndeterminateProgressDialog(this, title, true);
dialog = builder.show();
if (StringUtils.isEmpty(title)){
if (nullDialog!=null)
{
nullDialog.show();
}else {
nullDialog=new NUllDialog(this);
nullDialog.show();
}
}else {
if (dialog != null) {
dialog = dialog.getBuilder().title(title).build();
dialog.show();
} else {
MaterialDialog.Builder builder = MaterialDialogUtils.showIndeterminateProgressDialog(this, title, true);
dialog = builder.show();
}
}
}
......@@ -260,6 +280,9 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
if (nullDialog != null && nullDialog.isShowing()) {
nullDialog.dismiss();
}
}
/**
......@@ -405,4 +428,44 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
public <T extends ViewModel> T createViewModel(FragmentActivity activity, Class<T> cls) {
return ViewModelProviders.of(activity).get(cls);
}
public int getApp(Context context) {
switch (getAppProcessName(context)) {
case "com.xx.merchanthbh":
return 0;
case "com.xx.hbhconsumer":
return 1;
case "com.xx.hbhbcompany":
return 2;
default:
return 0;
}
}
/**
* 获取当前应用程序的包名
*
* @param context 上下文对象
* @return 返回包名
*/
public String getAppProcessName(Context context) {
//当前应用pid
int pid = android.os.Process.myPid();
//任务管理类
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
//遍历所有应用
List<ActivityManager.RunningAppProcessInfo> infos = manager.getRunningAppProcesses();
for (ActivityManager.RunningAppProcessInfo info : infos) {
if (info.pid == pid)//得到当前应用
return info.processName;//返回包名
}
return "";
}
}
package com.xx.xxviewlibrary.comm;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import com.xx.xxviewlibrary.R;
public class NUllDialog extends Dialog {
public NUllDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*LinearLayout ll=new LinearLayout(getContext());
ll.setBackgroundColor(getContext().getColor(R.color.transparent));
setContentView(ll);
setCanceledOnTouchOutside(false);
setCancelable(false);
getWindow().setBackgroundDrawable(new ColorDrawable(getContext().getColor(R.color.transparent)));
getWindow().getDecorView().setPadding(0, 0, 0, 0);
// window.setAttributes(params);
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);*/
Window window = getWindow();
window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams layoutParams = window.getAttributes();
getWindow().setBackgroundDrawable(new ColorDrawable(getContext().getColor(R.color.transparent)));
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.dimAmount=0.0f;
window.setAttributes(layoutParams);
setCanceledOnTouchOutside(false);
setCancelable(false);
}
}
......@@ -29,7 +29,13 @@ fun priceSTrUtils(price:Double): SpannableStringBuilder
{
doublePart=".00"
}else{
doublePart="."+(f1*100).toLong().toString()
if(f1<0.1)
{
doublePart=".0"+(f1*100).toLong().toString()
}else{
doublePart="."+(f1*100).toLong().toString()
}
}
......
......@@ -2,7 +2,7 @@
<resources>
<color name="black">#222222</color>
<color name="white">#FFFFFFFF</color>
<color name="transparent">#00000000</color>
<color name="foreground">#5971A4</color>
<color name="text_foreground">#1C3B81</color>
<color name="text_grey">#666666</color>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment