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);
}
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);
}
}
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;
}
}
Aggregations