TreatmentsBolusFragment -> jetpack

This commit is contained in:
Milos Kozak 2021-02-03 16:04:09 +01:00
parent 74ae51a9e0
commit 8a15fe12ba
3 changed files with 132 additions and 133 deletions

View file

@ -5,23 +5,23 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.TreatmentsBolusFragmentBinding
import info.nightscout.androidaps.databinding.TreatmentsBolusItemBinding
import info.nightscout.androidaps.db.Source import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.db.Treatment
import info.nightscout.androidaps.dialogs.WizardInfoDialog
import info.nightscout.androidaps.events.EventTreatmentChange import info.nightscout.androidaps.events.EventTreatmentChange
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
import info.nightscout.androidaps.db.Treatment
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.dialogs.WizardInfoDialog
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsBolusFragment.RecyclerViewAdapter.TreatmentsViewHolder import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsBolusFragment.RecyclerViewAdapter.TreatmentsViewHolder
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
@ -31,10 +31,10 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.treatments_bolus_fragment.*
import javax.inject.Inject import javax.inject.Inject
class TreatmentsBolusFragment : DaggerFragment() { class TreatmentsBolusFragment : DaggerFragment() {
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
@Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var rxBus: RxBusWrapper
@ -48,25 +48,29 @@ class TreatmentsBolusFragment : DaggerFragment() {
@Inject lateinit var dateUtil: DateUtil @Inject lateinit var dateUtil: DateUtil
@Inject lateinit var buildHelper: BuildHelper @Inject lateinit var buildHelper: BuildHelper
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, private var _binding: TreatmentsBolusFragmentBinding? = null
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.treatments_bolus_fragment, container, false) // This property is only valid between onCreateView and
} // onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
TreatmentsBolusFragmentBinding.inflate(inflater, container, false).also { _binding = it }.root
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
treatments_recyclerview.setHasFixedSize(true) binding.recyclerview.setHasFixedSize(true)
treatments_recyclerview.layoutManager = LinearLayoutManager(view.context) binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
treatments_recyclerview.adapter = RecyclerViewAdapter(treatmentsPlugin.treatmentsFromHistory) binding.recyclerview.adapter = RecyclerViewAdapter(treatmentsPlugin.treatmentsFromHistory)
treatments_reshreshfromnightscout.setOnClickListener { binding.reshreshFromNightscout.setOnClickListener {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?", Runnable { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
treatmentsPlugin.service.resetTreatments() treatmentsPlugin.service.resetTreatments()
rxBus.send(EventNSClientRestart()) rxBus.send(EventNSClientRestart())
})
} }
} }
treatments_delete_future_treatments.setOnClickListener { }
binding.deleteFutureTreatments.setOnClickListener {
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), resourceHelper.gs(R.string.deletefuturetreatments) + "?", Runnable { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), resourceHelper.gs(R.string.deletefuturetreatments) + "?", Runnable {
val futureTreatments = treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true) val futureTreatments = treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true)
@ -82,10 +86,11 @@ class TreatmentsBolusFragment : DaggerFragment() {
} }
} }
val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) || !buildHelper.isEngineeringMode() val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) || !buildHelper.isEngineeringMode()
if (nsUploadOnly) treatments_reshreshfromnightscout.visibility = View.GONE if (nsUploadOnly) binding.reshreshFromNightscout.visibility = View.GONE
} }
@Synchronized override fun onResume() { @Synchronized
override fun onResume() {
super.onResume() super.onResume()
disposable.add(rxBus disposable.add(rxBus
.toObservable(EventTreatmentChange::class.java) .toObservable(EventTreatmentChange::class.java)
@ -100,12 +105,20 @@ class TreatmentsBolusFragment : DaggerFragment() {
updateGui() updateGui()
} }
@Synchronized override fun onPause() { @Synchronized
override fun onPause() {
super.onPause() super.onPause()
disposable.clear() disposable.clear()
} }
@Synchronized
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
inner class RecyclerViewAdapter internal constructor(var treatments: List<Treatment>) : RecyclerView.Adapter<TreatmentsViewHolder>() { inner class RecyclerViewAdapter internal constructor(var treatments: List<Treatment>) : RecyclerView.Adapter<TreatmentsViewHolder>() {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): TreatmentsViewHolder { override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): TreatmentsViewHolder {
val v = LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_bolus_item, viewGroup, false) val v = LayoutInflater.from(viewGroup.context).inflate(R.layout.treatments_bolus_item, viewGroup, false)
return TreatmentsViewHolder(v) return TreatmentsViewHolder(v)
@ -114,41 +127,32 @@ class TreatmentsBolusFragment : DaggerFragment() {
override fun onBindViewHolder(holder: TreatmentsViewHolder, position: Int) { override fun onBindViewHolder(holder: TreatmentsViewHolder, position: Int) {
val profile = profileFunction.getProfile() ?: return val profile = profileFunction.getProfile() ?: return
val t = treatments[position] val t = treatments[position]
holder.date.text = dateUtil.dateAndTimeString(t.date) holder.binding.date.text = dateUtil.dateAndTimeString(t.date)
holder.insulin.text = resourceHelper.gs(R.string.formatinsulinunits, t.insulin) holder.binding.insulin.text = resourceHelper.gs(R.string.formatinsulinunits, t.insulin)
holder.carbs.text = resourceHelper.gs(R.string.format_carbs, t.carbs.toInt()) holder.binding.carbs.text = resourceHelper.gs(R.string.format_carbs, t.carbs.toInt())
val iob = t.iobCalc(System.currentTimeMillis(), profile.dia) val iob = t.iobCalc(System.currentTimeMillis(), profile.dia)
holder.iob.text = resourceHelper.gs(R.string.formatinsulinunits, iob.iobContrib) holder.binding.iob.text = resourceHelper.gs(R.string.formatinsulinunits, iob.iobContrib)
holder.mealOrCorrection.text = if (t.isSMB) "SMB" else if (t.mealBolus) resourceHelper.gs(R.string.mealbolus) else resourceHelper.gs(R.string.correctionbous) holder.binding.mealOrCorrection.text = if (t.isSMB) "SMB" else if (t.mealBolus) resourceHelper.gs(R.string.mealbolus) else resourceHelper.gs(R.string.correctionbous)
holder.ph.visibility = if (t.source == Source.PUMP) View.VISIBLE else View.GONE holder.binding.pump.visibility = if (t.source == Source.PUMP) View.VISIBLE else View.GONE
holder.ns.visibility = if (NSUpload.isIdValid(t._id)) View.VISIBLE else View.GONE holder.binding.ns.visibility = if (NSUpload.isIdValid(t._id)) View.VISIBLE else View.GONE
holder.invalid.visibility = if (t.isValid) View.GONE else View.VISIBLE holder.binding.invalid.visibility = if (t.isValid) View.GONE else View.VISIBLE
if (iob.iobContrib != 0.0) holder.iob.setTextColor(resourceHelper.gc(R.color.colorActive)) else holder.iob.setTextColor(holder.carbs.currentTextColor) if (iob.iobContrib != 0.0) holder.binding.iob.setTextColor(resourceHelper.gc(R.color.colorActive)) else holder.binding.iob.setTextColor(holder.binding.carbs.currentTextColor)
if (t.date > DateUtil.now()) holder.date.setTextColor(resourceHelper.gc(R.color.colorScheduled)) else holder.date.setTextColor(holder.carbs.currentTextColor) if (t.date > DateUtil.now()) holder.binding.date.setTextColor(resourceHelper.gc(R.color.colorScheduled)) else holder.binding.date.setTextColor(holder.binding.carbs.currentTextColor)
holder.remove.tag = t holder.binding.remove.tag = t
holder.calculation.tag = t holder.binding.calculation.tag = t
holder.calculation.visibility = if (t.getBoluscalc() == null) View.INVISIBLE else View.VISIBLE holder.binding.calculation.visibility = if (t.getBoluscalc() == null) View.INVISIBLE else View.VISIBLE
} }
override fun getItemCount(): Int { override fun getItemCount(): Int {
return treatments.size return treatments.size
} }
inner class TreatmentsViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class TreatmentsViewHolder internal constructor(view: View) : RecyclerView.ViewHolder(view) {
var cv: CardView = itemView.findViewById(R.id.treatments_cardview)
var date: TextView = itemView.findViewById(R.id.treatments_date) val binding = TreatmentsBolusItemBinding.bind(view)
var insulin: TextView = itemView.findViewById(R.id.treatments_insulin)
var carbs: TextView = itemView.findViewById(R.id.treatments_carbs)
var iob: TextView = itemView.findViewById(R.id.treatments_iob)
var mealOrCorrection: TextView = itemView.findViewById(R.id.treatments_mealorcorrection)
var remove: TextView = itemView.findViewById(R.id.treatments_remove)
var calculation: TextView = itemView.findViewById(R.id.treatments_calculation)
var ph: TextView = itemView.findViewById(R.id.pump_sign)
var ns: TextView = itemView.findViewById(R.id.ns_sign)
var invalid: TextView = itemView.findViewById(R.id.invalid_sign)
init { init {
calculation.setOnClickListener { binding.calculation.setOnClickListener {
val treatment = it.tag as Treatment val treatment = it.tag as Treatment
if (treatment.getBoluscalc() != null) { if (treatment.getBoluscalc() != null) {
val wizardDialog = WizardInfoDialog() val wizardDialog = WizardInfoDialog()
@ -156,8 +160,8 @@ class TreatmentsBolusFragment : DaggerFragment() {
wizardDialog.show(childFragmentManager, "WizardInfoDialog") wizardDialog.show(childFragmentManager, "WizardInfoDialog")
} }
} }
calculation.paintFlags = calculation.paintFlags or Paint.UNDERLINE_TEXT_FLAG binding.calculation.paintFlags = binding.calculation.paintFlags or Paint.UNDERLINE_TEXT_FLAG
remove.setOnClickListener { binding.remove.setOnClickListener {
val treatment = it.tag as Treatment? ?: return@setOnClickListener val treatment = it.tag as Treatment? ?: return@setOnClickListener
activity?.let { activity -> activity?.let { activity ->
val text = resourceHelper.gs(R.string.configbuilder_insulin) + ": " + val text = resourceHelper.gs(R.string.configbuilder_insulin) + ": " +
@ -179,20 +183,21 @@ class TreatmentsBolusFragment : DaggerFragment() {
}) })
} }
} }
remove.paintFlags = remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG binding.remove.paintFlags = binding.remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG
} }
} }
} }
private fun updateGui() { private fun updateGui() {
treatments_recyclerview?.swapAdapter(RecyclerViewAdapter(treatmentsPlugin.treatmentsFromHistory), false) if (_binding == null) return
binding.recyclerview.swapAdapter(RecyclerViewAdapter(treatmentsPlugin.treatmentsFromHistory), false)
if (treatmentsPlugin.lastCalculationTreatments != null) { if (treatmentsPlugin.lastCalculationTreatments != null) {
treatments_iobtotal?.text = resourceHelper.gs(R.string.formatinsulinunits, treatmentsPlugin.lastCalculationTreatments.iob) binding.iobTotal.text = resourceHelper.gs(R.string.formatinsulinunits, treatmentsPlugin.lastCalculationTreatments.iob)
treatments_iobactivitytotal?.text = resourceHelper.gs(R.string.formatinsulinunits, treatmentsPlugin.lastCalculationTreatments.activity) binding.iobActivityTotal.text = resourceHelper.gs(R.string.formatinsulinunits, treatmentsPlugin.lastCalculationTreatments.activity)
} }
if (treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true).isNotEmpty()) if (treatmentsPlugin.service.getTreatmentDataFromTime(DateUtil.now() + 1000, true).isNotEmpty())
treatments_delete_future_treatments?.visibility = View.VISIBLE binding.deleteFutureTreatments.visibility = View.VISIBLE
else else
treatments_delete_future_treatments?.visibility = View.GONE binding.deleteFutureTreatments.visibility = View.GONE
} }
} }

