-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing files home notification files.
- Loading branch information
1 parent
a2f8267
commit e070950
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/home/EpoxyHomeNotification.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.swordfish.lemuroid.app.mobile.feature.home | ||
|
||
import android.view.View | ||
import android.widget.Button | ||
import android.widget.TextView | ||
import com.airbnb.epoxy.EpoxyAttribute | ||
import com.airbnb.epoxy.EpoxyHolder | ||
import com.airbnb.epoxy.EpoxyModelClass | ||
import com.airbnb.epoxy.EpoxyModelWithHolder | ||
import com.swordfish.lemuroid.R | ||
|
||
@EpoxyModelClass(layout = R.layout.layout_home_notification) | ||
abstract class EpoxyHomeNotification : EpoxyModelWithHolder<EpoxyHomeNotification.Holder>() { | ||
|
||
@EpoxyAttribute | ||
var title: Int? = null | ||
|
||
@EpoxyAttribute | ||
var message: Int? = null | ||
|
||
@EpoxyAttribute | ||
var action: Int? = null | ||
|
||
@EpoxyAttribute | ||
var actionEnabled: Boolean? = null | ||
|
||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) | ||
var onClick: (() -> Unit)? = null | ||
|
||
override fun bind(holder: Holder) { | ||
title?.let { holder.titleView?.setText(it) } | ||
message?.let { holder.messageView?.setText(it) } | ||
action?.let { holder.buttonView?.setText(it) } | ||
actionEnabled?.let { holder.buttonView?.isEnabled = it } | ||
|
||
holder.buttonView?.setOnClickListener { onClick?.invoke() } | ||
} | ||
|
||
override fun unbind(holder: Holder) { | ||
super.unbind(holder) | ||
holder.buttonView?.setOnClickListener(null) | ||
} | ||
|
||
class Holder : EpoxyHolder() { | ||
var itemView: View? = null | ||
var messageView: TextView? = null | ||
var titleView: TextView? = null | ||
var buttonView: Button? = null | ||
|
||
override fun bindView(itemView: View) { | ||
this.itemView = itemView | ||
this.messageView = itemView.findViewById(R.id.message) | ||
this.titleView = itemView.findViewById(R.id.title) | ||
this.buttonView = itemView.findViewById(R.id.action) | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
lemuroid-app/src/main/res/layout/layout_home_notification.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginTop="16dp"> | ||
|
||
<androidx.appcompat.widget.LinearLayoutCompat | ||
android:layout_margin="@dimen/grid_unit_2x" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:layout_gravity="center" | ||
android:orientation="vertical"> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/title" | ||
android:textAppearance="?attr/textAppearanceHeadline6" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="start" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/message" | ||
android:textAppearance="?attr/textAppearanceCaption" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="start" | ||
android:layout_marginTop="@dimen/grid_unit_2x" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/action" | ||
style="@style/Widget.MaterialComponents.Button.OutlinedButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="end" | ||
android:layout_marginTop="@dimen/grid_unit_2x" /> | ||
|
||
</androidx.appcompat.widget.LinearLayoutCompat> | ||
|
||
</com.google.android.material.card.MaterialCardView> |