kopia lustrzana https://github.com/ryukoposting/Signal-Android
Finalize credit card copy.
rodzic
ed2edc1ebb
commit
0e3a9a3130
|
@ -6,6 +6,7 @@ import android.view.View
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.widget.addTextChangedListener
|
import androidx.core.widget.addTextChangedListener
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
@ -22,6 +23,7 @@ import org.thoughtcrime.securesms.payments.FiatMoneyUtil
|
||||||
import org.thoughtcrime.securesms.util.LifecycleDisposable
|
import org.thoughtcrime.securesms.util.LifecycleDisposable
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil
|
import org.thoughtcrime.securesms.util.ViewUtil
|
||||||
|
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||||
|
|
||||||
class CreditCardFragment : Fragment(R.layout.credit_card_fragment) {
|
class CreditCardFragment : Fragment(R.layout.credit_card_fragment) {
|
||||||
|
|
||||||
|
@ -40,6 +42,12 @@ class CreditCardFragment : Fragment(R.layout.credit_card_fragment) {
|
||||||
getString(R.string.CreditCardFragment__donation_amount_s, FiatMoneyUtil.format(resources, args.request.fiat))
|
getString(R.string.CreditCardFragment__donation_amount_s, FiatMoneyUtil.format(resources, args.request.fiat))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.description.setLinkColor(ContextCompat.getColor(requireContext(), R.color.signal_colorPrimary))
|
||||||
|
binding.description.setLearnMoreVisible(true)
|
||||||
|
binding.description.setOnLinkClickListener {
|
||||||
|
findNavController().safeNavigate(CreditCardFragmentDirections.actionCreditCardFragmentToYourInformationIsPrivateBottomSheet())
|
||||||
|
}
|
||||||
|
|
||||||
binding.cardNumber.addTextChangedListener(afterTextChanged = {
|
binding.cardNumber.addTextChangedListener(afterTextChanged = {
|
||||||
viewModel.onNumberChanged(it?.toString()?.filter { it != ' ' } ?: "")
|
viewModel.onNumberChanged(it?.toString()?.filter { it != ' ' } ?: "")
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
package org.thoughtcrime.securesms.components.settings.app.subscription.donate.card
|
||||||
|
|
||||||
|
import org.signal.core.util.dp
|
||||||
|
import org.thoughtcrime.securesms.R
|
||||||
|
import org.thoughtcrime.securesms.components.settings.DSLConfiguration
|
||||||
|
import org.thoughtcrime.securesms.components.settings.DSLSettingsAdapter
|
||||||
|
import org.thoughtcrime.securesms.components.settings.DSLSettingsBottomSheetFragment
|
||||||
|
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
||||||
|
import org.thoughtcrime.securesms.components.settings.configure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays information about how Signal keeps card details private and how
|
||||||
|
* Signal does not link donation information to your Signal account.
|
||||||
|
*/
|
||||||
|
class YourInformationIsPrivateBottomSheet : DSLSettingsBottomSheetFragment() {
|
||||||
|
override fun bindAdapter(adapter: DSLSettingsAdapter) {
|
||||||
|
adapter.submitList(getConfiguration().toMappingModelList())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getConfiguration(): DSLConfiguration {
|
||||||
|
return configure {
|
||||||
|
|
||||||
|
space(10.dp)
|
||||||
|
|
||||||
|
noPadTextPref(
|
||||||
|
title = DSLSettingsText.from(
|
||||||
|
R.string.YourInformationIsPrivateBottomSheet__your_information_is_private,
|
||||||
|
DSLSettingsText.CenterModifier,
|
||||||
|
DSLSettingsText.TextAppearanceModifier(R.style.Signal_Text_HeadlineMedium)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
space(24.dp)
|
||||||
|
|
||||||
|
noPadTextPref(
|
||||||
|
title = DSLSettingsText.from(
|
||||||
|
R.string.YourInformationIsPrivateBottomSheet__signal_does_not_collect,
|
||||||
|
DSLSettingsText.BodyLargeModifier
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
space(24.dp)
|
||||||
|
|
||||||
|
noPadTextPref(
|
||||||
|
title = DSLSettingsText.from(
|
||||||
|
R.string.YourInformationIsPrivateBottomSheet__we_use_stripe,
|
||||||
|
DSLSettingsText.BodyLargeModifier
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
space(24.dp)
|
||||||
|
|
||||||
|
noPadTextPref(
|
||||||
|
title = DSLSettingsText.from(
|
||||||
|
R.string.YourInformationIsPrivateBottomSheet__signal_does_not_and_cannot,
|
||||||
|
DSLSettingsText.BodyLargeModifier
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
space(24.dp)
|
||||||
|
|
||||||
|
noPadTextPref(
|
||||||
|
title = DSLSettingsText.from(
|
||||||
|
R.string.YourInformationIsPrivateBottomSheet__thank_you,
|
||||||
|
DSLSettingsText.BodyLargeModifier
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
space(56.dp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -100,7 +100,7 @@ public final class FeatureFlags {
|
||||||
private static final String SMS_EXPORTER = "android.sms.exporter.2";
|
private static final String SMS_EXPORTER = "android.sms.exporter.2";
|
||||||
private static final String HIDE_CONTACTS = "android.hide.contacts";
|
private static final String HIDE_CONTACTS = "android.hide.contacts";
|
||||||
private static final String SMS_EXPORT_MEGAPHONE_DELAY_DAYS = "android.smsExport.megaphoneDelayDays.2";
|
private static final String SMS_EXPORT_MEGAPHONE_DELAY_DAYS = "android.smsExport.megaphoneDelayDays.2";
|
||||||
public static final String CREDIT_CARD_PAYMENTS = "android.credit.card.payments.1";
|
public static final String CREDIT_CARD_PAYMENTS = "android.credit.card.payments.2";
|
||||||
private static final String PAYMENTS_REQUEST_ACTIVATE_FLOW = "android.payments.requestActivateFlow";
|
private static final String PAYMENTS_REQUEST_ACTIVATE_FLOW = "android.payments.requestActivateFlow";
|
||||||
private static final String KEEP_MUTED_CHATS_ARCHIVED = "android.keepMutedChatsArchived";
|
private static final String KEEP_MUTED_CHATS_ARCHIVED = "android.keepMutedChatsArchived";
|
||||||
public static final String GOOGLE_PAY_DISABLED_REGIONS = "global.donations.gpayDisabledRegions";
|
public static final String GOOGLE_PAY_DISABLED_REGIONS = "global.donations.gpayDisabledRegions";
|
||||||
|
|
|
@ -59,14 +59,14 @@ public final class LocaleFeatureFlags {
|
||||||
* @return Whether credit cards are disabled in this region
|
* @return Whether credit cards are disabled in this region
|
||||||
*/
|
*/
|
||||||
public static boolean isCreditCardDisabled() {
|
public static boolean isCreditCardDisabled() {
|
||||||
return isEnabled(FeatureFlags.CREDIT_CARD_DISABLED_REGIONS, FeatureFlags.googlePayDisabledRegions());
|
return isEnabled(FeatureFlags.CREDIT_CARD_DISABLED_REGIONS, FeatureFlags.creditCardDisabledRegions());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether PayPal is disabled in this region
|
* @return Whether PayPal is disabled in this region
|
||||||
*/
|
*/
|
||||||
public static boolean isPayPalDisabled() {
|
public static boolean isPayPalDisabled() {
|
||||||
return isEnabled(FeatureFlags.PAYPAL_DISABLED_REGIONS, FeatureFlags.googlePayDisabledRegions());
|
return isEnabled(FeatureFlags.PAYPAL_DISABLED_REGIONS, FeatureFlags.paypalDisabledRegions());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,9 @@ import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.util.CommunicationActions;
|
import org.thoughtcrime.securesms.util.CommunicationActions;
|
||||||
import org.thoughtcrime.securesms.util.ThemeUtil;
|
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an optional "Learn more" link to a given piece of text.
|
||||||
|
*/
|
||||||
public class LearnMoreTextView extends AppCompatTextView {
|
public class LearnMoreTextView extends AppCompatTextView {
|
||||||
|
|
||||||
private OnClickListener linkListener;
|
private OnClickListener linkListener;
|
||||||
|
|
|
@ -29,14 +29,14 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
||||||
tools:text="Donation amount: $20" />
|
tools:text="Donation amount: $20" />
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.util.views.LearnMoreTextView
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:paddingHorizontal="32dp"
|
android:paddingHorizontal="32dp"
|
||||||
android:text="@string/CreditCardFragment__enter_your_card_information_below"
|
android:text="@string/CreditCardFragment__enter_your_card_details"
|
||||||
android:textColor="@color/signal_colorOnSurfaceVariant"
|
android:textColor="@color/signal_colorOnSurfaceVariant"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,10 @@
|
||||||
android:name="request"
|
android:name="request"
|
||||||
app:argType="org.thoughtcrime.securesms.components.settings.app.subscription.donate.gateway.GatewayRequest"
|
app:argType="org.thoughtcrime.securesms.components.settings.app.subscription.donate.gateway.GatewayRequest"
|
||||||
app:nullable="false" />
|
app:nullable="false" />
|
||||||
|
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_creditCardFragment_to_yourInformationIsPrivateBottomSheet"
|
||||||
|
app:destination="@id/yourInformationIsPrivateBottomSheet" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<dialog
|
<dialog
|
||||||
|
@ -142,4 +146,10 @@
|
||||||
app:nullable="false" />
|
app:nullable="false" />
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
<dialog
|
||||||
|
android:id="@+id/yourInformationIsPrivateBottomSheet"
|
||||||
|
android:name="org.thoughtcrime.securesms.components.settings.app.subscription.donate.card.YourInformationIsPrivateBottomSheet"
|
||||||
|
android:label="your_information_is_private_bottom_sheet"
|
||||||
|
tools:layout="@layout/dsl_settings_bottom_sheet" />
|
||||||
|
|
||||||
</navigation>
|
</navigation>
|
Ładowanie…
Reference in New Issue