View file

@ -1,48 +1,44 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".plugins.treatments.fragments.TreatmentsBolusFragment"> tools:context=".plugins.treatments.fragments.TreatmentsBolusFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingBottom="10dp" android:paddingTop="10dp"
android:paddingTop="10dp"> android:paddingBottom="10dp">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingStart="10dp"
android:text="@string/treatments_iobtotal_label_string" android:text="@string/treatments_iobtotal_label_string"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView <TextView
android:id="@+id/treatments_iobtotal" android:id="@+id/iob_total"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingStart="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingStart="10dp"
android:text="@string/treatments_iobactivitytotal_label_string" android:text="@string/treatments_iobactivitytotal_label_string"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView <TextView
android:id="@+id/treatments_iobactivitytotal" android:id="@+id/iob_activity_total"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingStart="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" /> android:textStyle="bold" />
@ -54,7 +50,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<Button <Button
android:id="@+id/treatments_reshreshfromnightscout" android:id="@+id/reshresh_from_nightscout"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -63,7 +59,7 @@
android:text="@string/nav_refreshtreatments" /> android:text="@string/nav_refreshtreatments" />
<Button <Button
android:id="@+id/treatments_delete_future_treatments" android:id="@+id/delete_future_treatments"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -74,12 +70,10 @@
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/treatments_recyclerview" android:id="@+id/recyclerview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>
</LinearLayout> </LinearLayout>
</FrameLayout>

