Search in sources :

Example 6 with InAppHelper

use of net.osmand.plus.inapp.InAppHelper in project Osmand by osmandapp.

the class OsmLiveActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    getMyApplication().applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_livie_updates);
    if (Version.isGooglePlayEnabled(getMyApplication())) {
        inAppHelper = new InAppHelper(getMyApplication(), false);
    }
    if (Version.isDeveloperVersion(getMyApplication())) {
        inAppHelper = null;
    }
    Intent intent = getIntent();
    if (intent != null && intent.getExtras() != null) {
        openSubscription = intent.getExtras().getBoolean(OPEN_SUBSCRIPTION_INTENT_PARAM, false);
    }
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager(), getResources());
    viewPager.setAdapter(pagerAdapter);
    final TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
    tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
    tabLayout.setupWithViewPager(viewPager);
    getLastUpdateDateTask = new GetLastUpdateDateTask();
    getLastUpdateDateTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : TabLayout(android.support.design.widget.TabLayout) InAppHelper(net.osmand.plus.inapp.InAppHelper) Intent(android.content.Intent) ViewPager(android.support.v4.view.ViewPager)

Example 7 with InAppHelper

use of net.osmand.plus.inapp.InAppHelper in project Osmand by osmandapp.

the class LiveUpdatesFragment method onDestroy.

@Override
public void onDestroy() {
    super.onDestroy();
    InAppHelper helper = getInAppHelper();
    if (helper != null) {
        helper.removeListener(this);
    }
}
Also used : InAppHelper(net.osmand.plus.inapp.InAppHelper)

Example 8 with InAppHelper

use of net.osmand.plus.inapp.InAppHelper in project Osmand by osmandapp.

the class MapActivity method execInAppTask.

public InAppHelper execInAppTask(@NonNull InAppHelper.InAppRunnable runnable) {
    if (inAppHelper != null) {
        inAppHelper.stop();
    }
    if (Version.isGooglePlayEnabled(app)) {
        inAppHelper = new InAppHelper(getMyApplication(), false);
        inAppHelper.addListener(new InAppHelper.InAppListener() {

            @Override
            public void onError(String error) {
                inAppHelper = null;
            }

            @Override
            public void onGetItems() {
                inAppHelper = null;
            }

            @Override
            public void onItemPurchased(String sku) {
                inAppHelper = null;
            }

            @Override
            public void showProgress() {
            }

            @Override
            public void dismissProgress() {
            }
        });
        inAppHelper.exec(runnable);
        return inAppHelper;
    } else {
        return null;
    }
}
Also used : InAppHelper(net.osmand.plus.inapp.InAppHelper)

Aggregations

InAppHelper (net.osmand.plus.inapp.InAppHelper)8 Intent (android.content.Intent)2 TabLayout (android.support.design.widget.TabLayout)1 Fragment (android.support.v4.app.Fragment)1 ViewPager (android.support.v4.view.ViewPager)1 AppCompatCheckBox (android.support.v7.widget.AppCompatCheckBox)1 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 Button (android.widget.Button)1 CheckBox (android.widget.CheckBox)1 CompoundButton (android.widget.CompoundButton)1 EditText (android.widget.EditText)1 ImageButton (android.widget.ImageButton)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 BaseOsmAndDialogFragment (net.osmand.plus.base.BaseOsmAndDialogFragment)1 CountryItem (net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem)1