use of org.horaapps.leafpic.util.inapppurchase.Purchase in project LeafPic by HoraApps.
the class DonateActivity method setTheme.
private void setTheme() {
/**** ToolBar *****/
toolbar.setBackgroundColor(getPrimaryColor());
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(new IconicsDrawable(this).icon(CommunityMaterial.Icon.cmd_arrow_left).color(Color.WHITE).sizeDp(19));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
toolbar.setTitle(getString(org.horaapps.leafpic.R.string.donate));
setStatusBarColor();
setNavBarColor();
setRecentApp(getString(org.horaapps.leafpic.R.string.donate));
final Button btnDonateIap = (Button) findViewById(R.id.button_donate_play_store);
btnDonateIap.setText(String.format("%s %d€", getString(R.string.donate).toUpperCase(), progress));
themeSeekBar(bar);
bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
if (i == 0)
progress = 2;
else
progress = (i + 1) * 2;
btnDonateIap.setText(String.format("%s %d€", getString(R.string.donate).toUpperCase(), progress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
/**** Title Cards ***/
((TextView) findViewById(org.horaapps.leafpic.R.id.team_name)).setTextColor(getAccentColor());
((TextView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_item_title)).setTextColor(getAccentColor());
((TextView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_item_title)).setTextColor(getAccentColor());
((TextView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item_title)).setTextColor(getAccentColor());
/** BackGround **/
findViewById(org.horaapps.leafpic.R.id.donate_background).setBackgroundColor(getBackgroundColor());
/** Cards **/
int color = getCardBackgroundColor();
((CardView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_card)).setCardBackgroundColor(color);
((CardView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_card)).setCardBackgroundColor(color);
((CardView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_card)).setCardBackgroundColor(color);
((CardView) findViewById(org.horaapps.leafpic.R.id.donate_header_card)).setCardBackgroundColor(color);
/** Icons **/
color = getIconColor();
((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_icon_title)).setColor(color);
((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_icon_title)).setColor(color);
((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_icon_title)).setColor(color);
((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_header_icon)).setColor(color);
/** TextViews **/
color = getTextColor();
((TextView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_item)).setTextColor(color);
((TextView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_item)).setTextColor(color);
((TextView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item)).setTextColor(color);
((TextView) findViewById(org.horaapps.leafpic.R.id.donate_header_item)).setTextColor(color);
/***** ScrolView *****/
setScrollViewColor(scr);
/** ACTIONS **/
findViewById(org.horaapps.leafpic.R.id.button_donate_paypal).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cts.launchUrl("https://www.paypal.me/HoraApps");
}
});
findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("Copied to Clipboard", ((TextView) v).getText());
clipboard.setPrimaryClip(clip);
StringUtils.showToast(getApplicationContext(), getString(org.horaapps.leafpic.R.string.address_copied));
return true;
}
});
findViewById(R.id.button_donate_play_store).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mHelper != null)
mHelper.flagEndAsync();
mHelper.launchPurchaseFlow(DonateActivity.this, "donation_" + progress, 123, new IabHelper.OnIabPurchaseFinishedListener() {
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
mHelper.consumeAsync(info, mPurchaseFinishedListener);
}
});
}
});
}
Aggregations