View file

@ -27,13 +27,13 @@
android:text="{fa-clock-o}" /> android:text="{fa-clock-o}" />
<TextView <TextView
android:id="@+id/treatments_date" android:id="@+id/date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="5dp" /> android:paddingLeft="5dp" />
<TextView <TextView
android:id="@+id/treatments_mealorcorrection" android:id="@+id/meal_or_correction"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
@ -58,7 +58,7 @@
android:text="@string/treatments_insulin_label_string" /> android:text="@string/treatments_insulin_label_string" />
<TextView <TextView
android:id="@+id/treatments_insulin" android:id="@+id/insulin"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -74,7 +74,7 @@
android:text="@string/treatments_carbs_label_string" /> android:text="@string/treatments_carbs_label_string" />
<TextView <TextView
android:id="@+id/treatments_carbs" android:id="@+id/carbs"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -88,7 +88,7 @@
android:text="" /> android:text="" />
<TextView <TextView
android:id="@+id/pump_sign" android:id="@+id/pump"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
@ -96,7 +96,7 @@
android:textColor="@color/colorSetTempButton" /> android:textColor="@color/colorSetTempButton" />
<TextView <TextView
android:id="@+id/ns_sign" android:id="@+id/ns"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
@ -104,7 +104,7 @@
android:textColor="@color/colorSetTempButton" /> android:textColor="@color/colorSetTempButton" />
<TextView <TextView
android:id="@+id/invalid_sign" android:id="@+id/invalid"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
@ -127,7 +127,7 @@
android:text="@string/treatments_iob_label_string" /> android:text="@string/treatments_iob_label_string" />
<TextView <TextView
android:id="@+id/treatments_iob" android:id="@+id/iob"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -142,7 +142,7 @@
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/treatments_calculation" android:id="@+id/calculation"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
@ -153,7 +153,7 @@
android:textColor="@color/colorCalculatorButton" /> android:textColor="@color/colorCalculatorButton" />
<TextView <TextView
android:id="@+id/treatments_remove" android:id="@+id/remove"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"