diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt index 69c572b05e..b8923981fd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/activities/QuickWizardListActivity.kt @@ -11,6 +11,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import info.nightscout.androidaps.R import info.nightscout.androidaps.activities.NoSplashAppCompatActivity +import info.nightscout.androidaps.databinding.OverviewQuickwizardlistActivityBinding import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange @@ -20,10 +21,10 @@ import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.wizard.QuickWizard import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.CompositeDisposable -import kotlinx.android.synthetic.main.overview_quickwizardlist_activity.* import javax.inject.Inject class QuickWizardListActivity : NoSplashAppCompatActivity() { + @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var quickWizard: QuickWizard @@ -31,6 +32,8 @@ class QuickWizardListActivity : NoSplashAppCompatActivity() { private var disposable: CompositeDisposable = CompositeDisposable() + private lateinit var binding: OverviewQuickwizardlistActivityBinding + private inner class RecyclerViewAdapter(var fragmentManager: FragmentManager) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QuickWizardEntryViewHolder { @@ -47,6 +50,7 @@ class QuickWizardListActivity : NoSplashAppCompatActivity() { override fun getItemCount(): Int = quickWizard.size() private inner class QuickWizardEntryViewHolder(itemView: View, var fragmentManager: FragmentManager) : RecyclerView.ViewHolder(itemView) { + val buttonText: TextView = itemView.findViewById(R.id.overview_quickwizard_item_buttonText) val carbs: TextView = itemView.findViewById(R.id.overview_quickwizard_item_carbs) val from: TextView = itemView.findViewById(R.id.overview_quickwizard_item_from) @@ -73,13 +77,14 @@ class QuickWizardListActivity : NoSplashAppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.overview_quickwizardlist_activity) + binding = OverviewQuickwizardlistActivityBinding.inflate(layoutInflater) + setContentView(binding.root) - overview_quickwizardactivity_recyclerview?.setHasFixedSize(true) - overview_quickwizardactivity_recyclerview?.layoutManager = LinearLayoutManager(this) - overview_quickwizardactivity_recyclerview?.adapter = RecyclerViewAdapter(supportFragmentManager) + binding.recyclerview.setHasFixedSize(true) + binding.recyclerview.layoutManager = LinearLayoutManager(this) + binding.recyclerview.adapter = RecyclerViewAdapter(supportFragmentManager) - overview_quickwizardactivity_add_button.setOnClickListener { + binding.addButton.setOnClickListener { val manager = supportFragmentManager val editQuickWizardDialog = EditQuickWizardDialog() editQuickWizardDialog.show(manager, "EditQuickWizardDialog") @@ -93,7 +98,7 @@ class QuickWizardListActivity : NoSplashAppCompatActivity() { .observeOn(AndroidSchedulers.mainThread()) .subscribe({ val adapter = RecyclerViewAdapter(supportFragmentManager) - overview_quickwizardactivity_recyclerview?.swapAdapter(adapter, false) + binding.recyclerview.swapAdapter(adapter, false) }, { fabricPrivacy.logException(it) }) } diff --git a/app/src/main/res/layout/overview_quickwizardlist_activity.xml b/app/src/main/res/layout/overview_quickwizardlist_activity.xml index dc8d3ac8b3..36684867e1 100644 --- a/app/src/main/res/layout/overview_quickwizardlist_activity.xml +++ b/app/src/main/res/layout/overview_quickwizardlist_activity.xml @@ -1,36 +1,32 @@ - - + android:layout_height="wrap_content" + android:paddingBottom="15dp" + android:text="@string/quickwizard" + android:textAlignment="center" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" /> - +