use of com.anjlab.android.iab.v3.BillingProcessor in project Phonograph by kabouzeid.
the class PurchaseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_purchase);
setDrawUnderStatusbar(true);
ButterKnife.bind(this);
setStatusbarColor(ACTIVITY_COLOR);
setNavigationbarColor(ACTIVITY_COLOR);
setTaskDescriptionColor(ACTIVITY_COLOR);
setSupportActionBar(toolbar);
// noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(getString(R.string.buy_pro));
restoreButton.setEnabled(false);
purchaseButton.setEnabled(false);
restoreButton.setOnClickListener(v -> {
if (restorePurchaseAsyncTask == null || restorePurchaseAsyncTask.getStatus() != AsyncTask.Status.RUNNING) {
restorePurchase();
}
});
purchaseButton.setOnClickListener(v -> {
billingProcessor.purchase(PurchaseActivity.this, App.PRO_VERSION_PRODUCT_ID);
if (!BuildConfig.DEBUG) {
Answers.getInstance().logAddToCart(new AddToCartEvent().putCurrency(Currency.getInstance("EUR")).putItemId("pro_version").putItemName("Phonograph Pro").putItemPrice(BigDecimal.valueOf(3)));
}
});
billingProcessor = new BillingProcessor(this, App.GOOGLE_PLAY_LICENSE_KEY, this);
if (!BuildConfig.DEBUG) {
Answers.getInstance().logContentView(new ContentViewEvent().putContentName("Purchase Activity").putContentId("1"));
}
}
use of com.anjlab.android.iab.v3.BillingProcessor in project Android-NotesApp by HelloPraveen.
the class AboutActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
bp = new BillingProcessor(this, "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApcobfuZFov1KIJgKEKrzp9PP2n1EbBpV/xf9AyhWYN47QY8/rWGPuKht/7b4DmCVnpd6PrnYJqLt/rqR5c+lifLY5XuUH1VGqnkWA33TkPXm4UkGk3q/jvVIbM5xbcdPLqNkLiEoEuBlmAYNxM6K3lf5Kz+ff1HUH1ljYjDE9M38xS0TiLnQIRPm9cfehNxaKWOF81sx5Q9K3vNB1JoNuMyaMfBFQjfMRL6llsMRF42NEf6W/4/2c5Guxvg2qLo14/gGVRLS5H0ZVwqThNZVYTtLRWWNIrgFIwMnCjcbntFkEBK/B987poGN6miDI2r1m6XALRAgLEzM/IUaPnwnWwIDAQAB", this);
sv = findViewById(R.id.about_scroll);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/whitney.ttf").setFontAttrId(R.attr.fontPath).build());
Typeface font2 = Typeface.createFromAsset(getAssets(), "fonts/whitney.ttf");
SpannableStringBuilder SS = new SpannableStringBuilder("About");
SS.setSpan(new CustomTypefaceSpan("", font2), 0, SS.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(SS);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
List<String> l = new ArrayList<>();
l.add("Project Contributors");
l.add("Tools & Licenses Used");
l.add("Donate and Support");
l.add("Rate the Application");
final RecyclerView recyclerView = findViewById(R.id.aboutRecyclerView);
AboutAdapter mAdapter = new AboutAdapter(l);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
recyclerView.setAdapter(mAdapter);
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), new ClickListener() {
@Override
public void onClick(View view, final int position) {
if (position == 0) {
Intent i = new Intent(AboutActivity.this, ContributorsActivity.class);
startActivity(i);
} else if (position == 1) {
Intent i = new Intent(AboutActivity.this, LicensesActivity.class);
startActivity(i);
} else if (position == 2) {
bp.purchase(AboutActivity.this, "typenote_donate");
} else if (position == 3) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=io.praveen.typenote")));
}
}
}));
}
use of com.anjlab.android.iab.v3.BillingProcessor in project Android-NotesApp by HelloPraveen.
the class ProActivity method onCreate.
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pro);
bp = new BillingProcessor(this, "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApcobfuZFov1KIJgKEKrzp9PP2n1EbBpV/xf9AyhWYN47QY8/rWGPuKht/7b4DmCVnpd6PrnYJqLt/rqR5c+lifLY5XuUH1VGqnkWA33TkPXm4UkGk3q/jvVIbM5xbcdPLqNkLiEoEuBlmAYNxM6K3lf5Kz+ff1HUH1ljYjDE9M38xS0TiLnQIRPm9cfehNxaKWOF81sx5Q9K3vNB1JoNuMyaMfBFQjfMRL6llsMRF42NEf6W/4/2c5Guxvg2qLo14/gGVRLS5H0ZVwqThNZVYTtLRWWNIrgFIwMnCjcbntFkEBK/B987poGN6miDI2r1m6XALRAgLEzM/IUaPnwnWwIDAQAB", this);
bp.loadOwnedPurchasesFromGoogle();
TextView tv = findViewById(R.id.pro_head);
TextView tv2 = findViewById(R.id.pro_text);
Button b1 = findViewById(R.id.pro_upgrade);
Button b2 = findViewById(R.id.pro_redeem);
Button b3 = findViewById(R.id.pro_restore);
TextView tv3 = findViewById(R.id.pro_help);
preferences = PreferenceManager.getDefaultSharedPreferences(ProActivity.this);
int id = preferences.getInt("premium", 0);
if (id == 1) {
tv.setText("You're Premium!");
tv2.setText("Thanks for upgrading, you'll continue to receive premium features until your lifetime!");
b1.setVisibility(View.GONE);
b2.setVisibility(View.GONE);
b3.setVisibility(View.GONE);
LinearLayout temp = findViewById(R.id.pro_ll);
temp.setVisibility(View.GONE);
tv3.setText("For any queries,\nDon't hesitate to contact at\nhello@praveen.io or @HelloPraveenIO");
}
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bp.purchase(ProActivity.this, "notes_pro");
}
});
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bp.purchase(ProActivity.this, "notes_pro");
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri redeemUri = Uri.parse("https://play.google.com/redeem");
Intent redeemIntent = new Intent(Intent.ACTION_VIEW, redeemUri);
startActivity(redeemIntent);
}
});
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/whitney.ttf").setFontAttrId(R.attr.fontPath).build());
Typeface font2 = Typeface.createFromAsset(getAssets(), "fonts/whitney.ttf");
SpannableStringBuilder SS = new SpannableStringBuilder("Premium");
SS.setSpan(new CustomTypefaceSpan("", font2), 0, SS.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(SS);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
Aggregations