Skip to content

Commit

Permalink
Merge pull request #315 from simondankelmann/ui-bugfix
Browse files Browse the repository at this point in the history
Added hints
  • Loading branch information
simondankelmann authored Nov 27, 2024
2 parents 19a6f51 + 5bbd4a9 commit e9b3c42
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.io.Serializable

class AdvertisementSetCollection : Serializable {
var title = ""
var hints:MutableList<String> = mutableListOf()
var advertisementSetLists:MutableList<AdvertisementSetList> = mutableListOf()

fun getNumberOfLists():Int{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class AdvertisementFragment : Fragment(), IAdvertisementServiceCallback, IAdvert
fun setAdvertisementSetCollection(advertisementSetCollection: AdvertisementSetCollection){
_viewModel!!.advertisementSetCollectionTitle.postValue(advertisementSetCollection.title)
_viewModel!!.advertisementSetCollectionSubTitle.postValue(getAdvertisementSetCollectionSubTitle(advertisementSetCollection))
_viewModel!!.advertisementSetCollectionHint.postValue(getAdvertisementSetCollectionHint(advertisementSetCollection))

// Update UI
setupExpandableListView(advertisementSetCollection)
Expand All @@ -111,6 +112,29 @@ class AdvertisementFragment : Fragment(), IAdvertisementServiceCallback, IAdvert
//AppContext.getAdvertisementSetQueueHandler().setAdvertisementSetCollection(advertisementSetCollection)
}

fun getAdvertisementSetCollectionHint(advertisementSetCollection: AdvertisementSetCollection):String{
var hint = ""
var sep = ""
Log.d(_logTag, "Collection: " + advertisementSetCollection.advertisementSetLists.count())


if(advertisementSetCollection.hints.isNotEmpty()){

advertisementSetCollection.hints.forEach { it ->
Log.d(_logTag, "CURRENT HINT: " +it)
hint = hint + sep + it
//hint += sep + it
sep = ", "
Log.d(_logTag, "HINT IS NOW: " + hint)
}
} else {
hint = "-"
}

Log.d(_logTag, "Returning: " + hint)
return hint
}

private fun setupExpandableListView(advertisementSetCollection: AdvertisementSetCollection) {

Log.d(_logTag, "Collection: " + advertisementSetCollection.advertisementSetLists.count())
Expand Down Expand Up @@ -204,6 +228,7 @@ class AdvertisementFragment : Fragment(), IAdvertisementServiceCallback, IAdvert
var advertisementSetCollectionSubTitle = _binding!!.advertisementFragmentCollectionSubtitle
var advertisementSetTitle = _binding!!.advertisementFragmentCurrentSetTitle
var advertisementSetSubTitle = _binding!!.advertisementFragmentCurrentSetSubTitle
var advertisementSetCollectionHint = _binding!!.advertisementFragmentCollectionHint
var queueModeButtonSingle = _binding!!.advertisementFragmentQueueModeSingleButton
var queueModeButtonLinear = _binding!!.advertisementFragmentQueueModeLinearButton
var queueModeButtonRandom = _binding!!.advertisementFragmentQueueModeRandomButton
Expand Down Expand Up @@ -263,6 +288,10 @@ class AdvertisementFragment : Fragment(), IAdvertisementServiceCallback, IAdvert
advertisementSetCollectionSubTitle.text = value
}

_viewModel!!.advertisementSetCollectionHint.observe(viewLifecycleOwner) { value ->
advertisementSetCollectionHint.text = value
}

_viewModel!!.advertisementSetTitle.observe(viewLifecycleOwner) { value ->
advertisementSetTitle.text = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class AdvertisementViewModel : ViewModel() {
value = "-"
}

var advertisementSetCollectionHint = MutableLiveData<String>().apply {
value = "-"
}

var advertisementSetTitle = MutableLiveData<String>().apply {
value = "-"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ class StartFragment : Fragment() {
startFragmentDatabaseCardViewContentWrapper.background = resources.getDrawable(R.drawable.gradient_error, AppContext.getContext().theme)
}
}

}

fun navigateToAdvertisementFragmentWithType(advertisementSetTypes: List<AdvertisementSetType>, advertisementSetCollectionTitle:String){
Expand All @@ -376,6 +375,17 @@ class StartFragment : Fragment() {
var advertisementSetCollection = AdvertisementSetCollection()
advertisementSetCollection.title = advertisementSetCollectionTitle

if(advertisementSetTypes.contains(AdvertisementSetType.ADVERTISEMENT_TYPE_FAST_PAIRING_DEVICE) ||
advertisementSetTypes.contains(AdvertisementSetType.ADVERTISEMENT_TYPE_FAST_PAIRING_PHONE_SETUP) ||
advertisementSetTypes.contains(AdvertisementSetType.ADVERTISEMENT_TYPE_FAST_PAIRING_NON_PRODUCTION) ||
advertisementSetTypes.contains(AdvertisementSetType.ADVERTISEMENT_TYPE_FAST_PAIRING_DEBUG)){
advertisementSetCollection.hints.add("Fast Pairing is patched on all modern devices due to this we no longer offer support for this feature")
}

if(advertisementSetTypes.contains(AdvertisementSetType.ADVERTISEMENT_TYPE_CONTINUITY_IOS_17_CRASH)){
advertisementSetCollection.hints.add("Devices on iOS 18 or above will not crash but still get pop-ups")
}

advertisementSetTypes.forEach { advertisementSetType ->
var titlePrefix = when(advertisementSetType){
AdvertisementSetType.ADVERTISEMENT_TYPE_UNDEFINED -> "Undefined"
Expand Down Expand Up @@ -411,6 +421,7 @@ class StartFragment : Fragment() {
// Add List to the Collection
advertisementSetCollection.advertisementSetLists.add(advertisementSetList)


hideLoadingSpinner()
}

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/layout/fragment_advertisement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
android:text="test"
android:textColor="@color/text_color"
android:textStyle="italic"
app:layout_constraintBottom_toTopOf="@id/advertisementFragmentCollectionHint" />

<TextView
android:id="@+id/advertisementFragmentCollectionHint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="-"
android:textColor="@color/text_color"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- End: Advertisement Top Container -->
Expand Down

0 comments on commit e9b3c42

Please sign in to comment.