Show add to download list tip
This commit is contained in:
1 parent
4b2801190c
commit
275a0766fa
8 files changed
+17
-5
No files matched your search
@@ -37,6 +37,7 @@ import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.dao.DownloadLabel;
|
||||
import com.hippo.ehviewer.download.DownloadManager;
|
||||
import com.hippo.ehviewer.download.DownloadService;
|
||||
import com.hippo.ehviewer.ui.scene.BaseScene;
|
||||
import com.hippo.text.Html;
|
||||
import com.hippo.yorozuya.FileUtils;
|
||||
|
||||
@@ -216,7 +217,7 @@ public final class CommonOperations {
|
||||
client.execute(request);
|
||||
}
|
||||
|
||||
public static void startDownload(final Activity activity, final GalleryInfo galleryInfo, boolean forceDefault) {
|
||||
public static void startDownload(final MainActivity activity, final GalleryInfo galleryInfo, boolean forceDefault) {
|
||||
final DownloadManager dm = EhApplication.getDownloadManager(activity);
|
||||
|
||||
boolean justStart = forceDefault || dm.containDownloadInfo(galleryInfo.gid);
|
||||
@@ -239,6 +240,8 @@ public final class CommonOperations {
|
||||
intent.putExtra(DownloadService.KEY_LABEL, label);
|
||||
intent.putExtra(DownloadService.KEY_GALLERY_INFO, galleryInfo);
|
||||
activity.startService(intent);
|
||||
// Notify
|
||||
activity.showTip(R.string.added_to_download_list, BaseScene.LENGTH_SHORT);
|
||||
} else {
|
||||
// Let use chose label
|
||||
List<DownloadLabel> list = dm.getLabelList();
|
||||
@@ -274,6 +277,8 @@ public final class CommonOperations {
|
||||
} else {
|
||||
Settings.putHasDefaultDownloadLabel(false);
|
||||
}
|
||||
// Notify
|
||||
activity.showTip(R.string.added_to_download_list, BaseScene.LENGTH_SHORT);
|
||||
}
|
||||
}, activity.getString(R.string.remember_download_label), false)
|
||||
.setTitle(R.string.download)
|
||||
|
||||
@@ -74,6 +74,7 @@ import com.hippo.ehviewer.client.parser.RateGalleryParser;
|
||||
import com.hippo.ehviewer.dao.DownloadInfo;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
import com.hippo.ehviewer.ui.GalleryActivity;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.ehviewer.ui.annotation.WholeLifeCircle;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.scene.Announcer;
|
||||
@@ -986,7 +987,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
} else if (mDownload == v) {
|
||||
GalleryInfo galleryInfo = getGalleryInfo();
|
||||
if (galleryInfo != null) {
|
||||
CommonOperations.startDownload(getActivity(), galleryInfo, false);
|
||||
CommonOperations.startDownload((MainActivity) getActivity(), galleryInfo, false);
|
||||
}
|
||||
} else if (mRead == v) {
|
||||
GalleryInfo galleryInfo = null;
|
||||
@@ -1102,7 +1103,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
if (mDownload == v) {
|
||||
GalleryInfo galleryInfo = getGalleryInfo();
|
||||
if (galleryInfo != null) {
|
||||
CommonOperations.startDownload(getActivity(), galleryInfo, true);
|
||||
CommonOperations.startDownload((MainActivity) getActivity(), galleryInfo, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
import com.hippo.ehviewer.client.parser.GalleryListParser;
|
||||
import com.hippo.ehviewer.dao.QuickSearch;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.ehviewer.widget.SearchBar;
|
||||
import com.hippo.ehviewer.widget.SearchLayout;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
@@ -645,7 +646,7 @@ public final class GalleryListScene extends BaseScene
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
case 0: // Download
|
||||
CommonOperations.startDownload(getActivity(), gi, false);
|
||||
CommonOperations.startDownload((MainActivity) getActivity(), gi, false);
|
||||
break;
|
||||
case 1: // Favorites
|
||||
CommonOperations.addToFavorites(getActivity(), gi,
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.dao.HistoryInfo;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
@@ -174,7 +175,7 @@ public class HistoryScene extends ToolbarScene
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
case 0: // Download
|
||||
CommonOperations.startDownload(getActivity(), gi, false);
|
||||
CommonOperations.startDownload((MainActivity) getActivity(), gi, false);
|
||||
break;
|
||||
case 1: // Favorites
|
||||
CommonOperations.addToFavorites(getActivity(), gi,
|
||||
|
||||
Reference in new issue
Block a user