Skip to content

Commit 61cc843

Browse files
committed
Extract license-entry layout setup into LicenseContentViewBinder
1 parent fcd5ca7 commit 61cc843

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

presentation/src/main/java/org/cryptomator/presentation/ui/activity/LicenseCheckActivity.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,10 @@ class LicenseCheckActivity : BaseActivity<ActivityLicenseCheckBinding>(ActivityL
108108

109109
private fun setupLicenseEntryView() {
110110
supportActionBar?.title = getString(R.string.screen_license_check_title)
111-
binding.licenseContent.licenseEntryGroup.visibility = View.VISIBLE
112-
binding.licenseContent.purchaseOptionsGroup.visibility = View.GONE
113-
binding.licenseContent.tvRestorePurchase.visibility = View.GONE
114-
binding.licenseContent.legalLinksGroup.visibility = View.GONE
111+
licenseContentViewBinder.bindInitialLicenseEntryLayout()
115112
binding.licenseContent.btnPurchase.visibility = View.VISIBLE
116113
binding.licenseContent.btnPurchase.text = getString(R.string.dialog_enter_license_ok_button)
117114
binding.licenseContent.btnPurchase.setOnClickListener { onLicenseSubmit() }
118-
binding.licenseContent.tvLicenseLink.text = getString(R.string.dialog_enter_license_content)
119-
binding.licenseContent.tvLicenseLink.visibility = View.VISIBLE
120115
binding.licenseContent.tvLicenseLink.setOnClickListener {
121116
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://cryptomator.org/android/")))
122117
}

presentation/src/main/java/org/cryptomator/presentation/ui/fragment/WelcomeLicenseFragment.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,8 @@ class WelcomeLicenseFragment : BaseFragment<FragmentWelcomeLicenseBinding>(Fragm
6363
}
6464

6565
private fun setupLicenseEntryUi() {
66-
binding.licenseContent.licenseEntryGroup.visibility = View.VISIBLE
67-
binding.licenseContent.tvLicenseLink.visibility = View.VISIBLE
68-
binding.licenseContent.tvLicenseLink.text = getString(R.string.dialog_enter_license_content)
66+
licenseContentViewBinder.bindInitialLicenseEntryLayout()
6967
binding.licenseContent.tvLicenseLink.setOnClickListener { listener?.onOpenLicenseLink() }
70-
binding.licenseContent.purchaseOptionsGroup.visibility = View.GONE
71-
binding.licenseContent.tvRestorePurchase.visibility = View.GONE
72-
binding.licenseContent.legalLinksGroup.visibility = View.GONE
7368
binding.licenseContent.btnPurchase.visibility = View.GONE
7469
binding.licenseContent.etLicense.addTextChangedListener(object : TextWatcher {
7570
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}

presentation/src/main/java/org/cryptomator/presentation/ui/layout/LicenseContentViewBinder.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ class LicenseContentViewBinder(
2626
binding.btnLifetime.isEnabled = false
2727
}
2828

29+
/** Sets the initial visibility state for license-entry (non-IAP) mode. */
30+
fun bindInitialLicenseEntryLayout() {
31+
binding.licenseEntryGroup.visibility = View.VISIBLE
32+
binding.purchaseOptionsGroup.visibility = View.GONE
33+
binding.tvRestorePurchase.visibility = View.GONE
34+
binding.legalLinksGroup.visibility = View.GONE
35+
binding.tvLicenseLink.visibility = View.VISIBLE
36+
binding.tvLicenseLink.text = context.getString(R.string.dialog_enter_license_content)
37+
}
38+
2939
/** Sets click listeners on Terms and Privacy links. */
3040
fun bindLegalLinks() {
3141
binding.tvTerms.setOnClickListener {

0 commit comments

Comments
 (0)