将 Toast 换为 SuperToast
This commit is contained in:
1 parent
27cb0aa260
commit
dfa00b7605
12 files changed
+121
-209
No files matched your search
@@ -18,8 +18,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="60.0dp"
|
||||
android:minWidth="200.0dp"
|
||||
android:background="@android:color/holo_blue_dark" >
|
||||
android:minWidth="100.0dp"
|
||||
android:background="@color/toast_bg" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
|
||||
<color name="detail_divider">#22000000</color>
|
||||
|
||||
|
||||
<color name="toast_bg">#ff458cf5</color>
|
||||
<color name="toast_bg_light">#ff458cf5</color>
|
||||
<color name="btn_white_default">#fff0f0f0</color>
|
||||
</resources>
|
||||
@@ -18,12 +18,12 @@ package com.hippo.ehviewer.ui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hippo.ehviewer.ListUrls;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.data.Comment;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.FswView;
|
||||
import com.hippo.ehviewer.widget.OnFitSystemWindowsListener;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@@ -41,7 +41,6 @@ import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class CommentsSectionFragment extends Fragment
|
||||
implements AdapterView.OnItemLongClickListener {
|
||||
@@ -129,8 +128,7 @@ public class CommentsSectionFragment extends Fragment
|
||||
ClipboardManager cm = (ClipboardManager)mActivity
|
||||
.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText(null, c.comment));
|
||||
Toast.makeText(mActivity, getString(R.string.copyed),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setMessage(R.string.copyed).show();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.hippo.ehviewer.widget.OlScrollView;
|
||||
import com.hippo.ehviewer.widget.OnFitSystemWindowsListener;
|
||||
import com.hippo.ehviewer.widget.OnLayoutListener;
|
||||
import com.hippo.ehviewer.widget.ProgressiveRatingBar;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@@ -76,7 +77,6 @@ import android.widget.ProgressBar;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.TextSwitcher;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ViewSwitcher.ViewFactory;
|
||||
|
||||
public class DetailSectionFragment extends Fragment
|
||||
@@ -257,7 +257,9 @@ public class DetailSectionFragment extends Fragment
|
||||
PreviewList pageList = mGalleryDetail.previewLists[page];
|
||||
if (pageList == null) {
|
||||
Log.d(TAG, "WTF, I may check mangaDetail.pageLists[page] is not null");
|
||||
Toast.makeText(mActivity, "WTF, I may check mangaDetail.pageLists[page] is not null", Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning)
|
||||
.setMessage("WTF, I may check mangaDetail.pageLists[page] is not null")
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
int index = page * mGalleryDetail.previewPerPage + 1;
|
||||
@@ -340,8 +342,9 @@ public class DetailSectionFragment extends Fragment
|
||||
|
||||
int page = (Integer)checkFlag;
|
||||
if (page == mCurPage) {
|
||||
Toast.makeText(mActivity,
|
||||
eMsg, Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning)
|
||||
.setMessage(eMsg)
|
||||
.show();
|
||||
mWaitPreviewList.setVisibility(View.GONE);
|
||||
mPreviewRefreshButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -479,8 +482,9 @@ public class DetailSectionFragment extends Fragment
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO
|
||||
Toast.makeText(mActivity, getString(R.string.unfinished),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity)
|
||||
.setMessage(R.string.unfinished)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
@@ -569,8 +573,8 @@ public class DetailSectionFragment extends Fragment
|
||||
mCurPage = 0;
|
||||
addPageItem(0);
|
||||
} else
|
||||
Toast.makeText(mActivity,
|
||||
getString(R.string.detail_preview_error), Toast.LENGTH_SHORT)
|
||||
new SuperToast(mActivity)
|
||||
.setMessage(R.string.detail_preview_error)
|
||||
.show();
|
||||
|
||||
// Set comments
|
||||
@@ -671,8 +675,10 @@ public class DetailSectionFragment extends Fragment
|
||||
public void onClick(View v) {
|
||||
int rating = getSendableRating(rb.getRating());
|
||||
if (rating <= 0 || rating > 10)
|
||||
Toast.makeText(mActivity, getString(R.string.invalid_rating),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage(R.string.invalid_rating)
|
||||
.show();
|
||||
else {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
mClient.rate(mGalleryDetail.gid, mGalleryDetail.token,
|
||||
@@ -692,14 +698,13 @@ public class DetailSectionFragment extends Fragment
|
||||
averagePeople.setText(String.format("%.2f (%d)",
|
||||
mGalleryDetail.rating, mGalleryDetail.people));
|
||||
}
|
||||
Toast.makeText(mActivity,
|
||||
getString(R.string.rate_succeeded), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setMessage(R.string.rate_succeeded).show();
|
||||
}
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
Toast.makeText(mActivity,
|
||||
getString(R.string.rate_failed) + "\n" + eMsg,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning)
|
||||
.setMessage(getString(R.string.rate_failed) + "\n" + eMsg)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -744,9 +749,7 @@ public class DetailSectionFragment extends Fragment
|
||||
// Show refresh button
|
||||
mWaitPb.setVisibility(View.GONE);
|
||||
mRefreshButton.setVisibility(View.VISIBLE);
|
||||
Toast.makeText(mActivity,
|
||||
eMsg, Toast.LENGTH_SHORT).show();
|
||||
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning).setMessage(eMsg).show();
|
||||
}
|
||||
}
|
||||
private class PageImageGetListener implements EhClient.OnGetImageListener {
|
||||
@@ -829,8 +832,7 @@ public class DetailSectionFragment extends Fragment
|
||||
private class SimpleVoteListener implements EhClient.OnVoteListener {
|
||||
@Override
|
||||
public void onSuccess(String tagPane) {
|
||||
Toast.makeText(mActivity,
|
||||
getString(R.string.vote_succeeded), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setMessage(R.string.vote_succeeded).show();
|
||||
|
||||
DetailParser parser = new DetailParser();
|
||||
parser.setMode(DetailParser.TAG);
|
||||
@@ -838,16 +840,13 @@ public class DetailSectionFragment extends Fragment
|
||||
mGalleryDetail.tags = parser.tags;
|
||||
addTags();
|
||||
} else {
|
||||
Toast.makeText(mActivity,
|
||||
getString(R.string.em_parser_error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning).setMessage(R.string.em_parser_error).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
Toast.makeText(mActivity,
|
||||
getString(R.string.vote_failed) + "\n"+ eMsg, Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning).setMessage(getString(R.string.vote_failed) + "\n"+ eMsg).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,6 @@ import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.DownloadItemLayout;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -17,16 +17,13 @@
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
@@ -43,29 +40,24 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
|
||||
import com.hippo.ehviewer.AppContext;
|
||||
import com.hippo.ehviewer.ImageGeterManager;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.data.Data;
|
||||
import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.service.DownloadService;
|
||||
import com.hippo.ehviewer.service.DownloadServiceConnection;
|
||||
import com.hippo.ehviewer.util.Cache;
|
||||
import com.hippo.ehviewer.util.Log;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.widget.ActionableToastBar;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.FswView;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.OnFitSystemWindowsListener;
|
||||
import com.hippo.ehviewer.widget.ActionableToastBar.ActionClickedListener;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public class FavouriteActivity extends AbstractGalleryActivity
|
||||
@@ -123,7 +115,7 @@ public class FavouriteActivity extends AbstractGalleryActivity
|
||||
mSlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
|
||||
|
||||
mActionableToastBar = new ActionableToastBar(this);
|
||||
mActionableToastBar.setBackgroundColor(Ui.HOLO_BLUE_DARK);
|
||||
mActionableToastBar.setBackgroundColor(mResources.getColor(R.color.toast_bg));
|
||||
mMainView.addView(mActionableToastBar);
|
||||
mMainView.setOnTouchListener(this);
|
||||
|
||||
@@ -232,7 +224,9 @@ public class FavouriteActivity extends AbstractGalleryActivity
|
||||
|
||||
@Override
|
||||
public void onFailure(Object checkFlag, String eMsg) {
|
||||
Toast.makeText(FavouriteActivity.this, eMsg, Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(FavouriteActivity.this)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage(eMsg).show();
|
||||
}
|
||||
});
|
||||
// TODO
|
||||
@@ -342,16 +336,17 @@ public class FavouriteActivity extends AbstractGalleryActivity
|
||||
@Override
|
||||
public void onSuccess(ArrayList<GalleryInfo> gis,
|
||||
int indexPerPage, int maxPage) {
|
||||
Toast.makeText(FavouriteActivity.this,
|
||||
"移动成功", Toast.LENGTH_SHORT).show(); // TODO
|
||||
new SuperToast(FavouriteActivity.this)
|
||||
.setMessage("移动成功").show();
|
||||
mGiList = gis;
|
||||
mGalleryAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
Toast.makeText(FavouriteActivity.this,
|
||||
"移动失败\n" + eMsg, Toast.LENGTH_SHORT).show(); // TODO
|
||||
new SuperToast(FavouriteActivity.this)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage("移动失败\n" + eMsg).show(); // TODO
|
||||
}
|
||||
});
|
||||
|
||||
@@ -379,15 +374,16 @@ public class FavouriteActivity extends AbstractGalleryActivity
|
||||
@Override
|
||||
public void onSuccess(ArrayList<GalleryInfo> gis, int indexPerPage,
|
||||
int maxPage) {
|
||||
Toast.makeText(FavouriteActivity.this,
|
||||
"删除成功", Toast.LENGTH_SHORT).show(); // TODO
|
||||
new SuperToast(FavouriteActivity.this)
|
||||
.setMessage("删除成功").show(); // TODO
|
||||
mGiList = gis;
|
||||
mGalleryAdapter.notifyDataSetChanged();
|
||||
}
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
Toast.makeText(FavouriteActivity.this,
|
||||
"删除失败\n" + eMsg, Toast.LENGTH_SHORT).show(); // TODO
|
||||
new SuperToast(FavouriteActivity.this)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage("删除失败\n" + eMsg).show(); // TODO
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,46 +23,33 @@ import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import com.hippo.ehviewer.AppContext;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.R.id;
|
||||
import com.hippo.ehviewer.R.layout;
|
||||
import com.hippo.ehviewer.R.string;
|
||||
import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.gallery.GalleryView;
|
||||
import com.hippo.ehviewer.gallery.data.ImageSet;
|
||||
import com.hippo.ehviewer.gallery.ui.GLRootView;
|
||||
import com.hippo.ehviewer.network.Downloader;
|
||||
import com.hippo.ehviewer.util.Cache;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
||||
import com.hippo.ehviewer.util.Log;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MangaActivity extends AbstractActivity {
|
||||
private String TAG = "MangaActivity";
|
||||
@@ -214,9 +201,11 @@ public class MangaActivity extends AbstractActivity {
|
||||
retryTimes++;
|
||||
int targetPage = (Integer)checkFlag;
|
||||
if (retryTimes < maxRetry) {
|
||||
Toast.makeText(MangaActivity.this, eMsg + " " +
|
||||
String.format(getString(R.string.em_retry_times), retryTimes),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaActivity.this)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage(eMsg + " " +
|
||||
String.format(getString(R.string.em_retry_times), retryTimes))
|
||||
.show(); // TODO
|
||||
if (targetPage == firstPage - 1 &&
|
||||
getPrePage == true) {
|
||||
mEhClient.getMangaUrl(allPrePageUrl, targetPage, new MangaUrlGetListener());
|
||||
@@ -230,12 +219,14 @@ public class MangaActivity extends AbstractActivity {
|
||||
if (targetPage == firstPage - 1 &&
|
||||
getPrePage == true) {
|
||||
getPrePage = false;
|
||||
Toast.makeText(MangaActivity.this,
|
||||
getString(R.string.retry_max_pre), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaActivity.this)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage(R.string.retry_max_pre).show();
|
||||
}
|
||||
else {
|
||||
Toast.makeText(MangaActivity.this,
|
||||
getString(R.string.retry_max_next), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaActivity.this)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage(R.string.retry_max_next).show();
|
||||
mStop = true;
|
||||
}
|
||||
mImageSet.changeState(targetPage, ImageSet.STATE_FAIL);
|
||||
@@ -305,11 +296,13 @@ public class MangaActivity extends AbstractActivity {
|
||||
isv.setOnEdgeListener(new GalleryView.OnEdgeListener() {
|
||||
@Override
|
||||
public void onLastPageEdge() {
|
||||
Toast.makeText(MangaActivity.this, getString(R.string.last_page), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaActivity.this)
|
||||
.setMessage(R.string.last_page).show();
|
||||
}
|
||||
@Override
|
||||
public void onFirstPageEdge() {
|
||||
Toast.makeText(MangaActivity.this, getString(R.string.first_page), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaActivity.this)
|
||||
.setMessage(R.string.first_page).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ import com.hippo.ehviewer.ehclient.DetailUrlParser;
|
||||
import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.service.DownloadService;
|
||||
import com.hippo.ehviewer.service.DownloadServiceConnection;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.widget.AlertButton;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.ActionBar.Tab;
|
||||
@@ -41,7 +41,6 @@ import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
@@ -50,7 +49,6 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
// TODO I'm going to add an awesome feature.
|
||||
// When views in ListView or ScrollView or some ViewGroup can
|
||||
@@ -104,9 +102,9 @@ public class MangaDetailActivity extends AbstractFragmentActivity
|
||||
// TODO
|
||||
}
|
||||
// TODO reset views
|
||||
|
||||
Toast.makeText(this, getString(R.string.unfinished),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(this)
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setMessage(R.string.unfinished).show();
|
||||
|
||||
} else {
|
||||
mGalleryInfo = intent.getParcelableExtra(KEY_G_INFO);
|
||||
@@ -206,31 +204,23 @@ public class MangaDetailActivity extends AbstractFragmentActivity
|
||||
return true;
|
||||
case R.id.action_favourite:
|
||||
((AppContext)getApplication()).getData().addLocalFavourite(mGalleryInfo);
|
||||
Toast.makeText(MangaDetailActivity.this,
|
||||
getString(R.string.toast_add_favourite),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(this).setMessage(R.string.toast_add_favourite).show();
|
||||
return true;
|
||||
case R.id.action_download:
|
||||
if (mGalleryDetail.language == null) {
|
||||
Toast.makeText(MangaDetailActivity.this,
|
||||
getString(R.string.wait),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(this).setMessage(R.string.wait).show();
|
||||
} else {
|
||||
Intent it = new Intent(MangaDetailActivity.this, DownloadService.class);
|
||||
startService(it);
|
||||
mServiceConn.getService().add(String.valueOf(mGalleryDetail.gid), mGalleryDetail.thumb,
|
||||
EhClient.getDetailUrl(mGalleryDetail.gid, mGalleryDetail.token),
|
||||
mGalleryDetail.title);
|
||||
Toast.makeText(MangaDetailActivity.this,
|
||||
getString(R.string.toast_add_download),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(this, R.string.toast_add_download).show();
|
||||
}
|
||||
return true;
|
||||
case R.id.action_info:
|
||||
if (mGalleryDetail.language == null) {
|
||||
Toast.makeText(MangaDetailActivity.this,
|
||||
getString(R.string.wait),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(this, R.string.wait).show();
|
||||
} else {
|
||||
|
||||
new DialogBuilder(this).setTitle(R.string.info)
|
||||
@@ -284,7 +274,8 @@ public class MangaDetailActivity extends AbstractFragmentActivity
|
||||
}
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
Toast.makeText(MangaDetailActivity.this, eMsg, Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaDetailActivity.this, eMsg)
|
||||
.setIcon(R.drawable.ic_warning).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,43 +17,25 @@
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import com.hippo.ehviewer.AppContext;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.gallery.GalleryView;
|
||||
import com.hippo.ehviewer.gallery.data.DownloadImageSet;
|
||||
import com.hippo.ehviewer.gallery.data.ImageSet;
|
||||
import com.hippo.ehviewer.gallery.ui.GLRootView;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Util;
|
||||
|
||||
import android.R.color;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
|
||||
import com.hippo.ehviewer.util.Log;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MangaDownloadActivity extends AbstractActivity {
|
||||
private static final String TAG = "MangaDownloadActivity";
|
||||
@@ -104,11 +86,11 @@ public class MangaDownloadActivity extends AbstractActivity {
|
||||
isv.setOnEdgeListener(new GalleryView.OnEdgeListener() {
|
||||
@Override
|
||||
public void onLastPageEdge() {
|
||||
Toast.makeText(MangaDownloadActivity.this, getString(R.string.last_page), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaDownloadActivity.this, R.string.last_page).show();
|
||||
}
|
||||
@Override
|
||||
public void onFirstPageEdge() {
|
||||
Toast.makeText(MangaDownloadActivity.this, getString(R.string.first_page), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaDownloadActivity.this, R.string.first_page).show();
|
||||
}
|
||||
});
|
||||
glrv.setContentPane(isv);
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.List;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import com.hippo.ehviewer.AppContext;
|
||||
import com.hippo.ehviewer.ImageGeterManager;
|
||||
import com.hippo.ehviewer.ListUrls;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.UpdateHelper;
|
||||
@@ -37,22 +36,19 @@ import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.network.Downloader;
|
||||
import com.hippo.ehviewer.service.DownloadService;
|
||||
import com.hippo.ehviewer.service.DownloadServiceConnection;
|
||||
import com.hippo.ehviewer.util.Cache;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Log;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Util;
|
||||
import com.hippo.ehviewer.widget.AlertButton;
|
||||
import com.hippo.ehviewer.widget.CheckTextView;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.FswListView;
|
||||
import com.hippo.ehviewer.widget.FswView;
|
||||
import com.hippo.ehviewer.widget.HfListView;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.OnFitSystemWindowsListener;
|
||||
import com.hippo.ehviewer.widget.PrefixEditText;
|
||||
import com.hippo.ehviewer.widget.SuperDialogUtil;
|
||||
import com.hippo.ehviewer.widget.SuperSwipeRefreshLayout;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
import com.hippo.ehviewer.widget.TagListView;
|
||||
import com.hippo.ehviewer.widget.TagsAdapter;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
@@ -66,7 +62,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -91,12 +86,9 @@ import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
// TODO check visiblePage is right or not
|
||||
// TODO http://lofi.e-hentai.org/
|
||||
@@ -229,9 +221,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
setUserPanel();
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
eMsg,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, eMsg).setIcon(R.drawable.ic_warning).show();
|
||||
if (!MangaListActivity.this.isFinishing())
|
||||
loginDialog.show();
|
||||
}
|
||||
@@ -286,8 +276,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
public void onClick(View v) {
|
||||
int mode = modeSpinner.getSelectedItemPosition();
|
||||
if (mode > 1) {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
R.string.unfinished, Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.unfinished).show();
|
||||
} else {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
Config.setMode(mode);
|
||||
@@ -344,15 +333,11 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
if (searchNormal.getVisibility() == View.GONE) {
|
||||
searchNormal.setVisibility(View.VISIBLE);
|
||||
searchTag.setVisibility(View.GONE);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_normal_mode), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_normal_mode).show();
|
||||
} else {
|
||||
searchNormal.setVisibility(View.GONE);
|
||||
searchTag.setVisibility(View.VISIBLE);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_tag_mode), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_tag_mode).show();
|
||||
}
|
||||
}
|
||||
}).setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@@ -384,9 +369,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
setTitle(mTitle);
|
||||
} else {
|
||||
lus = backup;
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.wait_for_last),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.wait_for_last).show();
|
||||
}
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
|
||||
@@ -540,9 +523,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
case 0: // Add favourite item
|
||||
lmd = mGiList.get(longClickItemIndex);
|
||||
mData.addLocalFavourite(lmd);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_add_favourite),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_add_favourite).show();
|
||||
break;
|
||||
case 1:
|
||||
lmd = mGiList.get(longClickItemIndex);
|
||||
@@ -550,9 +531,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
startService(it);
|
||||
mServiceConn.getService().add(String.valueOf(lmd.gid), lmd.thumb,
|
||||
EhClient.getDetailUrl(lmd.gid, lmd.token), lmd.title);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_add_download),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_add_download).show();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -611,15 +590,11 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
|
||||
getList();
|
||||
} else {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_invalid_page),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_invalid_page).setIcon(R.drawable.ic_warning).show();
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_invalid_page),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_invalid_page).setIcon(R.drawable.ic_warning).show();
|
||||
}
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel,
|
||||
@@ -656,13 +631,9 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
public void onClick(View v) {
|
||||
String key = et.getText().toString();
|
||||
if (key.length() == 0)
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.tag_name_empty),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.tag_name_empty).setIcon(R.drawable.ic_warning).show();
|
||||
else if (listMenuTag.contains(key) && !key.equals(oldStr))
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.tag_name_exist),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.tag_name_empty).setIcon(R.drawable.ic_warning).show();
|
||||
else {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
if (listener != null) {
|
||||
@@ -697,15 +668,11 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
if (searchNormal.getVisibility() == View.GONE) {
|
||||
searchNormal.setVisibility(View.VISIBLE);
|
||||
searchTag.setVisibility(View.GONE);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_normal_mode), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_normal_mode).show();
|
||||
} else {
|
||||
searchNormal.setVisibility(View.GONE);
|
||||
searchTag.setVisibility(View.VISIBLE);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_tag_mode), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_tag_mode).show();
|
||||
}
|
||||
}
|
||||
}).setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@@ -1050,21 +1017,13 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
mHlv.setVisibility(View.GONE);
|
||||
mFreshButton.setVisibility(View.VISIBLE);
|
||||
|
||||
Log.d(TAG, "error");
|
||||
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
eMsg, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
new SuperToast(MangaListActivity.this, eMsg).setIcon(R.drawable.ic_warning).show();
|
||||
mGiList.clear();
|
||||
mGalleryAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "error " + mGetMode);
|
||||
mFreshButton.setVisibility(View.GONE);
|
||||
Toast.makeText(
|
||||
MangaListActivity.this,
|
||||
eMsg,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, eMsg).setIcon(R.drawable.ic_warning).show();
|
||||
break;
|
||||
}
|
||||
mHlv.setAnyRefreshComplete(false);
|
||||
@@ -1135,18 +1094,14 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
mEhClient.logout(new EhClient.OnLogoutListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_logout_succeeded),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.toast_logout_succeeded).show();
|
||||
Config.logoutNow();
|
||||
setUserPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
eMsg,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, eMsg).setIcon(R.drawable.ic_warning).show();
|
||||
setUserPanel();
|
||||
}
|
||||
});
|
||||
@@ -1284,9 +1239,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
|
||||
showContent();
|
||||
} else {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.wait_for_last),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.wait_for_last).show();
|
||||
lus = backup;
|
||||
}
|
||||
break;
|
||||
@@ -1337,9 +1290,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
setTitle(mTitle);
|
||||
showContent();
|
||||
} else {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.wait_for_last),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.wait_for_last).show();
|
||||
lus = backup;
|
||||
}
|
||||
}
|
||||
@@ -1498,9 +1449,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
mTitle = t;
|
||||
setTitle(mTitle);
|
||||
} else {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.wait_for_last),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.wait_for_last).show();
|
||||
lus = backup;
|
||||
}
|
||||
return true;
|
||||
@@ -1591,7 +1540,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
public void onBackPressed() {
|
||||
if (System.currentTimeMillis() - curBackTime > BACK_PRESSED_INTERVAL) {
|
||||
curBackTime = System.currentTimeMillis();
|
||||
Toast.makeText(this, getString(R.string.exit_tip), Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.exit_tip).show();
|
||||
} else
|
||||
finish();
|
||||
}
|
||||
@@ -1643,9 +1592,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
return true;
|
||||
case R.id.action_refresh:
|
||||
if (!refresh())
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.wait),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, R.string.wait).show();
|
||||
return true;
|
||||
case R.id.action_jump:
|
||||
if (!mHlv.isRefreshing() && isGetOk())
|
||||
@@ -1735,9 +1682,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Config.loginNow();
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_login_succeeded),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this).setMessage(R.string.toast_login_succeeded).show();
|
||||
setUserPanel();
|
||||
}
|
||||
|
||||
@@ -1746,9 +1691,7 @@ public class MangaListActivity extends AbstractGalleryActivity
|
||||
if (force && !MangaListActivity.this.isFinishing())
|
||||
loginDialog.show();
|
||||
setUserPanel();
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
eMsg,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(MangaListActivity.this, eMsg).setIcon(R.drawable.ic_warning).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -35,11 +35,11 @@ import com.hippo.ehviewer.widget.AlertButton;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.FileExplorerView;
|
||||
import com.hippo.ehviewer.widget.SuperDialogUtil;
|
||||
import com.hippo.ehviewer.widget.SuperToast;
|
||||
import com.hippo.ehviewer.network.Downloader;
|
||||
import com.hippo.ehviewer.preference.AutoListPreference;
|
||||
import com.readystatesoftware.systembartint.SystemBarTintManager.SystemBarConfig;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
@@ -49,7 +49,6 @@ import android.preference.CheckBoxPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@@ -61,7 +60,6 @@ import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
@SuppressWarnings("unused")
|
||||
@@ -321,8 +319,8 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
try {
|
||||
cacheSize = Integer.parseInt((String) objValue) * 1024 * 1024;
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(mActivity, getString(R.string.input_error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning)
|
||||
.setMessage(R.string.input_error).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -335,9 +333,8 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
Cache.diskCache = new DiskCache(mActivity,
|
||||
Cache.cpCachePath, cacheSize);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(mActivity,
|
||||
getString(R.string.create_cache_error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning)
|
||||
.setMessage(R.string.create_cache_error).show();
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else
|
||||
@@ -412,8 +409,8 @@ public class SettingsActivity extends AbstractPreferenceActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!fileExplorerView.canWrite())
|
||||
Toast.makeText(mActivity, "当前路径不可写",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
new SuperToast(mActivity).setIcon(R.drawable.ic_warning)
|
||||
.setMessage("当前路径不可写").show();
|
||||
else {
|
||||
String downloadPath = fileExplorerView.getCurPath();
|
||||
|
||||
|
||||
@@ -37,11 +37,24 @@ public class SuperToast extends Toast {
|
||||
|
||||
public SuperToast(Context context) {
|
||||
super(context);
|
||||
|
||||
mContext = context;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public SuperToast(Context context, String mesg) {
|
||||
this(context);
|
||||
setMessage(mesg);
|
||||
}
|
||||
|
||||
public SuperToast(Context context, int strResId) {
|
||||
this(context);
|
||||
setMessage(strResId);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
LayoutInflater inflate = (LayoutInflater)
|
||||
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
mMainView = (LinearLayout)inflate.inflate(R.layout.super_toast, null);
|
||||
mIcon = (ImageView)mMainView.findViewById(R.id.icon);
|
||||
mMessage = (TextView)mMainView.findViewById(R.id.message);
|
||||
|
||||
Reference in new issue
Block a user