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
class CustomerDisplayPresentation( | |
context: Context, | |
display: Display, | |
private var lifecycleOwner: LifecycleOwner?, | |
private var customerDisplayViewModel: CustomerDisplayViewModel? | |
) : Presentation(context, display) { | |
private val adapter = OrderItemPresentationAdapter(context) | |
private lateinit var binding: PresentationCustomerDisplayBinding | |
private var cartItems: List<OrderItemModel> |
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
class CustomerDisplayViewModel : ViewModel() { | |
enum class CustomerDisplayState(val flipperViewIndex: Int) { | |
DEFAULT(0), CART(1), CONFIRM_PRINT(2) | |
} | |
val stateLiveData = MutableLiveData<CustomerDisplayState>() | |
val cartLiveData = MutableLiveData<OrderCartPresentationModel>() | |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<ViewFlipper | |
android:id="@+id/viewFlipper" | |
android:theme="@style/IO"> | |
<androidx.constraintlayout.widget.ConstraintLayout |
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
private var presentation: DefaultPresentation? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
[...] | |
getCustomerDisplay(this)?.let { display -> | |
presentation = DefaultPresentation(display, applicationContext) | |
presentation?.setImage(uri) | |
} | |
} |
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
class DefaultPresentation( | |
display: Display, | |
context: Context | |
) : Presentation(context, display) { | |
private lateinit var binding: PresentationDefaultBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
requestWindowFeature(Window.FEATURE_NO_TITLE) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:android="http://schemas.android.com/apk/res/android"> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<androidx.appcompat.widget.AppCompatImageView | |
android:id="@+id/presentation_image" |
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
fun getCustomerDisplay(context: Context): Display? { | |
val displayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager | |
val displays = displayManager.displays | |
if (displays.size <= 1) { | |
return null | |
} | |
// We take the first additional screen | |
return displays[1] | |
} |
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
class CustomerDisplayPresentation( | |
context: Context, | |
display: Display, | |
private var lifecycleOwner: LifecycleOwner?, | |
private var customerDisplayViewModel: CustomerDisplayViewModel? | |
) : Presentation(context, display) { | |
private val adapter = OrderItemPresentationAdapter(context) | |
private lateinit var binding: PresentationCustomerDisplayBinding | |
private var cartItems: List<OrderItemModel> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<ViewFlipper | |
android:id="@+id/viewFlipper" | |
android:theme="@style/IO"> | |
<androidx.constraintlayout.widget.ConstraintLayout |
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
class CustomerDisplayViewModel : ViewModel() { | |
enum class CustomerDisplayState(val flipperViewIndex: Int) { | |
DEFAULT(0), CART(1), CONFIRM_PRINT(2) | |
} | |
val stateLiveData = MutableLiveData<CustomerDisplayState>() | |
val cartLiveData = MutableLiveData<OrderCartPresentationModel>() | |
NewerOlder