Search in sources :

Example 1 with BillingProcessor

use of com.anjlab.android.iab.v3.BillingProcessor in project Phonograph by kabouzeid.

the class DonationsDialog method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    billingProcessor = new BillingProcessor(getContext(), App.GOOGLE_PLAY_LICENSE_KEY, this);
    @SuppressLint("InflateParams") View customView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_donation, null);
    ProgressBar progressBar = ButterKnife.findById(customView, R.id.progress);
    MDTintHelper.setTint(progressBar, ThemeSingleton.get().positiveColor.getDefaultColor());
    return new MaterialDialog.Builder(getContext()).title(R.string.support_development).customView(customView, false).build();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) BillingProcessor(com.anjlab.android.iab.v3.BillingProcessor) SuppressLint(android.annotation.SuppressLint) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView) ProgressBar(android.widget.ProgressBar) NonNull(android.support.annotation.NonNull)

Example 2 with BillingProcessor

use of com.anjlab.android.iab.v3.BillingProcessor in project Android-NotesApp by HelloPraveenIO.

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);
    }
}
Also used : Typeface(android.graphics.Typeface) BillingProcessor(com.anjlab.android.iab.v3.BillingProcessor) SpannableStringBuilder(android.text.SpannableStringBuilder) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) Uri(android.net.Uri) SuppressLint(android.annotation.SuppressLint) Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout) SpannableStringBuilder(android.text.SpannableStringBuilder) SuppressLint(android.annotation.SuppressLint)

Example 3 with BillingProcessor

use of com.anjlab.android.iab.v3.BillingProcessor in project Android-NotesApp by HelloPraveenIO.

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")));
            }
        }
    }));
}
Also used : RecyclerTouchListener(io.praveen.typenote.SQLite.RecyclerTouchListener) Typeface(android.graphics.Typeface) BillingProcessor(com.anjlab.android.iab.v3.BillingProcessor) SpannableStringBuilder(android.text.SpannableStringBuilder) ArrayList(java.util.ArrayList) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) AboutAdapter(io.praveen.typenote.SQLite.AboutAdapter) RecyclerView(android.support.v7.widget.RecyclerView) SpannableStringBuilder(android.text.SpannableStringBuilder) ClickListener(io.praveen.typenote.SQLite.ClickListener)

Example 4 with BillingProcessor

use of com.anjlab.android.iab.v3.BillingProcessor in project Timber by naman14.

the class DonateActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_donate);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Support development");
    action = getIntent().getAction();
    productListView = (LinearLayout) findViewById(R.id.product_list);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    status = (TextView) findViewById(R.id.donation_status);
    if (action != null && action.equals("restore")) {
        status.setText("Restoring purchases..");
    }
    bp = new BillingProcessor(this, getString(R.string.play_billing_license_key), this);
}
Also used : BillingProcessor(com.anjlab.android.iab.v3.BillingProcessor) Toolbar(androidx.appcompat.widget.Toolbar)

Example 5 with BillingProcessor

use of com.anjlab.android.iab.v3.BillingProcessor in project Phonograph by kabouzeid.

the class App method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    app = this;
    // default theme
    if (!ThemeStore.isConfigured(this, 1)) {
        ThemeStore.editTheme(this).activityTheme(R.style.Theme_Phonograph_Light).primaryColorRes(R.color.md_indigo_500).accentColorRes(R.color.md_pink_A400).commit();
    }
    // Set up Crashlytics, disabled for debug builds
    Crashlytics crashlyticsKit = new Crashlytics.Builder().core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build();
    if (!BuildConfig.DEBUG) {
        Fabric.with(this, crashlyticsKit, new Answers());
    } else {
        // crashlytics kit is disabled here
        Fabric.with(this, crashlyticsKit);
    }
    // Set up dynamic shortcuts
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).initDynamicShortcuts();
    }
    // automatically restores purchases
    billingProcessor = new BillingProcessor(this, App.GOOGLE_PLAY_LICENSE_KEY, new BillingProcessor.IBillingHandler() {

        @Override
        public void onProductPurchased(String productId, TransactionDetails details) {
        }

        @Override
        public void onPurchaseHistoryRestored() {
        // Toast.makeText(App.this, R.string.restored_previous_purchase_please_restart, Toast.LENGTH_LONG).show();
        }

        @Override
        public void onBillingError(int errorCode, Throwable error) {
        }

        @Override
        public void onBillingInitialized() {
        }
    });
}
Also used : Answers(com.crashlytics.android.answers.Answers) DynamicShortcutManager(com.kabouzeid.gramophone.appshortcuts.DynamicShortcutManager) BillingProcessor(com.anjlab.android.iab.v3.BillingProcessor) TransactionDetails(com.anjlab.android.iab.v3.TransactionDetails) Crashlytics(com.crashlytics.android.Crashlytics)

Aggregations

BillingProcessor (com.anjlab.android.iab.v3.BillingProcessor)8 View (android.view.View)5 Intent (android.content.Intent)4 Typeface (android.graphics.Typeface)4 SpannableStringBuilder (android.text.SpannableStringBuilder)4 SuppressLint (android.annotation.SuppressLint)3 TextView (android.widget.TextView)3 Uri (android.net.Uri)2 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)2 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Button (android.widget.Button)2 LinearLayout (android.widget.LinearLayout)2 AboutAdapter (io.praveen.typenote.SQLite.AboutAdapter)2 ClickListener (io.praveen.typenote.SQLite.ClickListener)2 RecyclerTouchListener (io.praveen.typenote.SQLite.RecyclerTouchListener)2 ArrayList (java.util.ArrayList)2 NonNull (android.support.annotation.NonNull)1 ListView (android.widget.ListView)1