-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into PM-86-android-15
- Loading branch information
Showing
19 changed files
with
329 additions
and
125 deletions.
There are no files selected for viewing
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
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
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
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
42 changes: 42 additions & 0 deletions
42
...c/main/java/net/gini/android/health/sdk/exampleapp/configuration/ConfigurationFragment.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,42 @@ | ||
package net.gini.android.health.sdk.exampleapp.configuration | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.activityViewModels | ||
import net.gini.android.health.sdk.exampleapp.MainViewModel | ||
import net.gini.android.health.sdk.exampleapp.databinding.FragmentConfigurationBinding | ||
import net.gini.android.health.sdk.exampleapp.review.ReviewViewModel | ||
import net.gini.android.health.sdk.paymentcomponent.PaymentComponentConfiguration | ||
|
||
class ConfigurationFragment: Fragment() { | ||
|
||
private lateinit var binding: FragmentConfigurationBinding | ||
private val viewModel by activityViewModels<MainViewModel>() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
binding = FragmentConfigurationBinding.inflate(layoutInflater) | ||
with(binding) { | ||
setupSwitchListeners() | ||
} | ||
return binding.root | ||
} | ||
|
||
private fun FragmentConfigurationBinding.setupSwitchListeners() { | ||
ghsHidePoweredBy.isChecked = !(viewModel.getPaymentComponentConfiguration()?.isPaymentComponentBranded ?: true) | ||
|
||
ghsHidePoweredBy.setOnCheckedChangeListener { _, newValue -> | ||
viewModel.setPaymentComponentConfiguration(PaymentComponentConfiguration(isPaymentComponentBranded = !newValue)) | ||
} | ||
} | ||
|
||
companion object { | ||
fun newInstance() = ConfigurationFragment() | ||
} | ||
} |
Oops, something went wrong.