parent
077a84239f
commit
32ff8ad12e
110 changed files with 5395 additions and 807 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,21 +0,0 @@ |
||||
package com.project.survey.activity.approval |
||||
|
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivityApprovalBinding |
||||
|
||||
/** |
||||
* 待处理,已处理,已发起 |
||||
*/ |
||||
class ApprovalActivity : BaseBindingActivity<ActivityApprovalBinding>() { |
||||
override fun getBinding(): ActivityApprovalBinding { |
||||
return ActivityApprovalBinding.inflate(layoutInflater) |
||||
} |
||||
|
||||
override fun initView() { |
||||
TODO("Not yet implemented") |
||||
} |
||||
|
||||
override fun initData() { |
||||
TODO("Not yet implemented") |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
package com.project.survey.adapter; |
||||
|
||||
import android.content.Context; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.project.survey.adapter.base.BaseAdapter; |
||||
import com.project.survey.adapter.viewholder.ApprovalInitatedListViewHolder; |
||||
import com.project.survey.databinding.ItemApprovalInitatedListBinding; |
||||
import com.project.survey.model.ApprovalBean; |
||||
|
||||
/** |
||||
* 流程审批 已发起 |
||||
*/ |
||||
public class ApprovalInitatedAdapter extends BaseAdapter<ApprovalInitatedListViewHolder, ApprovalBean> { |
||||
|
||||
public ApprovalInitatedAdapter(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public ApprovalInitatedListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
return new ApprovalInitatedListViewHolder(ItemApprovalInitatedListBinding.inflate(getInflater(), parent, false)); |
||||
} |
||||
|
||||
@Override |
||||
protected void onBindViewHolderDo(ApprovalInitatedListViewHolder holder, int position) { |
||||
ApprovalBean bean = mDataList.get(position); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,43 @@ |
||||
package com.project.survey.adapter; |
||||
|
||||
import android.content.Context; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.project.survey.ui.approval.ApprovalActivity; |
||||
import com.project.survey.adapter.base.BaseAdapter; |
||||
import com.project.survey.adapter.viewholder.ApprovalWaitListViewHolder; |
||||
import com.project.survey.databinding.ItemApprovalWaitListBinding; |
||||
import com.project.survey.model.ApprovalBean; |
||||
|
||||
/** |
||||
* 流程审批 等待审批 |
||||
*/ |
||||
public class ApprovalWaitAdapter extends BaseAdapter<ApprovalWaitListViewHolder, ApprovalBean> { |
||||
|
||||
private final String type; |
||||
|
||||
public ApprovalWaitAdapter(Context context, String type) { |
||||
super(context); |
||||
this.type = type; |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public ApprovalWaitListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
return new ApprovalWaitListViewHolder(ItemApprovalWaitListBinding.inflate(getInflater(), parent, false)); |
||||
} |
||||
|
||||
@Override |
||||
protected void onBindViewHolderDo(ApprovalWaitListViewHolder holder, int position) { |
||||
ApprovalBean bean = mDataList.get(position); |
||||
|
||||
if (ApprovalActivity.TYPE_PROCESSED.equals(type)) { |
||||
holder.mBinding.ivAgree.setVisibility(View.VISIBLE); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
package com.project.survey.adapter; |
||||
|
||||
import android.content.Context; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.project.survey.adapter.base.BaseAdapter; |
||||
import com.project.survey.adapter.viewholder.ControlNetFirstListViewHolder; |
||||
import com.project.survey.databinding.ItemControlNetFirstListBinding; |
||||
import com.project.survey.model.ControlNetListBean; |
||||
|
||||
/** |
||||
* 首级控制网列表 |
||||
*/ |
||||
public class ControlNetFirstListAdapter extends BaseAdapter<ControlNetFirstListViewHolder, ControlNetListBean> { |
||||
|
||||
public ControlNetFirstListAdapter(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public ControlNetFirstListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
return new ControlNetFirstListViewHolder(ItemControlNetFirstListBinding.inflate(getInflater(), parent, false)); |
||||
} |
||||
|
||||
@Override |
||||
protected void onBindViewHolderDo(ControlNetFirstListViewHolder holder, int position) { |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
package com.project.survey.adapter; |
||||
|
||||
import android.content.Context; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.project.survey.adapter.base.BaseAdapter; |
||||
import com.project.survey.adapter.viewholder.ControlNetSpecialListViewHolder; |
||||
import com.project.survey.databinding.ItemControlNetSpecialListBinding; |
||||
import com.project.survey.model.ControlNetListBean; |
||||
|
||||
/** |
||||
* 专用控制网列表 |
||||
*/ |
||||
public class ControlNetSpeciaListAdapter extends BaseAdapter<ControlNetSpecialListViewHolder, ControlNetListBean> { |
||||
|
||||
public ControlNetSpeciaListAdapter(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public ControlNetSpecialListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
return new ControlNetSpecialListViewHolder(ItemControlNetSpecialListBinding.inflate(getInflater(), parent, false)); |
||||
} |
||||
|
||||
@Override |
||||
protected void onBindViewHolderDo(ControlNetSpecialListViewHolder holder, int position) { |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.project.survey.adapter; |
||||
|
||||
import android.content.Context; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.project.survey.adapter.base.BaseAdapter; |
||||
import com.project.survey.adapter.viewholder.LoftingListViewHolder; |
||||
import com.project.survey.databinding.ItemLoftingListBinding; |
||||
import com.project.survey.model.LoftingListBean; |
||||
|
||||
/** |
||||
* 放样列表 |
||||
*/ |
||||
public class LoftingListAdapter extends BaseAdapter<LoftingListViewHolder, LoftingListBean> { |
||||
|
||||
|
||||
public LoftingListAdapter(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public LoftingListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
return new LoftingListViewHolder(ItemLoftingListBinding.inflate(getInflater(), parent, false)); |
||||
} |
||||
|
||||
@Override |
||||
protected void onBindViewHolderDo(LoftingListViewHolder holder, int position) { |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
package com.project.survey.adapter; |
||||
|
||||
import android.content.Context; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.project.survey.adapter.base.BaseAdapter; |
||||
import com.project.survey.adapter.viewholder.PointMeasureListViewHolder; |
||||
import com.project.survey.databinding.ItemPointMeasureListBinding; |
||||
import com.project.survey.model.PointMeasureListBean; |
||||
|
||||
/** |
||||
* 点测量列表 |
||||
*/ |
||||
public class PointMeasureListAdapter extends BaseAdapter<PointMeasureListViewHolder, PointMeasureListBean> { |
||||
|
||||
private final String type; |
||||
|
||||
public PointMeasureListAdapter(Context context, String type) { |
||||
super(context); |
||||
this.type = type; |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public PointMeasureListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
return new PointMeasureListViewHolder(ItemPointMeasureListBinding.inflate(getInflater(), parent, false)); |
||||
} |
||||
|
||||
@Override |
||||
protected void onBindViewHolderDo(PointMeasureListViewHolder holder, int position) { |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.project.survey.adapter.viewholder; |
||||
|
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.project.survey.databinding.ItemApprovalInitatedListBinding; |
||||
import com.project.survey.databinding.ItemApprovalWaitListBinding; |
||||
|
||||
/** |
||||
* 流程审批的 已发起 |
||||
*/ |
||||
public class ApprovalInitatedListViewHolder extends RecyclerView.ViewHolder { |
||||
public final ItemApprovalInitatedListBinding mBinding; |
||||
|
||||
public ApprovalInitatedListViewHolder(ItemApprovalInitatedListBinding binding) { |
||||
super(binding.getRoot()); |
||||
mBinding = binding; |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.project.survey.adapter.viewholder; |
||||
|
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.project.survey.databinding.ItemApprovalWaitListBinding; |
||||
import com.project.survey.databinding.ItemProjectListBinding; |
||||
|
||||
/** |
||||
* 流程审批的 |
||||
*/ |
||||
public class ApprovalWaitListViewHolder extends RecyclerView.ViewHolder { |
||||
public final ItemApprovalWaitListBinding mBinding; |
||||
|
||||
public ApprovalWaitListViewHolder(ItemApprovalWaitListBinding binding) { |
||||
super(binding.getRoot()); |
||||
mBinding = binding; |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.project.survey.adapter.viewholder; |
||||
|
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.project.survey.databinding.ItemControlNetFirstListBinding; |
||||
|
||||
/** |
||||
* 首级控制网 |
||||
*/ |
||||
public class ControlNetFirstListViewHolder extends RecyclerView.ViewHolder { |
||||
public final ItemControlNetFirstListBinding mBinding; |
||||
|
||||
public ControlNetFirstListViewHolder(ItemControlNetFirstListBinding binding) { |
||||
super(binding.getRoot()); |
||||
mBinding = binding; |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.project.survey.adapter.viewholder; |
||||
|
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.project.survey.databinding.ItemControlNetFirstListBinding; |
||||
import com.project.survey.databinding.ItemControlNetSpecialListBinding; |
||||
|
||||
/** |
||||
* 专用控制网 |
||||
*/ |
||||
public class ControlNetSpecialListViewHolder extends RecyclerView.ViewHolder { |
||||
public final ItemControlNetSpecialListBinding mBinding; |
||||
|
||||
public ControlNetSpecialListViewHolder(ItemControlNetSpecialListBinding binding) { |
||||
super(binding.getRoot()); |
||||
mBinding = binding; |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.project.survey.adapter.viewholder; |
||||
|
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.project.survey.databinding.ItemLoftingListBinding; |
||||
|
||||
/** |
||||
* 放样 |
||||
*/ |
||||
public class LoftingListViewHolder extends RecyclerView.ViewHolder { |
||||
public final ItemLoftingListBinding mBinding; |
||||
|
||||
public LoftingListViewHolder(ItemLoftingListBinding binding) { |
||||
super(binding.getRoot()); |
||||
mBinding = binding; |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.project.survey.adapter.viewholder; |
||||
|
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.project.survey.databinding.ItemApprovalWaitListBinding; |
||||
import com.project.survey.databinding.ItemPointMeasureListBinding; |
||||
|
||||
/** |
||||
* 点测量的 |
||||
*/ |
||||
public class PointMeasureListViewHolder extends RecyclerView.ViewHolder { |
||||
public final ItemPointMeasureListBinding mBinding; |
||||
|
||||
public PointMeasureListViewHolder(ItemPointMeasureListBinding binding) { |
||||
super(binding.getRoot()); |
||||
mBinding = binding; |
||||
} |
||||
} |
@ -0,0 +1,195 @@ |
||||
package com.project.survey.dialog; |
||||
|
||||
import android.content.Context; |
||||
import android.graphics.Color; |
||||
import android.graphics.drawable.ColorDrawable; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.PopupWindow; |
||||
|
||||
import androidx.annotation.DrawableRes; |
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.bingce.AppChannel; |
||||
import com.project.survey.R; |
||||
import com.project.survey.databinding.LayoutBubblePopwindowBinding; |
||||
|
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
|
||||
public class BubblePopWindow extends PopupWindow { |
||||
|
||||
private OnHelpDocClickListener onHelpDocClickListener; |
||||
private OnTiltSwitchClickListener onTiltSwitchClickListener; |
||||
private OnRedrawClickListener onRedrawClickListener; |
||||
|
||||
private LayoutBubblePopwindowBinding binding; |
||||
|
||||
public BubblePopWindow(Context context, boolean isCADCustomView) { |
||||
this(context, isCADCustomView, Collections.emptyList()); |
||||
} |
||||
|
||||
public BubblePopWindow(Context context, List<CustomMenuItem> menuItems) { |
||||
this(context, false, menuItems); |
||||
} |
||||
|
||||
public BubblePopWindow(Context context, boolean isCADCustomView, List<CustomMenuItem> menuItems) { |
||||
super(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
||||
//这里要注意设置setOutsideTouchable之前要设置 setBackgroundDrawable()
|
||||
//否则点击外部无法关闭pop
|
||||
setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
setOutsideTouchable(true); |
||||
//获取焦点设置为true 这样再次点击菜单时 就隐藏菜单
|
||||
setFocusable(true); |
||||
|
||||
binding = LayoutBubblePopwindowBinding.inflate(LayoutInflater.from(context)); |
||||
setContentView(binding.getRoot()); |
||||
|
||||
binding.llSoftwareSetup.setOnClickListener(v -> { |
||||
dismiss(); |
||||
// SoftwareSetupActivity.start(context);
|
||||
}); |
||||
|
||||
binding.llHelpDocument.setOnClickListener(v -> { |
||||
dismiss(); |
||||
onHelpDocClickListener.onHelpClick(); |
||||
}); |
||||
|
||||
binding.llTiltSwitch.setOnClickListener(v -> { |
||||
dismiss(); |
||||
onTiltSwitchClickListener.onTiltSwitchClick(); |
||||
}); |
||||
|
||||
if (isCADCustomView) { |
||||
binding.llCadRedraw.setVisibility(View.VISIBLE); |
||||
} else { |
||||
binding.llCadRedraw.setVisibility(View.GONE); |
||||
} |
||||
|
||||
binding.llCadRedraw.setOnClickListener(v -> { |
||||
dismiss(); |
||||
onRedrawClickListener.onCadRedrawClicked(); |
||||
}); |
||||
|
||||
if (AppChannel.customChannel == AppChannel.CUSTOM_FJD || |
||||
AppChannel.customChannel == AppChannel.CUSTOM_COMNAV) { |
||||
binding.llHelpDocument.setVisibility(View.GONE); |
||||
} |
||||
|
||||
if (menuItems != null) { |
||||
if (!menuItems.isEmpty()) { |
||||
binding.llMenu1.setVisibility(View.VISIBLE); |
||||
binding.ivMenu1.setImageResource(menuItems.get(0).iconRes); |
||||
binding.tvMenu1.setText(menuItems.get(0).title); |
||||
binding.llMenu1.setOnClickListener(v -> { |
||||
dismiss(); |
||||
menuItems.get(0).action.run(); |
||||
}); |
||||
} |
||||
if (menuItems.size() > 1) { |
||||
binding.llMenu2.setVisibility(View.VISIBLE); |
||||
binding.ivMenu2.setImageResource(menuItems.get(1).iconRes); |
||||
binding.tvMenu2.setText(menuItems.get(1).title); |
||||
binding.llMenu2.setOnClickListener(v -> { |
||||
dismiss(); |
||||
menuItems.get(1).action.run(); |
||||
}); |
||||
} |
||||
if (menuItems.size() > 2) { |
||||
binding.llMenu3.setVisibility(View.VISIBLE); |
||||
binding.ivMenu3.setImageResource(menuItems.get(2).iconRes); |
||||
binding.tvMenu3.setText(menuItems.get(2).title); |
||||
binding.llMenu3.setOnClickListener(v -> { |
||||
dismiss(); |
||||
menuItems.get(2).action.run(); |
||||
}); |
||||
} |
||||
if (menuItems.size() > 3) { |
||||
binding.llMenu4.setVisibility(View.VISIBLE); |
||||
binding.ivMenu4.setImageResource(menuItems.get(3).iconRes); |
||||
binding.tvMenu4.setText(menuItems.get(3).title); |
||||
binding.llMenu4.setOnClickListener(v -> { |
||||
dismiss(); |
||||
menuItems.get(3).action.run(); |
||||
}); |
||||
} |
||||
if (menuItems.size() > 4) { |
||||
binding.llMenu5.setVisibility(View.VISIBLE); |
||||
binding.ivMenu5.setImageResource(menuItems.get(4).iconRes); |
||||
binding.tvMenu5.setText(menuItems.get(4).title); |
||||
binding.llMenu5.setOnClickListener(v -> { |
||||
dismiss(); |
||||
menuItems.get(4).action.run(); |
||||
}); |
||||
} |
||||
if (menuItems.size() > 5) { |
||||
binding.llMenu6.setVisibility(View.VISIBLE); |
||||
binding.ivMenu6.setImageResource(menuItems.get(5).iconRes); |
||||
binding.tvMenu6.setText(menuItems.get(5).title); |
||||
binding.llMenu6.setOnClickListener(v -> { |
||||
dismiss(); |
||||
menuItems.get(5).action.run(); |
||||
}); |
||||
} |
||||
if (menuItems.size() > 6) { |
||||
binding.llMenu7.setVisibility(View.VISIBLE); |
||||
binding.ivMenu7.setImageResource(menuItems.get(6).iconRes); |
||||
binding.tvMenu7.setText(menuItems.get(6).title); |
||||
binding.llMenu7.setOnClickListener(v -> { |
||||
dismiss(); |
||||
menuItems.get(6).action.run(); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
//设置窗口进入和退出的动画
|
||||
setAnimationStyle(R.style.popWindowStyle); |
||||
} |
||||
|
||||
public interface OnHelpDocClickListener { |
||||
void onHelpClick(); |
||||
} |
||||
|
||||
public void setOnHelpDocClickListener(OnHelpDocClickListener onHelpDocClickListener) { |
||||
this.onHelpDocClickListener = onHelpDocClickListener; |
||||
} |
||||
|
||||
public void setHideHelpDoc(boolean isHide) { |
||||
binding.llHelpDocument.setVisibility(isHide ? View.GONE : View.VISIBLE); |
||||
} |
||||
|
||||
public interface OnTiltSwitchClickListener { |
||||
void onTiltSwitchClick(); |
||||
} |
||||
|
||||
public void setOnTiltSwitchClickListener(OnTiltSwitchClickListener onTiltSwitchClickListener) { |
||||
this.onTiltSwitchClickListener = onTiltSwitchClickListener; |
||||
} |
||||
|
||||
public void setHideTiltSwitch(boolean isHide) { |
||||
binding.llTiltSwitch.setVisibility(isHide ? View.GONE : View.VISIBLE); |
||||
} |
||||
|
||||
public interface OnRedrawClickListener { |
||||
void onCadRedrawClicked(); |
||||
} |
||||
|
||||
public void setOnRedrawClickListener(OnRedrawClickListener onRedrawClickListener) { |
||||
this.onRedrawClickListener = onRedrawClickListener; |
||||
} |
||||
|
||||
public static class CustomMenuItem { |
||||
public final @DrawableRes int iconRes; |
||||
public final String title; |
||||
public final Runnable action; |
||||
|
||||
|
||||
public CustomMenuItem(@DrawableRes int iconRes, @NonNull String title, @NonNull Runnable action) { |
||||
this.iconRes = iconRes; |
||||
this.title = title; |
||||
this.action = action; |
||||
} |
||||
} |
||||
} |
@ -1,21 +0,0 @@ |
||||
package com.project.survey.fragment.home |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.project.survey.databinding.FragmentHomeBinding |
||||
import com.project.survey.fragment.base.BaseFragmentBinding |
||||
|
||||
class HomeFragment : BaseFragmentBinding<FragmentHomeBinding>() { |
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentHomeBinding { |
||||
return FragmentHomeBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
} |
||||
|
||||
override fun initData() { |
||||
} |
||||
} |
@ -1,21 +0,0 @@ |
||||
package com.project.survey.fragment.home |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.project.survey.databinding.FragmentInstrumentBinding |
||||
import com.project.survey.fragment.base.BaseFragmentBinding |
||||
|
||||
class InstrumentFragment : BaseFragmentBinding<FragmentInstrumentBinding>() { |
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentInstrumentBinding { |
||||
return FragmentInstrumentBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
} |
||||
|
||||
override fun initData() { |
||||
} |
||||
} |
@ -0,0 +1,4 @@ |
||||
package com.project.survey.model |
||||
|
||||
class ApprovalBean { |
||||
} |
@ -0,0 +1,4 @@ |
||||
package com.project.survey.model |
||||
|
||||
class ControlNetListBean { |
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.project.survey.model |
||||
|
||||
/** |
||||
* 控制网版本号 |
||||
*/ |
||||
class ControlNetVersionBean(val version: String) { |
||||
|
||||
|
||||
override fun toString(): String { |
||||
return version |
||||
} |
||||
} |
@ -0,0 +1,4 @@ |
||||
package com.project.survey.model |
||||
|
||||
class LoftingListBean { |
||||
} |
@ -0,0 +1,4 @@ |
||||
package com.project.survey.model |
||||
|
||||
class PointMeasureListBean { |
||||
} |
@ -1,7 +1,7 @@ |
||||
package com.project.survey.activity |
||||
package com.project.survey.ui |
||||
|
||||
import android.content.Intent |
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivitySplashBinding |
||||
|
||||
/** |
@ -0,0 +1,52 @@ |
||||
package com.project.survey.ui.approval |
||||
|
||||
import android.content.Context |
||||
import android.content.Intent |
||||
import com.project.survey.R |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivityApprovalBinding |
||||
|
||||
/** |
||||
* 待处理,已处理,已发起 |
||||
*/ |
||||
class ApprovalActivity : BaseBindingActivity<ActivityApprovalBinding>() { |
||||
|
||||
companion object { |
||||
private const val KEY_TYPE = "KEY_TYPE" |
||||
const val TYPE_WAIT = "TYPE_WAIT"//待处理 |
||||
const val TYPE_PROCESSED = "TYPE_PROCESSED"//已处理 |
||||
const val TYPE_INITIATED = "TYPE_INITIATED"//已发起 |
||||
|
||||
fun launch(context: Context, type: String) { |
||||
context.startActivity(Intent(context, ApprovalActivity::class.java).apply { |
||||
putExtra(KEY_TYPE, type) |
||||
}) |
||||
} |
||||
} |
||||
|
||||
override fun getBinding(): ActivityApprovalBinding { |
||||
return ActivityApprovalBinding.inflate(layoutInflater) |
||||
} |
||||
|
||||
override fun initView() { |
||||
val beginTransaction = supportFragmentManager.beginTransaction() |
||||
val fragemnt = when (getType()) { |
||||
TYPE_WAIT -> ApprovalWaitFragment() |
||||
TYPE_PROCESSED -> ApprovalProcessedFragment() |
||||
TYPE_INITIATED -> ApprovalInitiatedFragment() |
||||
else -> { |
||||
throw IllegalArgumentException("type is error") |
||||
} |
||||
} |
||||
beginTransaction.replace(R.id.container, fragemnt) |
||||
beginTransaction.commit() |
||||
} |
||||
|
||||
override fun initData() { |
||||
|
||||
} |
||||
|
||||
|
||||
private fun getType() = intent.getStringExtra(KEY_TYPE) |
||||
|
||||
} |
@ -0,0 +1,45 @@ |
||||
package com.project.survey.ui.approval |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.project.survey.adapter.ApprovalInitatedAdapter |
||||
import com.project.survey.databinding.FragmentApprovalBinding |
||||
import com.project.survey.ui.base.BaseFragmentBinding |
||||
import com.project.survey.model.ApprovalBean |
||||
import com.project.survey.widget.decoration.TransparentDividerDecoration |
||||
|
||||
/** |
||||
* 已发起 |
||||
*/ |
||||
class ApprovalInitiatedFragment : BaseFragmentBinding<FragmentApprovalBinding>() { |
||||
|
||||
private val adapter by lazy { ApprovalInitatedAdapter(requireContext()) } |
||||
|
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentApprovalBinding { |
||||
return FragmentApprovalBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initAdapter() |
||||
} |
||||
|
||||
override fun initData() { |
||||
val dataList = mutableListOf<ApprovalBean>() |
||||
for (i in 0 until 3) { |
||||
dataList.add(ApprovalBean()) |
||||
} |
||||
adapter.refreshData(dataList) |
||||
} |
||||
|
||||
private fun initAdapter() { |
||||
mBinding.recyclerView.addItemDecoration(TransparentDividerDecoration(requireContext())) |
||||
adapter.setOnItemClickListener { |
||||
|
||||
} |
||||
mBinding.recyclerView.setAdapter(adapter) |
||||
} |
||||
|
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.project.survey.ui.approval |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.project.survey.adapter.ApprovalWaitAdapter |
||||
import com.project.survey.databinding.FragmentApprovalBinding |
||||
import com.project.survey.ui.base.BaseFragmentBinding |
||||
import com.project.survey.model.ApprovalBean |
||||
import com.project.survey.widget.decoration.TransparentDividerDecoration |
||||
|
||||
/** |
||||
* 已处理 |
||||
*/ |
||||
class ApprovalProcessedFragment : BaseFragmentBinding<FragmentApprovalBinding>() { |
||||
private val adapter by lazy { |
||||
ApprovalWaitAdapter( |
||||
requireContext(), |
||||
ApprovalActivity.TYPE_PROCESSED |
||||
) |
||||
} |
||||
|
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentApprovalBinding { |
||||
return FragmentApprovalBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initAdapter() |
||||
} |
||||
|
||||
override fun initData() { |
||||
val dataList = mutableListOf<ApprovalBean>() |
||||
for (i in 0 until 3) { |
||||
dataList.add(ApprovalBean()) |
||||
} |
||||
adapter.refreshData(dataList) |
||||
} |
||||
|
||||
private fun initAdapter() { |
||||
mBinding.recyclerView.addItemDecoration(TransparentDividerDecoration(requireContext())) |
||||
adapter.setOnItemClickListener { |
||||
|
||||
} |
||||
mBinding.recyclerView.setAdapter(adapter) |
||||
} |
||||
|
||||
} |
@ -0,0 +1,50 @@ |
||||
package com.project.survey.ui.approval |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.project.survey.adapter.ApprovalWaitAdapter |
||||
import com.project.survey.databinding.FragmentApprovalBinding |
||||
import com.project.survey.ui.base.BaseFragmentBinding |
||||
import com.project.survey.model.ApprovalBean |
||||
import com.project.survey.widget.decoration.TransparentDividerDecoration |
||||
|
||||
/** |
||||
* 待处理 |
||||
*/ |
||||
class ApprovalWaitFragment : BaseFragmentBinding<FragmentApprovalBinding>() { |
||||
|
||||
private val adapter by lazy { |
||||
ApprovalWaitAdapter( |
||||
requireContext(), |
||||
ApprovalActivity.TYPE_WAIT |
||||
) |
||||
} |
||||
|
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentApprovalBinding { |
||||
return FragmentApprovalBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initAdapter() |
||||
} |
||||
|
||||
override fun initData() { |
||||
val dataList = mutableListOf<ApprovalBean>() |
||||
for (i in 0 until 3) { |
||||
dataList.add(ApprovalBean()) |
||||
} |
||||
adapter.refreshData(dataList) |
||||
} |
||||
|
||||
private fun initAdapter() { |
||||
mBinding.recyclerView.addItemDecoration(TransparentDividerDecoration(requireContext())) |
||||
adapter.setOnItemClickListener { |
||||
|
||||
} |
||||
mBinding.recyclerView.setAdapter(adapter) |
||||
} |
||||
|
||||
} |
@ -1,4 +1,4 @@ |
||||
package com.project.survey.activity.base |
||||
package com.project.survey.ui.base |
||||
|
||||
import android.os.Bundle |
||||
import android.view.MenuItem |
@ -1,4 +1,4 @@ |
||||
package com.project.survey.fragment.base; |
||||
package com.project.survey.ui.base; |
||||
|
||||
import android.os.Bundle; |
||||
import android.view.LayoutInflater; |
@ -0,0 +1,625 @@ |
||||
package com.project.survey.ui.base; |
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.os.Bundle; |
||||
import android.text.TextUtils; |
||||
import android.view.KeyEvent; |
||||
import android.view.View; |
||||
import android.view.WindowManager; |
||||
|
||||
import androidx.annotation.DrawableRes; |
||||
import androidx.annotation.NonNull; |
||||
import androidx.appcompat.app.AppCompatActivity; |
||||
import androidx.core.content.ContextCompat; |
||||
|
||||
import com.bingce.AppChannel; |
||||
import com.bingce.constants.KeyEventAction; |
||||
import com.bingce.coordlib.model.Blh; |
||||
import com.bingce.coordlib.model.Coordinate; |
||||
import com.bingce.device.Device; |
||||
import com.bingce.device.enums.DeviceTypeEnum; |
||||
import com.bingce.device.ui.manager.DeviceConnectManager; |
||||
import com.bingce.device.ui.manager.RtkManager; |
||||
import com.bingce.device.ui.manager.TsAnglesRefreshManager; |
||||
import com.bingce.device.ui.manager.TsBatteryRefreshManager; |
||||
import com.bingce.device.ui.manager.TsChangeHrManager; |
||||
import com.bingce.device.ui.manager.TsMeasCoordinateManager; |
||||
import com.bingce.device.ui.manager.TsMeasSdAnglesManager; |
||||
import com.bingce.device.ui.utils.TSSettingDialogUtils; |
||||
import com.bingce.rtk.command.RTK; |
||||
import com.bingce.rtk.gnss.Gnss; |
||||
import com.bingce.surveyor.util.DeviceConnectUtil; |
||||
import com.bingce.surveyor.util.SurveyDevicePoleHrHeightUtils; |
||||
import com.bingce.totalstation.TsListener; |
||||
import com.bingce.utils.PropertiesGet; |
||||
import com.project.survey.App; |
||||
import com.project.survey.R; |
||||
import com.project.survey.dialog.BubblePopWindow; |
||||
import com.project.survey.ui.instrument.satellitosis.SatelliteStatusActivity; |
||||
import com.project.survey.ui.interfacee.IUIProvider; |
||||
import com.project.survey.util.AnimUtil; |
||||
import com.project.survey.util.BaseSurveyActivityUtils; |
||||
import com.project.survey.util.CountDownUtils; |
||||
import com.project.survey.util.DrawableUtils; |
||||
import com.project.survey.util.SystemUtils; |
||||
|
||||
import org.polaric.colorful.Colorful; |
||||
import org.polaric.colorful.ColorfulActivity; |
||||
|
||||
import java.util.List; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public abstract class BaseSurveyNewActivity extends AppCompatActivity implements IUIProvider, Device.IDeviceConnectListener, RtkManager.IRtkListener, |
||||
TsListener.MeasCoordinateListener, TsListener.MeasSdAnglesListener, TsListener.AnglesRefreshListener, TsListener.BatteryRefreshListener, TsListener.ChangeHrListener, |
||||
CountDownUtils.ICountDownSwitcher { |
||||
public final BaseSurveyActivityUtils baseSurveyActivityUtils = new BaseSurveyActivityUtils(this, this, onRootSetBackgroundColor()); |
||||
|
||||
private final CountDownUtils countDownUtils = new CountDownUtils(() -> this, this); |
||||
public final DeviceConnectManager deviceConnectManager = new DeviceConnectManager(this, this); |
||||
protected final RtkManager rtkManager = new RtkManager(this, this); |
||||
protected final TsMeasCoordinateManager tsMeasCoordinateManager = new TsMeasCoordinateManager(this, this); |
||||
protected final TsMeasSdAnglesManager tsMeasSdAnglesManager = new TsMeasSdAnglesManager(this, this); |
||||
protected final TsAnglesRefreshManager tsAnglesRefreshManager = new TsAnglesRefreshManager(this, this); |
||||
protected final TsBatteryRefreshManager tsBatteryRefreshManager = new TsBatteryRefreshManager(this, this); |
||||
protected final TsChangeHrManager tsChangeHrManager = new TsChangeHrManager(this, this); |
||||
protected final TSSettingDialogUtils tsSettingDialogUtils = new TSSettingDialogUtils(this); |
||||
|
||||
final protected void hideSurveyorInfoLayout() { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlSurveyInfo.setVisibility(View.INVISIBLE); |
||||
} |
||||
|
||||
//最右侧的按钮图片点击事件
|
||||
protected void onCommonRightClicked(View view) { |
||||
} |
||||
|
||||
public int onRootSetBackgroundColor() { |
||||
return -1; |
||||
} |
||||
|
||||
public boolean isUseSystemStyleNavigationBar() { |
||||
return false; |
||||
} |
||||
|
||||
public boolean isShowTopBarHrPoleLayout() { |
||||
return true; |
||||
} |
||||
|
||||
public int customSystemStyleNavigationBarColor() { |
||||
return R.color.theme_gray; |
||||
} |
||||
|
||||
public void setFragmentTitle(int fragmentTitle) { |
||||
setStayMainPage(false, getString(fragmentTitle)); |
||||
} |
||||
|
||||
public void setStayMainPage(boolean isStayMainPage) { |
||||
setStayMainPage(isStayMainPage, ""); |
||||
} |
||||
|
||||
public void setStayMainPage(boolean isStayMainPage, String fragmentTitle) { |
||||
if (isStayMainPage) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlSurveyInfo.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlBack.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llRoadItemSurveyInfo.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llTitleBarRightIcon.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlMenuSideslip.setVisibility(View.VISIBLE); |
||||
} else { |
||||
if (!TextUtils.isEmpty(fragmentTitle)) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlSurveyInfo.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlBack.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llRoadItemSurveyInfo.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llTitleBarRightIcon.setVisibility(View.GONE); |
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlSurveyInfo.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlBack.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llRoadItemSurveyInfo.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llTitleBarRightIcon.setVisibility(View.GONE); |
||||
} |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setText(fragmentTitle); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlMenuSideslip.setVisibility(View.GONE); |
||||
} |
||||
} |
||||
|
||||
public BubblePopWindow newBubblePopWindow(Context context) { |
||||
return new BubblePopWindow(context, false); |
||||
} |
||||
|
||||
private BubblePopWindow defaultMenu = null; |
||||
|
||||
protected void showMenu() { |
||||
if (defaultMenu == null) { |
||||
defaultMenu = newBubblePopWindow(this); |
||||
defaultMenu.setOnDismissListener(() -> toggleBright()); |
||||
defaultMenu.setHideHelpDoc(isHideHelpDoc()); |
||||
defaultMenu.setOnHelpDocClickListener(() -> { |
||||
onHelpClicked(); |
||||
}); |
||||
|
||||
defaultMenu.setHideTiltSwitch(isHideTiltSwitch()); |
||||
defaultMenu.setOnTiltSwitchClickListener(() -> { |
||||
onTiltSwitchClick(); |
||||
}); |
||||
} |
||||
defaultMenu.showAsDropDown(baseSurveyActivityUtils.activityBaseSurveyBinding.ivMore, -150, 20); |
||||
} |
||||
|
||||
public boolean isHideHelpDoc() { |
||||
return false; |
||||
} |
||||
|
||||
public boolean isHideTiltSwitch() { |
||||
return true; |
||||
} |
||||
|
||||
private AnimUtil animUtil; |
||||
private float bgAlpha = 1f; |
||||
private boolean bright = false; |
||||
private static final long DURATION = 400; |
||||
private static final float START_ALPHA = 0.6f; |
||||
private static final float END_ALPHA = 1f; |
||||
|
||||
@Override |
||||
protected void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
Colorful.applyTheme(this); |
||||
baseSurveyActivityUtils.onCreate(); |
||||
if (((App) Utils.getApp()).isThemeDark) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.cutDownProgressbar.setBackgroundColor(ContextCompat.getColor(this, R.color.dark)); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.baseView.setBackgroundColor(ContextCompat.getColor(this, R.color.dark)); |
||||
} |
||||
if (!isUseSystemStyleNavigationBar()) { |
||||
if (onRootSetBackgroundColor() != -1) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.getRoot().setBackgroundColor(getColor(onRootSetBackgroundColor())); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivBack, R.drawable.icon_system_back, R.color.black); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivMore, R.drawable.icon_white_more, R.color.black); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setTextColor(getColor(R.color.black)); |
||||
} |
||||
} else { |
||||
if (customSystemStyleNavigationBarColor() == R.color.theme_gray) { |
||||
if (((App) Utils.getApp()).isThemeDark) { |
||||
Colorful.ThemeColor primaryColor = Colorful.getThemeDelegate().getPrimaryColor(); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.getRoot().setBackgroundColor(getColor(primaryColor.getColorRes())); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivBack, R.drawable.icon_system_back, R.color.white); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivMore, R.drawable.icon_white_more, R.color.white); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setTextColor(getColor(R.color.white)); |
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.getRoot().setBackgroundColor(getColor(R.color.white)); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivBack, R.drawable.icon_system_back, R.color.black); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivMore, R.drawable.icon_white_more, R.color.black); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setTextColor(getColor(R.color.black)); |
||||
} |
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.getRoot().setBackgroundColor(getColor(customSystemStyleNavigationBarColor())); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivBack, R.drawable.icon_system_back, R.color.white); |
||||
DrawableUtils.tintModifyColorVector(baseSurveyActivityUtils.activityBaseSurveyBinding.ivMore, R.drawable.icon_white_more, R.color.white); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setTextColor(getColor(R.color.white)); |
||||
} |
||||
} |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llPoleHighHr.setVisibility(isShowTopBarHrPoleLayout() ? View.VISIBLE : View.GONE); |
||||
|
||||
SurveyDevicePoleHrHeightUtils.setDevicePoleHrHigh(this, baseSurveyActivityUtils.activityBaseSurveyBinding.llPoleHighHr, baseSurveyActivityUtils.activityBaseSurveyBinding.ivPoleHighHr, baseSurveyActivityUtils.activityBaseSurveyBinding.tvPoleHighHr, true); |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llCommonRight.setOnClickListener(this::onCommonRightClicked); |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llIconHomeSatellite.setOnClickListener(v -> { |
||||
if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) { |
||||
tsSettingDialogUtils.showTotalStationSettingDialog(); |
||||
} else { |
||||
startActivity(new Intent(this, SatelliteStatusActivity.class)); |
||||
} |
||||
}); |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llRtkStatus.setOnClickListener(v -> { |
||||
DeviceConnectUtil.startDeviceConnected(this, baseSurveyActivityUtils.activityBaseSurveyBinding); |
||||
}); |
||||
|
||||
animUtil = new AnimUtil(); |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlMore.setOnClickListener(v -> { |
||||
showMenu(); |
||||
toggleBright(); |
||||
}); |
||||
|
||||
initViewMap(savedInstanceState); |
||||
initView(); |
||||
initData(); |
||||
} |
||||
|
||||
@Override |
||||
protected void onResume() { |
||||
super.onResume(); |
||||
//按照设置选项,保持屏幕常亮,放在onResume而不放在onCreate里是因为,用户更改设置后返回主页就要开始常亮了
|
||||
SystemUtils.setScreenAlwaysLight(this); |
||||
} |
||||
|
||||
final public void toggleBright() { |
||||
// 三个参数分别为:起始值 结束值 时长,那么整个动画回调过来的值就是从0.5f--1f的
|
||||
animUtil.setValueAnimator(START_ALPHA, END_ALPHA, DURATION); |
||||
animUtil.addUpdateListener(progress -> { |
||||
// 此处系统会根据上述三个值,计算每次回调的值是多少,我们根据这个值来改变透明度
|
||||
bgAlpha = bright ? progress : (START_ALPHA + END_ALPHA - progress); |
||||
backgroundAlpha(bgAlpha); |
||||
}); |
||||
animUtil.addEndListner(animator -> { |
||||
// 在一次动画结束的时候,翻转状态
|
||||
bright = !bright; |
||||
}); |
||||
animUtil.startAnimator(); |
||||
} |
||||
|
||||
final public void backgroundAlpha(float bgAlpha) { |
||||
WindowManager.LayoutParams lp = getWindow().getAttributes(); |
||||
lp.alpha = bgAlpha; //0.0-1.0
|
||||
getWindow().setAttributes(lp); |
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); |
||||
} |
||||
|
||||
protected void initViewMap(Bundle savedInstanceState) { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 设置标题 |
||||
* |
||||
* @param title |
||||
*/ |
||||
final protected void setTitle(String title) { |
||||
setTitle(title, null, "", R.color.white); |
||||
} |
||||
|
||||
final protected void setTitle(String title, String rightText) { |
||||
setTitle(title, null, rightText, R.color.white); |
||||
} |
||||
|
||||
final protected void setTitle(String title, String rightText, int rightTextColor) { |
||||
setTitle(title, null, rightText, rightTextColor); |
||||
} |
||||
|
||||
@Override |
||||
public void setTitle(int titleId) { |
||||
setTitle(getString(titleId)); |
||||
} |
||||
|
||||
@Override |
||||
public void setTitle(CharSequence title) { |
||||
setTitle(title.toString()); |
||||
} |
||||
|
||||
final protected void setTitle(String title, Integer rightIcon, String rightText, int rightTextColor) { |
||||
if (!TextUtils.isEmpty(title)) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setText(title); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlSurveyInfo.setVisibility(View.GONE); |
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.rlSurveyInfo.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setText(""); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonTitle.setVisibility(View.GONE); |
||||
} |
||||
|
||||
if (rightIcon == null && TextUtils.isEmpty(rightText)) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llCommonRight.setVisibility(View.GONE); |
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llCommonRight.setVisibility(View.VISIBLE); |
||||
} |
||||
if (rightIcon != null) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivCommonRightIcon.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivCommonRightIcon.setImageResource(rightIcon); |
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivCommonRightIcon.setVisibility(View.GONE); |
||||
} |
||||
if (!TextUtils.isEmpty(rightText)) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonRightText.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonRightText.setText(rightText); |
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonRightText.setVisibility(View.GONE); |
||||
} |
||||
|
||||
if (rightTextColor > 0) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.tvCommonRightText.setTextColor(getColor(rightTextColor)); |
||||
} |
||||
} |
||||
|
||||
protected void setTitleBar(List<CustomMainMenuItem> itemList) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.llTitleBarRightIcon.setVisibility(!itemList.isEmpty() ? View.VISIBLE : View.GONE); |
||||
if (itemList.size() == 1) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon02.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon03.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setImageDrawable(ContextCompat.getDrawable(this, itemList.get(0).iconRes)); |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setOnClickListener(v -> itemList.get(0).action.run()); |
||||
|
||||
} else if (itemList.size() == 2) { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon02.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon03.setVisibility(View.GONE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setImageDrawable(ContextCompat.getDrawable(this, itemList.get(0).iconRes)); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon02.setImageDrawable(ContextCompat.getDrawable(this, itemList.get(1).iconRes)); |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setOnClickListener(v -> itemList.get(0).action.run()); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon02.setOnClickListener(v -> itemList.get(1).action.run()); |
||||
|
||||
} else { |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon02.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon03.setVisibility(View.VISIBLE); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setImageDrawable(ContextCompat.getDrawable(this, itemList.get(0).iconRes)); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon02.setImageDrawable(ContextCompat.getDrawable(this, itemList.get(1).iconRes)); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon03.setImageDrawable(ContextCompat.getDrawable(this, itemList.get(2).iconRes)); |
||||
|
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon01.setOnClickListener(v -> itemList.get(0).action.run()); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon02.setOnClickListener(v -> itemList.get(1).action.run()); |
||||
baseSurveyActivityUtils.activityBaseSurveyBinding.ivTitleBarRightIcon03.setOnClickListener(v -> itemList.get(2).action.run()); |
||||
|
||||
} |
||||
} |
||||
|
||||
public static class CustomMainMenuItem { |
||||
public final @DrawableRes int iconRes; |
||||
public final Runnable action; |
||||
|
||||
|
||||
public CustomMainMenuItem(@DrawableRes int iconRes, @NonNull Runnable action) { |
||||
this.iconRes = iconRes; |
||||
this.action = action; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public int getLayoutId() { |
||||
return -1; |
||||
} |
||||
|
||||
@Override |
||||
public View getContentView() { |
||||
return null; |
||||
} |
||||
|
||||
protected abstract void initView(); |
||||
|
||||
protected abstract void initData(); |
||||
|
||||
@Override |
||||
public boolean isShowTimeStatusBar() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyDown(int keyCode, KeyEvent event) { |
||||
switch (keyCode) { |
||||
case KeyEvent.KEYCODE_VOLUME_UP: |
||||
switch (/*((App) Utils.getApp()).*/volumeUpAction()) { |
||||
case KeyEventAction.NONE: |
||||
return super.onKeyDown(keyCode, event); |
||||
case KeyEventAction.CAL: |
||||
break; |
||||
case KeyEventAction.MEASURE: |
||||
performMeasure(); |
||||
break; |
||||
case KeyEventAction.RECORD: |
||||
performRecord(); |
||||
break; |
||||
case KeyEventAction.LAST: |
||||
performLast(); |
||||
break; |
||||
case KeyEventAction.NEXT: |
||||
performNext(); |
||||
break; |
||||
case KeyEventAction.MEASURE_NOT_SEND: |
||||
performMeasureNotSend(); |
||||
break; |
||||
case KeyEventAction.MEASURE_AND_RECORD: |
||||
performMeasureRecord(); |
||||
break; |
||||
} |
||||
return true; |
||||
case KeyEvent.KEYCODE_VOLUME_DOWN: |
||||
switch (volumeDownAction()) { |
||||
case KeyEventAction.NONE: |
||||
return super.onKeyDown(keyCode, event); |
||||
case KeyEventAction.CAL: |
||||
break; |
||||
case KeyEventAction.MEASURE: |
||||
performMeasure(); |
||||
break; |
||||
case KeyEventAction.RECORD: |
||||
performRecord(); |
||||
break; |
||||
case KeyEventAction.LAST: |
||||
performLast(); |
||||
break; |
||||
case KeyEventAction.NEXT: |
||||
performNext(); |
||||
break; |
||||
case KeyEventAction.MEASURE_NOT_SEND: |
||||
performMeasureNotSend(); |
||||
break; |
||||
case KeyEventAction.MEASURE_AND_RECORD: |
||||
performMeasureRecord(); |
||||
break; |
||||
} |
||||
return true; |
||||
case 220://中海达记录快捷键
|
||||
if (PropertiesGet.getModel() != null) { |
||||
if ((PropertiesGet.getModel().startsWith("iHand") || PropertiesGet.getModel().startsWith("Q3"))) { |
||||
performRecord(); |
||||
} |
||||
} |
||||
break; |
||||
case 131://丰疆手薄记录快捷键
|
||||
if (AppChannel.customChannel == AppChannel.CUSTOM_FJD) { |
||||
performRecord(); |
||||
} |
||||
break; |
||||
} |
||||
return super.onKeyDown(keyCode, event); |
||||
} |
||||
|
||||
protected int volumeUpAction() { |
||||
// return BingCeBaseSurveyPresenter.volumeUpAction();
|
||||
return 0; |
||||
} |
||||
|
||||
protected int volumeDownAction() { |
||||
// return BingCeBaseSurveyPresenter.volumeDownAction();
|
||||
return 0; |
||||
} |
||||
|
||||
protected void performMeasure() { |
||||
|
||||
} |
||||
|
||||
protected void performRecord() { |
||||
|
||||
} |
||||
|
||||
protected void performMeasureRecord() { |
||||
} |
||||
|
||||
protected void performMeasureNotSend() { |
||||
} |
||||
|
||||
protected void performNext() { |
||||
|
||||
} |
||||
|
||||
protected void performLast() { |
||||
} |
||||
|
||||
|
||||
protected void onHelpClicked() { |
||||
|
||||
} |
||||
|
||||
protected void onTiltSwitchClick() { |
||||
if (!Gnss.getInstance().getDevice().isSupportTilt()) { |
||||
ToastUtils.showShort(R.string.current_device_not_support_tilt); |
||||
} else { |
||||
if (Gnss.getInstance().getDevice().isTiltOpen()) { |
||||
RTK.getInstance().sendCloseTiltCmd(); |
||||
} else { |
||||
RTK.getInstance().sendOpenTiltCmd(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
final public void setContentView(View view) { |
||||
//判断view的背景色
|
||||
ColorfulActivity.autoSwitchRootViewBgColor(view); |
||||
super.setContentView(view); |
||||
} |
||||
|
||||
@Override |
||||
public void onDeviceConnectLost() { |
||||
baseSurveyActivityUtils.resetTopStatus(); |
||||
} |
||||
|
||||
@Override |
||||
public void onDeviceConnectFailed() { |
||||
baseSurveyActivityUtils.resetTopStatus(); |
||||
} |
||||
|
||||
@Override |
||||
public void onDeviceConnectNeedOpenBT() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onDeviceConnectSucceed() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onRtkPositionReceived(double antennaHeight, Blh blh, Blh originalBlh, Coordinate coordinate, double hdop, double vdop, double pdop) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onRtkStatusChanged() { |
||||
baseSurveyActivityUtils.refreshRtkStatus(); |
||||
} |
||||
|
||||
@Override |
||||
public void onRtkError(String errorMsg) { |
||||
ToastUtils.showShort(errorMsg); |
||||
} |
||||
|
||||
@Override |
||||
public void onRtkPoleHeightChanged() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onRtkTiltSwitched(boolean onOff) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onSatelliteSkyViewRefresh() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onMeasCoordinateSuccess(Coordinate coordinate) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onMeasCoordinateFailed(String errorMsg, String original) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onMeasSdAnglesSuccess(double originalHa, double originalVa, double sd, double clockwiseHa, double topVa, double hd, double vd) { |
||||
baseSurveyActivityUtils.onMeasSdAngleSuccess(originalHa, originalVa, sd, clockwiseHa, topVa, hd, vd); |
||||
} |
||||
|
||||
@Override |
||||
public void onMeasSdAnglesFailed(String errorMsg, String original) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onAnglesRefresh(double originalHa, double originalVa) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onBatteryRefresh(int percent) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onChangeHrSuccess(double hr) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void onChangeHrFailed(String errorMsg) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean isVipCountDownOpen() { |
||||
return true; |
||||
} |
||||
|
||||
public interface ISurveyorUIMenuContainer { |
||||
BubblePopWindow uiMenu(); |
||||
} |
||||
|
||||
public interface IFragmentBtnHelp { |
||||
void onHelpBtnClicked(); |
||||
} |
||||
|
||||
public interface IFragmentBtnTilt { |
||||
void onTiltBtnClicked(); |
||||
} |
||||
} |
@ -0,0 +1,60 @@ |
||||
package com.project.survey.ui.controlnet |
||||
|
||||
import android.content.Context |
||||
import android.content.Intent |
||||
import com.project.survey.adapter.ControlNetFirstListAdapter |
||||
import com.project.survey.databinding.ActivityControlNetListBinding |
||||
import com.project.survey.model.ControlNetListBean |
||||
import com.project.survey.model.ControlNetVersionBean |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.widget.decoration.TransparentDividerDecoration |
||||
|
||||
/** |
||||
* 首级控制网列表 |
||||
*/ |
||||
class ControlNetFirstListActivity : BaseBindingActivity<ActivityControlNetListBinding>() { |
||||
|
||||
private val adapter by lazy { ControlNetFirstListAdapter(this) } |
||||
|
||||
companion object { |
||||
fun launch(context: Context) { |
||||
context.startActivity(Intent(context, ControlNetFirstListActivity::class.java)) |
||||
} |
||||
} |
||||
|
||||
override fun getBinding(): ActivityControlNetListBinding { |
||||
return ActivityControlNetListBinding.inflate(layoutInflater) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initVersion() |
||||
|
||||
|
||||
initAdapter() |
||||
} |
||||
|
||||
private fun initVersion() { |
||||
val versionList = mutableListOf<ControlNetVersionBean>() |
||||
versionList.add(ControlNetVersionBean("版本一")) |
||||
versionList.add(ControlNetVersionBean("版本二")) |
||||
versionList.add(ControlNetVersionBean("版本三")) |
||||
|
||||
mBinding.ilSearch.spinner.setItems(versionList) |
||||
} |
||||
|
||||
override fun initData() { |
||||
val dataList = mutableListOf<ControlNetListBean>() |
||||
for (i in 0 until 3) { |
||||
dataList.add(ControlNetListBean()) |
||||
} |
||||
adapter.refreshData(dataList) |
||||
} |
||||
|
||||
private fun initAdapter() { |
||||
mBinding.recyclerView.addItemDecoration(TransparentDividerDecoration(this)) |
||||
adapter.setOnItemClickListener { |
||||
|
||||
} |
||||
mBinding.recyclerView.setAdapter(adapter) |
||||
} |
||||
} |
@ -0,0 +1,57 @@ |
||||
package com.project.survey.ui.controlnet |
||||
|
||||
import android.content.Context |
||||
import android.content.Intent |
||||
import com.project.survey.adapter.ControlNetSpeciaListAdapter |
||||
import com.project.survey.databinding.ActivityControlNetListBinding |
||||
import com.project.survey.model.ControlNetListBean |
||||
import com.project.survey.model.ControlNetVersionBean |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.widget.decoration.TransparentDividerDecoration |
||||
|
||||
/** |
||||
* 专用控制网列表 |
||||
*/ |
||||
class ControlNetSpeciaListActivity : BaseBindingActivity<ActivityControlNetListBinding>() { |
||||
private val adapter by lazy { ControlNetSpeciaListAdapter(this) } |
||||
|
||||
companion object { |
||||
fun launch(context: Context) { |
||||
context.startActivity(Intent(context, ControlNetSpeciaListActivity::class.java)) |
||||
} |
||||
} |
||||
|
||||
override fun getBinding(): ActivityControlNetListBinding { |
||||
return ActivityControlNetListBinding.inflate(layoutInflater) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initVersion() |
||||
initAdapter() |
||||
} |
||||
|
||||
override fun initData() { |
||||
val dataList = mutableListOf<ControlNetListBean>() |
||||
for (i in 0 until 3) { |
||||
dataList.add(ControlNetListBean()) |
||||
} |
||||
adapter.refreshData(dataList) |
||||
} |
||||
|
||||
private fun initVersion() { |
||||
val versionList = mutableListOf<ControlNetVersionBean>() |
||||
versionList.add(ControlNetVersionBean("版本一")) |
||||
versionList.add(ControlNetVersionBean("版本二")) |
||||
versionList.add(ControlNetVersionBean("版本三")) |
||||
|
||||
mBinding.ilSearch.spinner.setItems(versionList) |
||||
} |
||||
|
||||
private fun initAdapter() { |
||||
mBinding.recyclerView.addItemDecoration(TransparentDividerDecoration(this)) |
||||
adapter.setOnItemClickListener { |
||||
|
||||
} |
||||
mBinding.recyclerView.setAdapter(adapter) |
||||
} |
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.project.survey.ui.home |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.project.survey.databinding.FragmentHomeBinding |
||||
import com.project.survey.ui.approval.ApprovalActivity |
||||
import com.project.survey.ui.base.BaseFragmentBinding |
||||
import com.project.survey.ui.controlnet.ControlNetFirstListActivity |
||||
import com.project.survey.ui.controlnet.ControlNetSpeciaListActivity |
||||
import com.project.survey.ui.lofting.LoftingListActivity |
||||
import com.project.survey.ui.pointmeasure.PointMeasureListActivity |
||||
|
||||
class HomeFragment : BaseFragmentBinding<FragmentHomeBinding>() { |
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentHomeBinding { |
||||
return FragmentHomeBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
mBinding.tvPointMeasure.setOnClickListener { |
||||
//点测量 |
||||
PointMeasureListActivity.launch(requireContext()) |
||||
} |
||||
mBinding.tvLofting.setOnClickListener { |
||||
//放样 |
||||
LoftingListActivity.launch(requireContext()) |
||||
} |
||||
mBinding.rlApprovalWait.setOnClickListener { |
||||
ApprovalActivity.launch(requireContext(), ApprovalActivity.TYPE_WAIT) |
||||
} |
||||
mBinding.tvApprovalProcessed.setOnClickListener { |
||||
ApprovalActivity.launch(requireContext(), ApprovalActivity.TYPE_PROCESSED) |
||||
} |
||||
mBinding.tvApprovalInitated.setOnClickListener { |
||||
ApprovalActivity.launch(requireContext(), ApprovalActivity.TYPE_INITIATED) |
||||
} |
||||
mBinding.tvControlNetFirst.setOnClickListener { |
||||
ControlNetFirstListActivity.launch(requireContext()) |
||||
} |
||||
mBinding.tvControlNetSpecial.setOnClickListener { |
||||
ControlNetSpeciaListActivity.launch(requireContext()) |
||||
} |
||||
} |
||||
|
||||
override fun initData() { |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
package com.project.survey.ui.home |
||||
|
||||
import android.content.Intent |
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.bingce.device.ui.ConnectRtkActivity |
||||
import com.bingce.device.ui.ConnectTSActivity |
||||
import com.project.survey.databinding.FragmentInstrumentBinding |
||||
import com.project.survey.ui.base.BaseFragmentBinding |
||||
import com.project.survey.ui.instrument.satellitosis.SatelliteStatusActivity |
||||
|
||||
class InstrumentFragment : BaseFragmentBinding<FragmentInstrumentBinding>() { |
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentInstrumentBinding { |
||||
return FragmentInstrumentBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
mBinding.tvConnectTSActivity.setOnClickListener { |
||||
ConnectTSActivity.start(requireContext()) |
||||
} |
||||
mBinding.tvConnectRtkActivity.setOnClickListener { |
||||
ConnectRtkActivity.start(this) |
||||
} |
||||
mBinding.tvSatelliteStatusActivity.setOnClickListener { |
||||
startActivity(Intent(requireContext(), SatelliteStatusActivity::class.java)) |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
override fun initData() { |
||||
} |
||||
} |
@ -0,0 +1,201 @@ |
||||
package com.project.survey.ui.instrument.satellitosis; |
||||
|
||||
import android.content.Intent; |
||||
import android.view.Menu; |
||||
import android.view.MenuItem; |
||||
import android.view.View; |
||||
|
||||
import com.bingce.device.Device; |
||||
import com.bingce.device.ui.databinding.ActivitySatelliteStatusBinding; |
||||
import com.bingce.rtk.command.RTK; |
||||
import com.bingce.rtk.command.geomax.GeoMaxRTK; |
||||
import com.bingce.rtk.enums.SateSystemEnum; |
||||
import com.bingce.rtk.model.GnssPosition; |
||||
import com.bingce.rtk.parser.nmea0183.SatInfo; |
||||
import com.bingce.rtk.parser.nmea0183.SatelliteData; |
||||
import com.project.survey.R; |
||||
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||
|
||||
|
||||
public class SatelliteStatusActivity extends BaseSurveyNewActivity { |
||||
private ActivitySatelliteStatusBinding binding; |
||||
|
||||
@Override |
||||
public View getContentView() { |
||||
binding = ActivitySatelliteStatusBinding.inflate(getLayoutInflater()); |
||||
return binding.getRoot(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initView() { |
||||
} |
||||
|
||||
@Override |
||||
protected void initData() { |
||||
onSatelliteSkyViewRefresh(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void onPause() { |
||||
super.onPause(); |
||||
if (Device.getInstance().isDeviceConnected()) { |
||||
if (RTK.getInstance() instanceof GeoMaxRTK) { |
||||
((GeoMaxRTK) RTK.getInstance()).stopOutputSatelliteInfo(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void onResume() { |
||||
super.onResume(); |
||||
if (Device.getInstance().isDeviceConnected() && RTK.getInstance() instanceof GeoMaxRTK) { |
||||
((GeoMaxRTK) RTK.getInstance()).startOutputSatelliteInfo(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void onSatelliteSkyViewRefresh() { |
||||
super.onSatelliteSkyViewRefresh(); |
||||
binding.activitySatelliteStatusSkyview.update(); |
||||
binding.activitySatelliteStatusViewSatelliteNumber.setText(String.format("%s %s", getString(R.string.tracked_satellite_number), GnssPosition.getInstance().getSatTrackNum())); |
||||
binding.activitySatelliteStatusSolutionSatelliteNumber.setText(String.format("%s %s", getString(R.string.solution_satellite_number), GnssPosition.getInstance().getSatSolutionNum())); |
||||
|
||||
StringBuilder systemResult = new StringBuilder(getString(R.string.satellite_system) + "\r\n"); |
||||
StringBuilder prnResult = new StringBuilder(getString(R.string.satellite_prn) + "\r\n"); |
||||
StringBuilder elevationResult = new StringBuilder(getString(R.string.satellite_elevation) + "\r\n"); |
||||
StringBuilder azimuthResult = new StringBuilder(getString(R.string.satellite_azimuth) + "\r\n"); |
||||
StringBuilder snrResult = new StringBuilder(getString(R.string.satellite_snr) + "\r\n"); |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.GPS) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "GPS"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.GLONASS) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "GLONASS"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.BDS) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "BDS"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.GALILEO) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "GALILEO"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.QZSS) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "QZSS"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.SBAS) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "SBAS"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.IRNSS) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "IRNSS"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
for (int i = 0; i < SatelliteData.getInstance().getSatInfoArray().size(); i++) { |
||||
SatInfo satInfo = SatelliteData.getInstance().getSatInfoArray().get(i); |
||||
if (satInfo.getSateSystem() == SateSystemEnum.OTHER) { |
||||
if (satInfo.getElevation() <= 0.0) continue; |
||||
double snr = satInfo.snrL1B1 != 0 ? satInfo.snrL1B1 : satInfo.snrL2B2 != 0 ? satInfo.snrL2B2 : satInfo.snrL5B3; |
||||
String systemName = "OTHER"; |
||||
systemResult.append(systemName + "\r\n"); |
||||
prnResult.append(satInfo.getPrn() + "\r\n"); |
||||
elevationResult.append(satInfo.getElevation() + "\r\n"); |
||||
azimuthResult.append(satInfo.getAzimuth() + "\r\n"); |
||||
snrResult.append(snr + "\r\n"); |
||||
} |
||||
} |
||||
|
||||
binding.activitySatelliteStatusSystem.setText(systemResult.toString()); |
||||
binding.activitySatelliteStatusPrn.setText(prnResult.toString()); |
||||
binding.activitySatelliteStatusAzimuth.setText(azimuthResult.toString()); |
||||
binding.activitySatelliteStatusElevation.setText(elevationResult.toString()); |
||||
binding.activitySatelliteStatusSnr.setText(snrResult.toString()); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onCreateOptionsMenu(Menu menu) { |
||||
getMenuInflater().inflate(R.menu.menu_activity_satellite_system_switch, menu); |
||||
return super.onCreateOptionsMenu(menu); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onOptionsItemSelected(MenuItem item) { |
||||
switch (item.getItemId()) { |
||||
case android.R.id.home: |
||||
finish(); |
||||
break; |
||||
case R.id.menu_satellite_system_switch: |
||||
Intent intent = new Intent(this, SatelliteSystemSwitchActivity.class); |
||||
startActivity(intent); |
||||
break; |
||||
} |
||||
return super.onOptionsItemSelected(item); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,54 @@ |
||||
package com.project.survey.ui.instrument.satellitosis; |
||||
|
||||
import android.os.Bundle; |
||||
import android.view.MenuItem; |
||||
import android.view.View; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
|
||||
import com.bingce.device.Device; |
||||
import com.bingce.rtk.command.RtkCommand; |
||||
import com.bingce.rtk.gnss.Gnss; |
||||
import com.project.survey.R; |
||||
import com.project.survey.databinding.ActivitySatelliteSystemSwitchBinding; |
||||
|
||||
import org.polaric.colorful.ColorfulActivity; |
||||
|
||||
public class SatelliteSystemSwitchActivity extends ColorfulActivity { |
||||
|
||||
private ActivitySatelliteSystemSwitchBinding binding; |
||||
|
||||
@Override |
||||
protected void onCreate(@Nullable Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
binding = ActivitySatelliteSystemSwitchBinding.inflate(getLayoutInflater()); |
||||
setContentView(binding.getRoot()); |
||||
setSupportActionBar(binding.getRoot().findViewById(R.id.toolbar)); |
||||
if (getSupportActionBar() != null) |
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
||||
|
||||
binding.switchGps.setChecked(Gnss.getInstance().getGps().isGpsEnable()); |
||||
binding.switchGlonass.setChecked(Gnss.getInstance().getGps().isGlonassEnable()); |
||||
binding.switchBeidou.setChecked(Gnss.getInstance().getGps().isBeidouEnable()); |
||||
binding.switchGalileo.setChecked(Gnss.getInstance().getGps().isGalileoEnable()); |
||||
binding.switchQzss.setChecked(Gnss.getInstance().getGps().isQzssEnable()); |
||||
binding.switchSbas.setChecked(Gnss.getInstance().getGps().isSbasEnable()); |
||||
binding.btnApply.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
Device.getInstance().rtkSendCommand(RtkCommand.getInstance().setSatelliteSystem(true)); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) { |
||||
switch (item.getItemId()) { |
||||
case android.R.id.home: |
||||
finish(); |
||||
break; |
||||
} |
||||
return super.onOptionsItemSelected(item); |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
package com.project.survey.ui.interfacee; |
||||
|
||||
import android.view.View; |
||||
|
||||
public interface IUIProvider { |
||||
int getLayoutId(); |
||||
|
||||
View getContentView(); |
||||
|
||||
boolean isShowTimeStatusBar(); |
||||
} |
@ -0,0 +1,46 @@ |
||||
package com.project.survey.ui.lofting |
||||
|
||||
import android.content.Context |
||||
import android.content.Intent |
||||
import com.project.survey.adapter.LoftingListAdapter |
||||
import com.project.survey.databinding.ActivityLoftingListBinding |
||||
import com.project.survey.model.LoftingListBean |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.widget.decoration.TransparentDividerDecoration |
||||
|
||||
class LoftingListActivity : BaseBindingActivity<ActivityLoftingListBinding>() { |
||||
|
||||
private val adapter by lazy { LoftingListAdapter(this) } |
||||
|
||||
companion object { |
||||
fun launch(context: Context) { |
||||
context.startActivity(Intent(context, LoftingListActivity::class.java)) |
||||
} |
||||
} |
||||
|
||||
override fun getBinding(): ActivityLoftingListBinding { |
||||
return ActivityLoftingListBinding.inflate(layoutInflater) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initAdapter() |
||||
|
||||
|
||||
} |
||||
|
||||
private fun initAdapter() { |
||||
mBinding.recyclerView.addItemDecoration(TransparentDividerDecoration(this)) |
||||
adapter.setOnItemClickListener { |
||||
|
||||
} |
||||
mBinding.recyclerView.setAdapter(adapter) |
||||
} |
||||
|
||||
override fun initData() { |
||||
val dataList = mutableListOf<LoftingListBean>() |
||||
for (i in 0 until 3) { |
||||
dataList.add(LoftingListBean()) |
||||
} |
||||
adapter.refreshData(dataList) |
||||
} |
||||
} |
@ -1,8 +1,8 @@ |
||||
package com.project.survey.activity.login |
||||
package com.project.survey.ui.login |
||||
|
||||
import android.content.Intent |
||||
import androidx.core.widget.addTextChangedListener |
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivityForgetPwdBinding |
||||
|
||||
/** |
@ -1,7 +1,7 @@ |
||||
package com.project.survey.activity.login |
||||
package com.project.survey.ui.login |
||||
|
||||
import android.content.Intent |
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivityForgetPwdInputCodeBinding |
||||
|
||||
/** |
@ -1,9 +1,9 @@ |
||||
package com.project.survey.activity.login |
||||
package com.project.survey.ui.login |
||||
|
||||
import android.content.Intent |
||||
import android.view.View |
||||
import com.project.survey.R |
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivityLoginBinding |
||||
import com.project.survey.util.Tools |
||||
|
@ -1,7 +1,7 @@ |
||||
package com.project.survey.activity.login |
||||
package com.project.survey.ui.login |
||||
|
||||
import android.util.Log |
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivityLoginInputCodeBinding |
||||
|
||||
class LoginInputCodeActivity : BaseBindingActivity<ActivityLoginInputCodeBinding>() { |
@ -1,6 +1,6 @@ |
||||
package com.project.survey.activity.login |
||||
package com.project.survey.ui.login |
||||
|
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivitySetNewPwdBinding |
||||
|
||||
/** |
@ -0,0 +1,78 @@ |
||||
package com.project.survey.ui.pointmeasure |
||||
|
||||
import android.content.Context |
||||
import android.content.Intent |
||||
import android.view.View |
||||
import androidx.core.os.bundleOf |
||||
import com.project.survey.R |
||||
import com.project.survey.databinding.ActivityPointMeasureListBinding |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
|
||||
/** |
||||
* 点测量列表 |
||||
*/ |
||||
class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBinding>() { |
||||
|
||||
companion object { |
||||
const val KEY_TYPE = "KEY_TYPE" |
||||
const val TYPE_ALL = "TYPE_ALL"//全部 |
||||
const val TYPE_SURVEY_PLAN = "TYPE_SURVEY_PLAN"//测量计划 |
||||
const val TYPE_PROJECT_MEASURE = "TYPE_PROJECT_MEASURE"//工程计量 |
||||
|
||||
fun launch(context: Context) { |
||||
context.startActivity(Intent(context, PointMeasureListActivity::class.java)) |
||||
} |
||||
} |
||||
|
||||
override fun getBinding(): ActivityPointMeasureListBinding { |
||||
return ActivityPointMeasureListBinding.inflate(layoutInflater) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initListener() |
||||
|
||||
|
||||
} |
||||
|
||||
private fun initListener() { |
||||
mBinding.tvAll.setOnClickListener { |
||||
loadFirstPage() |
||||
} |
||||
mBinding.tvSurveyPlan.setOnClickListener { |
||||
setBtnSelected(mBinding.tvSurveyPlan) |
||||
switchFragment(TYPE_SURVEY_PLAN) |
||||
} |
||||
mBinding.tvProjectMeasured.setOnClickListener { |
||||
setBtnSelected(mBinding.tvProjectMeasured) |
||||
switchFragment(TYPE_PROJECT_MEASURE) |
||||
} |
||||
} |
||||
|
||||
private fun switchFragment(type: String) { |
||||
val frament = PointMeasureListFragment() |
||||
frament.arguments = bundleOf(KEY_TYPE to type) |
||||
|
||||
val transaction = supportFragmentManager.beginTransaction() |
||||
transaction.replace(R.id.container, frament) |
||||
transaction.commit() |
||||
} |
||||
|
||||
override fun initData() { |
||||
loadFirstPage() |
||||
} |
||||
|
||||
|
||||
private fun loadFirstPage() { |
||||
setBtnSelected(mBinding.tvAll) |
||||
switchFragment(TYPE_ALL) |
||||
} |
||||
|
||||
private fun setBtnSelected(view: View) { |
||||
mBinding.tvAll.isSelected = false |
||||
mBinding.tvSurveyPlan.isSelected = false |
||||
mBinding.tvProjectMeasured.isSelected = false |
||||
|
||||
view.isSelected = true |
||||
} |
||||
|
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.project.survey.ui.pointmeasure |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.ViewGroup |
||||
import com.project.survey.adapter.PointMeasureListAdapter |
||||
import com.project.survey.databinding.FragmentPointMeasureListBinding |
||||
import com.project.survey.model.PointMeasureListBean |
||||
import com.project.survey.ui.base.BaseFragmentBinding |
||||
import com.project.survey.widget.decoration.TransparentDividerDecoration |
||||
|
||||
class PointMeasureListFragment : BaseFragmentBinding<FragmentPointMeasureListBinding>() { |
||||
|
||||
private val adapter by lazy { |
||||
PointMeasureListAdapter( |
||||
requireContext(), |
||||
getType() |
||||
) |
||||
} |
||||
|
||||
override fun getViewBinding( |
||||
inflater: LayoutInflater, |
||||
container: ViewGroup? |
||||
): FragmentPointMeasureListBinding { |
||||
return FragmentPointMeasureListBinding.inflate(inflater, container, false) |
||||
} |
||||
|
||||
override fun initView() { |
||||
initAdapter() |
||||
|
||||
} |
||||
|
||||
private fun initAdapter() { |
||||
mBinding.recyclerView.addItemDecoration(TransparentDividerDecoration(requireContext())) |
||||
adapter.setOnItemClickListener { |
||||
|
||||
} |
||||
mBinding.recyclerView.setAdapter(adapter) |
||||
} |
||||
|
||||
override fun initData() { |
||||
val dataList = mutableListOf<PointMeasureListBean>() |
||||
for (i in 0 until 3) { |
||||
dataList.add(PointMeasureListBean()) |
||||
} |
||||
adapter.refreshData(dataList) |
||||
} |
||||
|
||||
private fun getType() = getArgumentString(PointMeasureListActivity.KEY_TYPE) |
||||
} |
@ -1,10 +1,10 @@ |
||||
package com.project.survey.activity.project |
||||
package com.project.survey.ui.project |
||||
|
||||
import androidx.fragment.app.Fragment |
||||
import com.bingce.ui.TabEntity |
||||
import com.flyco.tablayout.listener.CustomTabEntity |
||||
import com.project.survey.R |
||||
import com.project.survey.activity.base.BaseBindingActivity |
||||
import com.project.survey.ui.base.BaseBindingActivity |
||||
import com.project.survey.databinding.ActivityProjectListBinding |
||||
|
||||
class ProjectListActivity : BaseBindingActivity<ActivityProjectListBinding>() { |
@ -0,0 +1,103 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.animation.Animator; |
||||
import android.animation.ValueAnimator; |
||||
import android.view.animation.Interpolator; |
||||
import android.view.animation.LinearInterpolator; |
||||
|
||||
/** |
||||
* 动画工具类 |
||||
* UpdateListener: 动画过程中通过添加此监听来回调数据 |
||||
* EndListener: 动画结束的时候通过此监听器来做一些处理 |
||||
*/ |
||||
public class AnimUtil { |
||||
|
||||
private ValueAnimator valueAnimator; |
||||
private UpdateListener updateListener; |
||||
private EndListener endListener; |
||||
private long duration; |
||||
private float start; |
||||
private float end; |
||||
private Interpolator interpolator = new LinearInterpolator(); |
||||
|
||||
public AnimUtil() { |
||||
duration = 1000; //默认动画时常1s
|
||||
start = 0.0f; |
||||
end = 1.0f; |
||||
interpolator = new LinearInterpolator();// 匀速的插值器
|
||||
} |
||||
|
||||
|
||||
public void setDuration(int timeLength) { |
||||
duration = timeLength; |
||||
} |
||||
|
||||
public void setValueAnimator(float start, float end, long duration) { |
||||
|
||||
this.start = start; |
||||
this.end = end; |
||||
this.duration = duration; |
||||
|
||||
} |
||||
|
||||
public void setInterpolator(Interpolator interpolator) { |
||||
this.interpolator = interpolator; |
||||
} |
||||
|
||||
public void startAnimator() { |
||||
if (valueAnimator != null){ |
||||
valueAnimator = null; |
||||
} |
||||
valueAnimator = ValueAnimator.ofFloat(start, end); |
||||
valueAnimator.setDuration(duration); |
||||
valueAnimator.setInterpolator(interpolator); |
||||
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
||||
@Override |
||||
public void onAnimationUpdate(ValueAnimator valueAnimator) { |
||||
|
||||
if (updateListener == null) { |
||||
return; |
||||
} |
||||
|
||||
float cur = (float) valueAnimator.getAnimatedValue(); |
||||
updateListener.progress(cur); |
||||
} |
||||
}); |
||||
valueAnimator.addListener(new Animator.AnimatorListener() { |
||||
@Override |
||||
public void onAnimationStart(Animator animator) {} |
||||
@Override |
||||
public void onAnimationEnd(Animator animator) { |
||||
if(endListener == null){ |
||||
return; |
||||
} |
||||
endListener.endUpdate(animator); |
||||
} |
||||
@Override |
||||
public void onAnimationCancel(Animator animator) {} |
||||
|
||||
@Override |
||||
public void onAnimationRepeat(Animator animator) {} |
||||
}); |
||||
valueAnimator.start(); |
||||
} |
||||
|
||||
public void addUpdateListener(UpdateListener updateListener) { |
||||
|
||||
this.updateListener = updateListener; |
||||
} |
||||
|
||||
public void addEndListner(EndListener endListener){ |
||||
this.endListener = endListener; |
||||
} |
||||
|
||||
public interface EndListener { |
||||
void endUpdate(Animator animator); |
||||
} |
||||
|
||||
public interface UpdateListener { |
||||
|
||||
void progress(float progress); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,199 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.appcompat.app.AppCompatActivity; |
||||
import androidx.core.content.ContextCompat; |
||||
|
||||
import com.bingce.autounit.TextFactory; |
||||
import com.bingce.device.Device; |
||||
import com.bingce.device.enums.DeviceTypeEnum; |
||||
import com.bingce.rtk.enums.WorkModeEnum; |
||||
import com.bingce.rtk.gnss.Gnss; |
||||
import com.bingce.rtk.model.GnssPosition; |
||||
import com.bingce.surveyorBase.databinding.ActivityBaseSurveyNewBinding; |
||||
import com.bingce.totalstation.TotalStation; |
||||
import com.bingce.totalstation.TsConfig; |
||||
import com.bingce.totalstation.enums.SetupStationModeEnum; |
||||
import com.bingce.utils.Util; |
||||
import com.gyf.immersionbar.ImmersionBar; |
||||
import com.project.survey.R; |
||||
import com.project.survey.ui.interfacee.IUIProvider; |
||||
|
||||
import java.util.Locale; |
||||
|
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public class BaseSurveyActivityUtils { |
||||
public ActivityBaseSurveyNewBinding activityBaseSurveyBinding; |
||||
public final AppCompatActivity activity; |
||||
private final IUIProvider uiProvider; |
||||
private final int onRootSetBackgroundColor; |
||||
|
||||
public BaseSurveyActivityUtils(AppCompatActivity activity, IUIProvider uiProvider, int onRootSetBackgroundColor) { |
||||
this.activity = activity; |
||||
this.uiProvider = uiProvider; |
||||
this.onRootSetBackgroundColor = onRootSetBackgroundColor; |
||||
} |
||||
|
||||
public void onCreate() { |
||||
SystemUtils.SystemVerticalScreen(activity); |
||||
activityBaseSurveyBinding = ActivityBaseSurveyNewBinding.inflate(activity.getLayoutInflater()); |
||||
activity.setContentView(activityBaseSurveyBinding.getRoot()); |
||||
int layoutId = uiProvider.getLayoutId(); |
||||
View contentView = uiProvider.getContentView(); |
||||
if (contentView == null && layoutId > 0) { |
||||
contentView = LayoutInflater.from(activity).inflate(layoutId, activityBaseSurveyBinding.baseView, false); |
||||
} |
||||
if (contentView != null) { |
||||
activityBaseSurveyBinding.baseView.addView(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); |
||||
} |
||||
|
||||
if (onRootSetBackgroundColor == -1) { |
||||
if (!uiProvider.isShowTimeStatusBar()) { |
||||
ImmersionBar.with(activity).fitsSystemWindows(true).statusBarDarkFont(false).init(); |
||||
} else { |
||||
ImmersionBar.with(activity).fitsSystemWindows(true).statusBarDarkFont(true).init(); |
||||
} |
||||
} else { |
||||
ImmersionBar.with(activity).fitsSystemWindows(true).statusBarDarkFont(true).init(); |
||||
} |
||||
|
||||
activityBaseSurveyBinding.rlBack.setOnClickListener(v -> { |
||||
activity.onBackPressed(); |
||||
}); |
||||
|
||||
resetTopStatus(); |
||||
} |
||||
|
||||
public void resetTopStatus() { |
||||
if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) { |
||||
if (TsConfig.getInstance().getSetupStationMethod().getMode() == SetupStationModeEnum.ON_TOTAL_STATION) { |
||||
activityBaseSurveyBinding.tvSolutionState.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.pivPowerIcon.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.tvPowerNum.setVisibility(View.GONE); |
||||
} else { |
||||
activityBaseSurveyBinding.tvSolutionState.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.pivPowerIcon.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvPowerNum.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.pivPowerIcon.setProgress(0); |
||||
activityBaseSurveyBinding.pivPowerIcon.setTextSize(0); |
||||
activityBaseSurveyBinding.tvSolutionState.setText(String.format("Ha %s", Util.radianToDmsString(0, 0, true))); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setText(String.format("Va %s", Util.radianToDmsString(0, 0, true))); |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setText(String.format("Hd %s", Util.formatDouble2String(0, 3))); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setText(String.format("Sd %s", Util.formatDouble2String(0, 3))); |
||||
} |
||||
activityBaseSurveyBinding.tvPoleHighHr.setText("0.000m"); |
||||
activityBaseSurveyBinding.ivPoleHighHr.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.icon_hr_high_white)); |
||||
activityBaseSurveyBinding.ivRtkStatusSatellite.setImageDrawable(ContextCompat.getDrawable(activity, R.mipmap.icon_edm_np)); |
||||
activityBaseSurveyBinding.tvRtkStatusSatellite.setText(R.string.laser); |
||||
} else { |
||||
activityBaseSurveyBinding.tvSolutionState.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.pivPowerIcon.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvPowerNum.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvSolutionState.setText(""); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setText(""); |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setText(Utils.getApp().getString(com.bingce.surveyorBase.R.string.no_data)); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setText(Utils.getApp().getString(com.bingce.surveyorBase.R.string.no_delay)); |
||||
activityBaseSurveyBinding.tvPoleHighHr.setText("0.000m"); |
||||
activityBaseSurveyBinding.tvPowerNum.setText("0%"); |
||||
activityBaseSurveyBinding.ivPoleHighHr.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.icon_pole_high_white)); |
||||
activityBaseSurveyBinding.ivRtkStatusSatellite.setImageDrawable(ContextCompat.getDrawable(activity, R.mipmap.icon_home_satellite)); |
||||
activityBaseSurveyBinding.tvRtkStatusSatellite.setText(String.format("%s %s/%s", Utils.getApp().getString(com.bingce.surveyorBase.R.string.satellite), 0, 0)); |
||||
activityBaseSurveyBinding.pivPowerIcon.setProgress(0); |
||||
activityBaseSurveyBinding.pivPowerIcon.setTextSize(0); |
||||
} |
||||
} |
||||
|
||||
public void refreshRtkStatus() { |
||||
if (Device.getInstance().deviceType != DeviceTypeEnum.DEVICE_TYPE_RTK) |
||||
return; |
||||
if (!Device.getInstance().isDeviceConnected()) { |
||||
activityBaseSurveyBinding.llRtkStatus.setVisibility(View.GONE); |
||||
return; |
||||
} |
||||
if (Gnss.getInstance().getDevice().getWorkMode() == WorkModeEnum.STATIC) { |
||||
activityBaseSurveyBinding.tvSolutionState.setText(R.string.static_mode); |
||||
} else { |
||||
activityBaseSurveyBinding.tvSolutionState.setText(GnssPosition.getInstance().getSolutionState()); |
||||
} |
||||
switch (Gnss.getInstance().getDevice().getWorkMode()) { |
||||
case ROVER: |
||||
case BASE: |
||||
if (Gnss.getInstance().getDevice().getWorkMode() == WorkModeEnum.BASE) { |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.GONE); |
||||
} else { |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.VISIBLE); |
||||
} |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setText(TextFactory.distanceFormatDouble2String("H: ", GnssPosition.getInstance().getHrms(), 3)); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setText(TextFactory.distanceFormatDouble2String("V: ", GnssPosition.getInstance().getVrms(), 3)); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setText(String.format(Locale.US, "%s%s", "延迟" + " ", GnssPosition.getInstance().getDiffAge())); |
||||
activityBaseSurveyBinding.tvRtkStatusSatellite.setText(String.format(Locale.US, "%s %s/%s", activity.getString(R.string.satellite), GnssPosition.getInstance().getSatSolutionNum(), GnssPosition.getInstance().getSatTrackNum())); |
||||
break; |
||||
case STATIC: |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.GONE); |
||||
activityBaseSurveyBinding.tvRtkStatusSatellite.setVisibility(View.GONE); |
||||
break; |
||||
} |
||||
if (Gnss.getInstance().getDevice().getPowerLevel2() >= 0) { |
||||
int title_num = Gnss.getInstance().getDevice().getPowerLevel() + Gnss.getInstance().getDevice().getPowerLevel2(); |
||||
activityBaseSurveyBinding.pivPowerIcon.setProgress(Math.round(title_num / 2f)); |
||||
activityBaseSurveyBinding.tvPowerNum.setText(Math.round(title_num / 2f) + "%"); |
||||
} else if (Gnss.getInstance().getDevice().getPowerLevel() >= 0) { |
||||
activityBaseSurveyBinding.pivPowerIcon.setProgress(Gnss.getInstance().getDevice().getPowerLevel()); |
||||
activityBaseSurveyBinding.tvPowerNum.setText(Gnss.getInstance().getDevice().getPowerLevel() + "%"); |
||||
} |
||||
activityBaseSurveyBinding.pivPowerIcon.setTextSize(0); |
||||
} |
||||
|
||||
public void refreshHaVa(double originalHa, double originalVa) { |
||||
activityBaseSurveyBinding.tvSolutionState.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.VISIBLE); |
||||
if (TotalStation.getInstance().getOriginalHa() >= 0) { |
||||
activityBaseSurveyBinding.tvSolutionState.setText(String.format("Ha %s", Util.radianToDmsString(originalHa, 0, true))); |
||||
} else { |
||||
activityBaseSurveyBinding.tvSolutionState.setText(String.format("Ha %s", activity.getString(R.string.tilt_over))); |
||||
} |
||||
if (TotalStation.getInstance().getOriginalVa() >= 0) { |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setText(String.format("Va %s", Util.radianToDmsString(originalVa, 0, true))); |
||||
} else { |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setText(String.format("Va %s", activity.getString(R.string.tilt_over))); |
||||
} |
||||
} |
||||
|
||||
public void onMeasSdAngleSuccess(double originalHa, double originalVa, double sd, double clockwiseHa, double topVa, double hd, double vd) { |
||||
activityBaseSurveyBinding.tvSolutionState.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.pivPowerIcon.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvPowerNum.setVisibility(View.VISIBLE); |
||||
activityBaseSurveyBinding.tvSolutionState.setText(String.format("Ha %s", Util.radianToDmsString(originalHa, 0, true))); |
||||
activityBaseSurveyBinding.tvRtkStatusDiffAge.setText(String.format("Va %s", Util.radianToDmsString(originalVa, 0, true))); |
||||
activityBaseSurveyBinding.tvRtkStatusHrms.setText(String.format("Hd %s", Util.formatDouble2String(hd, 3))); |
||||
activityBaseSurveyBinding.tvRtkStatusVrms.setText(String.format("Sd %s", Util.formatDouble2String(sd, 3))); |
||||
} |
||||
|
||||
public void refreshBatteryLevel(double percent) { |
||||
if (percent >= 0) { |
||||
int title_num = TotalStation.getInstance().getPowerLevel() + TotalStation.getInstance().getPowerLevel2(); |
||||
activityBaseSurveyBinding.pivPowerIcon.setProgress(Math.round(title_num / 2f)); |
||||
activityBaseSurveyBinding.tvPowerNum.setText(String.format(Locale.US, "%d%%", Math.round(title_num / 2f))); |
||||
} else { |
||||
activityBaseSurveyBinding.pivPowerIcon.setTextSize(0); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,110 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.graphics.Color; |
||||
import android.util.Log; |
||||
import android.view.View; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.appcompat.app.AlertDialog; |
||||
import androidx.core.content.ContextCompat; |
||||
import androidx.fragment.app.FragmentActivity; |
||||
import androidx.lifecycle.Lifecycle; |
||||
import androidx.lifecycle.LifecycleEventObserver; |
||||
import androidx.lifecycle.LifecycleOwner; |
||||
|
||||
import com.bingce.event.CountDownEvent; |
||||
import com.bingce.utils.ActivityProviderUtils; |
||||
import com.bingce.utils.ColorUtil; |
||||
import com.bingce.utils.IProvider; |
||||
import com.bingce.utils.SdkUtils; |
||||
import com.bingce.utils.VipManager; |
||||
import com.daimajia.numberprogressbar.NumberProgressBar; |
||||
import com.project.survey.R; |
||||
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||
|
||||
import org.greenrobot.eventbus.EventBus; |
||||
import org.greenrobot.eventbus.Subscribe; |
||||
import org.greenrobot.eventbus.ThreadMode; |
||||
|
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public class CountDownUtils extends ActivityProviderUtils { |
||||
public interface ICountDownSwitcher { |
||||
//是否启动倒计时
|
||||
boolean isVipCountDownOpen(); |
||||
} |
||||
|
||||
private final ICountDownSwitcher mSwitcher; |
||||
|
||||
public CountDownUtils(IProvider<FragmentActivity> activityIProvider) { |
||||
this(activityIProvider, () -> true); |
||||
} |
||||
|
||||
public CountDownUtils(IProvider<FragmentActivity> activityIProvider, ICountDownSwitcher switcher) { |
||||
super(activityIProvider); |
||||
activity().getLifecycle().addObserver(new LifecycleEventObserver() { |
||||
@Override |
||||
public void onStateChanged(@NonNull LifecycleOwner source, @NonNull Lifecycle.Event event) { |
||||
switch (event) { |
||||
case ON_CREATE: |
||||
EventBus.getDefault().register(CountDownUtils.this); |
||||
break; |
||||
case ON_DESTROY: |
||||
EventBus.getDefault().unregister(CountDownUtils.this); |
||||
break; |
||||
} |
||||
} |
||||
}); |
||||
mSwitcher = switcher; |
||||
} |
||||
|
||||
public void refresh(CountDownEvent event) { |
||||
if (mSwitcher != null && !mSwitcher.isVipCountDownOpen()) return; |
||||
Log.d("CountDownUtils", "vipinfo refresh:" + "needRefresh:" + event.isNeedRefresh()); |
||||
if (activity() instanceof BaseSurveyNewActivity) { |
||||
NumberProgressBar cutDownProgressBar = ((BaseSurveyNewActivity) activity()).baseSurveyActivityUtils.activityBaseSurveyBinding.cutDownProgressbar; |
||||
if (!SdkUtils.isRegCodeValidate() && SdkUtils.isVipValidate()) { |
||||
cutDownProgressBar.setVisibility(View.VISIBLE); |
||||
int maxProgress = (int) (SdkUtils.availableTimeMax() / 60 / 1000L); |
||||
cutDownProgressBar.setMax(maxProgress); |
||||
int progress = Math.max((int) (SdkUtils.availableTime() / 60 / 1000L), 0);//可用时间可能小于0
|
||||
cutDownProgressBar.setProgress(progress); |
||||
if (progress < 60) { |
||||
cutDownProgressBar.setPrefix(getString(R.string.remaining_offline_time) + progress + getString(R.string.minute) + " "); |
||||
} else { |
||||
cutDownProgressBar.setPrefix(getString(R.string.remaining_offline_time) + progress / 60 + getString(R.string.hour) + progress % 60 + getString(R.string.minute) + " "); |
||||
} |
||||
if (event.isNeedRefresh()) { |
||||
// VipManager.getInstance().surveyorSdkRefresh(activity(), ((App) Utils.getApp()).registerCodeV2, null);
|
||||
} |
||||
if (progress == 240 || progress == 180 || progress == 120 || progress == 60 || (progress > 0 && progress < 60 && progress % 10 == 0)) { |
||||
new AlertDialog.Builder(/*this*/activity()) |
||||
.setTitle(R.string.warning) |
||||
.setMessage(getString(R.string.remaining_offline_time) + progress + getString(R.string.minute) + "," + getString(R.string.the_network_reboot_software_can_reset_the_remaining_time_offline)) |
||||
.setPositiveButton(R.string.i_know, null) |
||||
.show(); |
||||
} |
||||
if (progress > 240) {//离线时间大于4小时,主题色显示
|
||||
cutDownProgressBar.setProgressTextColor(ColorUtil.getColorPrimary(/*this*/activity())); |
||||
cutDownProgressBar.setReachedBarColor(ColorUtil.getColorPrimary(/*this*/activity())); |
||||
cutDownProgressBar.setUnreachedBarColor(ColorUtil.getColorPrimary(/*this*/activity())); |
||||
} else if (progress > 120) {//离线时间2-5小时间显示橙色警告
|
||||
cutDownProgressBar.setProgressTextColor(ContextCompat.getColor(/*this*/activity(), R.color.md_orange_800)); |
||||
cutDownProgressBar.setReachedBarColor(ContextCompat.getColor(/*this*/activity(), R.color.md_orange_800)); |
||||
cutDownProgressBar.setUnreachedBarColor(ContextCompat.getColor(/*this*/activity(), R.color.md_orange_800)); |
||||
} else {//离线时间小于2小时红色警告
|
||||
cutDownProgressBar.setProgressTextColor(Color.RED); |
||||
cutDownProgressBar.setReachedBarColor(Color.RED); |
||||
cutDownProgressBar.setUnreachedBarColor(Color.RED); |
||||
} |
||||
} else { |
||||
cutDownProgressBar.setVisibility(View.GONE); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN) |
||||
public void onMessageEvent(CountDownEvent event) { |
||||
refresh(event); |
||||
} |
||||
} |
@ -0,0 +1,41 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public class DisplayUtils { |
||||
/** |
||||
* dp 转成 px |
||||
* @return |
||||
*/ |
||||
public static int dip2px(float dpVale) { |
||||
final float scale = (Utils.getApp()).getResources().getDisplayMetrics().density; |
||||
return (int) (dpVale * scale + 0.5f); |
||||
} |
||||
|
||||
/** |
||||
* px 转 dp |
||||
* @return |
||||
*/ |
||||
public static int px2dip(float pxValue) { |
||||
final float scale = (Utils.getApp()).getResources().getDisplayMetrics().density; |
||||
return (int) (pxValue / scale + 0.5f); |
||||
} |
||||
|
||||
/** |
||||
* px 转 sp |
||||
* @return |
||||
*/ |
||||
public static int px2sp(float pxValue) { |
||||
final float fontScale = (Utils.getApp()).getResources().getDisplayMetrics().scaledDensity; |
||||
return (int) (pxValue / fontScale + 0.5F); |
||||
} |
||||
|
||||
/** |
||||
* sp 转 px |
||||
* @return |
||||
*/ |
||||
public static int sp2px(float spValue) { |
||||
final float fontScale = (Utils.getApp()).getResources().getDisplayMetrics().scaledDensity; |
||||
return (int) (spValue * fontScale + 0.5F); |
||||
} |
||||
} |
@ -1,640 +1,201 @@ |
||||
/* |
||||
* Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com) |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package com.project.survey.util; |
||||
|
||||
import android.content.Context; |
||||
import static blankj.utilcode.util.ResourceUtils.getDrawable; |
||||
|
||||
import android.annotation.SuppressLint; |
||||
import android.content.res.ColorStateList; |
||||
import android.content.res.Resources; |
||||
import android.graphics.Bitmap; |
||||
import android.graphics.Canvas; |
||||
import android.graphics.Color; |
||||
import android.graphics.ColorFilter; |
||||
import android.graphics.LightingColorFilter; |
||||
import android.graphics.Matrix; |
||||
import android.graphics.Paint; |
||||
import android.graphics.PixelFormat; |
||||
import android.graphics.Rect; |
||||
import android.graphics.RectF; |
||||
import android.graphics.drawable.BitmapDrawable; |
||||
import android.graphics.drawable.Drawable; |
||||
import android.graphics.drawable.GradientDrawable; |
||||
import android.graphics.drawable.LayerDrawable; |
||||
import android.graphics.drawable.ShapeDrawable; |
||||
import android.graphics.drawable.StateListDrawable; |
||||
import android.view.View; |
||||
import android.webkit.WebView; |
||||
import android.widget.ImageView; |
||||
import android.widget.ScrollView; |
||||
import android.widget.TextView; |
||||
|
||||
import androidx.annotation.ColorInt; |
||||
import androidx.annotation.DrawableRes; |
||||
import androidx.annotation.FloatRange; |
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.appcompat.content.res.AppCompatResources; |
||||
import androidx.core.graphics.drawable.DrawableCompat; |
||||
import androidx.core.widget.NestedScrollView; |
||||
|
||||
import java.security.InvalidParameterException; |
||||
|
||||
/** |
||||
* Drawable工具类 |
||||
* |
||||
* @author xuexiang |
||||
* @since 2019/1/3 下午3:47 |
||||
*/ |
||||
public final class DrawableUtils { |
||||
|
||||
private DrawableUtils() { |
||||
throw new UnsupportedOperationException("u can't instantiate me..."); |
||||
} |
||||
import com.project.survey.R; |
||||
|
||||
private static final String TAG = DrawableUtils.class.getSimpleName(); |
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public class DrawableUtils { |
||||
/** |
||||
* 节省每次创建时产生的开销,但要注意多线程操作synchronized |
||||
*/ |
||||
private static final Canvas CANVAS = new Canvas(); |
||||
|
||||
/** |
||||
* 从一个view创建Bitmap。 |
||||
* 注意点:绘制之前要清掉 View 的焦点,因为焦点可能会改变一个 View 的 UI 状态。 |
||||
* 来源:https://github.com/tyrantgit/ExplosionField
|
||||
* 对目标Drawable 进行着色 |
||||
* |
||||
* @param view 传入一个 View,会获取这个 View 的内容创建 Bitmap。 |
||||
* @param scale 缩放比例,对创建的 Bitmap 进行缩放,数值支持从 0 到 1。 |
||||
*/ |
||||
public static Bitmap createBitmapFromView(View view, float scale) { |
||||
if (view instanceof ImageView) { |
||||
Drawable drawable = ((ImageView) view).getDrawable(); |
||||
if (drawable != null && drawable instanceof BitmapDrawable) { |
||||
return ((BitmapDrawable) drawable).getBitmap(); |
||||
} |
||||
} |
||||
view.clearFocus(); |
||||
int viewHeight = 0; |
||||
if (view instanceof ScrollView) { |
||||
for (int i = 0; i < ((ScrollView) view).getChildCount(); i++) { |
||||
viewHeight += ((ScrollView) view).getChildAt(i).getHeight(); |
||||
} |
||||
} else if (view instanceof NestedScrollView) { |
||||
for (int i = 0; i < ((NestedScrollView) view).getChildCount(); i++) { |
||||
viewHeight += ((NestedScrollView) view).getChildAt(i).getHeight(); |
||||
} |
||||
} else { |
||||
viewHeight = view.getHeight(); |
||||
} |
||||
|
||||
Bitmap bitmap = createBitmapSafely((int) (view.getWidth() * scale), |
||||
(int) (viewHeight * scale), Bitmap.Config.ARGB_8888, 1); |
||||
if (bitmap != null) { |
||||
synchronized (CANVAS) { |
||||
Canvas canvas = CANVAS; |
||||
canvas.setBitmap(bitmap); |
||||
canvas.save(); |
||||
// 防止 View 上面有些区域空白导致最终 Bitmap 上有些区域变黑
|
||||
canvas.drawColor(Color.WHITE); |
||||
canvas.scale(scale, scale); |
||||
view.draw(canvas); |
||||
canvas.restore(); |
||||
canvas.setBitmap(null); |
||||
} |
||||
} |
||||
return bitmap; |
||||
} |
||||
|
||||
|
||||
public static Bitmap createBitmapFromWebView(WebView view) { |
||||
return createBitmapFromWebView(view, 1f); |
||||
} |
||||
|
||||
public static Bitmap createBitmapFromWebView(WebView view, float scale) { |
||||
view.clearFocus(); |
||||
int viewHeight = (int) (view.getContentHeight() * view.getScale()); |
||||
Bitmap bitmap = createBitmapSafely((int) (view.getWidth() * scale), (int) (viewHeight * scale), Bitmap.Config.ARGB_8888, 1); |
||||
|
||||
int unitHeight = view.getHeight(); |
||||
int bottom = viewHeight; |
||||
|
||||
if (bitmap != null) { |
||||
synchronized (CANVAS) { |
||||
Canvas canvas = CANVAS; |
||||
canvas.setBitmap(bitmap); |
||||
// 防止 View 上面有些区域空白导致最终 Bitmap 上有些区域变黑
|
||||
canvas.drawColor(Color.WHITE); |
||||
canvas.scale(scale, scale); |
||||
while (bottom > 0) { |
||||
if (bottom < unitHeight) { |
||||
bottom = 0; |
||||
} else { |
||||
bottom -= unitHeight; |
||||
} |
||||
canvas.save(); |
||||
canvas.clipRect(0, bottom, canvas.getWidth(), bottom + unitHeight); |
||||
view.scrollTo(0, bottom); |
||||
view.draw(canvas); |
||||
canvas.restore(); |
||||
} |
||||
canvas.setBitmap(null); |
||||
} |
||||
} |
||||
return bitmap; |
||||
} |
||||
|
||||
|
||||
public static Bitmap createBitmapFromView(View view) { |
||||
return createBitmapFromView(view, 1f); |
||||
} |
||||
|
||||
/** |
||||
* 从一个view创建Bitmap。把view的区域截掉leftCrop/topCrop/rightCrop/bottomCrop |
||||
* @param drawable 目标Drawable |
||||
* @param color 着色的颜色值 |
||||
* @return 着色处理后的Drawable |
||||
*/ |
||||
public static Bitmap createBitmapFromView(View view, int leftCrop, int topCrop, int rightCrop, int bottomCrop) { |
||||
Bitmap originBitmap = DrawableUtils.createBitmapFromView(view); |
||||
if (originBitmap == null) { |
||||
return null; |
||||
} |
||||
Bitmap cutBitmap = createBitmapSafely(view.getWidth() - rightCrop - leftCrop, view.getHeight() - topCrop - bottomCrop, Bitmap.Config.ARGB_8888, 1); |
||||
if (cutBitmap == null) { |
||||
return null; |
||||
} |
||||
Canvas canvas = new Canvas(cutBitmap); |
||||
Rect src = new Rect(leftCrop, topCrop, view.getWidth() - rightCrop, view.getHeight() - bottomCrop); |
||||
Rect dest = new Rect(0, 0, view.getWidth() - rightCrop - leftCrop, view.getHeight() - topCrop - bottomCrop); |
||||
// 防止 View 上面有些区域空白导致最终 Bitmap 上有些区域变黑
|
||||
canvas.drawColor(Color.WHITE); |
||||
canvas.drawBitmap(originBitmap, src, dest, null); |
||||
originBitmap.recycle(); |
||||
return cutBitmap; |
||||
public static Drawable tintModifyColorDrawable(@NonNull Drawable drawable, int color) { |
||||
Drawable wrappedDrawable = DrawableCompat.wrap(drawable); |
||||
DrawableCompat.setTint(wrappedDrawable, color); |
||||
return wrappedDrawable; |
||||
} |
||||
|
||||
/** |
||||
* 安全的创建bitmap。 |
||||
* 如果新建 Bitmap 时产生了 OOM,可以主动进行一次 GC - System.gc(),然后再次尝试创建。 |
||||
* 对目标Drawable 进行着色 |
||||
* |
||||
* @param width Bitmap 宽度。 |
||||
* @param height Bitmap 高度。 |
||||
* @param config 传入一个 Bitmap.Config。 |
||||
* @param retryCount 创建 Bitmap 时产生 OOM 后,主动重试的次数。 |
||||
* @return 返回创建的 Bitmap。 |
||||
* @param drawable 目标(int) Drawable |
||||
* @param color 着色的颜色值 |
||||
* @return 着色处理后的Drawable |
||||
*/ |
||||
public static Bitmap createBitmapSafely(int width, int height, Bitmap.Config config, int retryCount) { |
||||
//width and height must be > 0
|
||||
if (width <= 0 || height <= 0) { |
||||
return null; |
||||
} |
||||
try { |
||||
return Bitmap.createBitmap(width, height, config); |
||||
} catch (OutOfMemoryError e) { |
||||
e.printStackTrace(); |
||||
if (retryCount > 0) { |
||||
System.gc(); |
||||
return createBitmapSafely(width, height, config, retryCount - 1); |
||||
} |
||||
return null; |
||||
} |
||||
public static Drawable tintModifyColorDrawable(@NonNull int drawable, int color) { |
||||
Drawable wrappedDrawable = DrawableCompat.wrap(getDrawable(drawable)); |
||||
DrawableCompat.setTint(wrappedDrawable, (Utils.getApp()).getResources().getColor(color)); |
||||
return wrappedDrawable; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 安全的创建bitmap。 |
||||
* 如果新建 Bitmap 时产生了 OOM,可以主动进行一次 GC - System.gc(),然后再次尝试创建。 |
||||
* 对目标Drawable 进行着色 |
||||
* |
||||
* @param source 原图片 |
||||
* @param x 源中第一个像素的x坐标 |
||||
* @param y 源中第一个像素的y坐标 |
||||
* @param width 一行像素点的数量 |
||||
* @param height 行数 |
||||
* @param retryCount 创建 Bitmap 时产生 OOM 后,主动重试的次数。 |
||||
* @return 返回创建的 Bitmap。 |
||||
* @param drawable 目标Drawable |
||||
* @param colors 着色值 |
||||
* @return 着色处理后的Drawable |
||||
*/ |
||||
public static Bitmap createBitmapSafely(@NonNull Bitmap source, int x, int y, int width, int height, int retryCount) { |
||||
if (x < 0 || y < 0 || width <= 0 || height <= 0) { |
||||
return null; |
||||
} |
||||
try { |
||||
return Bitmap.createBitmap(source, x, y, width, height); |
||||
} catch (IllegalArgumentException e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} catch (OutOfMemoryError e) { |
||||
e.printStackTrace(); |
||||
if (retryCount > 0) { |
||||
System.gc(); |
||||
return createBitmapSafely(source, x, y, width, height, retryCount - 1); |
||||
} |
||||
return null; |
||||
} |
||||
public static Drawable tintListDrawable(@NonNull Drawable drawable, ColorStateList colors) { |
||||
Drawable wrappedDrawable = DrawableCompat.wrap(drawable); |
||||
// 进行着色
|
||||
DrawableCompat.setTintList(wrappedDrawable, colors); |
||||
return wrappedDrawable; |
||||
} |
||||
|
||||
/** |
||||
* 创建一张指定大小的纯色图片,支持圆角 |
||||
* |
||||
* @param resources Resources对象,用于创建BitmapDrawable |
||||
* @param width 图片的宽度 |
||||
* @param height 图片的高度 |
||||
* @param cornerRadius 图片的圆角,不需要则传0 |
||||
* @param filledColor 图片的填充色 |
||||
* @return 指定大小的纯色图片 |
||||
* 修改矢量图标的颜色 |
||||
* @param imageView |
||||
* @param icVector |
||||
*/ |
||||
public static BitmapDrawable createDrawableWithSize(Resources resources, int width, int height, int cornerRadius, @ColorInt int filledColor) { |
||||
Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); |
||||
Canvas canvas = new Canvas(output); |
||||
|
||||
if (filledColor == 0) { |
||||
filledColor = Color.TRANSPARENT; |
||||
} |
||||
if (cornerRadius > 0) { |
||||
Paint paint = new Paint(); |
||||
paint.setAntiAlias(true); |
||||
paint.setStyle(Paint.Style.FILL); |
||||
paint.setColor(filledColor); |
||||
canvas.drawRoundRect(new RectF(0, 0, width, height), cornerRadius, cornerRadius, paint); |
||||
} else { |
||||
canvas.drawColor(filledColor); |
||||
} |
||||
return new BitmapDrawable(resources, output); |
||||
public static void tintModifyColorVector(ImageView imageView, int icVector){ |
||||
tintModifyColorVector(imageView, icVector, R.color.theme_green); |
||||
} |
||||
|
||||
/** |
||||
* 设置Drawable的颜色 |
||||
* <b>这里不对Drawable进行mutate(),会影响到所有用到这个Drawable的地方,如果要避免,请先自行mutate()</b> |
||||
*/ |
||||
public static ColorFilter setDrawableTintColor(Drawable drawable, @ColorInt int tintColor) { |
||||
LightingColorFilter colorFilter = new LightingColorFilter(Color.argb(255, 0, 0, 0), tintColor); |
||||
if (drawable != null) { |
||||
drawable.setColorFilter(colorFilter); |
||||
} |
||||
return colorFilter; |
||||
public static void tintModifyColorVector(ImageView imageView, int icVector, int color){ |
||||
imageView.setImageDrawable(DrawableUtils.tintModifyColorDrawable(icVector, color)); |
||||
} |
||||
|
||||
/** |
||||
* 创建一张渐变图片,支持韵脚。 |
||||
* |
||||
* @param startColor 渐变开始色 |
||||
* @param endColor 渐变结束色 |
||||
* @param radius 圆角大小 |
||||
* @param centerX 渐变中心点 X 轴坐标 |
||||
* @param centerY 渐变中心点 Y 轴坐标 |
||||
* @return 返回所创建的渐变图片。 |
||||
* 设置按压前后矢量图标的状态 |
||||
* @param imageView |
||||
* @param icVector |
||||
*/ |
||||
public static GradientDrawable createCircleGradientDrawable(@ColorInt int startColor, |
||||
@ColorInt int endColor, int radius, |
||||
@FloatRange(from = 0f, to = 1f) float centerX, |
||||
@FloatRange(from = 0f, to = 1f) float centerY) { |
||||
GradientDrawable gradientDrawable = new GradientDrawable(); |
||||
gradientDrawable.setColors(new int[]{ |
||||
startColor, |
||||
endColor |
||||
}); |
||||
gradientDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT); |
||||
gradientDrawable.setGradientRadius(radius); |
||||
gradientDrawable.setGradientCenter(centerX, centerY); |
||||
return gradientDrawable; |
||||
public static void setClickVectorEffect(ImageView imageView, int icVector){ |
||||
setClickVectorEffect(imageView, icVector, (Utils.getApp()).getResources().getColor(R.color.theme_green_press), (Utils.getApp()).getResources().getColor(R.color.theme_green)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 动态创建带上分隔线或下分隔线的Drawable。 |
||||
* |
||||
* @param separatorColor 分割线颜色。 |
||||
* @param bgColor Drawable 的背景色。 |
||||
* @param top true 则分割线为上分割线,false 则为下分割线。 |
||||
* @return 返回所创建的 Drawable。 |
||||
*/ |
||||
public static LayerDrawable createItemSeparatorBg(@ColorInt int separatorColor, @ColorInt int bgColor, int separatorHeight, boolean top) { |
||||
|
||||
ShapeDrawable separator = new ShapeDrawable(); |
||||
separator.getPaint().setStyle(Paint.Style.FILL); |
||||
separator.getPaint().setColor(separatorColor); |
||||
|
||||
ShapeDrawable bg = new ShapeDrawable(); |
||||
bg.getPaint().setStyle(Paint.Style.FILL); |
||||
bg.getPaint().setColor(bgColor); |
||||
|
||||
Drawable[] layers = {separator, bg}; |
||||
LayerDrawable layerDrawable = new LayerDrawable(layers); |
||||
|
||||
layerDrawable.setLayerInset(1, 0, top ? separatorHeight : 0, 0, top ? 0 : separatorHeight); |
||||
return layerDrawable; |
||||
public static void setClickVectorEffect(ImageView imageView, int icVector, int pressColor, int normalColor){ |
||||
//状态
|
||||
int[][] states = new int[2][]; |
||||
//按下
|
||||
states[0] = new int[] {android.R.attr.state_pressed}; |
||||
//默认
|
||||
states[1] = new int[] {}; |
||||
//状态对应颜色值(按下,默认)
|
||||
int[] colors = new int[] {pressColor, normalColor}; |
||||
ColorStateList colorList = new ColorStateList(states, colors); |
||||
imageView.setImageDrawable(tintListDrawable(getDrawable(icVector),colorList)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 创建一张指定大小的圆形图片,并附带文字 |
||||
* |
||||
* @param resources Resources对象,用于创建BitmapDrawable |
||||
* @param size 图片的宽度 |
||||
* @param filledColor 图片的填充色 |
||||
* @param text 文字 |
||||
* @param textSize 文字大小(px) |
||||
* @param textColor 文字颜色 |
||||
* @return 指定大小的纯色图片 |
||||
* 设置按压前后文字的状态 |
||||
* @param textView |
||||
* 默认按压色白色,默认色为主题色 |
||||
*/ |
||||
public static BitmapDrawable createCircleDrawableWithText(Resources resources, int size, @ColorInt int filledColor, String text, float textSize, @ColorInt int textColor) { |
||||
if (size <= 0) { |
||||
throw new InvalidParameterException("bitmap size must be > 0!"); |
||||
} |
||||
if (textSize <= 0) { |
||||
throw new InvalidParameterException("text size must be > 0!"); |
||||
} |
||||
Bitmap output = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); |
||||
Canvas canvas = new Canvas(output); |
||||
canvas.drawColor(Color.TRANSPARENT); |
||||
// 画圆
|
||||
int radius = size / 2; |
||||
Paint paint = new Paint(); |
||||
paint.setAntiAlias(true); |
||||
paint.setStyle(Paint.Style.FILL); |
||||
paint.setColor(filledColor); |
||||
canvas.drawCircle(radius, radius, radius, paint); |
||||
// 画文字
|
||||
paint.setColor(textColor); |
||||
paint.setTextSize(textSize); |
||||
paint.setTextAlign(Paint.Align.CENTER); |
||||
float baseline = radius + getBaselineDistance(paint); |
||||
canvas.drawText(text, radius, baseline, paint); |
||||
return new BitmapDrawable(resources, output); |
||||
public static void setClickTextEffect(TextView textView){ |
||||
setClickTextEffect(textView, R.color.theme_green_press, R.color.theme_green); |
||||
} |
||||
|
||||
/** |
||||
* 获取画笔的基线距离 |
||||
* |
||||
* @param paint 画笔 |
||||
* @return 基线距离 |
||||
*/ |
||||
public static float getBaselineDistance(@NonNull Paint paint) { |
||||
Paint.FontMetrics fontMetrics = paint.getFontMetrics(); |
||||
return (fontMetrics.bottom - fontMetrics.top) / 2 - fontMetrics.bottom; |
||||
public static void setClickTextEffect(TextView textView, int pressColor, int normalColor){ |
||||
//状态
|
||||
int[][] states = new int[2][]; |
||||
//按下
|
||||
states[0] = new int[] {android.R.attr.state_pressed}; |
||||
//默认
|
||||
states[1] = new int[] {}; |
||||
//状态对应颜色值(按下,默认)
|
||||
int[] colors = new int[] {(Utils.getApp()).getResources().getColor(pressColor), (Utils.getApp()).getResources().getColor(normalColor)}; |
||||
ColorStateList colorList = new ColorStateList(states, colors); |
||||
textView.setTextColor(colorList); |
||||
} |
||||
|
||||
/////////////// StateListDrawable /////////////////////
|
||||
|
||||
/** |
||||
* 实体 得到随机色 状态选择器 |
||||
* |
||||
* @param cornerRadius 圆角半径 |
||||
* @return 状态选择器 |
||||
* 设置按压前后View的状态 |
||||
* @param view |
||||
*/ |
||||
public static StateListDrawable getDrawable(int cornerRadius) { |
||||
return getDrawable(cornerRadius, ColorUtils.getRandomColor()); |
||||
} |
||||
|
||||
/** |
||||
* 实体 按下的颜色加深 |
||||
* |
||||
* @param cornerRadius 圆角半径 |
||||
* @param normalColor 正常的颜色 |
||||
* @return 状态选择器 |
||||
*/ |
||||
public static final int RADIUS_ALL = 0; |
||||
public static final int RADIUS_BOTTOM = RADIUS_ALL + 1; |
||||
public static final int RADIUS_LEFT = RADIUS_BOTTOM + 1; |
||||
public static final int RADIUS_RIGHT = RADIUS_LEFT + 1; |
||||
public static final int RADIUS_TOP = RADIUS_RIGHT + 1; |
||||
|
||||
public static StateListDrawable getDrawable(int cornerRadius, int normalColor) { |
||||
return getDrawable(cornerRadius, ColorUtils.darker(normalColor, 0.8F), normalColor); |
||||
public static void setClickBackgroundEffect(View view){ |
||||
setClickBackgroundEffect(view, R.color.theme_green_press, R.color.theme_green,0, RADIUS_ALL); |
||||
} |
||||
|
||||
/** |
||||
* 实体 状态选择器 |
||||
* |
||||
* @param cornerRadius 圆角半径 |
||||
* @param pressedColor 按下颜色 |
||||
* @param normalColor 正常的颜色 |
||||
* @return 状态选择器 |
||||
*/ |
||||
public static StateListDrawable getDrawable(int cornerRadius, int pressedColor, int normalColor) { |
||||
return getStateListDrawable(getSolidRectDrawable(cornerRadius, pressedColor), getSolidRectDrawable(cornerRadius, normalColor)); |
||||
public static void setClickBackgroundEffect(View view, int dpStroke){ |
||||
setClickBackgroundEffect(view, R.color.theme_green_press, R.color.theme_green, dpStroke, RADIUS_ALL); |
||||
} |
||||
|
||||
/** |
||||
* 背景选择器 |
||||
* |
||||
* @param pressedDrawable 按下状态的Drawable |
||||
* @param normalDrawable 正常状态的Drawable |
||||
* @return 状态选择器 |
||||
*/ |
||||
public static StateListDrawable getStateListDrawable(Drawable pressedDrawable, Drawable normalDrawable) { |
||||
StateListDrawable stateListDrawable = new StateListDrawable(); |
||||
stateListDrawable.addState(new int[]{android.R.attr.state_enabled, android.R.attr.state_pressed}, pressedDrawable); |
||||
stateListDrawable.addState(new int[]{android.R.attr.state_enabled}, normalDrawable); |
||||
//设置不能用的状态
|
||||
//默认其他状态背景
|
||||
GradientDrawable gray = getSolidRectDrawable(10, Color.GRAY); |
||||
stateListDrawable.addState(new int[]{}, gray); |
||||
return stateListDrawable; |
||||
public static void setClickBackgroundEffect(View view, int dpStroke, int radiusPosition){ |
||||
setClickBackgroundEffect(view, R.color.theme_green_press, R.color.theme_green, dpStroke, radiusPosition); |
||||
} |
||||
|
||||
/** |
||||
* 得到实心的drawable, 一般作为选中,点中的效果 |
||||
* |
||||
* @param cornerRadius 圆角半径 |
||||
* @param solidColor 实心颜色 |
||||
* @return 得到实心效果 |
||||
*/ |
||||
public static GradientDrawable getSolidRectDrawable(int cornerRadius, int solidColor) { |
||||
GradientDrawable gradientDrawable = new GradientDrawable(); |
||||
// 设置矩形的圆角半径
|
||||
gradientDrawable.setCornerRadius(cornerRadius); |
||||
// 设置绘画图片色值
|
||||
gradientDrawable.setColor(solidColor); |
||||
// 绘画的是矩形
|
||||
gradientDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT); |
||||
return gradientDrawable; |
||||
public static void setClickBackgroundEffect(View view, int pressColor, int normalColor, int dpStroke){ |
||||
setClickBackgroundEffect(view, pressColor, normalColor, dpStroke, RADIUS_ALL); |
||||
} |
||||
|
||||
/** |
||||
* 给drawable上色 |
||||
* |
||||
* @param drawable 图像 |
||||
* @param tint 颜色 |
||||
* @return drawable |
||||
*/ |
||||
public static Drawable setTint(final Drawable drawable, @ColorInt int tint) { |
||||
if (drawable != null) { |
||||
DrawableCompat.setTint(drawable, tint); |
||||
} |
||||
return drawable; |
||||
} |
||||
public static void setClickBackgroundEffect(View view, int pressColor, int normalColor, int dpStroke, int radiusPosition){ |
||||
|
||||
/** |
||||
* 给drawable上色 |
||||
* |
||||
* @param drawable 图像 |
||||
* @param tint 颜色 |
||||
* @return drawable |
||||
*/ |
||||
public static Drawable setTintList(final Drawable drawable, @Nullable ColorStateList tint) { |
||||
if (drawable != null) { |
||||
DrawableCompat.setTintList(drawable, tint); |
||||
int radiusLeftUpValue = 0; |
||||
int radiusLeftDownValue = 0; |
||||
int radiusRightUpValue = 0; |
||||
int radiusRightDownValue = 0; |
||||
switch (radiusPosition){ |
||||
case RADIUS_ALL: |
||||
radiusLeftUpValue = DisplayUtils.dip2px(dpStroke); |
||||
radiusLeftDownValue = DisplayUtils.dip2px(dpStroke); |
||||
radiusRightUpValue = DisplayUtils.dip2px(dpStroke); |
||||
radiusRightDownValue = DisplayUtils.dip2px(dpStroke); |
||||
break; |
||||
case RADIUS_LEFT: |
||||
radiusLeftUpValue = DisplayUtils.dip2px(dpStroke); |
||||
radiusLeftDownValue = DisplayUtils.dip2px(dpStroke); |
||||
break; |
||||
case RADIUS_RIGHT: |
||||
radiusRightUpValue = DisplayUtils.dip2px(dpStroke); |
||||
radiusRightDownValue = DisplayUtils.dip2px(dpStroke); |
||||
break; |
||||
case RADIUS_TOP: |
||||
radiusLeftUpValue = DisplayUtils.dip2px(dpStroke); |
||||
radiusRightUpValue = DisplayUtils.dip2px(dpStroke); |
||||
break; |
||||
case RADIUS_BOTTOM: |
||||
radiusLeftDownValue = DisplayUtils.dip2px(dpStroke); |
||||
radiusRightDownValue = DisplayUtils.dip2px(dpStroke); |
||||
break; |
||||
} |
||||
return drawable; |
||||
} |
||||
|
||||
/////////////// VectorDrawable /////////////////////
|
||||
|
||||
@Nullable |
||||
public static Drawable getVectorDrawable(Context context, @DrawableRes int resVector) { |
||||
try { |
||||
return AppCompatResources.getDrawable(context, resVector); |
||||
} catch (Exception e) { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public static Bitmap vectorDrawableToBitmap(Context context, @DrawableRes int resVector) { |
||||
Drawable drawable = getVectorDrawable(context, resVector); |
||||
if (drawable != null) { |
||||
return drawable2Bitmap(drawable); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/////////////// VectorDrawable /////////////////////
|
||||
|
||||
/** |
||||
* 获取支持RTL布局的drawable【如果是RTL布局就旋转180度】 |
||||
* |
||||
* @param src 原drawable |
||||
* @return |
||||
*/ |
||||
public static Drawable getSupportRTLDrawable(@NonNull Context context, Drawable src) { |
||||
return getSupportRTLDrawable(context, src, false); |
||||
Drawable normal,press; |
||||
StateListDrawable drawable = new StateListDrawable(); |
||||
press = DrawableUtils.setShapeColor((Utils.getApp()).getResources().getColor(pressColor),new float[]{radiusLeftUpValue,radiusLeftUpValue,radiusRightUpValue,radiusRightUpValue,radiusRightDownValue,radiusRightDownValue,radiusLeftDownValue,radiusLeftDownValue}); |
||||
normal = DrawableUtils.setShapeColor((Utils.getApp()).getResources().getColor(normalColor),new float[]{radiusLeftUpValue,radiusLeftUpValue,radiusRightUpValue,radiusRightUpValue,radiusRightDownValue,radiusRightDownValue,radiusLeftDownValue,radiusLeftDownValue}); |
||||
drawable.addState(new int[]{android.R.attr.state_pressed},press); |
||||
drawable.addState(new int[]{-android.R.attr.state_pressed},normal); |
||||
view.setBackgroundDrawable(drawable); |
||||
} |
||||
|
||||
/** |
||||
* 获取支持RTL布局的drawable【如果是RTL布局就旋转180度】 |
||||
* 设置圆角背景 |
||||
* |
||||
* @param context |
||||
* @param src 原drawable |
||||
* @param |
||||
* @param radii new float[] { r0, r0, r1, r1, r2, r2, r3,r3 } |
||||
* 设置图片四个角圆形半径:1、2两个参数表示左上角,3、4表示右上角,5、6表示右下角,7、8表示左下角 |
||||
* @return |
||||
*/ |
||||
public static Drawable getSupportRTLDrawable(@NonNull Context context, Drawable src, boolean recycle) { |
||||
if (ResUtils.isRtl(context)) { |
||||
return rotate(src, 180, 0, 0, recycle); |
||||
} |
||||
return src; |
||||
} |
||||
|
||||
/** |
||||
* Return the rotated drawable. |
||||
* |
||||
* @param src The source of drawable. |
||||
* @param degrees The number of degrees. |
||||
* @param px The x coordinate of the pivot point. |
||||
* @param py The y coordinate of the pivot point. |
||||
* @param recycle True to recycle the source of drawable, false otherwise. |
||||
* @return the rotated drawable |
||||
*/ |
||||
public static Drawable rotate(final Drawable src, |
||||
final int degrees, |
||||
final float px, |
||||
final float py, |
||||
final boolean recycle) { |
||||
return bitmap2Drawable(rotate(drawable2Bitmap(src), degrees, px, py, recycle)); |
||||
} |
||||
|
||||
/** |
||||
* Return the rotated bitmap. |
||||
* |
||||
* @param src The source of bitmap. |
||||
* @param degrees The number of degrees. |
||||
* @param px The x coordinate of the pivot point. |
||||
* @param py The y coordinate of the pivot point. |
||||
* @param recycle True to recycle the source of bitmap, false otherwise. |
||||
* @return the rotated bitmap |
||||
*/ |
||||
public static Bitmap rotate(final Bitmap src, |
||||
final int degrees, |
||||
final float px, |
||||
final float py, |
||||
final boolean recycle) { |
||||
if (isEmptyBitmap(src)) { |
||||
return null; |
||||
} |
||||
if (src.isRecycled()) { |
||||
return null; |
||||
} |
||||
if (degrees == 0) { |
||||
return src; |
||||
} |
||||
Matrix matrix = new Matrix(); |
||||
matrix.setRotate(degrees, px, py); |
||||
Bitmap ret = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true); |
||||
if (recycle && !src.isRecycled()) { |
||||
src.recycle(); |
||||
} |
||||
return ret; |
||||
} |
||||
|
||||
private static boolean isEmptyBitmap(final Bitmap src) { |
||||
return src == null || src.getWidth() == 0 || src.getHeight() == 0; |
||||
} |
||||
|
||||
/** |
||||
* 获取图片 |
||||
* |
||||
* @param context 上下文 |
||||
* @param resId 图片资源 |
||||
* @return 图片 |
||||
*/ |
||||
public static Bitmap getBitmapByDrawableId(Context context, @DrawableRes int resId) { |
||||
return drawable2Bitmap(ResUtils.getDrawable(context, resId)); |
||||
} |
||||
|
||||
/** |
||||
* Drawable to bitmap. |
||||
* |
||||
* @param drawable The drawable. |
||||
* @return bitmap |
||||
*/ |
||||
public static Bitmap drawable2Bitmap(final Drawable drawable) { |
||||
if (drawable == null) { |
||||
return null; |
||||
} |
||||
if (drawable instanceof BitmapDrawable) { |
||||
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; |
||||
if (bitmapDrawable.getBitmap() != null) { |
||||
return bitmapDrawable.getBitmap(); |
||||
} |
||||
} |
||||
Bitmap bitmap; |
||||
if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) { |
||||
bitmap = Bitmap.createBitmap(1, 1, |
||||
drawable.getOpacity() != PixelFormat.OPAQUE |
||||
? Bitmap.Config.ARGB_8888 |
||||
: Bitmap.Config.RGB_565); |
||||
} else { |
||||
bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), |
||||
drawable.getIntrinsicHeight(), |
||||
drawable.getOpacity() != PixelFormat.OPAQUE |
||||
? Bitmap.Config.ARGB_8888 |
||||
: Bitmap.Config.RGB_565); |
||||
} |
||||
Canvas canvas = new Canvas(bitmap); |
||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); |
||||
drawable.draw(canvas); |
||||
return bitmap; |
||||
} |
||||
|
||||
/** |
||||
* Bitmap to drawable. |
||||
* |
||||
* @param bitmap The bitmap. |
||||
* @return drawable |
||||
*/ |
||||
public static Drawable bitmap2Drawable(final Bitmap bitmap) { |
||||
return bitmap == null ? null : new BitmapDrawable(ResUtils.getResources(), bitmap); |
||||
@SuppressLint("WrongConstant") |
||||
public static GradientDrawable setShapeColor(int color, float[] radii) { |
||||
GradientDrawable drawable = new GradientDrawable(); |
||||
drawable.setShape(GradientDrawable.RECTANGLE); |
||||
drawable.setGradientType(GradientDrawable.RECTANGLE); |
||||
drawable.setCornerRadii(radii); |
||||
drawable.setColor(color); |
||||
return drawable; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,396 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.annotation.SuppressLint; |
||||
import android.app.Activity; |
||||
import android.bluetooth.BluetoothAdapter; |
||||
import android.bluetooth.BluetoothDevice; |
||||
import android.content.ClipData; |
||||
import android.content.ClipboardManager; |
||||
import android.content.Context; |
||||
import android.content.pm.ActivityInfo; |
||||
import android.net.ConnectivityManager; |
||||
import android.net.NetworkInfo; |
||||
import android.net.wifi.WifiManager; |
||||
import android.os.Environment; |
||||
import android.os.ResultReceiver; |
||||
import android.text.TextUtils; |
||||
import android.util.Log; |
||||
import android.view.Display; |
||||
import android.view.View; |
||||
import android.view.WindowManager; |
||||
import android.view.inputmethod.InputMethodManager; |
||||
import android.widget.LinearLayout; |
||||
|
||||
import androidx.preference.PreferenceManager; |
||||
|
||||
import com.bingce.device.Device; |
||||
import com.bingce.device.enums.DeviceTypeEnum; |
||||
import com.bingce.log.BCLog; |
||||
import com.bingce.totalstation.event.TsUpdateBatteryEvent; |
||||
import com.gyf.immersionbar.ImmersionBar; |
||||
import com.project.survey.R; |
||||
|
||||
import org.greenrobot.eventbus.EventBus; |
||||
|
||||
import java.io.File; |
||||
import java.lang.reflect.Field; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.lang.reflect.Method; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Calendar; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.UUID; |
||||
|
||||
import blankj.utilcode.util.ActivityUtils; |
||||
import blankj.utilcode.util.KeyboardUtils; |
||||
import blankj.utilcode.util.ToastUtils; |
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public class SystemUtils { |
||||
|
||||
/** |
||||
* 适配手机底部返回键(例如:小米底部横线返回) |
||||
*/ |
||||
public static void SystemBottomBack(Activity activity) { |
||||
//MIUI系统底部返回键适配
|
||||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
||||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //设置沉浸式状态栏,在MIUI系统中,状态栏背景透明。原生系统中,状态栏背景半透明。
|
||||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); //设置沉浸式虚拟键,在MIUI系统中,虚拟键背景透明。原生系统中,虚拟键背景半透明。
|
||||
} |
||||
|
||||
/** |
||||
* 适配显示出沉浸式状态栏的高度 |
||||
*/ |
||||
public static void SystemTopStatusBar(Activity activity, View view) { |
||||
int hight = ImmersionBar.getStatusBarHeight(activity); |
||||
LinearLayout.LayoutParams searchParams = (LinearLayout.LayoutParams) view.getLayoutParams(); |
||||
searchParams.topMargin = hight; |
||||
view.setLayoutParams(searchParams); |
||||
} |
||||
|
||||
/** |
||||
* 禁止App旋转,只能竖屏 |
||||
*/ |
||||
@SuppressLint("SourceLockedOrientationActivity") |
||||
public static void SystemVerticalScreen(Activity activity) { |
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
||||
} |
||||
|
||||
/** |
||||
* 隐藏软键盘(只适用于Activity,不适用于Fragment) |
||||
*/ |
||||
public static void hideSoftKeyboard() { |
||||
Activity act = ActivityUtils.getTopActivity(); |
||||
if (act != null) { |
||||
if (act.getCurrentFocus() != null) { |
||||
InputMethodManager inputMethodManager = (InputMethodManager) act.getSystemService(Activity.INPUT_METHOD_SERVICE); |
||||
inputMethodManager.hideSoftInputFromWindow(act.getCurrentFocus().getWindowToken(), 0); |
||||
} else { |
||||
if (KeyboardUtils.isSoftInputVisible(act)) |
||||
KeyboardUtils.toggleSoftInput(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 隐藏软键盘(可用于Activity,Fragment) |
||||
* |
||||
* @param viewList 需要放的是当前界面所有触发软键盘弹出的控件 |
||||
*/ |
||||
public static void hideSoftKeyboard(List<View> viewList) { |
||||
if (viewList == null) return; |
||||
InputMethodManager inputMethodManager = (InputMethodManager) (Utils.getApp()).getSystemService(Activity.INPUT_METHOD_SERVICE); |
||||
for (View v : viewList) { |
||||
inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断sd卡是否可用 |
||||
*/ |
||||
public static boolean isExternalStorageAvailable() { |
||||
return Environment.getExternalStorageState().equals( |
||||
Environment.MEDIA_MOUNTED); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前时间 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static String getSimpleDateFormat() { |
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");// HH:mm:ss
|
||||
//获取当前时间
|
||||
Date date = new Date(System.currentTimeMillis()); |
||||
return simpleDateFormat.format(date); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前时间戳 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static long getSimpleDateTimeStamp() { |
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");// HH:mm:ss
|
||||
//获取当前时间
|
||||
Date date = new Date(System.currentTimeMillis()); |
||||
return date.getTime(); |
||||
} |
||||
|
||||
/** |
||||
* 复制 |
||||
* |
||||
* @param text |
||||
*/ |
||||
public static void copy(String text) { |
||||
// 获取系统剪贴板
|
||||
ClipboardManager clipboard = (ClipboardManager) (Utils.getApp()).getSystemService(Context.CLIPBOARD_SERVICE); |
||||
// 创建一个剪贴数据集,包含一个普通文本数据条目(需要复制的数据),其他的还有
|
||||
ClipData clipData = ClipData.newPlainText(null, text); |
||||
// 把数据集设置(复制)到剪贴板
|
||||
clipboard.setPrimaryClip(clipData); |
||||
if (!TextUtils.isEmpty(text)) { |
||||
ToastUtils.showShort((Utils.getApp()).getResources().getString(R.string.has_copy_to_clipboard)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取文件创建时间 |
||||
* |
||||
* @param file |
||||
* @return |
||||
*/ |
||||
private static final String mformatType = "yyyy/MM/dd"; |
||||
|
||||
public static String getFileCreateTime(File file) { |
||||
Calendar cal = Calendar.getInstance(); |
||||
long time = file.lastModified(); |
||||
SimpleDateFormat formatter = new SimpleDateFormat(mformatType); |
||||
cal.setTimeInMillis(time); |
||||
|
||||
// 输出:修改时间[2] 2009-08-17 10:32:38
|
||||
return formatter.format(cal.getTime()); |
||||
} |
||||
|
||||
/** |
||||
* 生成的UUID |
||||
* |
||||
* @return |
||||
*/ |
||||
@SuppressLint("MissingPermission") |
||||
public static String getUUID() { |
||||
UUID uuid = UUID.randomUUID(); |
||||
String uniqueId = uuid.toString(); |
||||
BCLog.log(log -> log.e("debug", "uuid=" + uniqueId)); |
||||
return uniqueId; |
||||
} |
||||
|
||||
/** |
||||
* 获取wifi状态 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static boolean getWifiEnabled() { |
||||
WifiManager wm = (WifiManager) (Utils.getApp()).getSystemService(Context.WIFI_SERVICE); |
||||
return wm.isWifiEnabled(); |
||||
} |
||||
|
||||
/** |
||||
* 开关wifi |
||||
* |
||||
* @param enabled true:打开 false:关闭 |
||||
* @return |
||||
*/ |
||||
public static void setWifiEnabled(boolean enabled) { |
||||
WifiManager wm = (WifiManager) (Utils.getApp()).getSystemService(Context.WIFI_SERVICE); |
||||
wm.setWifiEnabled(enabled); |
||||
} |
||||
|
||||
/** |
||||
* 获取手机数据流量是否打开 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static boolean getMobileDataEnabled() { |
||||
boolean mobileDataEnabled; |
||||
ConnectivityManager connectivityManager = (ConnectivityManager) (Utils.getApp()).getSystemService(Context.CONNECTIVITY_SERVICE); |
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); |
||||
if (activeNetworkInfo == null) { |
||||
Log.e("mobileData", "没有联网"); |
||||
mobileDataEnabled = false; |
||||
} else { |
||||
if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE) { |
||||
Log.e("mobileData", "连接的网络是移动数据流量"); |
||||
mobileDataEnabled = true; |
||||
} else { |
||||
Log.e("mobileData", "不是移动数据流量"); |
||||
mobileDataEnabled = false; |
||||
} |
||||
} |
||||
return mobileDataEnabled; |
||||
} |
||||
|
||||
/** |
||||
* 移动网络开关 |
||||
* |
||||
* @param enabled true:打开 false:关闭 |
||||
*/ |
||||
public static void setMobileDataEnabled(boolean enabled) { |
||||
ConnectivityManager conMgr = (ConnectivityManager) (Utils.getApp()).getSystemService(Context.CONNECTIVITY_SERVICE); |
||||
Class<?> conMgrClass = null;//ConnectivityManager类
|
||||
Field iConMgrField = null;//ConnectivityManager类中的字段
|
||||
Object iConMgr = null;//IConnectivityManager类的引用
|
||||
Class<?> iConMgrClass = null;//IConnectivityManager类
|
||||
Method setMobileDataEnabledMethod = null;//setMobileDataEnabled方法
|
||||
try { |
||||
//取得ConnectivityManager类
|
||||
conMgrClass = Class.forName(conMgr.getClass().getName()); |
||||
//取得ConnectivityManager类中的对象mService
|
||||
iConMgrField = conMgrClass.getDeclaredField("mService"); |
||||
//设置mService可访问
|
||||
iConMgrField.setAccessible(true); |
||||
//取得mService的实例化类IConnectivityManager
|
||||
iConMgr = iConMgrField.get(conMgr); |
||||
//取得IConnectivityManager类
|
||||
iConMgrClass = Class.forName(iConMgr.getClass().getName()); |
||||
//取得IConnectivityManager类中的setMobileDataEnabled(boolean)方法
|
||||
setMobileDataEnabledMethod = iConMgrClass.getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE); |
||||
//设置setMobileDataEnabled方法可访问
|
||||
setMobileDataEnabledMethod.setAccessible(true); |
||||
//调用setMobileDataEnabled方法
|
||||
setMobileDataEnabledMethod.invoke(iConMgr, enabled); |
||||
} catch (ClassNotFoundException e) { |
||||
e.printStackTrace(); |
||||
} catch (NoSuchFieldException e) { |
||||
e.printStackTrace(); |
||||
} catch (SecurityException e) { |
||||
e.printStackTrace(); |
||||
} catch (NoSuchMethodException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalArgumentException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (InvocationTargetException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取wifi热点状态 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static boolean getWifiApEnable() { |
||||
WifiManager wifiManager = (WifiManager) (Utils.getApp()).getApplicationContext().getSystemService(Context.WIFI_SERVICE); |
||||
if (wifiManager == null) { |
||||
return false; |
||||
} |
||||
try { |
||||
Method method = wifiManager.getClass().getDeclaredMethod("isWifiApEnabled"); |
||||
method.setAccessible(true); |
||||
return (Boolean) method.invoke(wifiManager); |
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 网络热点是否打开 |
||||
* |
||||
* @param enabled |
||||
*/ |
||||
public static void setWifiApEnabled(boolean enabled) { |
||||
ConnectivityManager connManager = (ConnectivityManager) (Utils.getApp()).getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); |
||||
Field iConnMgrField = null; |
||||
try { |
||||
iConnMgrField = connManager.getClass().getDeclaredField("mService"); |
||||
iConnMgrField.setAccessible(true); |
||||
Object iConnMgr = iConnMgrField.get(connManager); |
||||
Class<?> iConnMgrClass = Class.forName(iConnMgr.getClass().getName()); |
||||
if (enabled) { |
||||
Method startTethering = iConnMgrClass.getMethod("startTethering", int.class, ResultReceiver.class, boolean.class); |
||||
startTethering.invoke(iConnMgr, 0, null, true); |
||||
} else { |
||||
Method stopTethering = iConnMgrClass.getMethod("stopTethering", int.class); |
||||
stopTethering.invoke(iConnMgr, 0); |
||||
} |
||||
} catch (NoSuchFieldException e) { |
||||
e.printStackTrace(); |
||||
} catch (NoSuchMethodException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (InvocationTargetException e) { |
||||
e.printStackTrace(); |
||||
} catch (ClassNotFoundException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取当前连接蓝牙的名称(没有蓝牙连接,返回为空) |
||||
* |
||||
* @return |
||||
*/ |
||||
public static String getConnectedBtDeviceName() { |
||||
//获取蓝牙适配器
|
||||
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); |
||||
//得到已匹配的蓝牙设备列表
|
||||
Set<BluetoothDevice> bondedDevices = bluetoothAdapter.getBondedDevices(); |
||||
if (bondedDevices != null && bondedDevices.size() > 0) { |
||||
for (BluetoothDevice bondedDevice : bondedDevices) { |
||||
try { |
||||
//使用反射调用被隐藏的方法
|
||||
Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null); |
||||
isConnectedMethod.setAccessible(true); |
||||
boolean isConnected = (boolean) isConnectedMethod.invoke(bondedDevice, (Object[]) null); |
||||
if (isConnected) { |
||||
return bondedDevice.getName(); |
||||
} |
||||
} catch (NoSuchMethodException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (InvocationTargetException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static int[] getScreenWidthHeight(Context context) { |
||||
Activity activity = (Activity) context; |
||||
Display display = activity.getWindowManager().getDefaultDisplay(); |
||||
int width = display.getWidth(); |
||||
int height = display.getHeight(); |
||||
return new int[]{width, height}; |
||||
} |
||||
|
||||
public static String getFileName(String path) { |
||||
int start = path.lastIndexOf("/"); |
||||
int end = path.lastIndexOf("."); |
||||
if (start != -1 && end != -1) { |
||||
return path.substring(start + 1, end); |
||||
} else { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public static void setScreenAlwaysLight(Context context) { |
||||
Activity activity = (Activity) context; |
||||
boolean isWakeLock = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("key_is_wake_lock", false); |
||||
if (isWakeLock) { |
||||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
||||
} else { |
||||
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
||||
} |
||||
if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) { |
||||
EventBus.getDefault().post(new TsUpdateBatteryEvent()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
package com.project.survey.widget.decoration |
||||
|
||||
import android.content.Context |
||||
import androidx.core.content.ContextCompat |
||||
import com.bingce.utils.ScreenUtil |
||||
import com.project.survey.R |
||||
|
||||
class TransparentDividerDecoration(context: Context) : DefaultItemDecoration( |
||||
ContextCompat.getColor(context, R.color.transparent), |
||||
1, ScreenUtil.dp2px(context, 12f) |
||||
) |
@ -0,0 +1,733 @@ |
||||
package com.project.survey.widget.materialspinner; |
||||
|
||||
import android.animation.ObjectAnimator; |
||||
import android.content.Context; |
||||
import android.content.res.TypedArray; |
||||
import android.graphics.Color; |
||||
import android.graphics.PorterDuff; |
||||
import android.graphics.drawable.ColorDrawable; |
||||
import android.graphics.drawable.Drawable; |
||||
import android.graphics.drawable.StateListDrawable; |
||||
import android.os.Build; |
||||
import android.os.Bundle; |
||||
import android.os.Parcelable; |
||||
import android.util.AttributeSet; |
||||
import android.view.Gravity; |
||||
import android.view.MotionEvent; |
||||
import android.view.View; |
||||
import android.view.WindowManager; |
||||
import android.widget.AdapterView; |
||||
import android.widget.ListAdapter; |
||||
import android.widget.ListView; |
||||
import android.widget.PopupWindow; |
||||
|
||||
import androidx.annotation.ColorInt; |
||||
import androidx.annotation.DrawableRes; |
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.appcompat.widget.AppCompatTextView; |
||||
|
||||
import com.bingce.utils.ScreenUtil; |
||||
import com.project.survey.R; |
||||
import com.project.survey.util.ResUtils; |
||||
import com.project.survey.util.ThemeUtils; |
||||
import com.project.survey.util.Tools; |
||||
import com.project.survey.widget.util.Utils; |
||||
|
||||
import java.lang.reflect.Method; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 自定义下拉框,使用AppCompatTextView + PopupWindow组合实现 |
||||
* |
||||
* @author xuexiang |
||||
* @since 2018/12/7 下午4:24 |
||||
*/ |
||||
public class MaterialSpinner extends AppCompatTextView { |
||||
|
||||
private OnNothingSelectedListener mOnNothingSelectedListener; |
||||
private OnItemSelectedListener mOnItemSelectedListener; |
||||
private OnNoMoreChoiceListener mOnNoMoreChoiceListener; |
||||
private MaterialSpinnerBaseAdapter mAdapter; |
||||
private PopupWindow mPopupWindow; |
||||
private ListView mListView; |
||||
private Drawable mArrowDrawable; |
||||
private boolean mHideArrow; |
||||
private boolean mNothingSelected; |
||||
private int mPopupWindowMaxHeight; |
||||
private int mPopupWindowHeight; |
||||
private int mSelectedIndex; |
||||
private int mBackgroundColor; |
||||
private int mArrowColor; |
||||
private int mArrowColorDisabled; |
||||
private int mTextColor; |
||||
private boolean mIsInDialog; |
||||
private int mDropDownOffset; |
||||
|
||||
public MaterialSpinner(Context context) { |
||||
this(context, null); |
||||
} |
||||
|
||||
public MaterialSpinner(Context context, AttributeSet attrs) { |
||||
this(context, attrs, R.attr.MaterialSpinnerStyle); |
||||
} |
||||
|
||||
public MaterialSpinner(Context context, AttributeSet attrs, int defStyleAttr) { |
||||
super(context, attrs, defStyleAttr); |
||||
initAttrs(context, attrs, defStyleAttr); |
||||
} |
||||
|
||||
/** |
||||
* 初始化属性 |
||||
* |
||||
* @param context 上下文 |
||||
* @param attrs 属性 |
||||
* @param defStyleAttr 默认属性 |
||||
*/ |
||||
private void initAttrs(Context context, AttributeSet attrs, int defStyleAttr) { |
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MaterialSpinner, defStyleAttr, 0); |
||||
int defaultColor = getTextColors().getDefaultColor(); |
||||
int popAnimStyle; |
||||
Drawable dropDownBg; |
||||
int entriesId; |
||||
int backgroundSelector; |
||||
try { |
||||
mBackgroundColor = typedArray.getColor(R.styleable.MaterialSpinner_ms_background_color, Color.TRANSPARENT); |
||||
backgroundSelector = typedArray.getResourceId(R.styleable.MaterialSpinner_ms_background_selector, 0); |
||||
mTextColor = typedArray.getColor(R.styleable.MaterialSpinner_ms_text_color, defaultColor); |
||||
|
||||
mArrowDrawable = ResUtils.getDrawableAttrRes(context, typedArray, R.styleable.MaterialSpinner_ms_arrow_image); |
||||
mArrowColor = typedArray.getColor(R.styleable.MaterialSpinner_ms_arrow_tint, mTextColor); |
||||
mHideArrow = typedArray.getBoolean(R.styleable.MaterialSpinner_ms_hide_arrow, false); |
||||
mPopupWindowMaxHeight = typedArray.getDimensionPixelSize(R.styleable.MaterialSpinner_ms_dropdown_max_height, 0); |
||||
mPopupWindowHeight = typedArray.getLayoutDimension(R.styleable.MaterialSpinner_ms_dropdown_height, WindowManager.LayoutParams.WRAP_CONTENT); |
||||
mArrowColorDisabled = ResUtils.lighter(mArrowColor, 0.8f); |
||||
entriesId = typedArray.getResourceId(R.styleable.MaterialSpinner_ms_entries, 0); |
||||
dropDownBg = ResUtils.getDrawableAttrRes(context, typedArray, R.styleable.MaterialSpinner_ms_dropdown_bg); |
||||
mIsInDialog = typedArray.getBoolean(R.styleable.MaterialSpinner_ms_in_dialog, false); |
||||
popAnimStyle = typedArray.getResourceId(R.styleable.MaterialSpinner_ms_pop_anim_style, -1); |
||||
} finally { |
||||
typedArray.recycle(); |
||||
} |
||||
|
||||
mDropDownOffset = ThemeUtils.resolveDimension(getContext(), R.attr.ms_dropdown_offset); |
||||
|
||||
setGravity(Gravity.CENTER_VERTICAL | Gravity.START); |
||||
setClickable(true); |
||||
|
||||
int leftOrRight = ScreenUtil.dp2px(context, 16); |
||||
setPaddingRelative(leftOrRight, 0, leftOrRight, 0); |
||||
setBackgroundResource(R.drawable.ms_background_selector); |
||||
|
||||
if (!mHideArrow) { |
||||
if (mArrowDrawable == null) { |
||||
mArrowDrawable = ResUtils.getVectorDrawable(getContext(), R.drawable.ms_ic_arrow_up).mutate(); |
||||
} |
||||
mArrowDrawable.setColorFilter(mArrowColor, PorterDuff.Mode.SRC_IN); |
||||
int arrowSize = ThemeUtils.resolveDimension(getContext(), R.attr.ms_arrow_size); |
||||
mArrowDrawable.setBounds(0, 0, arrowSize, arrowSize); |
||||
setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, mArrowDrawable, null); |
||||
} |
||||
|
||||
mListView = new ListView(context); |
||||
mListView.setId(getId()); |
||||
mListView.setDivider(new ColorDrawable(Tools.getColor(R.color.hor_line))); |
||||
mListView.setDividerHeight(ScreenUtil.dp2px(context, 0.5f)); |
||||
mListView.setItemsCanFocus(true); |
||||
int padding = ThemeUtils.resolveDimension(getContext(), R.attr.ms_dropdown_offset); |
||||
mListView.setPadding(padding, padding, padding, padding); |
||||
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
||||
|
||||
@Override |
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
||||
if (position >= mSelectedIndex && position < mAdapter.getCount()) { |
||||
position++; |
||||
} |
||||
mSelectedIndex = position; |
||||
mNothingSelected = false; |
||||
Object item = mAdapter.get(position); |
||||
mAdapter.notifyItemSelected(position); |
||||
setText(item.toString()); |
||||
collapse(); |
||||
if (mOnItemSelectedListener != null) { |
||||
//noinspection unchecked
|
||||
mOnItemSelectedListener.onItemSelected(MaterialSpinner.this, position, id, item); |
||||
} |
||||
} |
||||
}); |
||||
if (entriesId != 0) { |
||||
setItems(ResUtils.getStringList(context, entriesId)); |
||||
} |
||||
|
||||
mPopupWindow = new PopupWindow(context); |
||||
mPopupWindow.setContentView(mListView); |
||||
mPopupWindow.setOutsideTouchable(true); |
||||
if (popAnimStyle != -1) { |
||||
mPopupWindow.setAnimationStyle(popAnimStyle); |
||||
} |
||||
mPopupWindow.setFocusable(true); |
||||
mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); |
||||
mPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); |
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
||||
mPopupWindow.setElevation(16); |
||||
} |
||||
|
||||
if (dropDownBg != null) { |
||||
mPopupWindow.setBackgroundDrawable(dropDownBg); |
||||
} else { |
||||
//ResUtils.getDrawable(getContext(), R.drawable.ms_drop_down_bg)
|
||||
mPopupWindow.setBackgroundDrawable(new ColorDrawable(Tools.getColor(R.color.bg_content))); |
||||
} |
||||
// default color is white
|
||||
if (mBackgroundColor != Color.WHITE) { |
||||
setBackgroundColor(mBackgroundColor); |
||||
} else if (backgroundSelector != 0) { |
||||
setBackgroundResource(backgroundSelector); |
||||
} |
||||
if (mTextColor != defaultColor) { |
||||
setTextColor(mTextColor); |
||||
} |
||||
|
||||
mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { |
||||
|
||||
@Override |
||||
public void onDismiss() { |
||||
if (mNothingSelected && mOnNothingSelectedListener != null) { |
||||
mOnNothingSelectedListener.onNothingSelected(MaterialSpinner.this); |
||||
} |
||||
if (!mHideArrow) { |
||||
animateArrow(false); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
||||
mPopupWindow.setHeight(calculatePopupWindowHeight()); |
||||
if (mAdapter != null) { |
||||
CharSequence currentText = getText(); |
||||
String longestItem = currentText.toString(); |
||||
for (int i = 0; i < mAdapter.getCount(); i++) { |
||||
String itemText = mAdapter.getItemText(i); |
||||
if (itemText.length() > longestItem.length()) { |
||||
longestItem = itemText; |
||||
} |
||||
} |
||||
setText(longestItem); |
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
||||
setText(currentText); |
||||
} else { |
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
||||
} |
||||
mPopupWindow.setWidth(getMeasuredWidth()); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onTouchEvent(@NonNull MotionEvent event) { |
||||
if (event.getAction() == MotionEvent.ACTION_UP) { |
||||
if (isEnabled() && isClickable()) { |
||||
if (!mPopupWindow.isShowing()) { |
||||
expand(); |
||||
} else { |
||||
collapse(); |
||||
} |
||||
} |
||||
} |
||||
return super.onTouchEvent(event); |
||||
} |
||||
|
||||
@Override |
||||
public void setBackgroundColor(int color) { |
||||
mBackgroundColor = color; |
||||
Drawable background = getBackground(); |
||||
if (background instanceof StateListDrawable) { // pre-L
|
||||
try { |
||||
Method getStateDrawable = StateListDrawable.class.getDeclaredMethod("getStateDrawable", int.class); |
||||
if (!getStateDrawable.isAccessible()) { |
||||
getStateDrawable.setAccessible(true); |
||||
} |
||||
int[] colors = {ResUtils.darker(color, 0.85f), color}; |
||||
for (int i = 0; i < colors.length; i++) { |
||||
ColorDrawable drawable = (ColorDrawable) getStateDrawable.invoke(background, i); |
||||
drawable.setColor(colors[i]); |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} else if (background != null) { // 21+ (RippleDrawable)
|
||||
background.setColorFilter(color, PorterDuff.Mode.SRC_IN); |
||||
} |
||||
mPopupWindow.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN); |
||||
} |
||||
|
||||
@Override |
||||
public void setTextColor(int color) { |
||||
mTextColor = color; |
||||
super.setTextColor(color); |
||||
} |
||||
|
||||
@Override |
||||
public Parcelable onSaveInstanceState() { |
||||
Bundle bundle = new Bundle(); |
||||
bundle.putParcelable("state", super.onSaveInstanceState()); |
||||
bundle.putInt("selected_index", mSelectedIndex); |
||||
if (mPopupWindow != null) { |
||||
bundle.putBoolean("is_popup_showing", mPopupWindow.isShowing()); |
||||
collapse(); |
||||
} else { |
||||
bundle.putBoolean("is_popup_showing", false); |
||||
} |
||||
return bundle; |
||||
} |
||||
|
||||
@Override |
||||
public void onRestoreInstanceState(Parcelable savedState) { |
||||
if (savedState instanceof Bundle) { |
||||
Bundle bundle = (Bundle) savedState; |
||||
mSelectedIndex = bundle.getInt("selected_index"); |
||||
if (mAdapter != null) { |
||||
setText(mAdapter.get(mSelectedIndex).toString()); |
||||
mAdapter.notifyItemSelected(mSelectedIndex); |
||||
} |
||||
if (bundle.getBoolean("is_popup_showing")) { |
||||
if (mPopupWindow != null) { |
||||
// Post the show request into the looper to avoid bad token exception
|
||||
post(new Runnable() { |
||||
|
||||
@Override |
||||
public void run() { |
||||
expand(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
savedState = bundle.getParcelable("state"); |
||||
} |
||||
super.onRestoreInstanceState(savedState); |
||||
} |
||||
|
||||
@Override |
||||
public void setEnabled(boolean enabled) { |
||||
super.setEnabled(enabled); |
||||
if (mArrowDrawable != null) { |
||||
mArrowDrawable.setColorFilter(enabled ? mArrowColor : mArrowColorDisabled, PorterDuff.Mode.SRC_IN); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* @return the selected item position |
||||
*/ |
||||
public int getSelectedIndex() { |
||||
return mSelectedIndex; |
||||
} |
||||
|
||||
/** |
||||
* Set the default spinner item using its index |
||||
* |
||||
* @param position the item's position |
||||
*/ |
||||
public MaterialSpinner setSelectedIndex(int position) { |
||||
if (mAdapter != null) { |
||||
if (position >= 0 && position <= mAdapter.getCount()) { |
||||
mAdapter.notifyItemSelected(position); |
||||
mSelectedIndex = position; |
||||
setText(mAdapter.get(position).toString()); |
||||
} else { |
||||
throw new IllegalArgumentException("Position must be lower than adapter count!"); |
||||
} |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 设置选中的内容 |
||||
* |
||||
* @param item 选中的内容 |
||||
* @param <T> |
||||
*/ |
||||
public <T> MaterialSpinner setSelectedItem(@NonNull T item) { |
||||
if (mAdapter != null && item != null) { |
||||
setSelectedIndex(getSpinnerPosition(item, mAdapter.getItems())); |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 获取选中内容在Spinner中的位置 |
||||
* |
||||
* @param item 选中的内容 |
||||
* @param items Spinner中选项的集合 |
||||
* @return |
||||
*/ |
||||
public <T> int getSpinnerPosition(T item, List<T> items) { |
||||
if (item != null && items != null && items.size() > 0) { |
||||
for (int i = 0; i < items.size(); i++) { |
||||
if (item.equals(items.get(i))) { |
||||
return i; |
||||
} |
||||
} |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
/** |
||||
* Register a callback to be invoked when an item in the dropdown is selected. |
||||
* |
||||
* @param onItemSelectedListener The callback that will run |
||||
*/ |
||||
public MaterialSpinner setOnItemSelectedListener(@Nullable OnItemSelectedListener onItemSelectedListener) { |
||||
mOnItemSelectedListener = onItemSelectedListener; |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* Register a callback to be invoked when the {@link PopupWindow} is shown but the user didn't select an item. |
||||
* |
||||
* @param onNothingSelectedListener the callback that will run |
||||
*/ |
||||
public MaterialSpinner setOnNothingSelectedListener(@Nullable OnNothingSelectedListener onNothingSelectedListener) { |
||||
mOnNothingSelectedListener = onNothingSelectedListener; |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 设置无更多选择的监听 |
||||
* |
||||
* @param onNoMoreChoiceListener |
||||
* @return |
||||
*/ |
||||
public MaterialSpinner setOnNoMoreChoiceListener(OnNoMoreChoiceListener onNoMoreChoiceListener) { |
||||
mOnNoMoreChoiceListener = onNoMoreChoiceListener; |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* Set the dropdown items |
||||
* |
||||
* @param items A list of items |
||||
* @param <T> The item type |
||||
*/ |
||||
@SafeVarargs |
||||
public final <T> MaterialSpinner setItems(@NonNull T... items) { |
||||
setItems(Arrays.asList(items)); |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* Set the dropdown items |
||||
* |
||||
* @param items A list of items |
||||
* @param <T> The item type |
||||
*/ |
||||
public <T> MaterialSpinner setItems(@NonNull List<T> items) { |
||||
mAdapter = new MaterialSpinnerAdapter<>(getContext(), items) |
||||
.setTextColor(mTextColor).setTextSize(getTextSize()); |
||||
setAdapterInternal(mAdapter); |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* Get the list of items in the adapter |
||||
* |
||||
* @param <T> The item type |
||||
* @return A list of items or {@code null} if no items are set. |
||||
*/ |
||||
public <T> List<T> getItems() { |
||||
if (mAdapter == null) { |
||||
return null; |
||||
} |
||||
//noinspection unchecked
|
||||
return mAdapter.getItems(); |
||||
} |
||||
|
||||
/** |
||||
* Get the Selected Item in the adapter |
||||
* |
||||
* @param <T> The item type |
||||
* @return A list of items or {@code null} if no items are set. |
||||
*/ |
||||
public <T> T getSelectedItem() { |
||||
return mAdapter != null ? (T) mAdapter.get(mSelectedIndex) : null; |
||||
} |
||||
|
||||
/** |
||||
* Set a custom adapter for the dropdown items |
||||
* |
||||
* @param adapter The list adapter |
||||
*/ |
||||
public MaterialSpinner setAdapter(@NonNull ListAdapter adapter) { |
||||
mAdapter = new MaterialSpinnerAdapterWrapper(getContext(), adapter) |
||||
.setTextColor(mTextColor).setTextSize(getTextSize()); |
||||
setAdapterInternal(mAdapter); |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* Set the custom adapter for the dropdown items |
||||
* |
||||
* @param adapter The adapter |
||||
* @param <T> The type |
||||
*/ |
||||
public <T> MaterialSpinner setAdapter(MaterialSpinnerAdapter<T> adapter) { |
||||
mAdapter = adapter; |
||||
mAdapter.setTextColor(mTextColor); |
||||
mAdapter.setTextSize(getTextSize()); |
||||
setAdapterInternal(adapter); |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 获取适配器 |
||||
* |
||||
* @return |
||||
*/ |
||||
public MaterialSpinnerBaseAdapter getAdapter() { |
||||
return mAdapter; |
||||
} |
||||
|
||||
public MaterialSpinner setDropDownBackgroundSelector(@DrawableRes int backgroundSelector) { |
||||
if (mAdapter != null) { |
||||
mAdapter.setBackgroundSelector(backgroundSelector); |
||||
} |
||||
return this; |
||||
} |
||||
|
||||
private void setAdapterInternal(@NonNull MaterialSpinnerBaseAdapter adapter) { |
||||
mListView.setAdapter(adapter); |
||||
if (mSelectedIndex >= adapter.getCount()) { |
||||
mSelectedIndex = 0; |
||||
} |
||||
if (adapter.getCount() >= 0) { |
||||
setText(adapter.get(mSelectedIndex).toString()); |
||||
} else { |
||||
setText(""); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* @return 是否有内容可以下拉选择 |
||||
*/ |
||||
private boolean hasMoreChoice() { |
||||
return mAdapter != null && mAdapter.getCount() > 0; |
||||
} |
||||
|
||||
/** |
||||
* Show the dropdown menu |
||||
*/ |
||||
public void expand() { |
||||
if (!hasMoreChoice()) { |
||||
if (mOnNoMoreChoiceListener != null) { |
||||
mOnNoMoreChoiceListener.OnNoMoreChoice(this); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
if (!mHideArrow) { |
||||
animateArrow(true); |
||||
} |
||||
mNothingSelected = true; |
||||
showPopupWindow(); |
||||
} |
||||
|
||||
/** |
||||
* Closes the dropdown menu |
||||
*/ |
||||
public void collapse() { |
||||
if (!mHideArrow) { |
||||
animateArrow(false); |
||||
} |
||||
mPopupWindow.dismiss(); |
||||
} |
||||
|
||||
private void showPopupWindow() { |
||||
if (mIsInDialog) { |
||||
mPopupWindow.showAsDropDown(this); |
||||
} else { |
||||
mPopupWindow.showAsDropDown(this, 0, calculatePopWindowYOffset(this)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 计算出来的位置,y方向就在anchorView的上面和下面对齐显示,x方向就是与屏幕右边对齐显示 |
||||
* 如果anchorView的位置有变化,就可以适当自己额外加入偏移来修正 |
||||
* |
||||
* @param anchorView 呼出window的view |
||||
* @return window显示的左上角的xOff, yOff坐标 |
||||
*/ |
||||
private int[] calculatePopWindowPos(final View anchorView) { |
||||
final int[] windowPos = new int[2]; |
||||
final int[] anchorLoc = new int[2]; |
||||
// 获取锚点View在屏幕上的左上角坐标位置
|
||||
anchorView.getLocationOnScreen(anchorLoc); |
||||
final int anchorHeight = anchorView.getHeight(); |
||||
// 获取屏幕的高宽
|
||||
final int screenHeight = Utils.getScreenHeight(getContext()); |
||||
// 计算ListView的高宽
|
||||
int listViewHeight = Utils.getListViewHeightBasedOnChildren(mListView); |
||||
if (mPopupWindowMaxHeight > 0 && listViewHeight > mPopupWindowMaxHeight) { |
||||
listViewHeight = mPopupWindowMaxHeight; |
||||
} |
||||
// 判断需要向上弹出还是向下弹出显示
|
||||
final boolean isNeedShowUp = (screenHeight - anchorLoc[1] - anchorHeight < listViewHeight); |
||||
if (isNeedShowUp) { |
||||
windowPos[0] = anchorLoc[0]; |
||||
windowPos[1] = anchorLoc[1] - listViewHeight - mDropDownOffset; |
||||
} else { |
||||
windowPos[0] = anchorLoc[0]; |
||||
windowPos[1] = anchorLoc[1] + anchorHeight; |
||||
} |
||||
return windowPos; |
||||
} |
||||
|
||||
/** |
||||
* 计算出来的位置,y方向就在anchorView的上面和下面对齐显示,x方向就是与屏幕右边对齐显示 |
||||
* 如果anchorView的位置有变化,就可以适当自己额外加入偏移来修正 |
||||
* |
||||
* @param anchorView 呼出window的view |
||||
* @return window显示的左上角的xOff, yOff坐标 |
||||
*/ |
||||
private int calculatePopWindowYOffset(final View anchorView) { |
||||
int windowYOffset; |
||||
final int[] anchorLoc = new int[2]; |
||||
// 获取锚点View在屏幕上的左上角坐标位置
|
||||
anchorView.getLocationOnScreen(anchorLoc); |
||||
final int anchorHeight = anchorView.getHeight(); |
||||
// 获取屏幕的高宽
|
||||
final int screenHeight = Utils.getScreenHeight(getContext()); |
||||
// 计算ListView的高宽
|
||||
int listViewHeight = Utils.getListViewHeightBasedOnChildren(mListView); |
||||
if (mPopupWindowMaxHeight > 0 && listViewHeight > mPopupWindowMaxHeight) { |
||||
listViewHeight = mPopupWindowMaxHeight; |
||||
} |
||||
// 判断需要向上弹出还是向下弹出显示
|
||||
final boolean isNeedShowUp = (screenHeight - anchorLoc[1] < listViewHeight + anchorHeight); |
||||
if (isNeedShowUp) { |
||||
windowYOffset = -(listViewHeight + mDropDownOffset + anchorHeight); |
||||
} else { |
||||
windowYOffset = 0; |
||||
} |
||||
return windowYOffset; |
||||
} |
||||
|
||||
/** |
||||
* Set the tint color for the dropdown arrow |
||||
* |
||||
* @param color the color value |
||||
*/ |
||||
public void setArrowColor(@ColorInt int color) { |
||||
mArrowColor = color; |
||||
mArrowColorDisabled = ResUtils.lighter(mArrowColor, 0.8f); |
||||
if (mArrowDrawable != null) { |
||||
mArrowDrawable.setColorFilter(mArrowColor, PorterDuff.Mode.SRC_IN); |
||||
} |
||||
} |
||||
|
||||
private void animateArrow(boolean shouldRotateUp) { |
||||
int start = shouldRotateUp ? 0 : 10000; |
||||
int end = shouldRotateUp ? 10000 : 0; |
||||
ObjectAnimator animator = ObjectAnimator.ofInt(mArrowDrawable, "level", start, end); |
||||
animator.start(); |
||||
} |
||||
|
||||
/** |
||||
* Set the maximum height of the dropdown menu. |
||||
* |
||||
* @param height the height in pixels |
||||
*/ |
||||
public void setDropdownMaxHeight(int height) { |
||||
mPopupWindowMaxHeight = height; |
||||
mPopupWindow.setHeight(calculatePopupWindowHeight()); |
||||
} |
||||
|
||||
/** |
||||
* Set the height of the dropdown menu |
||||
* |
||||
* @param height the height in pixels |
||||
*/ |
||||
public void setDropdownHeight(int height) { |
||||
mPopupWindowHeight = height; |
||||
mPopupWindow.setHeight(calculatePopupWindowHeight()); |
||||
} |
||||
|
||||
private int calculatePopupWindowHeight() { |
||||
if (mAdapter == null) { |
||||
return WindowManager.LayoutParams.WRAP_CONTENT; |
||||
} |
||||
float listViewHeight = mAdapter.getCount() * ThemeUtils.resolveDimension(getContext(), R.attr.ms_item_height_size); |
||||
if (mPopupWindowMaxHeight > 0 && listViewHeight > mPopupWindowMaxHeight) { |
||||
return mPopupWindowMaxHeight; |
||||
} else if (mPopupWindowHeight != WindowManager.LayoutParams.MATCH_PARENT |
||||
&& mPopupWindowHeight != WindowManager.LayoutParams.WRAP_CONTENT |
||||
&& mPopupWindowHeight <= listViewHeight) { |
||||
return mPopupWindowHeight; |
||||
} |
||||
return WindowManager.LayoutParams.WRAP_CONTENT; |
||||
} |
||||
|
||||
/** |
||||
* Get the {@link PopupWindow}. |
||||
* |
||||
* @return The {@link PopupWindow} that is displayed when the view has been clicked. |
||||
*/ |
||||
public PopupWindow getPopupWindow() { |
||||
return mPopupWindow; |
||||
} |
||||
|
||||
/** |
||||
* Get the {@link ListView} that is used in the dropdown menu |
||||
* |
||||
* @return the ListView shown in the PopupWindow. |
||||
*/ |
||||
public ListView getListView() { |
||||
return mListView; |
||||
} |
||||
|
||||
/** |
||||
* Interface definition for a callback to be invoked when an item in this view has been selected. |
||||
* |
||||
* @param <T> Adapter item type |
||||
*/ |
||||
public interface OnItemSelectedListener<T> { |
||||
|
||||
/** |
||||
* <p>Callback method to be invoked when an item in this view has been selected. This callback is invoked only when |
||||
* the newly selected position is different from the previously selected position or if there was no selected |
||||
* item.</p> |
||||
* |
||||
* @param view The {@link MaterialSpinner} view |
||||
* @param position The position of the view in the adapter |
||||
* @param id The row id of the item that is selected |
||||
* @param item The selected item |
||||
*/ |
||||
void onItemSelected(MaterialSpinner view, int position, long id, T item); |
||||
} |
||||
|
||||
/** |
||||
* Interface definition for a callback to be invoked when the dropdown is dismissed and no item was selected. |
||||
*/ |
||||
public interface OnNothingSelectedListener { |
||||
|
||||
/** |
||||
* Callback method to be invoked when the {@link PopupWindow} is dismissed and no item was selected. |
||||
* |
||||
* @param spinner the {@link MaterialSpinner} |
||||
*/ |
||||
void onNothingSelected(MaterialSpinner spinner); |
||||
} |
||||
|
||||
/** |
||||
* 无更多选择的监听 |
||||
*/ |
||||
public interface OnNoMoreChoiceListener { |
||||
/** |
||||
* 无更多选择 |
||||
* |
||||
* @param spinner |
||||
*/ |
||||
void OnNoMoreChoice(MaterialSpinner spinner); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,56 @@ |
||||
package com.project.survey.widget.materialspinner; |
||||
|
||||
import android.content.Context; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Spinner适配器 |
||||
* |
||||
* @author xuexiang |
||||
* @since 2019/1/14 下午10:08 |
||||
*/ |
||||
public class MaterialSpinnerAdapter<T> extends MaterialSpinnerBaseAdapter { |
||||
|
||||
private final List<T> mItems; |
||||
|
||||
public MaterialSpinnerAdapter(Context context, List<T> items) { |
||||
super(context); |
||||
mItems = items; |
||||
} |
||||
|
||||
@Override |
||||
public int getCount() { |
||||
return mItems != null ? mItems.size() - 1 : 0; |
||||
} |
||||
|
||||
/** |
||||
* 获取列表项 |
||||
* |
||||
* @param position |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public T getItem(int position) { |
||||
if (position >= getSelectedIndex()) { |
||||
return mItems.get(position + 1); |
||||
} else { |
||||
return mItems.get(position); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public T get(int position) { |
||||
if (mItems != null && position >= 0 && position <= mItems.size() - 1) { |
||||
return mItems.get(position); |
||||
} else { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public List<T> getItems() { |
||||
return mItems; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,52 @@ |
||||
package com.project.survey.widget.materialspinner; |
||||
|
||||
import android.content.Context; |
||||
import android.widget.ListAdapter; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Spinner适配器代理 |
||||
* |
||||
* @author xuexiang |
||||
* @since 2019/1/14 下午10:16 |
||||
*/ |
||||
final class MaterialSpinnerAdapterWrapper extends MaterialSpinnerBaseAdapter { |
||||
|
||||
private final ListAdapter listAdapter; |
||||
|
||||
public MaterialSpinnerAdapterWrapper(Context context, ListAdapter toWrap) { |
||||
super(context); |
||||
listAdapter = toWrap; |
||||
} |
||||
|
||||
@Override |
||||
public int getCount() { |
||||
return listAdapter.getCount() - 1; |
||||
} |
||||
|
||||
@Override |
||||
public Object getItem(int position) { |
||||
if (position >= getSelectedIndex()) { |
||||
return listAdapter.getItem(position + 1); |
||||
} else { |
||||
return listAdapter.getItem(position); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Object get(int position) { |
||||
return listAdapter.getItem(position); |
||||
} |
||||
|
||||
@Override |
||||
public List<Object> getItems() { |
||||
List<Object> items = new ArrayList<>(); |
||||
for (int i = 0; i < getCount(); i++) { |
||||
items.add(getItem(i)); |
||||
} |
||||
return items; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,115 @@ |
||||
package com.project.survey.widget.materialspinner; |
||||
|
||||
import android.content.Context; |
||||
import android.content.res.Configuration; |
||||
import android.os.Build; |
||||
import android.util.TypedValue; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.BaseAdapter; |
||||
import android.widget.TextView; |
||||
|
||||
import androidx.annotation.ColorInt; |
||||
import androidx.annotation.DrawableRes; |
||||
|
||||
|
||||
import com.project.survey.R; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 基础Spinner适配器 |
||||
* |
||||
* @author xuexiang |
||||
* @since 2019/1/14 下午10:03 |
||||
*/ |
||||
public abstract class MaterialSpinnerBaseAdapter<T> extends BaseAdapter { |
||||
|
||||
private final Context context; |
||||
private int selectedIndex; |
||||
private int textColor; |
||||
private float textSize; |
||||
private int backgroundSelector; |
||||
|
||||
public MaterialSpinnerBaseAdapter(Context context) { |
||||
this.context = context; |
||||
} |
||||
|
||||
@Override |
||||
public View getView(int position, View convertView, ViewGroup parent) { |
||||
final TextView textView; |
||||
if (convertView == null) { |
||||
LayoutInflater inflater = LayoutInflater.from(context); |
||||
convertView = inflater.inflate(R.layout.ms_layout_list_item, parent, false); |
||||
textView = convertView.findViewById(R.id.tv_tinted_spinner); |
||||
textView.setTextColor(textColor); |
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
||||
if (backgroundSelector != 0) { |
||||
textView.setBackgroundResource(backgroundSelector); |
||||
} |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { |
||||
Configuration config = context.getResources().getConfiguration(); |
||||
if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { |
||||
textView.setTextDirection(View.TEXT_DIRECTION_RTL); |
||||
} |
||||
} |
||||
convertView.setTag(new ViewHolder(textView)); |
||||
} else { |
||||
textView = ((ViewHolder) convertView.getTag()).textView; |
||||
} |
||||
textView.setText(getItemText(position)); |
||||
return convertView; |
||||
} |
||||
|
||||
public String getItemText(int position) { |
||||
return getItem(position).toString(); |
||||
} |
||||
|
||||
public int getSelectedIndex() { |
||||
return selectedIndex; |
||||
} |
||||
|
||||
public void notifyItemSelected(int index) { |
||||
selectedIndex = index; |
||||
} |
||||
|
||||
@Override |
||||
public long getItemId(int position) { |
||||
return position; |
||||
} |
||||
|
||||
@Override |
||||
public abstract T getItem(int position); |
||||
|
||||
@Override |
||||
public abstract int getCount(); |
||||
|
||||
public abstract T get(int position); |
||||
|
||||
public abstract List<T> getItems(); |
||||
|
||||
public MaterialSpinnerBaseAdapter<T> setTextColor(@ColorInt int textColor) { |
||||
this.textColor = textColor; |
||||
return this; |
||||
} |
||||
|
||||
public MaterialSpinnerBaseAdapter<T> setTextSize(float textSize) { |
||||
this.textSize = textSize; |
||||
return this; |
||||
} |
||||
|
||||
public MaterialSpinnerBaseAdapter<T> setBackgroundSelector(@DrawableRes int backgroundSelector) { |
||||
this.backgroundSelector = backgroundSelector; |
||||
return this; |
||||
} |
||||
|
||||
private static class ViewHolder { |
||||
|
||||
private TextView textView; |
||||
|
||||
private ViewHolder(TextView textView) { |
||||
this.textView = textView; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,16 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<alpha |
||||
android:duration="300" |
||||
android:fromAlpha="1.0" |
||||
android:toAlpha="0.0"/> |
||||
<scale |
||||
android:duration="300" |
||||
android:fromXScale="1.0" |
||||
android:fromYScale="1.0" |
||||
android:interpolator="@android:anim/accelerate_interpolator" |
||||
android:pivotX="85%" |
||||
android:pivotY="0%" |
||||
android:toXScale="0" |
||||
android:toYScale="0"/> |
||||
</set> |
@ -0,0 +1,16 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<alpha |
||||
android:duration="300" |
||||
android:fromAlpha="0.0" |
||||
android:toAlpha="1.0"/> |
||||
<scale |
||||
android:duration="300" |
||||
android:fromXScale="0" |
||||
android:fromYScale="0" |
||||
android:interpolator="@android:anim/decelerate_interpolator" |
||||
android:pivotX="85%" |
||||
android:pivotY="0%" |
||||
android:toXScale="1.0" |
||||
android:toYScale="1.0"/> |
||||
</set> |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<item android:color="@color/colorPrimary" android:state_selected="true" /> |
||||
<item android:color="@color/text_color_1" android:state_selected="false" /> |
||||
</selector> |
@ -0,0 +1,10 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:shape="rectangle"> |
||||
<corners android:radius="@dimen/sw_2dp" /> |
||||
|
||||
<stroke |
||||
android:width="@dimen/sw_0_5dp" |
||||
android:color="@color/colorPrimary" /> |
||||
|
||||
</shape> |
@ -0,0 +1,19 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<item android:state_selected="true"> |
||||
<shape android:shape="rectangle"> |
||||
<solid android:color="#E9F1FC" /> |
||||
<corners android:radius="99dp" /> |
||||
<stroke android:width="@dimen/sw_1dp" android:color="#1F396BD0" /> |
||||
</shape> |
||||
</item> |
||||
|
||||
<item android:state_selected="false"> |
||||
<shape android:shape="rectangle"> |
||||
<solid android:color="@color/white" /> |
||||
<corners android:radius="99dp" /> |
||||
<stroke android:width="@dimen/sw_1dp" android:color="#DFDFDF" /> |
||||
</shape> |
||||
</item> |
||||
|
||||
</selector> |
@ -0,0 +1,9 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:shape="rectangle"> |
||||
|
||||
<corners android:radius="@dimen/sw_4dp" /> |
||||
|
||||
<solid android:color="@color/white" /> |
||||
|
||||
</shape> |
@ -0,0 +1,13 @@ |
||||
<vector android:autoMirrored="true" android:height="58dp" |
||||
android:viewportHeight="58" android:viewportWidth="55" |
||||
android:width="55dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#00000000" |
||||
android:pathData="M6,10.875C10.5,6.679 20.579,6.067 20.579,13.132C21.119,21.825 1.712,38.091 7.62,46.069C10.86,50.443 20.428,46.675 24.702,41.866" |
||||
android:strokeColor="#000000" android:strokeLineCap="round" android:strokeWidth="3.6"/> |
||||
<path android:fillColor="#00000000" |
||||
android:pathData="M43.711,3.972L48.307,7.57A1.5,1.5 83.136,0 1,48.564 9.676L33.507,28.909A1.5,1.5 121.424,0 1,31.401 29.166L26.805,25.568A1.5,1.5 83.245,0 1,26.548 23.462L41.605,4.228A1.5,1.5 70.335,0 1,43.711 3.972z" |
||||
android:strokeColor="#000000" android:strokeWidth="3"/> |
||||
<path android:fillColor="#00000000" |
||||
android:pathData="M22.094,37.441C21.56,37.723 20.944,37.24 21.089,36.654L23.082,28.587C23.204,28.094 23.793,27.89 24.193,28.203L29.553,32.399C29.952,32.712 29.897,33.333 29.447,33.57L22.094,37.441Z" |
||||
android:strokeColor="#000000" android:strokeWidth="2.6"/> |
||||
</vector> |
@ -0,0 +1,10 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="48dp" |
||||
android:height="48dp" |
||||
android:autoMirrored="true" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:fillColor="#333333" |
||||
android:pathData="M764.9,249.9L259.1,249.9C116.2,249.9 0,365.6 0,508.9 0,651.8 116.2,768 259.1,768h505.9c142.8,0 259.1,-116.2 259.1,-259.1 0,-143.4 -116.2,-259.1 -259.1,-259.1zM259.1,745.5c-130.6,0 -236.5,-106 -236.5,-236.5 0,-130.6 106,-236.5 236.5,-236.5s236.5,106 236.5,236.5c0,130.6 -106,236.5 -236.5,236.5z" /> |
||||
</vector> |
@ -0,0 +1,5 @@ |
||||
<vector android:alpha="0.9" android:height="48dp" |
||||
android:viewportHeight="1024" android:viewportWidth="1024" |
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FF000000" android:pathData="M912,348.8c11.2,28.8 4.8,62.4 -16,84.8 -40,43.2 -40,112 0,156.8 20.8,22.4 27.2,56 16,84.8 -14.4,36.8 -35.2,72 -59.2,102.4 -19.2,24 -51.2,35.2 -80,28.8 -28.8,-6.4 -57.6,-1.6 -83.2,12.8s-43.2,38.4 -52.8,65.6c-9.6,30.4 -35.2,51.2 -65.6,56 -19.2,1.6 -40,3.2 -59.2,3.2 -19.2,0 -40,-1.6 -59.2,-4.8 -30.4,-4.8 -56,-25.6 -65.6,-56 -17.6,-57.6 -76.8,-91.2 -136,-78.4 -30.4,6.4 -60.8,-4.8 -80,-28.8 -24,-32 -44.8,-65.6 -59.2,-102.4 -11.2,-28.8 -4.8,-62.4 16,-84.8 40,-43.2 40,-112 0,-156.8 -20.8,-22.4 -27.2,-56 -16,-84.8 14.4,-36.8 35.2,-72 59.2,-102.4 19.2,-24 51.2,-35.2 81.6,-28.8 28.8,6.4 57.6,1.6 83.2,-12.8s43.2,-38.4 52.8,-65.6c9.6,-30.4 35.2,-51.2 65.6,-56 38.4,-4.8 78.4,-4.8 118.4,0 30.4,4.8 56,25.6 65.6,56 8,27.2 27.2,51.2 52.8,65.6 25.6,14.4 54.4,19.2 83.2,12.8 30.4,-6.4 62.4,4.8 80,28.8 22.4,33.6 43.2,67.2 57.6,104zM852.8,372.8c-12.8,-30.4 -30.4,-60.8 -51.2,-86.4 -3.2,-4.8 -9.6,-6.4 -16,-4.8 -43.2,9.6 -89.6,3.2 -128,-19.2 -40,-22.4 -68.8,-59.2 -81.6,-102.4 -1.6,-6.4 -6.4,-11.2 -12.8,-11.2 -33.6,-4.8 -67.2,-4.8 -100.8,0 -6.4,1.6 -11.2,4.8 -12.8,11.2 -12.8,43.2 -41.6,80 -81.6,102.4 -38.4,22.4 -84.8,28.8 -129.6,19.2 -6.4,-1.6 -12.8,1.6 -16,4.8 -20.8,27.2 -38.4,56 -51.2,86.4 -1.6,6.4 -1.6,12.8 3.2,17.6 62.4,68.8 62.4,174.4 0,243.2 -4.8,4.8 -4.8,11.2 -3.2,16 12.8,32 30.4,60.8 49.6,86.4 3.2,4.8 11.2,6.4 16,6.4C328,721.6 419.2,776 448,864c1.6,6.4 6.4,9.6 12.8,11.2 16,1.6 33.6,3.2 49.6,3.2 17.6,0 33.6,-1.6 51.2,-3.2 6.4,-1.6 11.2,-4.8 12.8,-11.2 12.8,-43.2 41.6,-80 81.6,-102.4 38.4,-22.4 84.8,-28.8 129.6,-19.2 6.4,1.6 12.8,-1.6 16,-4.8 20.8,-27.2 38.4,-56 51.2,-86.4 1.6,-4.8 1.6,-12.8 -3.2,-17.6 -62.4,-68.8 -62.4,-174.4 0,-243.2 4.8,-4.8 4.8,-11.2 3.2,-17.6zM505.6,672c-88,0 -160,-72 -160,-160s72,-160 160,-160 160,72 160,160 -70.4,160 -160,160zM505.6,608c52.8,0 96,-43.2 96,-96s-43.2,-96 -96,-96 -96,43.2 -96,96 43.2,96 96,96z"/> |
||||
</vector> |
@ -0,0 +1,6 @@ |
||||
<vector android:alpha="0.9" android:height="48dp" |
||||
android:viewportHeight="1024" android:viewportWidth="1024" |
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FF000000" android:pathData="M465.7,707.2a49,49 0,1 0,97.9 0,49 49,0 1,0 -97.9,0zM398.1,310c-32.3,35.1 -67.3,138.2 7.9,140 42,1 41.6,-25.1 43.7,-31.3s6.3,-35.6 19,-47.9 18.9,-18.4 38.6,-18.4c19.3,0 34.6,5.1 46.1,15.2 11.6,10.1 17.3,22.3 17.3,36.7a54.8,54.8 0,0 1,-7 28.4c-4.7,7.9 -18.3,22.5 -40.9,43.6 -23.4,22 -40.6,45.6 -51,70.5 -22.7,54.7 61.1,71.4 77.9,47.1 16.5,-23.9 6.9,-28.5 46.5,-68C616,507.2 628.4,493.7 633.6,485.6c9,-13.4 15.3,-26.7 19.4,-39.6a139.1,139.1 0,0 0,-13.1 -110.5c-38.9,-68.5 -161,-113.5 -241.9,-25.5z"/> |
||||
<path android:fillColor="#FF000000" android:pathData="M508.5,66.9A448,448 0,0 0,61 514.4a448,448 0,0 0,447.6 447.6,448 448,0 0,0 447.6,-447.6A448,448 0,0 0,508.5 66.9zM508.5,898a384,384 0,0 1,-383.6 -383.6A384,384 0,0 1,508.5 130.9a384,384 0,0 1,383.6 383.6,384 384,0 0,1 -383.6,383.6z"/> |
||||
</vector> |
@ -0,0 +1,8 @@ |
||||
<vector android:alpha="0.8" android:autoMirrored="true" |
||||
android:height="24dp" android:viewportHeight="24" |
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<group> |
||||
<clip-path android:fillType="evenOdd" android:pathData="M11.281,3.22C10.988,2.927 10.512,2.927 10.219,3.22L2.396,11.043L2.359,11.083C2.006,11.475 2.019,12.08 2.396,12.457C2.584,12.645 2.838,12.75 3.103,12.75H21L21.045,12.749C21.437,12.726 21.75,12.399 21.75,12L21.748,11.956C21.726,11.562 21.398,11.25 21,11.25H4.31L11.281,4.28L11.314,4.244C11.572,3.95 11.56,3.501 11.281,3.22ZM11.281,19.72L5.31,13.75H3.189L10.22,20.78L10.256,20.814C10.551,21.073 11,21.062 11.281,20.78C11.562,20.499 11.572,20.05 11.314,19.756L11.281,19.72Z"/> |
||||
<path android:fillColor="#000000" android:pathData="M24,0H0V24H24V0Z"/> |
||||
</group> |
||||
</vector> |
@ -0,0 +1,6 @@ |
||||
<vector android:alpha="0.9" android:height="48dp" |
||||
android:viewportHeight="1024" android:viewportWidth="1024" |
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FF000000" android:pathData="M784,112L240,112c-88,0 -160,72 -160,160v480c0,88 72,160 160,160h544c88,0 160,-72 160,-160L944,272c0,-88 -72,-160 -160,-160zM144,720L144,304h736v416L144,720zM240,176h544c41.6,0 76.8,27.2 89.6,64L150.4,240c12.8,-36.8 48,-64 89.6,-64zM784,848L240,848c-41.6,0 -76.8,-27.2 -89.6,-64h724.8c-14.4,36.8 -49.6,64 -91.2,64z"/> |
||||
<path android:fillColor="#FF000000" android:pathData="M628.8,457.6l-131.2,-78.4c-9.6,-6.4 -20.8,-9.6 -33.6,-9.6 -35.2,0 -64,28.8 -64,64V592c0,11.2 3.2,22.4 9.6,33.6 8,14.4 22.4,25.6 40,28.8 4.8,1.6 11.2,1.6 16,1.6 11.2,0 22.4,-3.2 33.6,-9.6L630.4,568c9.6,-4.8 16,-12.8 22.4,-22.4 16,-30.4 6.4,-70.4 -24,-88zM595.2,512L464,590.4V432l131.2,80z"/> |
||||
</vector> |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<item android:drawable="@color/c_10000000" android:state_pressed="true" /> |
||||
<item android:drawable="@color/white" android:state_pressed="false" /> |
||||
</selector> |
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<item android:top="?attr/ms_dropdown_offset"> |
||||
<shape android:shape="rectangle"> |
||||
<solid android:color="@color/white" /> |
||||
</shape> |
||||
</item> |
||||
</layer-list> |
@ -0,0 +1,10 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="24" |
||||
android:viewportHeight="24"> |
||||
<path |
||||
android:fillColor="#000000" |
||||
android:pathData="M7,10L12,15L17,10H7Z" /> |
||||
</vector> |
@ -0,0 +1,7 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:drawable="@drawable/ms_ic_arrow_down" |
||||
android:fromDegrees="0" |
||||
android:pivotX="50%" |
||||
android:pivotY="50%" |
||||
android:toDegrees="180" /> |
@ -1,6 +1,16 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
<include layout="@layout/toolbar" /> |
||||
|
||||
<include layout="@layout/item_search" /> |
||||
|
||||
<androidx.fragment.app.FragmentContainerView |
||||
android:id="@+id/container" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" /> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,21 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<include layout="@layout/toolbar" /> |
||||
|
||||
<include |
||||
android:id="@+id/ilSearch" |
||||
layout="@layout/item_search_control_net" /> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:padding="@dimen/sw_12dp" |
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,19 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<include layout="@layout/toolbar" /> |
||||
|
||||
<include layout="@layout/item_search" /> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:padding="@dimen/sw_12dp" |
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,61 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<include layout="@layout/toolbar" /> |
||||
|
||||
<include layout="@layout/item_search" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@color/white" |
||||
android:orientation="horizontal" |
||||
android:paddingHorizontal="@dimen/sw_16dp" |
||||
android:paddingVertical="@dimen/sw_14dp"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvAll" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_point_measure_selector" |
||||
android:paddingHorizontal="@dimen/sw_11dp" |
||||
android:paddingVertical="@dimen/sw_5dp" |
||||
android:text="全部 23" |
||||
android:textColor="@color/text_color_selector_blue_black" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvSurveyPlan" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="@dimen/sw_11dp" |
||||
android:background="@drawable/bg_point_measure_selector" |
||||
android:paddingHorizontal="@dimen/sw_11dp" |
||||
android:paddingVertical="@dimen/sw_5dp" |
||||
android:text="测量计划12" |
||||
android:textColor="@color/text_color_selector_blue_black" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvProjectMeasured" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="@dimen/sw_11dp" |
||||
android:background="@drawable/bg_point_measure_selector" |
||||
android:paddingHorizontal="@dimen/sw_11dp" |
||||
android:paddingVertical="@dimen/sw_5dp" |
||||
android:text="工程计量11" |
||||
android:textColor="@color/text_color_selector_blue_black" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<androidx.fragment.app.FragmentContainerView |
||||
android:id="@+id/container" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" /> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,122 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:leon="http://schemas.android.com/apk/res-auto" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<include layout="@layout/toolbar" /> |
||||
|
||||
<ScrollView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginStart="16dp" |
||||
android:layout_marginEnd="16dp" |
||||
android:orientation="vertical"> |
||||
|
||||
<com.leon.lib.settingview.LSettingItem |
||||
android:id="@+id/switch_gps" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:layout_marginBottom="4dp" |
||||
leon:inputType="numberDecimal" |
||||
leon:isShowUnderLine="true" |
||||
leon:leftText="GPS" |
||||
leon:leftTextSize="18" |
||||
leon:rightStyle="iconSwitch" |
||||
leon:rightText="" |
||||
leon:rightTextSize="18" /> |
||||
|
||||
<com.leon.lib.settingview.LSettingItem |
||||
android:id="@+id/switch_glonass" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:layout_marginBottom="4dp" |
||||
leon:inputType="numberDecimal" |
||||
leon:isShowUnderLine="true" |
||||
leon:leftText="GLONASS" |
||||
leon:leftTextSize="18" |
||||
leon:rightStyle="iconSwitch" |
||||
leon:rightText="" |
||||
leon:rightTextSize="18" /> |
||||
|
||||
<com.leon.lib.settingview.LSettingItem |
||||
android:id="@+id/switch_beidou" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:layout_marginBottom="4dp" |
||||
leon:inputType="numberDecimal" |
||||
leon:isShowUnderLine="true" |
||||
leon:leftText="BEIDOU" |
||||
leon:leftTextSize="18" |
||||
leon:rightStyle="iconSwitch" |
||||
leon:rightText="" |
||||
leon:rightTextSize="18" /> |
||||
|
||||
<com.leon.lib.settingview.LSettingItem |
||||
android:id="@+id/switch_galileo" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:layout_marginBottom="4dp" |
||||
leon:inputType="numberDecimal" |
||||
leon:isShowUnderLine="true" |
||||
leon:leftText="GALILEO" |
||||
leon:leftTextSize="18" |
||||
leon:rightStyle="iconSwitch" |
||||
leon:rightText="" |
||||
leon:rightTextSize="18" /> |
||||
|
||||
<com.leon.lib.settingview.LSettingItem |
||||
android:id="@+id/switch_qzss" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:layout_marginBottom="4dp" |
||||
leon:inputType="numberDecimal" |
||||
leon:isShowUnderLine="true" |
||||
leon:leftText="QZSS" |
||||
leon:leftTextSize="18" |
||||
leon:rightStyle="iconSwitch" |
||||
leon:rightText="" |
||||
leon:rightTextSize="18" /> |
||||
|
||||
<com.leon.lib.settingview.LSettingItem |
||||
android:id="@+id/switch_sbas" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:layout_marginBottom="4dp" |
||||
leon:inputType="numberDecimal" |
||||
leon:isShowUnderLine="true" |
||||
leon:leftText="SBAS" |
||||
leon:leftTextSize="18" |
||||
leon:rightStyle="iconSwitch" |
||||
leon:rightText="" |
||||
leon:rightTextSize="18" /> |
||||
</LinearLayout> |
||||
</ScrollView> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="horizontal"> |
||||
|
||||
<Button |
||||
android:id="@+id/btn_apply" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:layout_weight="1" |
||||
android:text="@string/apply" /> |
||||
|
||||
</LinearLayout> |
||||
</LinearLayout> |
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:id="@+id/recyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:padding="@dimen/sw_12dp" |
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> |
@ -0,0 +1,14 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:padding="@dimen/sw_12dp" |
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,39 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_white_round_4" |
||||
android:orientation="vertical" |
||||
android:padding="@dimen/sw_12dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="单位测量资质报验单" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_13sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="XMBH2021-00001" |
||||
android:textColor="@color/text_color_2" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_12dp" |
||||
android:text="发起时间:" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:text="结束时间:" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,68 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_white_round_4" |
||||
android:padding="@dimen/sw_12dp"> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/llContent" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="单位测量资质报验单" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_13sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="XMBH2021-00001" |
||||
android:textColor="@color/text_color_2" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_5dp" |
||||
android:background="@drawable/bg_approval_blue_stroke" |
||||
android:paddingHorizontal="@dimen/sw_4dp" |
||||
android:paddingVertical="@dimen/sw_1dp" |
||||
android:text="监理审核" |
||||
android:textColor="@color/colorPrimary" |
||||
android:textSize="@dimen/sw_10sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_12dp" |
||||
android:text="接收人:" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:text="办理时间:" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<ImageView |
||||
android:id="@+id/ivAgree" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignBottom="@+id/llContent" |
||||
android:layout_alignParentEnd="true" |
||||
android:background="@mipmap/ic_approval_agree" |
||||
android:visibility="gone" |
||||
tools:visibility="visible" /> |
||||
|
||||
</RelativeLayout> |
@ -0,0 +1,157 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_white_round_4" |
||||
android:orientation="vertical" |
||||
android:paddingHorizontal="@dimen/sw_12dp" |
||||
android:paddingTop="@dimen/sw_12dp" |
||||
android:paddingBottom="@dimen/sw_6dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="点名称" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_13sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<include |
||||
layout="@layout/line_hor" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/sw_0_5dp" |
||||
android:layout_marginTop="@dimen/sw_12dp" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/sw_36dp" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical" |
||||
android:text="X(m)" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvX" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:gravity="end" |
||||
android:text="362122.22" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/sw_36dp" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical" |
||||
android:text="Y(m)" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvY" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:gravity="end" |
||||
android:text="362122.22" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/sw_36dp" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical" |
||||
android:text="Z(m)" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvZ" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:gravity="end" |
||||
android:text="362122.22" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/sw_36dp" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical" |
||||
android:text="施测时间" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvTime" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:gravity="end" |
||||
android:text="2022-06-10 09:27:49" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/sw_36dp" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical" |
||||
android:text="备注" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvRemark" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:gravity="end" |
||||
android:text="" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
|
||||
</LinearLayout> |
||||
|
@ -0,0 +1,37 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_white_round_4" |
||||
android:orientation="vertical" |
||||
android:padding="@dimen/sw_12dp"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvPointName" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="点名称" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_13sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvGrade" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_12dp" |
||||
android:text="等级:内容" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvTime" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:text="施测时间:2022-05-17 10:58:48" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
@ -0,0 +1,74 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_white_round_4" |
||||
android:orientation="vertical" |
||||
android:padding="@dimen/sw_12dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="作业名称" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_13sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_12dp" |
||||
android:text="作业描述:内容" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:text="创建时间:2022-05-17 10:58:48" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:text="分项工程名称:单位-分部-分项 3个名称合并显示" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:layout_marginBottom="@dimen/sw_10dp" |
||||
android:text="测量员:丁汉臻" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<include layout="@layout/line_hor" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_10dp" |
||||
android:gravity="end" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvProjectMeasured" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="@dimen/sw_11dp" |
||||
android:background="@drawable/bg_point_measure_selector" |
||||
android:paddingHorizontal="@dimen/sw_28dp" |
||||
android:paddingVertical="@dimen/sw_6dp" |
||||
android:text="@string/lofting" |
||||
android:textColor="@color/text_color_selector_blue_black" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
@ -0,0 +1,106 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_white_round_4" |
||||
android:orientation="vertical" |
||||
android:padding="@dimen/sw_12dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="测量单位报审(验)单" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_13sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="XMBH2021-00001" |
||||
android:textColor="@color/text_color_2" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_5dp" |
||||
android:background="@drawable/bg_approval_blue_stroke" |
||||
android:paddingHorizontal="@dimen/sw_4dp" |
||||
android:paddingVertical="@dimen/sw_1dp" |
||||
android:text="测量类型" |
||||
android:textColor="@color/colorPrimary" |
||||
android:textSize="@dimen/sw_10sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_12dp" |
||||
android:text="分项工程名称:单位-分部-分项3个名称合并显示" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:text="测量内容:内容名称" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_4dp" |
||||
android:layout_marginBottom="@dimen/sw_10dp" |
||||
android:text="申请人:丁汉臻" |
||||
android:textColor="@color/text_color_1" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<include layout="@layout/line_hor" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="@dimen/sw_10dp" |
||||
android:gravity="end" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvAll" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/bg_point_measure_selector" |
||||
android:paddingHorizontal="@dimen/sw_11dp" |
||||
android:paddingVertical="@dimen/sw_5dp" |
||||
android:text="生成报验单" |
||||
android:textColor="@color/text_color_selector_blue_black" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvSurveyPlan" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="@dimen/sw_11dp" |
||||
android:background="@drawable/bg_point_measure_selector" |
||||
android:paddingHorizontal="@dimen/sw_11dp" |
||||
android:paddingVertical="@dimen/sw_5dp" |
||||
android:text="结束测量" |
||||
android:textColor="@color/text_color_selector_blue_black" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvProjectMeasured" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="@dimen/sw_11dp" |
||||
android:background="@drawable/bg_point_measure_selector" |
||||
android:paddingHorizontal="@dimen/sw_11dp" |
||||
android:paddingVertical="@dimen/sw_5dp" |
||||
android:text="进入测量" |
||||
android:textColor="@color/text_color_selector_blue_black" |
||||
android:textSize="@dimen/sw_12sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue