本文整理汇总了Java中com.google.android.gms.wallet.fragment.SupportWalletFragment类的典型用法代码示例。如果您正苦于以下问题:Java SupportWalletFragment类的具体用法?Java SupportWalletFragment怎么用?Java SupportWalletFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SupportWalletFragment类属于com.google.android.gms.wallet.fragment包,在下文中一共展示了SupportWalletFragment类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
/**
* Creates the WalletFragment to be added to the UI in order to display the Android Pay button.
*
* @param walletEnvironment
* @param buyButtonAppearance
* @param walletTheme
* @return {@link SupportWalletFragment}
*/
@NonNull
public SupportWalletFragment createWalletFragment(int walletEnvironment,
int buyButtonAppearance,
int walletTheme) {
// [START fragment_style_and_options]
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(WalletFragmentStyle.BuyButtonText.BUY_WITH)
.setBuyButtonAppearance(buyButtonAppearance)
.setBuyButtonHeight(150)
.setBuyButtonWidth(WalletFragmentStyle.Dimension.MATCH_PARENT);
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(walletEnvironment)
.setFragmentStyle(walletFragmentStyle)
.setTheme(walletTheme)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();
final SupportWalletFragment walletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
// [END fragment_style_and_options]
// Now initialize the Wallet Fragment
MaskedWalletRequest maskedWalletRequest;
// Direct integration
maskedWalletRequest = createMaskedWalletRequest(publicKey);
// [START params_builder]
WalletFragmentInitParams.Builder startParamsBuilder = WalletFragmentInitParams.newBuilder()
.setMaskedWalletRequest(maskedWalletRequest)
.setMaskedWalletRequestCode(REQUEST_CODE_MASKED_WALLET)
.setAccountName(null);
walletFragment.initialize(startParamsBuilder.build());
// [END params_builder]
return walletFragment;
}
开发者ID:Adyen,项目名称:adyen-android,代码行数:45,代码来源:AndroidPayActivity.java
示例2: initWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
private void initWalletFragment(){
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setMaskedWalletDetailsBackgroundColor(
ContextCompat.getColor(this, android.R.color.white))
.setMaskedWalletDetailsButtonBackgroundResource(
android.R.color.holo_orange_dark);
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(Constants.WALLET_ENVIRONMENT)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.SELECTION_DETAILS)
.build();
SupportWalletFragment walletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
WalletFragmentInitParams startParams = WalletFragmentInitParams.newBuilder()
.setMaskedWallet(mMaskedWallet)
.setMaskedWalletRequestCode(Simplify.REQUEST_CODE_MASKED_WALLET)
.build();
walletFragment.initialize(startParams);
// add Wallet fragment to the UI
getSupportFragmentManager().beginTransaction()
.replace(R.id.confirm_wallet_holder, walletFragment)
.commit();
}
开发者ID:ChristopherAbram,项目名称:Book-Shelf,代码行数:29,代码来源:AndroidPayActivity.java
示例3: createAndAddWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
private void createAndAddWalletFragment() {
// [START fragment_style_and_options]
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(WalletFragmentStyle.BuyButtonText.BUY_WITH)
.setBuyButtonAppearance(WalletFragmentStyle.BuyButtonAppearance.ANDROID_PAY_DARK)
.setBuyButtonWidth(WalletFragmentStyle.Dimension.MATCH_PARENT);
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(Constants.WALLET_ENVIRONMENT)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();
mWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
// [END fragment_style_and_options]
// Now initialize the Wallet Fragment
//String accountName = ((AdyenShopApplication)getApplication()).getAccountName();
MaskedWalletRequest maskedWalletRequest;
// Direct integration
maskedWalletRequest = WalletUtil.createMaskedWalletRequest(
productsList,
String.valueOf(orderTotal),
getString(R.string.public_key),
getApplicationContext());
// [START params_builder]
WalletFragmentInitParams.Builder startParamsBuilder = WalletFragmentInitParams.newBuilder()
.setMaskedWalletRequest(maskedWalletRequest)
.setMaskedWalletRequestCode(REQUEST_CODE_MASKED_WALLET)
.setAccountName(null);
mWalletFragment.initialize(startParamsBuilder.build());
// add Wallet fragment to the UI
getSupportFragmentManager().beginTransaction()
.replace(R.id.checkout_fragment_container, mWalletFragment)
.commit();
// [END params_builder]
}
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:41,代码来源:OrderConfirmationActivity.java
示例4: createAndAddWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
private void createAndAddWalletFragment() {
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setMaskedWalletDetailsTextAppearance(
R.style.AdyenShopWalletFragmentDetailsTextAppearance)
.setMaskedWalletDetailsHeaderTextAppearance(
R.style.AdyenShopWalletFragmentDetailsHeaderTextAppearance)
.setMaskedWalletDetailsBackgroundColor(getResources().getColor(R.color.white));
// [START wallet_fragment_options]
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(Constants.WALLET_ENVIRONMENT)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.SELECTION_DETAILS)
.build();
mWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
// [END wallet_fragment_options]
// Now initialize the Wallet Fragment
WalletFragmentInitParams.Builder startParamsBuilder = WalletFragmentInitParams.newBuilder()
.setMaskedWallet(mMaskedWallet)
.setMaskedWalletRequestCode(REQUEST_CODE_CHANGE_MASKED_WALLET)
.setAccountName(null);
mWalletFragment.initialize(startParamsBuilder.build());
// add Wallet fragment to the UI
getSupportFragmentManager().beginTransaction()
.replace(R.id.dynamic_wallet_masked_wallet_fragment, mWalletFragment)
.commit();
}
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:31,代码来源:ConfirmationActivity.java
示例5: triggerAndroidPaySheet
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
/**
* Attempts to programmatically trigger an Android Pay sheet from a wallet fragment. It does this by crawling the
* subviews of the fragment and clicking them.
*
* NB: This is very hacky.
*/
public static void triggerAndroidPaySheet(final @NonNull SupportWalletFragment walletFragment) {
try {
final ViewGroup group = (ViewGroup) walletFragment.getView();
if (group != null) {
recursiveClickFirstChildView(group);
}
} catch (ClassCastException | NullPointerException ignored) {
}
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:16,代码来源:AndroidPayUtils.java
示例6: prepareWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
/**
* Creates and injects a wallet fragment into the activity.
*/
private void prepareWalletFragment() {
final WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(AndroidPayUtils.environment(this.build))
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();
this.walletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
getSupportFragmentManager().beginTransaction()
.replace(R.id.masked_wallet_fragment, this.walletFragment)
.commit();
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:17,代码来源:CheckoutActivity.java
示例7: initializeWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
/**
* Initializes Android Pay wallet fragment with provided Masked Wallet.
*
* @param walletFragment {@link SupportWalletFragment}
* @param maskedWallet {@link MaskedWallet}
*/
public static void initializeWalletFragment(final SupportWalletFragment walletFragment, final MaskedWallet maskedWallet) {
WalletFragmentInitParams initParams = WalletFragmentInitParams.newBuilder()
.setMaskedWallet(maskedWallet)
.setMaskedWalletRequestCode(PayHelper.REQUEST_CODE_CHANGE_MASKED_WALLET)
.build();
walletFragment.initialize(initParams);
}
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:14,代码来源:PayHelper.java
示例8: updateMaskedWallet
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
private void updateMaskedWallet(@NonNull final MaskedWallet maskedWallet) {
final SupportWalletFragment walletFragment = (SupportWalletFragment) getSupportFragmentManager()
.findFragmentById(R.id.android_pay_layout);
if (walletFragment != null) {
walletFragment.updateMaskedWallet(maskedWallet);
} else {
final WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setMaskedWalletDetailsHeaderTextAppearance(R.style.WalletDetailsHeaderTextAppearance)
.setMaskedWalletDetailsTextAppearance(R.style.WalletDetailsTextAppearance)
.setMaskedWalletDetailsBackgroundColor(android.R.color.transparent)
.setMaskedWalletDetailsButtonBackgroundColor(android.R.color.transparent)
.setMaskedWalletDetailsButtonTextAppearance(R.style.WalletDetailsButton);
final WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(BuildConfig.ANDROID_PAY_ENVIRONMENT)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.SELECTION_DETAILS)
.build();
final SupportWalletFragment newWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
PayHelper.initializeWalletFragment(newWalletFragment, maskedWallet);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.android_pay_layout, newWalletFragment)
.commit();
}
}
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:30,代码来源:CheckoutActivity.java
示例9: createAndAddWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
private void createAndAddWalletFragment() {
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setMaskedWalletDetailsTextAppearance(
R.style.BikestoreWalletFragmentDetailsTextAppearance)
.setMaskedWalletDetailsHeaderTextAppearance(
R.style.BikestoreWalletFragmentDetailsHeaderTextAppearance)
.setMaskedWalletDetailsBackgroundColor(
getResources().getColor(R.color.bikestore_white))
.setMaskedWalletDetailsButtonBackgroundResource(
R.drawable.bikestore_btn_default_holo_light)
.setMaskedWalletDetailsLogoTextColor(
getResources().getColor(R.color.wallet_dark_grey));
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(WalletConstants.ENVIRONMENT_SANDBOX)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_HOLO_LIGHT)
.setMode(WalletFragmentMode.SELECTION_DETAILS)
.build();
mWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
// Now initialize the Wallet Fragment
String accountName = ((BikestoreApplication) getApplication()).getAccountName();
WalletFragmentInitParams.Builder startParamsBuilder = WalletFragmentInitParams.newBuilder()
.setMaskedWallet(mMaskedWallet)
.setMaskedWalletRequestCode(REQUEST_CODE_CHANGE_MASKED_WALLET)
.setAccountName(accountName);
mWalletFragment.initialize(startParamsBuilder.build());
// add Wallet fragment to the UI
getSupportFragmentManager().beginTransaction()
.replace(R.id.dynamic_wallet_masked_wallet_fragment, mWalletFragment)
.commit();
}
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:35,代码来源:ConfirmationActivity.java
示例10: createAndAddWalletFragment
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
private void createAndAddWalletFragment() {
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(BuyButtonText.BUY_WITH_GOOGLE)
.setBuyButtonWidth(Dimension.MATCH_PARENT);
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(WalletConstants.ENVIRONMENT_SANDBOX)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_HOLO_LIGHT)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();
mWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
// Now initialize the Wallet Fragment
String accountName = ((BikestoreApplication) getApplication()).getAccountName();
MaskedWalletRequest maskedWalletRequest =
WalletUtil.createMaskedWalletRequest(Constants.ITEMS_FOR_SALE[mItemId]);
WalletFragmentInitParams.Builder startParamsBuilder = WalletFragmentInitParams.newBuilder()
.setMaskedWalletRequest(maskedWalletRequest)
.setMaskedWalletRequestCode(REQUEST_CODE_MASKED_WALLET)
.setAccountName(accountName);
mWalletFragment.initialize(startParamsBuilder.build());
// add Wallet fragment to the UI
getSupportFragmentManager().beginTransaction()
.replace(R.id.dynamic_wallet_button_fragment, mWalletFragment)
.commit();
}
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:29,代码来源:CheckoutActivity.java
示例11: updateAndroidPayConfirmation
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
/**
* Call when a masked wallet has been obtained and the content in the android pay confirmation should be rendered.
*/
private void updateAndroidPayConfirmation(final @NonNull MaskedWallet maskedWallet,
final @NonNull AndroidPayPayload payload) {
Picasso.with(this).load(this.project.photo().full()).into(this.contextPhotoImageView);
this.projectNameTextView.setText(this.project.name());
this.creatorNameTextView.setText(this.ksString.format(
this.projectCreatorByCreatorString,
"creator_name",
this.project.creator().name()
));
this.termsAndPrivacyTextView.setText(Html.fromHtml(this.termsAndPrivacyString));
this.backer101TextView.setText(Html.fromHtml(this.backer101String));
if (maskedWallet != null) {
this.androidPayEmailTextView.setText(maskedWallet.getEmail());
final String[] paymentDescriptions = maskedWallet.getPaymentDescriptions();
if (paymentDescriptions.length > 0) {
this.androidPayInstrumentDescriptionTextView.setText(paymentDescriptions[0]);
}
}
this.pledgeDisclaimerTextView.setText(Html.fromHtml(
this.ksString.format(
this.pledgeDisclaimerString,
"charge_amount",
this.ksCurrency.format(Float.valueOf(payload.cart().totalPrice()), this.project)
)
));
this.confirmationWalletFragment = SupportWalletFragment.newInstance(
WalletFragmentOptions.newBuilder()
.setEnvironment(AndroidPayUtils.environment(this.build))
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.SELECTION_DETAILS)
.build()
);
this.confirmationWalletFragment.initialize(
WalletFragmentInitParams.newBuilder()
.setMaskedWallet(maskedWallet)
.setMaskedWalletRequestCode(ActivityRequestCodes.CHECKOUT_ACTIVITY_WALLET_CHANGE_REQUEST)
.build()
);
getSupportFragmentManager().beginTransaction()
.replace(R.id.confirmation_masked_wallet_fragment, this.confirmationWalletFragment)
.commit();
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:52,代码来源:CheckoutActivity.java
示例12: init
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
void init() {
simplify = ((SimplifyApplication) getApplication()).getSimplify();
//google api client required to request full wallet
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wallet.API, new Wallet.WalletOptions.Builder()
.setEnvironment(Constants.WALLET_ENVIRONMENT)
.setTheme(WalletConstants.THEME_LIGHT)
.build())
.build();
TextView amountView = (TextView) findViewById(R.id.amount);
amountView.setText(Constants.AMOUNT);
// init pay button
mPayButton = (Button) findViewById(R.id.btn_pay);
mPayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
confirmPurchase();
}
});
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
//fragment style for confirmation screen
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setMaskedWalletDetailsBackgroundColor(
ContextCompat.getColor(this, android.R.color.white))
.setMaskedWalletDetailsButtonBackgroundResource(
android.R.color.holo_orange_dark);
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(Constants.WALLET_ENVIRONMENT)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_LIGHT)
.setMode(WalletFragmentMode.SELECTION_DETAILS)
.build();
SupportWalletFragment walletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
WalletFragmentInitParams startParams = WalletFragmentInitParams.newBuilder()
.setMaskedWallet(mMaskedWallet)
.setMaskedWalletRequestCode(Simplify.REQUEST_CODE_MASKED_WALLET)
.build();
walletFragment.initialize(startParams);
// add Wallet fragment to the UI
getSupportFragmentManager().beginTransaction()
.replace(R.id.confirm_wallet_holder, walletFragment)
.commit();
}
开发者ID:simplifycom,项目名称:simplify-android-sample,代码行数:57,代码来源:ConfirmationActivity.java
示例13: onCreate
import com.google.android.gms.wallet.fragment.SupportWalletFragment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mWalletFragment = (SupportWalletFragment) getSupportFragmentManager().findFragmentByTag(WALLET_FRAGMENT_ID);
WalletFragmentInitParams startParams;
WalletFragmentInitParams.Builder startParamsBuilder = WalletFragmentInitParams.newBuilder()
.setMaskedWalletRequest(generateMaskedWalletRequest())
.setMaskedWalletRequestCode(MASKED_WALLET_REQUEST_CODE);
startParams = startParamsBuilder.build();
if(mWalletFragment == null) {
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(BuyButtonText.BUY_WITH_GOOGLE)
.setBuyButtonWidth(Dimension.MATCH_PARENT);
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(WalletConstants.ENVIRONMENT_SANDBOX)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_HOLO_LIGHT)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();
mWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
mWalletFragment.initialize(startParams);
}
getSupportFragmentManager().beginTransaction()
.replace(R.id.wallet_button_holder, mWalletFragment, WALLET_FRAGMENT_ID)
.commit();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wallet.API, new Wallet.WalletOptions.Builder()
.setEnvironment(WalletConstants.ENVIRONMENT_SANDBOX)
.setTheme(WalletConstants.THEME_HOLO_LIGHT)
.build())
.build();
setContentView(R.layout.activity_main);
}
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:45,代码来源:MainActivity.java
注:本文中的com.google.android.gms.wallet.fragment.SupportWalletFragment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论