Show space if needed
This commit is contained in:
parent
52ce34fae9
commit
6077465ab9
3 changed files with 34 additions and 43 deletions
|
@ -1,10 +1,28 @@
|
|||
package net.osmand.plus.download;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.ui.ActiveDownloadsDialogFragment;
|
||||
import net.osmand.plus.download.ui.DownloadResourceGroupFragment;
|
||||
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
||||
import net.osmand.plus.download.ui.UpdatesIndexFragment;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -15,37 +33,12 @@ import android.support.v4.app.DialogFragment;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.support.v7.app.NotificationCompat.Builder;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.ui.ActiveDownloadsDialogFragment;
|
||||
import net.osmand.plus.download.ui.DownloadResourceGroupFragment;
|
||||
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
||||
import net.osmand.plus.download.ui.UpdatesIndexFragment;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class DownloadActivity extends BaseDownloadActivity {
|
||||
public static final int UPDATES_TAB_NUMBER = 2;
|
||||
|
@ -129,7 +122,7 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
|
||||
}
|
||||
});
|
||||
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this);
|
||||
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this, true);
|
||||
|
||||
final Intent intent = getIntent();
|
||||
if (intent != null && intent.getExtras() != null) {
|
||||
|
@ -275,9 +268,11 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
private final OsmandApplication application;
|
||||
private final boolean shouldShowFreeVersionBanner;
|
||||
private final View freeVersionBannerTitle;
|
||||
private boolean showSpace;
|
||||
|
||||
public BannerAndDownloadFreeVersion(View view, final DownloadActivity ctx) {
|
||||
public BannerAndDownloadFreeVersion(View view, final DownloadActivity ctx, boolean showSpace) {
|
||||
this.ctx = ctx;
|
||||
this.showSpace = showSpace;
|
||||
application = (OsmandApplication) ctx.getApplicationContext();
|
||||
freeVersionBanner = view.findViewById(R.id.freeVersionBanner);
|
||||
downloadProgressLayout = view.findViewById(R.id.downloadProgressLayout);
|
||||
|
@ -304,10 +299,6 @@ public class DownloadActivity extends BaseDownloadActivity {
|
|||
}
|
||||
|
||||
public void updateBannerInProgress() {
|
||||
updateBannerInProgress(true);
|
||||
}
|
||||
|
||||
public void updateBannerInProgress(boolean showSpace) {
|
||||
BasicProgressAsyncTask<?, ?, ?, ?> basicProgressAsyncTask = ctx.getDownloadThread().getCurrentRunningTask();
|
||||
final boolean isFinished = basicProgressAsyncTask == null
|
||||
|| basicProgressAsyncTask.getStatus() == AsyncTask.Status.FINISHED;
|
||||
|
|
|
@ -93,7 +93,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
setHasOptionsMenu(true);
|
||||
|
||||
if(openAsDialog()) {
|
||||
banner = new BannerAndDownloadFreeVersion(view, (DownloadActivity) getActivity());
|
||||
banner = new BannerAndDownloadFreeVersion(view, (DownloadActivity) getActivity(), false);
|
||||
} else {
|
||||
banner = null;
|
||||
view.findViewById(R.id.freeVersionBanner).setVisibility(View.GONE);
|
||||
|
@ -153,7 +153,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
@Override
|
||||
public void newDownloadIndexes() {
|
||||
if(banner != null) {
|
||||
banner.updateBannerInProgress(false);
|
||||
banner.updateBannerInProgress();
|
||||
}
|
||||
reloadData();
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
@Override
|
||||
public void downloadHasFinished() {
|
||||
if(banner != null) {
|
||||
banner.updateBannerInProgress(false);
|
||||
banner.updateBannerInProgress();
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
@Override
|
||||
public void downloadInProgress() {
|
||||
if(banner != null) {
|
||||
banner.updateBannerInProgress(false);
|
||||
banner.updateBannerInProgress();
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
|||
}
|
||||
});
|
||||
|
||||
banner = new BannerAndDownloadFreeVersion(view, (DownloadActivity) getActivity());
|
||||
banner = new BannerAndDownloadFreeVersion(view, (DownloadActivity) getActivity(), false);
|
||||
|
||||
LinearLayout ll = (LinearLayout) view;
|
||||
ExpandableListView expandablelistView = (ExpandableListView) view.findViewById(android.R.id.list);
|
||||
|
@ -151,7 +151,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
|||
@Override
|
||||
public void newDownloadIndexes() {
|
||||
if(banner != null) {
|
||||
banner.updateBannerInProgress(false);
|
||||
banner.updateBannerInProgress();
|
||||
}
|
||||
updateSearchText(searchText);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
|||
@Override
|
||||
public void downloadHasFinished() {
|
||||
if(banner != null) {
|
||||
banner.updateBannerInProgress(false);
|
||||
banner.updateBannerInProgress();
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
|||
@Override
|
||||
public void downloadInProgress() {
|
||||
if(banner != null) {
|
||||
banner.updateBannerInProgress(false);
|
||||
banner.updateBannerInProgress();
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue