Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-08-19 16:19:50 +02:00
commit e6d14c7f35
4 changed files with 18 additions and 0 deletions

View file

@ -454,6 +454,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(ctx, OsmLiveActivity.class); Intent intent = new Intent(ctx, OsmLiveActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra(OsmLiveActivity.OPEN_SUBSCRIPTION_INTENT_PARAM, true);
ctx.startActivity(intent); ctx.startActivity(intent);
} }
}); });

View file

@ -168,6 +168,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
if (listAdapter.isShowOsmLiveBanner() && position == 0) { if (listAdapter.isShowOsmLiveBanner() && position == 0) {
Intent intent = new Intent(getMyActivity(), OsmLiveActivity.class); Intent intent = new Intent(getMyActivity(), OsmLiveActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra(OsmLiveActivity.OPEN_SUBSCRIPTION_INTENT_PARAM, true);
getMyActivity().startActivity(intent); getMyActivity().startActivity(intent);
} else { } else {
final IndexItem e = (IndexItem) getListAdapter().getItem(position); final IndexItem e = (IndexItem) getListAdapter().getItem(position);

View file

@ -210,6 +210,11 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
helper.addListener(this); helper.addListener(this);
helper.start(false); helper.start(false);
} }
if (((OsmLiveActivity) getActivity()).shouldOpenSubscription()) {
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
}
} }
@Override @Override

View file

@ -21,8 +21,10 @@ import org.apache.commons.logging.Log;
public class OsmLiveActivity extends AbstractDownloadActivity implements DownloadIndexesThread.DownloadEvents { public class OsmLiveActivity extends AbstractDownloadActivity implements DownloadIndexesThread.DownloadEvents {
private final static Log LOG = PlatformUtil.getLog(OsmLiveActivity.class); private final static Log LOG = PlatformUtil.getLog(OsmLiveActivity.class);
public final static String OPEN_SUBSCRIPTION_INTENT_PARAM = "open_subscription_intent_param";
private LiveUpdatesFragmentPagerAdapter pagerAdapter; private LiveUpdatesFragmentPagerAdapter pagerAdapter;
private InAppHelper inAppHelper; private InAppHelper inAppHelper;
private boolean openSubscription;
public InAppHelper getInAppHelper() { public InAppHelper getInAppHelper() {
return inAppHelper; return inAppHelper;
@ -39,6 +41,11 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
inAppHelper = null; 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); ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager(), getResources()); pagerAdapter = new LiveUpdatesFragmentPagerAdapter(getSupportFragmentManager(), getResources());
viewPager.setAdapter(pagerAdapter); viewPager.setAdapter(pagerAdapter);
@ -93,6 +100,10 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
((LiveUpdatesFragment) pagerAdapter.fragments[0]).notifyLiveUpdatesChanged(); ((LiveUpdatesFragment) pagerAdapter.fragments[0]).notifyLiveUpdatesChanged();
} }
public boolean shouldOpenSubscription() {
return openSubscription;
}
public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter { public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter {
private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment(), private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment(),
new ReportsFragment()}; new ReportsFragment()};