Search in sources :

Example 1 with IabHelper

use of it.gmariotti.cardslib.demo.iabutils.IabHelper in project cardslib by gabrielemariotti.

the class BaseActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLPreviewUtils = LPreviewUtilsBase.getInstance(this);
    mThemedStatusBarColor = getResources().getColor(R.color.demo_colorPrimaryDark);
    mNormalStatusBarColor = mThemedStatusBarColor;
    mHandler = new Handler();
    // ---------------------------------------------------------------
    // ...
    String base64EncodedPublicKey = IabUtil.key;
    // compute your public key and store it in base64EncodedPublicKey
    mHelper = new IabHelper(this, base64EncodedPublicKey);
    mHelper.enableDebugLogging(true);
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {

        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.d(TAG, "Problem setting up In-app Billing: " + result);
                return;
            }
            // Have we been disposed of in the meantime? If so, quit.
            if (mHelper == null)
                return;
            // Hooray, IAB is fully set up!
            IabUtil.getInstance().retrieveData(mHelper);
        }
    });
//-----------------------------------------------------------------
}
Also used : Handler(android.os.Handler) IabResult(it.gmariotti.cardslib.demo.iabutils.IabResult) IabHelper(it.gmariotti.cardslib.demo.iabutils.IabHelper)

Example 2 with IabHelper

use of it.gmariotti.cardslib.demo.iabutils.IabHelper in project cardslib by gabrielemariotti.

the class MainNativeActivity method onCreate.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.demo_activity_main);
    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    _initMenu();
    mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer);
    mDrawer.setDrawerListener(mDrawerToggle);
    // ---------------------------------------------------------------
    // ...
    String base64EncodedPublicKey = IabUtil.key;
    // compute your public key and store it in base64EncodedPublicKey
    mHelper = new IabHelper(this, base64EncodedPublicKey);
    mHelper.enableDebugLogging(true);
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {

        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.d(TAG, "Problem setting up In-app Billing: " + result);
                return;
            }
            // Have we been disposed of in the meantime? If so, quit.
            if (mHelper == null)
                return;
            // Hooray, IAB is fully set up!
            IabUtil.getInstance().retrieveData(mHelper);
        }
    });
    //BaseFragment baseFragment = null;
    if (savedInstanceState != null) {
        mSelectedFragment = savedInstanceState.getInt(BUNDLE_SELECTEDFRAGMENT);
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        if (fragmentManager.findFragmentById(R.id.fragment_main) == null)
            mBaseFragment = selectFragment(mSelectedFragment);
    //if (mBaseFragment==null)
    //    mBaseFragment = selectFragment(mSelectedFragment);
    } else {
        mBaseFragment = new TodoNativeCardFragment();
        openFragment(mBaseFragment);
    }
//-----------------------------------------------------------------
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) IabResult(it.gmariotti.cardslib.demo.iabutils.IabResult) IabHelper(it.gmariotti.cardslib.demo.iabutils.IabHelper) TodoNativeCardFragment(it.gmariotti.cardslib.demo.fragment.nativeview.TodoNativeCardFragment)

Example 3 with IabHelper

use of it.gmariotti.cardslib.demo.iabutils.IabHelper in project cardslib by gabrielemariotti.

the class MainActivity method onCreate.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.demo_activity_main);
    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    _initMenu();
    mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer);
    mDrawer.setDrawerListener(mDrawerToggle);
    // ---------------------------------------------------------------
    // ...
    String base64EncodedPublicKey = IabUtil.key;
    // compute your public key and store it in base64EncodedPublicKey
    mHelper = new IabHelper(this, base64EncodedPublicKey);
    mHelper.enableDebugLogging(true);
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {

        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.d(TAG, "Problem setting up In-app Billing: " + result);
                return;
            }
            // Have we been disposed of in the meantime? If so, quit.
            if (mHelper == null)
                return;
            // Hooray, IAB is fully set up!
            IabUtil.getInstance().retrieveData(mHelper);
        }
    });
    //BaseFragment baseFragment = null;
    if (savedInstanceState != null) {
        mSelectedFragment = savedInstanceState.getInt(BUNDLE_SELECTEDFRAGMENT);
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        if (fragmentManager.findFragmentById(R.id.fragment_main) == null)
            mBaseFragment = selectFragment(mSelectedFragment);
    //if (mBaseFragment==null)
    //    mBaseFragment = selectFragment(mSelectedFragment);
    } else {
        mBaseFragment = new HeaderFragment();
        openFragment(mBaseFragment);
    }
//-----------------------------------------------------------------
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) HeaderFragment(it.gmariotti.cardslib.demo.fragment.v1.HeaderFragment) IabResult(it.gmariotti.cardslib.demo.iabutils.IabResult) IabHelper(it.gmariotti.cardslib.demo.iabutils.IabHelper)

Aggregations

IabHelper (it.gmariotti.cardslib.demo.iabutils.IabHelper)3 IabResult (it.gmariotti.cardslib.demo.iabutils.IabResult)3 FragmentManager (android.app.FragmentManager)2 FragmentTransaction (android.app.FragmentTransaction)2 Handler (android.os.Handler)1 TodoNativeCardFragment (it.gmariotti.cardslib.demo.fragment.nativeview.TodoNativeCardFragment)1 HeaderFragment (it.gmariotti.cardslib.demo.fragment.v1.HeaderFragment)1