Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
400f92ebb5 | ||
|
|
dcac616391 | ||
|
|
10c814fc2b | ||
|
|
8a1c0c0766 | ||
|
|
5c179a4e5d | ||
|
|
e72dfae998 | ||
|
|
fd4a535701 | ||
|
|
d01370e480 | ||
|
|
e110647a17 | ||
|
|
4edc7f082b | ||
|
|
3a01dd6b5b | ||
|
|
6ef208db91 | ||
|
|
d25ea0957e | ||
|
|
c8030c6454 | ||
|
|
e608d8e142 | ||
|
|
df01343c97 | ||
|
|
2ee792c6a8 | ||
|
|
e601fc85d1 | ||
|
|
bbceb4e493 | ||
|
|
43df2a5887 | ||
|
|
be8e03e99d | ||
|
|
3cac88362c | ||
|
|
cf0659db85 | ||
|
|
72c1190aa9 | ||
|
|
6986a84cf6 | ||
|
|
9c11ffde3c | ||
|
|
492fcd56a0 | ||
|
|
481499c124 | ||
|
|
3f11ad9f53 | ||
|
|
e36c3fe796 | ||
|
|
7c235d2a33 | ||
|
|
727eb73721 | ||
|
|
42f5e6ae4e | ||
|
|
7515303e87 | ||
|
|
281af4140a | ||
|
|
4fa6a1f544 | ||
|
|
53f8cc4488 | ||
|
|
0f980a5cee | ||
|
|
6e06cca962 | ||
|
|
ba884f8c99 | ||
|
|
44c2d25218 | ||
|
|
cd33a557cd | ||
|
|
2c4daa447e | ||
|
|
6659fefc21 | ||
|
|
48face0e9e | ||
|
|
fe16ccd8b9 | ||
|
|
99fedf4e3c | ||
|
|
7924b53d00 |
No files matched your search
@@ -10,8 +10,8 @@ android {
|
||||
applicationId "com.hippo.ehviewer"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 23
|
||||
versionCode 50
|
||||
versionName "0.9.2"
|
||||
versionCode 52
|
||||
versionName "0.9.4"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ dependencies {
|
||||
compile project(':yorozuya')
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:23.2.0'
|
||||
compile 'com.android.support:customtabs:23.2.0'
|
||||
compile 'com.android.support:design:23.2.0'
|
||||
compile 'com.android.support:appcompat-v7:23.2.1'
|
||||
compile 'com.android.support:customtabs:23.2.1'
|
||||
compile 'com.android.support:design:23.2.1'
|
||||
compile 'com.github.amlcurran.showcaseview:library:5.4.1'
|
||||
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.6'
|
||||
compile 'de.greenrobot:greendao:2.0.0'
|
||||
|
||||
@@ -44,10 +44,15 @@ public class EditTextDialogBuilder extends AlertDialog.Builder implements EditTe
|
||||
mTextInputLayout = (TextInputLayout) view;
|
||||
mEditText = (EditText) view.findViewById(R.id.edit_text);
|
||||
mEditText.setText(text);
|
||||
mEditText.setSelection(mEditText.getText().length());
|
||||
mEditText.setOnEditorActionListener(this);
|
||||
mTextInputLayout.setHint(hint);
|
||||
}
|
||||
|
||||
public EditText getEditText() {
|
||||
return mEditText;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return mEditText.getText().toString();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.drawable;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.graphics.drawable.DrawableWrapper;
|
||||
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
|
||||
public class PreciselyClipDrawable extends DrawableWrapper {
|
||||
|
||||
private final boolean mClip;
|
||||
private RectF mScale;
|
||||
private Rect mTemp;
|
||||
|
||||
public PreciselyClipDrawable(Drawable drawable, int offsetX, int offsetY, int width, int height) {
|
||||
super(drawable);
|
||||
float originWidth = drawable.getIntrinsicWidth();
|
||||
float originHeight = drawable.getIntrinsicHeight();
|
||||
|
||||
if (originWidth <= 0 || originHeight <= 0) {
|
||||
// Can not clip
|
||||
mClip = false;
|
||||
} else {
|
||||
mClip = true;
|
||||
mScale = new RectF();
|
||||
mScale.set(MathUtils.clamp(offsetX / originWidth, 0.0f, 1.0f),
|
||||
MathUtils.clamp(offsetY / originHeight, 0.0f, 1.0f),
|
||||
MathUtils.clamp((offsetX + width) / originWidth, 0.0f, 1.0f),
|
||||
MathUtils.clamp((offsetY + height) / originHeight, 0.0f, 1.0f));
|
||||
mTemp = new Rect();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBoundsChange(Rect bounds) {
|
||||
if (mClip) {
|
||||
if (!mScale.isEmpty()) {
|
||||
mTemp.left = (int) ((mScale.left * bounds.right - mScale.right * bounds.left) /
|
||||
(mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left)));
|
||||
mTemp.right = (int) (((1 - mScale.right) * bounds.left - (1 - mScale.left) * bounds.right) /
|
||||
(mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left)));
|
||||
mTemp.top = (int) ((mScale.top * bounds.bottom - mScale.bottom * bounds.top) /
|
||||
(mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top)));
|
||||
mTemp.bottom = (int) (((1 - mScale.bottom) * bounds.top - (1 - mScale.top) * bounds.bottom) /
|
||||
(mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top)));
|
||||
super.onBoundsChange(mTemp);
|
||||
}
|
||||
} else {
|
||||
super.onBoundsChange(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
if (mClip) {
|
||||
return (int) (super.getIntrinsicWidth() * mScale.width());
|
||||
} else {
|
||||
return super.getIntrinsicWidth();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicHeight() {
|
||||
if (mClip) {
|
||||
return (int) (super.getIntrinsicHeight() * mScale.height());
|
||||
} else {
|
||||
return super.getIntrinsicHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (mClip) {
|
||||
if (!mScale.isEmpty()) {
|
||||
int saveCount = canvas.save();
|
||||
canvas.clipRect(getBounds());
|
||||
super.draw(canvas);
|
||||
canvas.restoreToCount(saveCount);
|
||||
}
|
||||
} else {
|
||||
super.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class AppConfig {
|
||||
private static final String CRASH = "crash";
|
||||
private static final String PARSE_ERROR = "parse_error";
|
||||
private static final String LOGCAT = "logcat";
|
||||
private static final String DATA = "data";
|
||||
|
||||
private static Context sContext;
|
||||
|
||||
@@ -103,6 +104,11 @@ public class AppConfig {
|
||||
return getDirInExternalAppDir(LOGCAT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static File getExternalDataDir() {
|
||||
return getDirInExternalAppDir(DATA);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static File createExternalTempFile() {
|
||||
return FileUtils.createTempFile(getExternalTempDir(), null);
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhEngine;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.download.DownloadManager;
|
||||
import com.hippo.ehviewer.spider.SpiderDen;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
@@ -75,8 +74,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
private BitmapHelper mBitmapHelper;
|
||||
private Conaco<Bitmap> mConaco;
|
||||
private LruCache<Long, GalleryDetail> mGalleryDetailCache;
|
||||
private LruCache<String, LargePreviewSet> mLargePreviewSetCache;
|
||||
private LruCache<Long, Integer> mPreviewPagesCache;
|
||||
private SimpleDiskCache mSpiderInfoCache;
|
||||
private DownloadManager mDownloadManager;
|
||||
|
||||
@@ -111,6 +108,8 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
|
||||
CommonOperations.ensureNoMediaFile(Settings.getDownloadLocation());
|
||||
|
||||
update();
|
||||
|
||||
// Update version code
|
||||
try {
|
||||
PackageInfo pi= getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
@@ -124,6 +123,13 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
}
|
||||
}
|
||||
|
||||
private void update() {
|
||||
int version = Settings.getVersionCode();
|
||||
if (version < 52) {
|
||||
Settings.putGuideGallery(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearMemoryCache() {
|
||||
if (null != mConaco) {
|
||||
mConaco.clearMemoryCache();
|
||||
@@ -131,12 +137,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
if (null != mGalleryDetailCache) {
|
||||
mGalleryDetailCache.evictAll();
|
||||
}
|
||||
if (null != mLargePreviewSetCache) {
|
||||
mLargePreviewSetCache.evictAll();
|
||||
}
|
||||
if (null != mPreviewPagesCache) {
|
||||
mPreviewPagesCache.evictAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -269,26 +269,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
return application.mGalleryDetailCache;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static LruCache<String, LargePreviewSet> getLargePreviewSetCache(@NonNull Context context) {
|
||||
EhApplication application = ((EhApplication) context.getApplicationContext());
|
||||
if (application.mLargePreviewSetCache == null) {
|
||||
// Max size 50, 3 min timeout
|
||||
application.mLargePreviewSetCache = new LruCache<>(50);
|
||||
}
|
||||
return application.mLargePreviewSetCache;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static LruCache<Long, Integer> getPreviewPagesCache(@NonNull Context context) {
|
||||
EhApplication application = ((EhApplication) context.getApplicationContext());
|
||||
if (application.mPreviewPagesCache == null) {
|
||||
// Max size 50, 3 min timeout
|
||||
application.mPreviewPagesCache = new LruCache<>(50);
|
||||
}
|
||||
return application.mPreviewPagesCache;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static SimpleDiskCache getSpiderInfoCache(@NonNull Context context) {
|
||||
EhApplication application = ((EhApplication) context.getApplicationContext());
|
||||
|
||||
@@ -42,9 +42,19 @@ import com.hippo.ehviewer.dao.LocalFavoriteInfo;
|
||||
import com.hippo.ehviewer.dao.LocalFavoritesDao;
|
||||
import com.hippo.ehviewer.dao.QuickSearch;
|
||||
import com.hippo.ehviewer.dao.QuickSearchDao;
|
||||
import com.hippo.ehviewer.download.DownloadManager;
|
||||
import com.hippo.util.SqlUtils;
|
||||
import com.hippo.yorozuya.FileUtils;
|
||||
import com.hippo.yorozuya.IOUtils;
|
||||
import com.hippo.yorozuya.ObjectUtils;
|
||||
import com.hippo.yorozuya.sparse.SparseJLArray;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -75,10 +85,14 @@ public class EhDB {
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
switch (oldVersion) {
|
||||
case 1: // 1 to 2
|
||||
FilterDao.createTable(db, true);
|
||||
}
|
||||
upgradeDB(db, oldVersion);
|
||||
}
|
||||
}
|
||||
|
||||
private static void upgradeDB(SQLiteDatabase db, int oldVersion) {
|
||||
switch (oldVersion) {
|
||||
case 1: // 1 to 2
|
||||
FilterDao.createTable(db, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,6 +399,14 @@ public class EhDB {
|
||||
return raw;
|
||||
}
|
||||
|
||||
public static synchronized DownloadLabel addDownloadLabel(DownloadLabel raw) {
|
||||
// Reset id
|
||||
raw.setId(null);
|
||||
DownloadLabelDao dao = sDaoSession.getDownloadLabelDao();
|
||||
raw.setId(dao.insert(raw));
|
||||
return raw;
|
||||
}
|
||||
|
||||
public static synchronized void updateDownloadLabel(DownloadLabel raw) {
|
||||
DownloadLabelDao dao = sDaoSession.getDownloadLabelDao();
|
||||
dao.update(raw);
|
||||
@@ -481,6 +503,7 @@ public class EhDB {
|
||||
|
||||
public static synchronized void insertQuickSearch(QuickSearch quickSearch) {
|
||||
QuickSearchDao dao = sDaoSession.getQuickSearchDao();
|
||||
quickSearch.id = null;
|
||||
quickSearch.time = System.currentTimeMillis();
|
||||
quickSearch.id = dao.insert(quickSearch);
|
||||
}
|
||||
@@ -542,6 +565,19 @@ public class EhDB {
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void putHistoryInfo(List<HistoryInfo> historyInfoList) {
|
||||
HistoryDao dao = sDaoSession.getHistoryDao();
|
||||
for (HistoryInfo info: historyInfoList) {
|
||||
if (null == dao.load(info.gid)) {
|
||||
dao.insert(info);
|
||||
}
|
||||
}
|
||||
|
||||
List<HistoryInfo> list = dao.queryBuilder().orderDesc(HistoryDao.Properties.Time)
|
||||
.limit(-1).offset(MAX_HISTORY_COUNT).list();
|
||||
dao.deleteInTx(list);
|
||||
}
|
||||
|
||||
public static synchronized void deleteHistoryInfo(HistoryInfo info) {
|
||||
HistoryDao dao = sDaoSession.getHistoryDao();
|
||||
dao.delete(info);
|
||||
@@ -557,11 +593,119 @@ public class EhDB {
|
||||
}
|
||||
|
||||
public static synchronized void addFilter(Filter filter) {
|
||||
long id = sDaoSession.getFilterDao().insert(filter);
|
||||
filter.setId(id);
|
||||
filter.setId(null);
|
||||
filter.setId(sDaoSession.getFilterDao().insert(filter));
|
||||
}
|
||||
|
||||
public static synchronized void deleteFilter(Filter filter) {
|
||||
sDaoSession.getFilterDao().delete(filter);
|
||||
}
|
||||
|
||||
public static synchronized boolean exportDB(Context context, File file) {
|
||||
File dbFile = context.getDatabasePath("eh.db");
|
||||
if (null == dbFile || !dbFile.isFile()) {
|
||||
return false;
|
||||
}
|
||||
if (null == file || !FileUtils.ensureFile(file)) {
|
||||
return false;
|
||||
}
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
try {
|
||||
is = new FileInputStream(dbFile);
|
||||
os = new FileOutputStream(file);
|
||||
IOUtils.copy(is, os);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
// Delete failed file
|
||||
file.delete();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param file The db file
|
||||
* @return error string, null for no error
|
||||
*/
|
||||
public static synchronized String importDB(Context context, File file) {
|
||||
try {
|
||||
SQLiteDatabase db = SQLiteDatabase.openDatabase(
|
||||
file.getPath(), null, SQLiteDatabase.NO_LOCALIZED_COLLATORS);
|
||||
int newVersion = DaoMaster.SCHEMA_VERSION;
|
||||
int oldVersion = db.getVersion();
|
||||
if (oldVersion < newVersion) {
|
||||
upgradeDB(db, oldVersion);
|
||||
db.setVersion(newVersion);
|
||||
} else if (oldVersion > newVersion) {
|
||||
return context.getString(R.string.cant_read_the_file);
|
||||
}
|
||||
|
||||
DaoMaster daoMaster = new DaoMaster(db);
|
||||
DaoSession session = daoMaster.newSession();
|
||||
|
||||
// Downloads
|
||||
DownloadManager manager = EhApplication.getDownloadManager(context);
|
||||
List<DownloadInfo> downloadInfoList = session.getDownloadsDao().queryBuilder().list();
|
||||
manager.addDownload(downloadInfoList);
|
||||
|
||||
// Download label
|
||||
List<DownloadLabel> downloadLabelList = session.getDownloadLabelDao().queryBuilder().list();
|
||||
manager.addDownloadLabel(downloadLabelList);
|
||||
|
||||
// Download dirname
|
||||
List<DownloadDirname> downloadDirnameList = session.getDownloadDirnameDao().queryBuilder().list();
|
||||
for (DownloadDirname dirname: downloadDirnameList) {
|
||||
putDownloadDirname(dirname.getGid(), dirname.getDirname());
|
||||
}
|
||||
|
||||
// History
|
||||
List<HistoryInfo> historyInfoList = session.getHistoryDao().queryBuilder().list();
|
||||
putHistoryInfo(historyInfoList);
|
||||
|
||||
// QuickSearch
|
||||
List<QuickSearch> quickSearchList = session.getQuickSearchDao().queryBuilder().list();
|
||||
List<QuickSearch> currentQuickSearchList = sDaoSession.getQuickSearchDao().queryBuilder().list();
|
||||
for (QuickSearch quickSearch: quickSearchList) {
|
||||
String name = quickSearch.name;
|
||||
for (QuickSearch q: currentQuickSearchList) {
|
||||
if (ObjectUtils.equal(q.name, name)) {
|
||||
// The same name
|
||||
name = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (null == name) {
|
||||
continue;
|
||||
}
|
||||
insertQuickSearch(quickSearch);
|
||||
}
|
||||
|
||||
// LocalFavorites
|
||||
List<LocalFavoriteInfo> localFavoriteInfoList = session.getLocalFavoritesDao().queryBuilder().list();
|
||||
for (LocalFavoriteInfo info: localFavoriteInfoList) {
|
||||
putLocalFavorites(info);
|
||||
}
|
||||
|
||||
// Bookmarks
|
||||
// TODO
|
||||
|
||||
// Filter
|
||||
List<Filter> filterList = session.getFilterDao().queryBuilder().list();
|
||||
List<Filter> currentFilterList = sDaoSession.getFilterDao().queryBuilder().list();
|
||||
for (Filter filter: filterList) {
|
||||
if (!currentFilterList.contains(filter)) {
|
||||
addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
return context.getString(R.string.cant_read_the_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.hippo.ehviewer.client.EhConfig;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.FavListUrlBuilder;
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
import com.hippo.ehviewer.gallery.gl.GalleryView;
|
||||
import com.hippo.ehviewer.gallery.gl.ImageView;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
@@ -261,7 +261,7 @@ public class Settings {
|
||||
}
|
||||
|
||||
public static final String KEY_DEFAULT_CATEGORIES = "default_categories";
|
||||
public static final int DEFAULT_DEFAULT_CATEGORIES = ListUrlBuilder.ALL_CATEGORT;
|
||||
public static final int DEFAULT_DEFAULT_CATEGORIES = EhUtils.ALL_CATEGORY;
|
||||
|
||||
public static int getDefaultCategories() {
|
||||
return getInt(KEY_DEFAULT_CATEGORIES, DEFAULT_DEFAULT_CATEGORIES);
|
||||
@@ -540,6 +540,17 @@ public class Settings {
|
||||
putIntToStr(KEY_PRELOAD_IMAGE, value);
|
||||
}
|
||||
|
||||
private static final String KEY_DOWNLOAD_ORIGIN_IMAGE = "download_origin_image";
|
||||
private static final boolean DEFAULT_DOWNLOAD_ORIGIN_IMAGE = false;
|
||||
|
||||
public static boolean getDownloadOriginImage() {
|
||||
return getBoolean(KEY_DOWNLOAD_ORIGIN_IMAGE, DEFAULT_DOWNLOAD_ORIGIN_IMAGE);
|
||||
}
|
||||
|
||||
public static void putDownloadOriginImage(boolean value) {
|
||||
putBoolean(KEY_DOWNLOAD_ORIGIN_IMAGE, value);
|
||||
}
|
||||
|
||||
/********************
|
||||
****** Favorites
|
||||
********************/
|
||||
|
||||
@@ -45,7 +45,7 @@ public class EhClient {
|
||||
public static final int METHOD_GET_GALLERY_LIST = 1;
|
||||
public static final int METHOD_FILL_GALLERY_LIST_BY_API = 2;
|
||||
public static final int METHOD_GET_GALLERY_DETAIL = 3;
|
||||
public static final int METHOD_GET_LARGE_PREVIEW_SET = 4;
|
||||
public static final int METHOD_GET_PREVIEW_SET = 4;
|
||||
public static final int METHOD_GET_RATE_GALLERY = 5;
|
||||
public static final int METHOD_GET_COMMENT_GALLERY = 6;
|
||||
public static final int METHOD_GET_GALLERY_TOKEN = 7;
|
||||
@@ -155,8 +155,8 @@ public class EhClient {
|
||||
return EhEngine.fillGalleryListByApi(this, mOkHttpClient, (List<GalleryInfo>) params[0]);
|
||||
case METHOD_GET_GALLERY_DETAIL:
|
||||
return EhEngine.getGalleryDetail(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_GET_LARGE_PREVIEW_SET:
|
||||
return EhEngine.getLargePreviewSet(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_GET_PREVIEW_SET:
|
||||
return EhEngine.getPreviewSet(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_GET_RATE_GALLERY:
|
||||
return EhEngine.rateGallery(this, mOkHttpClient, (Long) params[0], (String) params[1], (Float) params[2]);
|
||||
case METHOD_GET_COMMENT_GALLERY:
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.data.GalleryComment;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.CancelledException;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
@@ -201,7 +201,7 @@ public class EhEngine {
|
||||
}
|
||||
|
||||
// Filter title and uploader
|
||||
List<GalleryInfo> list = result.galleryInfos;
|
||||
List<GalleryInfo> list = result.galleryInfoList;
|
||||
for (int i = 0, n = list.size(); i < n; i++) {
|
||||
GalleryInfo info = list.get(i);
|
||||
if (!sEhFilter.filterTitle(info) || !sEhFilter.filterUploader(info)) {
|
||||
@@ -218,7 +218,7 @@ public class EhEngine {
|
||||
// Filter tag
|
||||
for (int i = 0, n = list.size(); i < n; i++) {
|
||||
GalleryInfo info = list.get(i);
|
||||
if (!sEhFilter.filterTag(info)) {
|
||||
if (!sEhFilter.filterTag(info) || !sEhFilter.filterTagNamespace(info)) {
|
||||
list.remove(i);
|
||||
i--;
|
||||
n--;
|
||||
@@ -309,7 +309,7 @@ public class EhEngine {
|
||||
}
|
||||
|
||||
|
||||
public static Pair<LargePreviewSet, Integer> getLargePreviewSet(
|
||||
public static Pair<PreviewSet, Integer> getPreviewSet(
|
||||
EhClient.Task task, OkHttpClient okHttpClient, String url) throws Exception {
|
||||
Log.d(TAG, url);
|
||||
Request request = new EhRequestBuilder(url, task.getEhConfig()).build();
|
||||
@@ -326,9 +326,8 @@ public class EhEngine {
|
||||
code = response.code();
|
||||
headers = response.headers();
|
||||
body = response.body().string();
|
||||
Document document = Jsoup.parse(body);
|
||||
return Pair.create(GalleryDetailParser.parseLargePreviewSet(document, body),
|
||||
GalleryDetailParser.parsePreviewPages(document, body));
|
||||
return Pair.create(GalleryDetailParser.parsePreviewSet(body),
|
||||
GalleryDetailParser.parsePreviewPages(body));
|
||||
} catch (Exception e) {
|
||||
throwException(call, code, headers, body, e);
|
||||
throw e;
|
||||
@@ -617,29 +616,9 @@ public class EhEngine {
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Filter title
|
||||
for (int i = 0, n = list.size(); i < n; i++) {
|
||||
GalleryInfo info = list.get(i);
|
||||
if (!sEhFilter.filterTitle(info)) {
|
||||
list.remove(i);
|
||||
i--;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
// Fill by api
|
||||
fillGalleryListByApi(task, okHttpClient, list);
|
||||
|
||||
// Filter uploader and tag
|
||||
for (int i = 0, n = list.size(); i < n; i++) {
|
||||
GalleryInfo info = list.get(i);
|
||||
if (!sEhFilter.filterUploader(info) || !sEhFilter.filterTag(info)) {
|
||||
list.remove(i);
|
||||
i--;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@@ -32,10 +32,12 @@ public final class EhFilter {
|
||||
public static final int MODE_TITLE = 0;
|
||||
public static final int MODE_UPLOADER = 1;
|
||||
public static final int MODE_TAG = 2;
|
||||
public static final int MODE_TAG_NAMESPACE = 3;
|
||||
|
||||
private final List<Filter> mTitleFilterList = new ArrayList<>();
|
||||
private final List<Filter> mUploaderFilterList = new ArrayList<>();
|
||||
private final List<Filter> mTagFilterList = new ArrayList<>();
|
||||
private final List<Filter> mTagNamespaceFilterList = new ArrayList<>();
|
||||
|
||||
private static EhFilter sInstance;
|
||||
|
||||
@@ -62,6 +64,10 @@ public final class EhFilter {
|
||||
filter.text = filter.text.toLowerCase();
|
||||
mTagFilterList.add(filter);
|
||||
break;
|
||||
case MODE_TAG_NAMESPACE:
|
||||
filter.text = filter.text.toLowerCase();
|
||||
mTagNamespaceFilterList.add(filter);
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "Unknown mode: " + filter.mode);
|
||||
break;
|
||||
@@ -81,6 +87,10 @@ public final class EhFilter {
|
||||
return mTagFilterList;
|
||||
}
|
||||
|
||||
public List<Filter> getTagNamespaceFilterList() {
|
||||
return mTagNamespaceFilterList;
|
||||
}
|
||||
|
||||
public synchronized void addFilter(Filter filter) {
|
||||
EhDB.addFilter(filter);
|
||||
|
||||
@@ -93,8 +103,13 @@ public final class EhFilter {
|
||||
mUploaderFilterList.add(filter);
|
||||
break;
|
||||
case MODE_TAG:
|
||||
filter.text = filter.text.toLowerCase();
|
||||
mTagFilterList.add(filter);
|
||||
break;
|
||||
case MODE_TAG_NAMESPACE:
|
||||
filter.text = filter.text.toLowerCase();
|
||||
mTagNamespaceFilterList.add(filter);
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "Unknown mode: " + filter.mode);
|
||||
break;
|
||||
@@ -114,6 +129,9 @@ public final class EhFilter {
|
||||
case MODE_TAG:
|
||||
mTagFilterList.remove(filter);
|
||||
break;
|
||||
case MODE_TAG_NAMESPACE:
|
||||
mTagNamespaceFilterList.remove(filter);
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "Unknown mode: " + filter.mode);
|
||||
break;
|
||||
@@ -121,7 +139,7 @@ public final class EhFilter {
|
||||
}
|
||||
|
||||
public synchronized boolean needCallApi() {
|
||||
return 0 != mTagFilterList.size();
|
||||
return 0 != mTagFilterList.size() || 0 != mTagNamespaceFilterList.size();
|
||||
}
|
||||
|
||||
public synchronized boolean filterTitle(GalleryInfo info) {
|
||||
@@ -220,4 +238,39 @@ public final class EhFilter {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean matchTagNamespace(String tag, String filter) {
|
||||
if (null == tag || null == filter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String tagNamespace;
|
||||
int index = tag.indexOf(':');
|
||||
if (index >= 0) {
|
||||
tagNamespace = tag.substring(0, index);
|
||||
return tagNamespace.equals(filter);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean filterTagNamespace(GalleryInfo info) {
|
||||
if (null == info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String[] tags = info.simpleTags;
|
||||
List<Filter> filters = mTagNamespaceFilterList;
|
||||
if (null != tags && filters.size() > 0) {
|
||||
for (String tag: tags) {
|
||||
for (int i = 0, n = filters.size(); i < n; i++) {
|
||||
if (matchTagNamespace(tag, filters.get(i).text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -95,4 +95,8 @@ public class EhUrl {
|
||||
public static String getAddFavorites(long gid, String token) {
|
||||
return getHost() + "gallerypopups.php?gid=" + gid + "&t=" + token + "&act=addfav";
|
||||
}
|
||||
|
||||
public static String getTagDefinitionUrl(String tag) {
|
||||
return "https://ehwiki.org/wiki/" + tag.replace(' ', '_');
|
||||
}
|
||||
}
|
||||
@@ -18,17 +18,23 @@ package com.hippo.ehviewer.client;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class EhUtils {
|
||||
|
||||
public static final int NONE = -1; // Use it for homepage
|
||||
public static final int UNKNOWN = 0x400;
|
||||
|
||||
public static final int ALL_CATEGORY = EhUtils.UNKNOWN - 1;
|
||||
//DOUJINSHI|MANGA|ARTIST_CG|GAME_CG|WESTERN|NON_H|IMAGE_SET|COSPLAY|ASIAN_PORN|MISC;
|
||||
|
||||
public static final int BG_COLOR_DOUJINSHI = 0xfff44336;
|
||||
public static final int BG_COLOR_MANGA = 0xffff9800;
|
||||
public static final int BG_COLOR_ARTIST_CG = 0xfffbc02d;
|
||||
@@ -41,6 +47,14 @@ public class EhUtils {
|
||||
public static final int BG_COLOR_MISC = 0xfff06292;
|
||||
public static final int BG_COLOR_UNKNOWN = Color.BLACK;
|
||||
|
||||
// Remove [XXX], (XXX), {XXX}, ~XXX~ stuff
|
||||
public static final Pattern PATTERN_TITLE_PREFIX = Pattern.compile(
|
||||
"^(?:(?:\\([^\\)]*\\))|(?:\\[[^\\]]*\\])|(?:\\{[^\\}]*\\})|(?:~[^~]*~)|\\s+)*");
|
||||
// Remove [XXX], (XXX), {XXX}, ~XXX~ stuff and something like ch. 1-23
|
||||
public static final Pattern PATTERN_TITLE_SUFFIX = Pattern.compile(
|
||||
"(?:\\s+ch.[\\s\\d-]+)?(?:(?:\\([^\\)]*\\))|(?:\\[[^\\]]*\\])|(?:\\{[^\\}]*\\})|(?:~[^~]*~)|\\s+)*$",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private static final int[] CATEGORY_VALUES = {
|
||||
EhConfig.MISC,
|
||||
EhConfig.DOUJINSHI,
|
||||
@@ -133,4 +147,25 @@ public class EhUtils {
|
||||
return TextUtils.isEmpty(gi.title) ? gi.titleJpn : gi.title;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String extractTitle(String title) {
|
||||
if (null == title) {
|
||||
return null;
|
||||
}
|
||||
title = PATTERN_TITLE_PREFIX.matcher(title).replaceFirst("");
|
||||
title = PATTERN_TITLE_SUFFIX.matcher(title).replaceFirst("");
|
||||
// Sometimes title is combined by romaji and english translation.
|
||||
// Only need romaji.
|
||||
// TODO But not sure every '|' means that
|
||||
int index = title.indexOf('|');
|
||||
if (index >= 0) {
|
||||
title = title.substring(0, index);
|
||||
}
|
||||
if (title.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,16 +29,14 @@ public class GalleryDetail extends GalleryInfo {
|
||||
public String visible;
|
||||
public String language;
|
||||
public String size;
|
||||
public String resize;
|
||||
public int pages;
|
||||
public int favoredTimes;
|
||||
public boolean isFavored;
|
||||
public int ratedTimes;
|
||||
public int favoriteCount;
|
||||
public boolean isFavorited;
|
||||
public int ratingCount;
|
||||
public GalleryTagGroup[] tags;
|
||||
public GalleryComment[] comments;
|
||||
public int previewPages;
|
||||
public LargePreviewSet previewSet;
|
||||
|
||||
public PreviewSet previewSet;
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
@@ -54,11 +52,10 @@ public class GalleryDetail extends GalleryInfo {
|
||||
dest.writeString(this.visible);
|
||||
dest.writeString(this.language);
|
||||
dest.writeString(this.size);
|
||||
dest.writeString(this.resize);
|
||||
dest.writeInt(this.pages);
|
||||
dest.writeInt(this.favoredTimes);
|
||||
dest.writeByte(isFavored ? (byte) 1 : (byte) 0);
|
||||
dest.writeInt(this.ratedTimes);
|
||||
dest.writeInt(this.favoriteCount);
|
||||
dest.writeByte(isFavorited ? (byte) 1 : (byte) 0);
|
||||
dest.writeInt(this.ratingCount);
|
||||
dest.writeParcelableArray(this.tags, 0);
|
||||
dest.writeParcelableArray(this.comments, 0);
|
||||
dest.writeInt(this.previewPages);
|
||||
@@ -76,11 +73,10 @@ public class GalleryDetail extends GalleryInfo {
|
||||
this.visible = in.readString();
|
||||
this.language = in.readString();
|
||||
this.size = in.readString();
|
||||
this.resize = in.readString();
|
||||
this.pages = in.readInt();
|
||||
this.favoredTimes = in.readInt();
|
||||
this.isFavored = in.readByte() != 0;
|
||||
this.ratedTimes = in.readInt();
|
||||
this.favoriteCount = in.readInt();
|
||||
this.isFavorited = in.readByte() != 0;
|
||||
this.ratingCount = in.readInt();
|
||||
Parcelable[] array = in.readParcelableArray(GalleryTagGroup.class.getClassLoader());
|
||||
if (array != null) {
|
||||
this.tags = Arrays.copyOf(array, array.length, GalleryTagGroup[].class);
|
||||
@@ -94,7 +90,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
this.comments = null;
|
||||
}
|
||||
this.previewPages = in.readInt();
|
||||
this.previewSet = in.readParcelable(LargePreviewSet.class.getClassLoader());
|
||||
this.previewSet = in.readParcelable(PreviewSet.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static final Creator<GalleryDetail> CREATOR = new Creator<GalleryDetail>() {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GalleryInfo implements Parcelable {
|
||||
|
||||
public static final Pattern[] S_LANG_PATTERNS = {
|
||||
Pattern.compile("[(\\[]eng(?:lish)?[)\\]]", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("[((\\[]chinese[))\\]]|[汉漢]化|中[国國][语語]|中文|[(\\[]CN[)\\]]", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("[((\\[]ch(?:inese)?[))\\]]|[汉漢]化|中[国國][语語]|中文", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("[(\\[]spanish[)\\]]|[(\\[]Español[)\\]]", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("[(\\[]korean?[)\\]]", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("[(\\[]rus(?:sian)?[)\\]]", Pattern.CASE_INSENSITIVE),
|
||||
|
||||
@@ -19,11 +19,27 @@ package com.hippo.ehviewer.client.data;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.hippo.widget.LoadImageView;
|
||||
|
||||
public class GalleryPreview implements Parcelable {
|
||||
|
||||
public String imageUrl;
|
||||
public String pageUrl;
|
||||
public int index;
|
||||
String imageKey;
|
||||
String imageUrl;
|
||||
String pageUrl;
|
||||
int position;
|
||||
int offsetX = Integer.MIN_VALUE;
|
||||
int offsetY = Integer.MIN_VALUE;
|
||||
int clipWidth = Integer.MIN_VALUE;
|
||||
int clipHeight = Integer.MIN_VALUE;
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void load(LoadImageView view) {
|
||||
view.setClip(offsetX, offsetY, clipWidth, clipHeight);
|
||||
view.load(imageKey, imageUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
@@ -34,7 +50,11 @@ public class GalleryPreview implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(this.imageUrl);
|
||||
dest.writeString(this.pageUrl);
|
||||
dest.writeInt(this.index);
|
||||
dest.writeInt(this.position);
|
||||
dest.writeInt(this.offsetX);
|
||||
dest.writeInt(this.offsetY);
|
||||
dest.writeInt(this.clipWidth);
|
||||
dest.writeInt(this.clipHeight);
|
||||
}
|
||||
|
||||
public GalleryPreview() {
|
||||
@@ -43,14 +63,20 @@ public class GalleryPreview implements Parcelable {
|
||||
protected GalleryPreview(Parcel in) {
|
||||
this.imageUrl = in.readString();
|
||||
this.pageUrl = in.readString();
|
||||
this.index = in.readInt();
|
||||
this.position = in.readInt();
|
||||
this.offsetX = in.readInt();
|
||||
this.offsetY = in.readInt();
|
||||
this.clipWidth = in.readInt();
|
||||
this.clipHeight = in.readInt();
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<GalleryPreview> CREATOR = new Parcelable.Creator<GalleryPreview>() {
|
||||
@Override
|
||||
public GalleryPreview createFromParcel(Parcel source) {
|
||||
return new GalleryPreview(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GalleryPreview[] newArray(int size) {
|
||||
return new GalleryPreview[size];
|
||||
}
|
||||
|
||||
@@ -19,38 +19,56 @@ package com.hippo.ehviewer.client.data;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.hippo.ehviewer.client.EhCacheKeyFactory;
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.yorozuya.IntList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LargePreviewSet implements Parcelable {
|
||||
public class LargePreviewSet extends PreviewSet {
|
||||
|
||||
private final IntList mIndexList;
|
||||
private final IntList mPositionList;
|
||||
private final ArrayList<String> mImageUrlList;
|
||||
private final ArrayList<String> mPageUrlList;
|
||||
|
||||
public int size() {
|
||||
return mImageUrlList.size();
|
||||
}
|
||||
|
||||
public void addItem(int index, String imageUrl, String pageUrl) {
|
||||
mIndexList.add(index);
|
||||
mPositionList.add(index);
|
||||
mImageUrlList.add(imageUrl);
|
||||
mPageUrlList.add(pageUrl);
|
||||
}
|
||||
|
||||
public int getIndexAt(int index) {
|
||||
return mIndexList.get(index);
|
||||
@Override
|
||||
public int size() {
|
||||
return mImageUrlList.size();
|
||||
}
|
||||
|
||||
public String getImageUrlAt(int index) {
|
||||
return mImageUrlList.get(index);
|
||||
@Override
|
||||
public int getPosition(int index) {
|
||||
return mPositionList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPageUrlAt(int index) {
|
||||
return mPageUrlList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GalleryPreview getGalleryPreview(long gid, int index) {
|
||||
GalleryPreview galleryPreview = new GalleryPreview();
|
||||
galleryPreview.position = mPositionList.get(index);
|
||||
galleryPreview.imageKey = EhCacheKeyFactory.getLargePreviewKey(gid, galleryPreview.position);
|
||||
galleryPreview.imageUrl = mImageUrlList.get(index);
|
||||
galleryPreview.pageUrl = mPageUrlList.get(index);
|
||||
return galleryPreview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(LoadImageView view, long gid, int index) {
|
||||
view.resetClip();
|
||||
view.load(EhCacheKeyFactory.getLargePreviewKey(gid, mPositionList.get(index)),
|
||||
mImageUrlList.get(index));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -58,19 +76,19 @@ public class LargePreviewSet implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(this.mIndexList, flags);
|
||||
dest.writeParcelable(this.mPositionList, flags);
|
||||
dest.writeStringList(this.mImageUrlList);
|
||||
dest.writeStringList(this.mPageUrlList);
|
||||
}
|
||||
|
||||
public LargePreviewSet() {
|
||||
mIndexList = new IntList();
|
||||
mPositionList = new IntList();
|
||||
mImageUrlList = new ArrayList<>();
|
||||
mPageUrlList = new ArrayList<>();
|
||||
}
|
||||
|
||||
protected LargePreviewSet(Parcel in) {
|
||||
this.mIndexList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mPositionList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mImageUrlList = in.createStringArrayList();
|
||||
this.mPageUrlList = in.createStringArrayList();
|
||||
}
|
||||
|
||||
@@ -48,9 +48,6 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
|
||||
public static final int MODE_WHATS_HOT = 0x3;
|
||||
public static final int MODE_IMAGE_SEARCH = 0x4;
|
||||
|
||||
public static final int ALL_CATEGORT = EhUtils.UNKNOWN - 1;
|
||||
//DOUJINSHI|MANGA|ARTIST_CG|GAME_CG|WESTERN|NON_H|IMAGE_SET|COSPLAY|ASIAN_PORN|MISC;
|
||||
|
||||
public static final int DEFAULT_ADVANCE = AdvanceSearchTable.SNAME | AdvanceSearchTable.STAGS;
|
||||
public static final int DEFAULT_MIN_RATING = 2;
|
||||
|
||||
@@ -166,6 +163,30 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
|
||||
return q;
|
||||
}
|
||||
|
||||
public boolean equalsQuickSearch(QuickSearch q) {
|
||||
if (null == q) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (q.mode != mMode) {
|
||||
return false;
|
||||
}
|
||||
if (q.category != mCategory) {
|
||||
return false;
|
||||
}
|
||||
if (!StringUtils.equals(q.keyword, mKeyword)) {
|
||||
return false;
|
||||
}
|
||||
if (q.advanceSearch != mAdvanceSearch) {
|
||||
return false;
|
||||
}
|
||||
if (q.minRating != mMinRating) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param query xxx=yyy&mmm=nnn
|
||||
*/
|
||||
|
||||
@@ -16,40 +16,121 @@
|
||||
|
||||
package com.hippo.ehviewer.client.data;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.yorozuya.IntList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class NormalPreviewSet {
|
||||
public class NormalPreviewSet extends PreviewSet {
|
||||
|
||||
private final IntList mIndexList = new IntList();
|
||||
private final ArrayList<String> mImageUrlList = new ArrayList<>();
|
||||
private final IntList mXOffsetList = new IntList();
|
||||
private final IntList mYOffsetList = new IntList();
|
||||
private final IntList mWidthList = new IntList();
|
||||
private final IntList mHeightList = new IntList();
|
||||
private final ArrayList<String> mPageUrlList = new ArrayList<>();
|
||||
private IntList mPositionList = new IntList();
|
||||
private ArrayList<String> mImageKeyList = new ArrayList<>();
|
||||
private ArrayList<String> mImageUrlList = new ArrayList<>();
|
||||
private IntList mOffsetXList = new IntList();
|
||||
private IntList mOffsetYList = new IntList();
|
||||
private IntList mClipWidthList = new IntList();
|
||||
private IntList mClipHeightList = new IntList();
|
||||
private ArrayList<String> mPageUrlList = new ArrayList<>();
|
||||
|
||||
public void addItem(int index, String imageUrl, int xOffset, int yOffset, int width,
|
||||
private String getImageKey(String imageUrl) {
|
||||
int index = imageUrl.indexOf('/');
|
||||
if (index >= 0) {
|
||||
return imageUrl.substring(index + 1);
|
||||
} else {
|
||||
return imageUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(int position, String imageUrl, int xOffset, int yOffset, int width,
|
||||
int height, String pageUrl) {
|
||||
mIndexList.add(index);
|
||||
mPositionList.add(position);
|
||||
mImageKeyList.add(getImageKey(imageUrl));
|
||||
mImageUrlList.add(imageUrl);
|
||||
mXOffsetList.add(xOffset);
|
||||
mYOffsetList.add(yOffset);
|
||||
mWidthList.add(width);
|
||||
mHeightList.add(height);
|
||||
mOffsetXList.add(xOffset);
|
||||
mOffsetYList.add(yOffset);
|
||||
mClipWidthList.add(width);
|
||||
mClipHeightList.add(height);
|
||||
mPageUrlList.add(pageUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return mIndexList.size();
|
||||
return mPositionList.size();
|
||||
}
|
||||
|
||||
public int getIndexAt(int index) {
|
||||
return mIndexList.get(index);
|
||||
@Override
|
||||
public int getPosition(int index) {
|
||||
return mPositionList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPageUrlAt(int index) {
|
||||
return mPageUrlList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GalleryPreview getGalleryPreview(long gid, int index) {
|
||||
GalleryPreview galleryPreview = new GalleryPreview();
|
||||
galleryPreview.position = mPositionList.get(index);
|
||||
galleryPreview.imageKey = mImageKeyList.get(index);
|
||||
galleryPreview.imageUrl = mImageUrlList.get(index);
|
||||
galleryPreview.pageUrl = mPageUrlList.get(index);
|
||||
galleryPreview.offsetX = mOffsetXList.get(index);
|
||||
galleryPreview.offsetY = mOffsetYList.get(index);
|
||||
galleryPreview.clipWidth = mClipWidthList.get(index);
|
||||
galleryPreview.clipHeight = mClipHeightList.get(index);
|
||||
return galleryPreview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(LoadImageView view, long gid, int index) {
|
||||
view.setClip(mOffsetXList.get(index), mOffsetYList.get(index),
|
||||
mClipWidthList.get(index), mClipHeightList.get(index));
|
||||
view.load(mImageKeyList.get(index), mImageUrlList.get(index));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(this.mPositionList, flags);
|
||||
dest.writeStringList(this.mImageKeyList);
|
||||
dest.writeStringList(this.mImageUrlList);
|
||||
dest.writeParcelable(this.mOffsetXList, flags);
|
||||
dest.writeParcelable(this.mOffsetYList, flags);
|
||||
dest.writeParcelable(this.mClipWidthList, flags);
|
||||
dest.writeParcelable(this.mClipHeightList, flags);
|
||||
dest.writeStringList(this.mPageUrlList);
|
||||
}
|
||||
|
||||
public NormalPreviewSet() {
|
||||
}
|
||||
|
||||
protected NormalPreviewSet(Parcel in) {
|
||||
this.mPositionList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mImageKeyList = in.createStringArrayList();
|
||||
this.mImageUrlList = in.createStringArrayList();
|
||||
this.mOffsetXList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mOffsetYList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mClipWidthList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mClipHeightList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mPageUrlList = in.createStringArrayList();
|
||||
}
|
||||
|
||||
public static final Creator<NormalPreviewSet> CREATOR = new Creator<NormalPreviewSet>() {
|
||||
@Override
|
||||
public NormalPreviewSet createFromParcel(Parcel source) {
|
||||
return new NormalPreviewSet(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NormalPreviewSet[] newArray(int size) {
|
||||
return new NormalPreviewSet[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -14,18 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer;
|
||||
package com.hippo.ehviewer.client.data;
|
||||
|
||||
import com.hippo.yorozuya.Messenger;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public final class Constants {
|
||||
import com.hippo.widget.LoadImageView;
|
||||
|
||||
public static final int MESSAGE_ID_LIST_MODE;
|
||||
public abstract class PreviewSet implements Parcelable {
|
||||
|
||||
static {
|
||||
Messenger messenger = Messenger.getInstance();
|
||||
MESSAGE_ID_LIST_MODE = messenger.newId();
|
||||
}
|
||||
public abstract int size();
|
||||
|
||||
private Constants(){}
|
||||
public abstract int getPosition(int index);
|
||||
|
||||
public abstract String getPageUrlAt(int index);
|
||||
|
||||
public abstract GalleryPreview getGalleryPreview(long gid, int index);
|
||||
|
||||
public abstract void load(LoadImageView view, long gid, int index);
|
||||
}
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
package com.hippo.ehviewer.client.parser;
|
||||
|
||||
import com.hippo.ehviewer.GetText;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
import com.hippo.util.JsoupUtils;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
@@ -27,32 +30,27 @@ import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FavoritesParser {
|
||||
|
||||
private static final Pattern LIMIT_PATTERN = Pattern.compile("Currently Used Favorite Slots: ([\\d,]+) / ([\\d,]+)");
|
||||
|
||||
public static class Result {
|
||||
public String[] catArray; // Size 10
|
||||
public int[] countArray; // Size 10
|
||||
public int current; // -1 for error
|
||||
public int limit; // -1 for error
|
||||
public int pages;
|
||||
public List<GalleryInfo> galleryInfoList;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static Result parse(String body) throws Exception {
|
||||
if (body.contains("This page requires you to log on.</p>")) {
|
||||
throw new EhException(GetText.getString(R.string.need_sign_in));
|
||||
}
|
||||
String[] catArray = new String[10];
|
||||
int[] countArray = new int[10];
|
||||
int current;
|
||||
int limit;
|
||||
|
||||
try {
|
||||
Document d = Jsoup.parse(body);
|
||||
Element ido = JsoupUtils.getElementByClass(d, "ido");
|
||||
//noinspection ConstantConditions
|
||||
Elements fps = ido.getElementsByClass("fp");
|
||||
// Last one is "fp fps"
|
||||
AssertUtils.assertEqualsEx(11, fps.size());
|
||||
@@ -62,15 +60,6 @@ public class FavoritesParser {
|
||||
countArray[i] = ParserUtils.parseInt(fp.child(0).text());
|
||||
catArray[i] = ParserUtils.trim(fp.child(2).text());
|
||||
}
|
||||
|
||||
Matcher m = LIMIT_PATTERN.matcher(body);
|
||||
if (m.find()) {
|
||||
current = ParserUtils.parseInt(m.group(1));
|
||||
limit = ParserUtils.parseInt(m.group(2));
|
||||
} else {
|
||||
current = -1;
|
||||
limit = -1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ParseException("Parse favorites error", body);
|
||||
@@ -81,10 +70,8 @@ public class FavoritesParser {
|
||||
Result re = new Result();
|
||||
re.catArray = catArray;
|
||||
re.countArray = countArray;
|
||||
re.current = current;
|
||||
re.limit = limit;
|
||||
re.pages = result.pages;
|
||||
re.galleryInfoList = result.galleryInfos;
|
||||
re.galleryInfoList = result.galleryInfoList;
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
@@ -25,12 +25,14 @@ import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.GalleryTagGroup;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.NormalPreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.client.exception.OffensiveException;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
import com.hippo.ehviewer.client.exception.PiningException;
|
||||
import com.hippo.util.JsoupUtils;
|
||||
import com.hippo.yorozuya.NumberUtils;
|
||||
import com.hippo.yorozuya.StringUtils;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
@@ -50,55 +52,22 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class GalleryDetailParser {
|
||||
|
||||
private static final DateFormat WEB_COMMENT_DATE_FORMAT = new SimpleDateFormat("dd MMMMM yyyy, HH:mm z", Locale.US);
|
||||
|
||||
private static final Pattern ERROR_PATTERN = Pattern.compile("<div class=\"d\">\n<p>([^<]+)</p>");
|
||||
private static final Pattern DETAIL_PATTERN = Pattern.compile(
|
||||
"var gid = (\\d+)" // 1 gid
|
||||
+ ".+?"
|
||||
+ "var token = \"([a-z0-9A]+)\"" // 2 token
|
||||
+ ".+?"
|
||||
+ "<div id=\"gd1\"><img src=\"([^\"]+)\"[^<>]+></div>" // 3 thumb
|
||||
+ "</div>"
|
||||
+ "<div id=\"gd2\">"
|
||||
+ "<h1 id=\"gn\">([^<>]+)</h1>" // 4 title
|
||||
+ "<h1 id=\"gj\">([^<>]*)</h1>" // 5 title_jpn might be empty string
|
||||
+ "</div>"
|
||||
+ ".+?"
|
||||
+ "<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\( (\\d+) \\)</a>" // 6 torrentUrl, 7 torrentCount
|
||||
+ ".+?"
|
||||
+ "<div id=\"gdc\"><a[^<>]+><[^<>]*alt=\"([\\w\\-]+)\"[^<>]*></a></div>" // 8 category
|
||||
+ "<div id=\"gdn\"><a[^<>]+>([^<>]+)</a>" // 9 uploader
|
||||
+ ".+?"
|
||||
+ "<tr><td[^<>]*>Posted:</td><td[^<>]*>([\\w\\-\\s:]+)</td></tr>" // 10 posted
|
||||
+ "<tr><td[^<>]*>Parent:</td><td[^<>]*>(?:<a[^<>]*>)?([^<>]+)(?:</a>)?</td></tr>" // 11 parent
|
||||
+ "<tr><td[^<>]*>Visible:</td><td[^<>]*>([^<>]+)</td></tr>" // 12 visible
|
||||
+ "<tr><td[^<>]*>Language:</td><td[^<>]*>([^<>]+)(?:<span[^<>]*>[^<>]*</span>)?</td></tr>" // 13 language
|
||||
+ "<tr><td[^<>]*>File Size:</td><td[^<>]*>([^<>]+)(?:<span[^<>]*>([^<>]+)</span>)?</td></tr>" // 14 File size, 15 resize
|
||||
+ "<tr><td[^<>]*>Length:</td><td[^<>]*>([\\d,]+) pages</td></tr>" // 16 pageCount
|
||||
+ "<tr><td[^<>]*>Favorited:</td><[^<>]*>([^<>]+)</td></tr>" // 17 Favorite times "([\d,]+) times" or "Once" or "Never"
|
||||
+ ".+?"
|
||||
+ "<td id=\"grt3\"><span id=\"rating_count\">([\\d,]+)</span></td>" // 18 ratedTimes
|
||||
+ "</tr>"
|
||||
+ "<tr><td[^<>]*>([^<>]+)</td>", // 19 rating "Average: x.xx" or "Not Yet Rated"
|
||||
Pattern.DOTALL);
|
||||
|
||||
private static final Pattern IS_FAVORED_PATTERN = Pattern.compile("<a id=\"favoritelink\"[^<>]*>(.+?)</a>"); // isFavored "Favorite Gallery" for favorite
|
||||
|
||||
private static final Pattern TAG_GROUP_PATTERN = Pattern.compile("<tr><td[^<>]+>([\\w\\s]+):</td><td>(?:<div[^<>]+><a[^<>]+>[\\w\\s]+</a></div>)+</td></tr>");
|
||||
private static final Pattern TAG_PATTERN = Pattern.compile("<div[^<>]+><a[^<>]+>([\\w\\s]+)</a></div>");
|
||||
|
||||
|
||||
private static final Pattern COMMENT_PATTERN = Pattern.compile("<div class=\"c3\">Posted on ([^<>]+) by: <a[^<>]+>([^<>]+)</a>.+?<div class=\"c6\"[^>]*>(.+?)</div><div class=\"c[78]\"");
|
||||
|
||||
public static final Pattern PAGES_PATTERN = Pattern.compile("<tr><td[^<>]*>Length:</td><td[^<>]*>([\\d,]+) pages</td></tr>");
|
||||
public static final Pattern PREVIEW_PAGES_PATTERN = Pattern.compile("<td[^>]+><a[^>]+>([\\d,]+)</a></td><td[^>]+>(?:<a[^>]+>)?>(?:</a>)?</td>");
|
||||
private static final Pattern NORMAL_PREVIEW_PATTERN = Pattern.compile("<div class=\"gdtm\"[^<>]*><div[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*><a[^<>]*href=\"(.+?)\"[^<>]*><img alt=\"([\\d,]+)\"");
|
||||
private static final Pattern LARGE_PREVIEW_PATTERN = Pattern.compile("<div class=\"gdtl\".+?<a href=\"(.+?)\"><img alt=\"([\\d,]+)\".+?src=\"(.+?)\"");
|
||||
private static final Pattern PATTERN_ERROR = Pattern.compile("<div class=\"d\">\n<p>([^<]+)</p>");
|
||||
private static final Pattern PATTERN_DETAIL = Pattern.compile("var gid = (\\d+).+?var token = \"([a-f0-9]+)\"", Pattern.DOTALL);
|
||||
private static final Pattern PATTERN_TORRENT = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\( (\\d+) \\)</a>");
|
||||
private static final Pattern PATTERN_TAG_GROUP = Pattern.compile("<tr><td[^<>]+>([\\w\\s]+):</td><td>(?:<div[^<>]+><a[^<>]+>[\\w\\s]+</a></div>)+</td></tr>");
|
||||
private static final Pattern PATTERN_TAG = Pattern.compile("<div[^<>]+><a[^<>]+>([\\w\\s]+)</a></div>");
|
||||
private static final Pattern PATTERN_COMMENT = Pattern.compile("<div class=\"c3\">Posted on ([^<>]+) by: <a[^<>]+>([^<>]+)</a>.+?<div class=\"c6\"[^>]*>(.+?)</div><div class=\"c[78]\"");
|
||||
private static final Pattern PATTERN_PAGES = Pattern.compile("<tr><td[^<>]*>Length:</td><td[^<>]*>([\\d,]+) pages</td></tr>");
|
||||
private static final Pattern PATTERN_PREVIEW_PAGES = Pattern.compile("<td[^>]+><a[^>]+>([\\d,]+)</a></td><td[^>]+>(?:<a[^>]+>)?>(?:</a>)?</td>");
|
||||
private static final Pattern PATTERN_NORMAL_PREVIEW = Pattern.compile("<div class=\"gdtm\"[^<>]*><div[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*><a[^<>]*href=\"(.+?)\"[^<>]*><img alt=\"([\\d,]+)\"");
|
||||
private static final Pattern PATTERN_LARGE_PREVIEW = Pattern.compile("<div class=\"gdtl\".+?<a href=\"(.+?)\"><img alt=\"([\\d,]+)\".+?src=\"(.+?)\"");
|
||||
|
||||
private static final GalleryTagGroup[] EMPTY_GALLERY_TAG_GROUP_ARRAY = new GalleryTagGroup[0];
|
||||
private static final GalleryComment[] EMPTY_GALLERY_COMMENT_ARRAY = new GalleryComment[0];
|
||||
|
||||
private static final DateFormat WEB_COMMENT_DATE_FORMAT = new SimpleDateFormat("dd MMMMM yyyy, HH:mm z", Locale.US);
|
||||
|
||||
static {
|
||||
WEB_COMMENT_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
@@ -118,78 +87,178 @@ public class GalleryDetailParser {
|
||||
}
|
||||
|
||||
// Error info
|
||||
Matcher m = ERROR_PATTERN.matcher(body);
|
||||
Matcher m = PATTERN_ERROR.matcher(body);
|
||||
if (m.find()) {
|
||||
throw new EhException(m.group(1));
|
||||
}
|
||||
|
||||
GalleryDetail galleryDetail = new GalleryDetail();
|
||||
parseDetail(body, galleryDetail);
|
||||
Document document = Jsoup.parse(body);
|
||||
parseDetail(galleryDetail, document, body);
|
||||
galleryDetail.tags = parseTagGroups(document);
|
||||
galleryDetail.comments = parseComments(document);
|
||||
galleryDetail.previewPages = parsePreviewPages(document, body);
|
||||
galleryDetail.previewSet = parseLargePreviewSet(document, body);
|
||||
galleryDetail.previewSet = parsePreviewSet(document, body);
|
||||
return galleryDetail;
|
||||
}
|
||||
|
||||
public static void parseDetail(String body, GalleryDetail gd) throws EhException {
|
||||
Matcher m = DETAIL_PATTERN.matcher(body);
|
||||
if (!m.find()) {
|
||||
throw new ParseException("Parse gallery detail error", body);
|
||||
}
|
||||
|
||||
gd.gid = ParserUtils.parseLong(m.group(1));
|
||||
gd.token = ParserUtils.trim(m.group(2));
|
||||
gd.thumb = ParserUtils.trim(m.group(3));
|
||||
gd.title = ParserUtils.trim(m.group(4));
|
||||
gd.titleJpn = ParserUtils.trim(m.group(5));
|
||||
gd.torrentUrl = ParserUtils.trim(m.group(6));
|
||||
gd.torrentCount = ParserUtils.parseInt(m.group(7));
|
||||
gd.category = EhUtils.getCategory(ParserUtils.trim(m.group(8)));
|
||||
gd.uploader = ParserUtils.trim(m.group(9));
|
||||
gd.posted = ParserUtils.trim(m.group(10));
|
||||
gd.parent = ParserUtils.trim(m.group(11));
|
||||
gd.visible = ParserUtils.trim(m.group(12));
|
||||
gd.language = ParserUtils.trim(m.group(13));
|
||||
gd.size = ParserUtils.trim(m.group(14));
|
||||
gd.resize = ParserUtils.trim(m.group(15));
|
||||
gd.pages = ParserUtils.parseInt(m.group(16));
|
||||
String favTimeStr = ParserUtils.trim(m.group(17));
|
||||
|
||||
switch (favTimeStr) {
|
||||
case "Never":
|
||||
gd.favoredTimes = 0;
|
||||
break;
|
||||
case "Once":
|
||||
gd.favoredTimes = 1;
|
||||
break;
|
||||
default:
|
||||
int index = favTimeStr.indexOf(' ');
|
||||
if (index == -1) {
|
||||
gd.favoredTimes = 0;
|
||||
} else {
|
||||
gd.favoredTimes = ParserUtils.parseInt(favTimeStr.substring(0, index));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
gd.ratedTimes = ParserUtils.parseInt(m.group(18));
|
||||
|
||||
String ratingStr = ParserUtils.trim(m.group(19));
|
||||
if ("Not Yet Rated".equals(ratingStr)) {
|
||||
gd.rating = Float.NaN;
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private static void parseDetail(GalleryDetail gd, Document d, String body) throws ParseException {
|
||||
Matcher matcher = PATTERN_DETAIL.matcher(body);
|
||||
if (matcher.find()) {
|
||||
gd.gid = Long.parseLong(matcher.group(1));
|
||||
gd.token = matcher.group(2);
|
||||
} else {
|
||||
int index = ratingStr.indexOf(' ');
|
||||
if (index == -1 || index >= ratingStr.length()) {
|
||||
gd.rating = 0f;
|
||||
throw new ParseException("Can't parse gallery detail", body);
|
||||
}
|
||||
|
||||
matcher = PATTERN_TORRENT.matcher(body);
|
||||
if (matcher.find()) {
|
||||
gd.torrentUrl = StringUtils.unescapeXml(StringUtils.trim(matcher.group(1)));
|
||||
gd.torrentCount = NumberUtils.parseIntSafely(matcher.group(2), 0);
|
||||
} else {
|
||||
gd.torrentCount = 0;
|
||||
gd.torrentUrl = "";
|
||||
}
|
||||
|
||||
try {
|
||||
Element gm = JsoupUtils.getElementByClass(d, "gm");
|
||||
|
||||
// Thumb url
|
||||
Element gd1 = gm.getElementById("gd1");
|
||||
try {
|
||||
gd.thumb = StringUtils.trim(gd1.child(0).attr("src"));
|
||||
} catch (Exception e) {
|
||||
gd.thumb = "";
|
||||
}
|
||||
|
||||
// Title
|
||||
Element gn = gm.getElementById("gn");
|
||||
if (null != gn) {
|
||||
gd.title = StringUtils.trim(gn.text());
|
||||
} else {
|
||||
gd.rating = NumberUtils.parseFloatSafely(ratingStr.substring(index + 1), 0f);
|
||||
gd.title = "";
|
||||
}
|
||||
|
||||
// Jpn title
|
||||
Element gj = gm.getElementById("gj");
|
||||
if (null != gj) {
|
||||
gd.titleJpn = StringUtils.trim(gj.text());
|
||||
} else {
|
||||
gd.titleJpn = "";
|
||||
}
|
||||
|
||||
// Category
|
||||
Element gdc = gm.getElementById("gdc");
|
||||
try {
|
||||
gd.category = EhUtils.getCategory(gdc.child(0).child(0).attr("alt"));
|
||||
} catch (Exception e) {
|
||||
gd.category = EhUtils.UNKNOWN;
|
||||
}
|
||||
|
||||
// Uploader
|
||||
Element gdn = gm.getElementById("gdn");
|
||||
if (null != gdn) {
|
||||
gd.uploader = StringUtils.trim(gdn.text());
|
||||
} else {
|
||||
gd.uploader = "";
|
||||
}
|
||||
|
||||
Element gdd = gm.getElementById("gdd");
|
||||
gd.posted = "";
|
||||
gd.parent = "";
|
||||
gd.visible = "";
|
||||
gd.visible = "";
|
||||
gd.size = "";
|
||||
gd.pages = 0;
|
||||
gd.favoriteCount = 0;
|
||||
try {
|
||||
Elements es = gdd.child(0).child(0).children();
|
||||
for (int i = 0, n = es.size(); i < n; i++) {
|
||||
parseDetailInfo(gd, es.get(i), body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
// Rating count
|
||||
Element rating_count = gm.getElementById("rating_count");
|
||||
if (null != rating_count) {
|
||||
gd.ratingCount = NumberUtils.parseIntSafely(
|
||||
StringUtils.trim(rating_count.text()), 0);
|
||||
} else {
|
||||
gd.ratingCount = 0;
|
||||
}
|
||||
|
||||
// Rating
|
||||
Element rating_label = gm.getElementById("rating_label");
|
||||
if (null != rating_label) {
|
||||
String ratingStr = StringUtils.trim(rating_label.text());
|
||||
if ("Not Yet Rated".equals(ratingStr)) {
|
||||
gd.rating = Float.NaN;
|
||||
} else {
|
||||
int index = ratingStr.indexOf(' ');
|
||||
if (index == -1 || index >= ratingStr.length()) {
|
||||
gd.rating = 0f;
|
||||
} else {
|
||||
gd.rating = NumberUtils.parseFloatSafely(ratingStr.substring(index + 1), 0f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gd.rating = Float.NaN;
|
||||
}
|
||||
|
||||
// isFavorited
|
||||
Element gdf = gm.getElementById("gdf");
|
||||
gd.isFavorited = null != gdf && !StringUtils.trim(gdf.text()).equals("Add to Favorites");
|
||||
} catch (Exception e) {
|
||||
throw new ParseException("Can't parse gallery detail", body);
|
||||
}
|
||||
}
|
||||
|
||||
private static void parseDetailInfo(GalleryDetail gd, Element e, String body) {
|
||||
Elements es = e.children();
|
||||
if (es.size() < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
String key = StringUtils.trim(es.get(0).text());
|
||||
String value = StringUtils.trim(es.get(1).ownText());
|
||||
if (key.startsWith("Posted")) {
|
||||
gd.posted = value;
|
||||
} else if (key.startsWith("Parent")) {
|
||||
gd.parent = value;
|
||||
} else if (key.startsWith("Visible")) {
|
||||
gd.visible = value;
|
||||
} else if (key.startsWith("Language")) {
|
||||
gd.language = value;
|
||||
} else if (key.startsWith("File Size")) {
|
||||
gd.size = value;
|
||||
} else if (key.startsWith("Length")) {
|
||||
int index = value.indexOf(' ');
|
||||
if (index >= 0) {
|
||||
gd.pages = NumberUtils.parseIntSafely(value.substring(0, index), 1);
|
||||
} else {
|
||||
gd.pages = 1;
|
||||
}
|
||||
} else if (key.startsWith("Favorited")) {
|
||||
switch (value) {
|
||||
case "Never":
|
||||
gd.favoriteCount = 0;
|
||||
break;
|
||||
case "Once":
|
||||
gd.favoriteCount = 1;
|
||||
break;
|
||||
default:
|
||||
int index = value.indexOf(' ');
|
||||
if (index == -1) {
|
||||
gd.favoriteCount = 0;
|
||||
} else {
|
||||
gd.favoriteCount = NumberUtils.parseIntSafely(value.substring(0, index), 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m = IS_FAVORED_PATTERN.matcher(body);
|
||||
gd.isFavored = m.find() && "Favorite Gallery".equals(ParserUtils.trim(m.group(1)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -250,7 +319,7 @@ public class GalleryDetailParser {
|
||||
private static GalleryTagGroup[] parseTagGroups(String body) throws EhException {
|
||||
List<GalleryTagGroup> list = new LinkedList<>();
|
||||
|
||||
Matcher m = TAG_GROUP_PATTERN.matcher(body);
|
||||
Matcher m = PATTERN_TAG_GROUP.matcher(body);
|
||||
while (m.find()) {
|
||||
GalleryTagGroup tagGroup = new GalleryTagGroup();
|
||||
tagGroup.groupName = ParserUtils.trim(m.group(1));
|
||||
@@ -262,7 +331,7 @@ public class GalleryDetailParser {
|
||||
}
|
||||
|
||||
private static void parseGroup(GalleryTagGroup tagGroup, String body) {
|
||||
Matcher m = TAG_PATTERN.matcher(body);
|
||||
Matcher m = PATTERN_TAG.matcher(body);
|
||||
while (m.find()) {
|
||||
tagGroup.addTag(ParserUtils.trim(m.group(1)));
|
||||
}
|
||||
@@ -316,7 +385,7 @@ public class GalleryDetailParser {
|
||||
public static GalleryComment[] parseComments(String body) {
|
||||
List<GalleryComment> list = new LinkedList<>();
|
||||
|
||||
Matcher m = COMMENT_PATTERN.matcher(body);
|
||||
Matcher m = PATTERN_COMMENT.matcher(body);
|
||||
while (m.find()) {
|
||||
String webDateString = ParserUtils.trim(m.group(1));
|
||||
Date date;
|
||||
@@ -352,7 +421,7 @@ public class GalleryDetailParser {
|
||||
* Parse preview pages with regular expressions
|
||||
*/
|
||||
public static int parsePreviewPages(String body) throws ParseException {
|
||||
Matcher m = PREVIEW_PAGES_PATTERN.matcher(body);
|
||||
Matcher m = PATTERN_PREVIEW_PAGES.matcher(body);
|
||||
int previewPages = -1;
|
||||
if (m.find()) {
|
||||
previewPages = ParserUtils.parseInt(m.group(1));
|
||||
@@ -369,7 +438,7 @@ public class GalleryDetailParser {
|
||||
* Parse pages with regular expressions
|
||||
*/
|
||||
public static int parsePages(String body) throws ParseException {
|
||||
Matcher m = PAGES_PATTERN.matcher(body);
|
||||
Matcher m = PATTERN_PAGES.matcher(body);
|
||||
if (m.find()) {
|
||||
return ParserUtils.parseInt(m.group(1));
|
||||
} else {
|
||||
@@ -377,13 +446,29 @@ public class GalleryDetailParser {
|
||||
}
|
||||
}
|
||||
|
||||
public static PreviewSet parsePreviewSet(Document d, String body) throws ParseException {
|
||||
try {
|
||||
return parseLargePreviewSet(d, body);
|
||||
} catch (ParseException e) {
|
||||
return parseNormalPreviewSet(body);
|
||||
}
|
||||
}
|
||||
|
||||
public static PreviewSet parsePreviewSet(String body) throws ParseException {
|
||||
try {
|
||||
return parseLargePreviewSet(body);
|
||||
} catch (ParseException e) {
|
||||
return parseNormalPreviewSet(body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse large previews with regular expressions
|
||||
*/
|
||||
public static LargePreviewSet parseLargePreviewSet(Document document, String body) throws ParseException {
|
||||
private static LargePreviewSet parseLargePreviewSet(Document d, String body) throws ParseException {
|
||||
try {
|
||||
LargePreviewSet largePreviewSet = new LargePreviewSet();
|
||||
Element gdt = document.getElementById("gdt");
|
||||
Element gdt = d.getElementById("gdt");
|
||||
Elements gdtls = gdt.getElementsByClass("gdtl");
|
||||
int n = gdtls.size();
|
||||
if (n <= 0) {
|
||||
@@ -407,8 +492,8 @@ public class GalleryDetailParser {
|
||||
/**
|
||||
* Parse large previews with regular expressions
|
||||
*/
|
||||
public static LargePreviewSet parseLargePreviewSet(String body) throws ParseException {
|
||||
Matcher m = LARGE_PREVIEW_PATTERN.matcher(body);
|
||||
private static LargePreviewSet parseLargePreviewSet(String body) throws ParseException {
|
||||
Matcher m = PATTERN_LARGE_PREVIEW.matcher(body);
|
||||
LargePreviewSet largePreviewSet = new LargePreviewSet();
|
||||
|
||||
while (m.find()) {
|
||||
@@ -426,8 +511,8 @@ public class GalleryDetailParser {
|
||||
/**
|
||||
* Parse normal previews with regular expressions
|
||||
*/
|
||||
public static NormalPreviewSet parseNormalPreviewSet(String body) throws ParseException {
|
||||
Matcher m = NORMAL_PREVIEW_PATTERN.matcher(body);
|
||||
private static NormalPreviewSet parseNormalPreviewSet(String body) throws ParseException {
|
||||
Matcher m = PATTERN_NORMAL_PREVIEW.matcher(body);
|
||||
NormalPreviewSet normalPreviewSet = new NormalPreviewSet();
|
||||
while (m.find()) {
|
||||
normalPreviewSet.addItem(ParserUtils.parseInt(m.group(6)) - 1,
|
||||
@@ -437,7 +522,7 @@ public class GalleryDetailParser {
|
||||
}
|
||||
|
||||
if (normalPreviewSet.size() == 0) {
|
||||
throw new ParseException("Can't parse large preview", body);
|
||||
throw new ParseException("Can't parse normal preview", body);
|
||||
}
|
||||
|
||||
return normalPreviewSet;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.hippo.ehviewer.client.parser;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
@@ -30,6 +32,7 @@ public final class GalleryDetailUrlParser {
|
||||
public static final Pattern URL_PATTERN = Pattern.compile("http://(?:" +
|
||||
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");
|
||||
|
||||
@Nullable
|
||||
public static Result parse(String url) {
|
||||
if (url == null) {
|
||||
return null;
|
||||
|
||||
@@ -17,11 +17,20 @@
|
||||
package com.hippo.ehviewer.client.parser;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
import com.hippo.util.JsoupUtils;
|
||||
import com.hippo.yorozuya.NumberUtils;
|
||||
import com.hippo.yorozuya.StringUtils;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -31,90 +40,27 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class GalleryListParser {
|
||||
|
||||
static final Pattern PAGES_PATTERN = Pattern.compile("<a[^<>]+>([\\d]+)</a></td><td[^<>]+>(?:<a[^<>]+>)?&");
|
||||
static final Pattern PATTERN = Pattern.compile(
|
||||
"<td class=\"itdc\">(?:<a.+?>)?<img.+?alt=\"(.+?)\".+?/>(?:</a>)?</td>" // category
|
||||
+ "<td.+?>(.+?)</td>" // posted
|
||||
+ "<td.+?><div.+?><div.+?height:(\\d+)px; width:(\\d+)px\">"
|
||||
+ "(?:<img.+?src=\"(.+?)\".+?alt=\"(.+?)\" style.+?/>"
|
||||
+ "|init~([^<>\"~]+~[^<>\"~]+)~([^<>]+))" // thumb and title
|
||||
+ "</div>"
|
||||
+ ".+?"
|
||||
+ "<div class=\"it5\"><a href=\"([^<>\"]+)\"[^<>]+>(.+?)</a></div>" // url and title
|
||||
+ ".+?"
|
||||
+ "<div class=\"ir it4r\" style=\"([^<>\"]+)\">" // rating
|
||||
+ ".+?"
|
||||
+ "<td class=\"itu\"><div><a.+?>(.+?)</a>"); // uploader
|
||||
static final Pattern RATING_PATTERN = Pattern.compile("\\d+px");
|
||||
private static final String TAG = GalleryListParser.class.getSimpleName();
|
||||
|
||||
private static final Pattern PATTERN_RATING = Pattern.compile("\\d+px");
|
||||
private static final Pattern PATTERN_THUMB_SIZE = Pattern.compile("height:(\\d+)px; width:(\\d+)px");
|
||||
|
||||
public static class Result {
|
||||
public int pages;
|
||||
public List<GalleryInfo> galleryInfos;
|
||||
public List<GalleryInfo> galleryInfoList;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Result parse(@NonNull String body) throws Exception {
|
||||
Result result = new Result();
|
||||
Matcher m;
|
||||
|
||||
// pages
|
||||
m = PAGES_PATTERN.matcher(body);
|
||||
if (m.find()) {
|
||||
result.pages = ParserUtils.parseInt(m.group(1));
|
||||
} else if (body.contains("No hits found</p>")) {
|
||||
result.pages = 0;
|
||||
result.galleryInfos = Collections.EMPTY_LIST;
|
||||
} else {
|
||||
// Can not get page number
|
||||
throw new ParseException("Can't parse gallery list", body);
|
||||
private static int parsePages(Document d, String body) throws ParseException {
|
||||
try {
|
||||
Elements es = d.getElementsByClass("ptt").first().child(0).child(0).children();
|
||||
return Integer.parseInt(es.get(es.size() - 2).text().trim());
|
||||
} catch (Exception e) {
|
||||
throw new ParseException("Can't parse gallery list pages", body);
|
||||
}
|
||||
|
||||
if (result.pages > 0) {
|
||||
List<GalleryInfo> list = new ArrayList<>(25);
|
||||
result.galleryInfos = list;
|
||||
|
||||
m = PATTERN.matcher(body);
|
||||
while (m.find()) {
|
||||
GalleryInfo gi = new GalleryInfo();
|
||||
|
||||
gi.category = EhUtils.getCategory(ParserUtils.trim(m.group(1)));
|
||||
gi.posted = ParserUtils.trim(m.group(2));
|
||||
gi.thumbHeight = ParserUtils.parseInt(m.group(3));
|
||||
gi.thumbWidth = ParserUtils.parseInt(m.group(4));
|
||||
|
||||
if (m.group(5) == null) {
|
||||
gi.thumb = ParserUtils.trim("http://" + m.group(7).replace('~', '/'));
|
||||
gi.title = ParserUtils.trim(m.group(8));
|
||||
} else {
|
||||
gi.thumb = ParserUtils.trim(m.group(5));
|
||||
gi.title = ParserUtils.trim(m.group(6));
|
||||
}
|
||||
|
||||
Matcher matcher = GalleryDetailUrlParser.URL_PATTERN.matcher(m.group(9));
|
||||
if (matcher.find()) {
|
||||
gi.gid = ParserUtils.parseLong(matcher.group(1));
|
||||
gi.token = ParserUtils.trim(matcher.group(2));
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
gi.rating = NumberUtils.parseFloatSafely(getRating(m.group(11)), Float.NaN);
|
||||
gi.uploader = ParserUtils.trim(m.group(12));
|
||||
gi.generateSLang();
|
||||
|
||||
list.add(gi);
|
||||
}
|
||||
|
||||
if (list.size() == 0) {
|
||||
throw new ParseException("Can't parse gallery list", body);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String getRating(String rawRate) {
|
||||
Matcher m = RATING_PATTERN.matcher(rawRate);
|
||||
private static String parseRating(String ratingStyle) {
|
||||
Matcher m = PATTERN_RATING.matcher(ratingStyle);
|
||||
int num1;
|
||||
int num2;
|
||||
int rate = 5;
|
||||
@@ -138,4 +84,134 @@ public class GalleryListParser {
|
||||
re = Integer.toString(rate);
|
||||
return re;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static GalleryInfo parseGalleryInfo(Element e) {
|
||||
GalleryInfo gi = new GalleryInfo();
|
||||
// Get category
|
||||
Element ic = JsoupUtils.getElementByClass(e, "ic");
|
||||
if (null != ic) {
|
||||
gi.category = EhUtils.getCategory(ic.attr("alt").trim());
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info category");
|
||||
gi.category = EhUtils.UNKNOWN;
|
||||
}
|
||||
// Posted
|
||||
Element itd = JsoupUtils.getElementByClass(e, "itd");
|
||||
if (null != itd) {
|
||||
gi.posted = itd.text().trim();
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info posted");
|
||||
gi.posted = "";
|
||||
}
|
||||
// Thumb
|
||||
Element it2 = JsoupUtils.getElementByClass(e, "it2");
|
||||
if (null != it2) {
|
||||
// Thumb size
|
||||
Matcher m = PATTERN_THUMB_SIZE.matcher(it2.attr("style"));
|
||||
if (m.find()) {
|
||||
gi.thumbWidth = NumberUtils.parseIntSafely(m.group(2), 0);
|
||||
gi.thumbHeight = NumberUtils.parseIntSafely(m.group(1), 0);
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info thumb size");
|
||||
gi.thumbWidth = 0;
|
||||
gi.thumbHeight = 0;
|
||||
}
|
||||
|
||||
// Thumb url
|
||||
Elements es = it2.children();
|
||||
if (null != es && es.size() >= 1) {
|
||||
gi.thumb = es.get(0).attr("src");
|
||||
} else {
|
||||
String html = it2.html();
|
||||
int index1 = html.indexOf('~');
|
||||
int index2 = StringUtils.ordinalIndexOf(html, '~', 2);
|
||||
if (index1 < index2) {
|
||||
gi.thumb = "http://" +StringUtils.replace(html.substring(index1 + 1, index2), "~", "/");
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info thumb url");
|
||||
gi.thumb = "";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info thumb");
|
||||
gi.thumbWidth = 0;
|
||||
gi.thumbHeight = 0;
|
||||
gi.thumb = "";
|
||||
}
|
||||
// Title (required)
|
||||
Element it5 = JsoupUtils.getElementByClass(e, "it5");
|
||||
if (null == it5) {
|
||||
Log.e(TAG, "Can't parse gallery info title");
|
||||
return null;
|
||||
}
|
||||
Elements es = it5.children();
|
||||
if (null == es || es.size() <= 0) {
|
||||
Log.e(TAG, "Can't parse gallery info title");
|
||||
return null;
|
||||
}
|
||||
Element a = es.get(0);
|
||||
GalleryDetailUrlParser.Result result = GalleryDetailUrlParser.parse(a.attr("href"));
|
||||
if (null == result) {
|
||||
Log.e(TAG, "Can't parse gallery info title");
|
||||
return null;
|
||||
}
|
||||
gi.gid = result.gid;
|
||||
gi.token = result.token;
|
||||
gi.title = a.text().trim();
|
||||
// Rating
|
||||
Element it4r = JsoupUtils.getElementByClass(e, "it4r");
|
||||
if (null != it4r) {
|
||||
gi.rating = NumberUtils.parseFloatSafely(parseRating(it4r.attr("style")), Float.NaN);
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info rating");
|
||||
gi.rating = Float.NaN;
|
||||
}
|
||||
// Uploader
|
||||
Element itu = JsoupUtils.getElementByClass(e, "itu");
|
||||
if (null != itu) {
|
||||
gi.uploader = itu.text().trim();
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info uploader");
|
||||
gi.uploader = "";
|
||||
}
|
||||
|
||||
gi.generateSLang();
|
||||
|
||||
return gi;
|
||||
}
|
||||
|
||||
public static Result parse(@NonNull String body) throws Exception {
|
||||
Result result = new Result();
|
||||
Document d = Jsoup.parse(body);
|
||||
|
||||
try {
|
||||
result.pages = parsePages(d, body);
|
||||
} catch (ParseException e) {
|
||||
if (body.contains("No hits found</p>")) {
|
||||
result.pages = 0;
|
||||
//noinspection unchecked
|
||||
result.galleryInfoList = Collections.EMPTY_LIST;
|
||||
return result;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Elements es = d.getElementsByClass("itg").first().child(0).children();
|
||||
List<GalleryInfo> list = new ArrayList<>(es.size() - 1);
|
||||
for (int i = 1; i < es.size(); i++) { // First one is table header, skip it
|
||||
GalleryInfo gi = parseGalleryInfo(es.get(i));
|
||||
if (null != gi) {
|
||||
list.add(gi);
|
||||
}
|
||||
}
|
||||
result.galleryInfoList = list;
|
||||
} catch (Exception e) {
|
||||
throw new ParseException("Can't parse gallery list", body);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -19,25 +19,31 @@ package com.hippo.ehviewer.client.parser;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
import com.hippo.yorozuya.StringUtils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class GalleryPageParser {
|
||||
|
||||
private static Pattern IMAGE_URL_PATTERN = Pattern.compile("<div id=\"i3\"><a[^>]+><img id=\"img\" src=\"([^\"]+)\"");
|
||||
private static Pattern SKIP_HATH_KEY_PATTERN = Pattern.compile("onclick=\"return nl\\('([^\\)]+)'\\)");
|
||||
private static final Pattern PATTERN_IMAGE_URL = Pattern.compile("<div id=\"i3\"><a[^>]+><img id=\"img\" src=\"([^\"]+)\"");
|
||||
private static final Pattern PATTERN_SKIP_HATH_KEY = Pattern.compile("onclick=\"return nl\\('([^\\)]+)'\\)");
|
||||
private static final Pattern PATTERN_ORIGIN_IMAGE_URL = Pattern.compile("<div id=\"i7\" class=\"if\"> <img[^>]+/> <a href=\"([^\"]+)\">");
|
||||
|
||||
public static Result parse(String body) throws ParseException {
|
||||
Matcher m;
|
||||
Result result = new Result();
|
||||
m = IMAGE_URL_PATTERN.matcher(body);
|
||||
m = PATTERN_IMAGE_URL.matcher(body);
|
||||
if (m.find()) {
|
||||
result.imageUrl = ParserUtils.trim(m.group(1));
|
||||
result.imageUrl = StringUtils.unescapeXml(StringUtils.trim(m.group(1)));
|
||||
}
|
||||
m = SKIP_HATH_KEY_PATTERN.matcher(body);
|
||||
m = PATTERN_SKIP_HATH_KEY.matcher(body);
|
||||
if (m.find()) {
|
||||
result.skipHathKey = ParserUtils.trim(m.group(1));
|
||||
result.skipHathKey = StringUtils.unescapeXml(StringUtils.trim(m.group(1)));
|
||||
}
|
||||
m = PATTERN_ORIGIN_IMAGE_URL.matcher(body);
|
||||
if (m.find()) {
|
||||
result.originImageUrl = StringUtils.unescapeXml(StringUtils.trim(m.group(1)));
|
||||
}
|
||||
if (!TextUtils.isEmpty(result.imageUrl) && !TextUtils.isEmpty(result.skipHathKey)) {
|
||||
return result;
|
||||
@@ -49,5 +55,6 @@ public class GalleryPageParser {
|
||||
public static class Result {
|
||||
public String imageUrl;
|
||||
public String skipHathKey;
|
||||
public String originImageUrl;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class RateGalleryParser {
|
||||
|
||||
public static class Result {
|
||||
public float rating;
|
||||
public int ratedTimes;
|
||||
public int ratingCount;
|
||||
}
|
||||
|
||||
public static Result parse(String body) throws Exception {
|
||||
@@ -33,7 +33,7 @@ public class RateGalleryParser {
|
||||
JSONObject jsonObject = new JSONObject(body);
|
||||
Result result = new Result();
|
||||
result.rating = (float)jsonObject.getDouble("rating_avg");
|
||||
result.ratedTimes = jsonObject.getInt("rating_cnt");
|
||||
result.ratingCount = jsonObject.getInt("rating_cnt");
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
Exception exception = new ParseException("Can't parse rate gallery", body);
|
||||
|
||||
@@ -168,6 +168,11 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
return mMap.get(label);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DownloadInfo getDownloadInfo(long gid) {
|
||||
return mAllInfoMap.get(gid);
|
||||
}
|
||||
|
||||
public int getDownloadState(long gid) {
|
||||
DownloadInfo info = mAllInfoMap.get(gid);
|
||||
if (null != info) {
|
||||
@@ -348,6 +353,61 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void addDownload(List<DownloadInfo> downloadInfoList) {
|
||||
for (DownloadInfo info: downloadInfoList) {
|
||||
if (containDownloadInfo(info.gid)) {
|
||||
// Contain
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure download state
|
||||
if (DownloadInfo.STATE_WAIT == info.state ||
|
||||
DownloadInfo.STATE_DOWNLOAD == info.state) {
|
||||
info.state = DownloadInfo.STATE_NONE;
|
||||
}
|
||||
|
||||
// Add to label download list
|
||||
LinkedList<DownloadInfo> list = getInfoListForLabel(info.label);
|
||||
if (null == list) {
|
||||
// Can't find the label in label list
|
||||
list = new LinkedList<>();
|
||||
mMap.put(info.label, list);
|
||||
if (!containLabel(info.label)) {
|
||||
// Add label to DB and list
|
||||
mLabelList.add(EhDB.addDownloadLabel(info.label));
|
||||
}
|
||||
}
|
||||
list.add(info);
|
||||
// Sort
|
||||
Collections.sort(list, DATE_DESC_COMPARATOR);
|
||||
|
||||
// Add to all download list and map
|
||||
mAllInfoList.add(info);
|
||||
mAllInfoMap.put(info.gid, info);
|
||||
|
||||
// Save to
|
||||
EhDB.putDownloadInfo(info);
|
||||
}
|
||||
|
||||
// Sort all download list
|
||||
Collections.sort(mAllInfoList, DATE_DESC_COMPARATOR);
|
||||
|
||||
// Notify
|
||||
for (DownloadInfoListener l: mDownloadInfoListeners) {
|
||||
l.onReload();
|
||||
}
|
||||
}
|
||||
|
||||
public void addDownloadLabel(List<DownloadLabel> downloadLabelList) {
|
||||
for (DownloadLabel label: downloadLabelList) {
|
||||
String labelString = label.getLabel();
|
||||
if (!containLabel(labelString)) {
|
||||
mMap.put(labelString, new LinkedList<DownloadInfo>());
|
||||
mLabelList.add(EhDB.addDownloadLabel(label));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addDownload(GalleryInfo galleryInfo, @Nullable String label) {
|
||||
if (containDownloadInfo(galleryInfo.gid)) {
|
||||
// Contain
|
||||
@@ -615,7 +675,7 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
srcList.remove(info);
|
||||
dstList.add(info);
|
||||
info.label = label;
|
||||
Collections.sort(dstList, sDateDescComparator);
|
||||
Collections.sort(dstList, DATE_DESC_COMPARATOR);
|
||||
|
||||
// Save to DB
|
||||
EhDB.putDownloadInfo(info);
|
||||
@@ -715,7 +775,7 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
}
|
||||
|
||||
// Sort
|
||||
Collections.sort(mDefaultInfoList, sDateDescComparator);
|
||||
Collections.sort(mDefaultInfoList, DATE_DESC_COMPARATOR);
|
||||
|
||||
// Notify listener
|
||||
for (DownloadInfoListener l: mDownloadInfoListeners) {
|
||||
@@ -1074,7 +1134,7 @@ public class DownloadManager implements SpiderQueen.OnSpiderListener {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Comparator<DownloadInfo> sDateDescComparator = new Comparator<DownloadInfo>() {
|
||||
private static final Comparator<DownloadInfo> DATE_DESC_COMPARATOR = new Comparator<DownloadInfo>() {
|
||||
@Override
|
||||
public int compare(DownloadInfo lhs, DownloadInfo rhs) {
|
||||
return lhs.time - rhs.time > 0 ? -1 : 1;
|
||||
|
||||
@@ -209,15 +209,6 @@ public class DownloadService extends Service implements DownloadManager.Download
|
||||
stopAllIntent.setAction(ACTION_STOP_ALL);
|
||||
PendingIntent piStopAll = PendingIntent.getService(this, 0, stopAllIntent, 0);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(DownloadsScene.KEY_ACTION, DownloadsScene.ACTION_CLEAR_DOWNLOAD_SERVICE);
|
||||
Intent activityIntent = new Intent(this, MainActivity.class);
|
||||
activityIntent.setAction(StageActivity.ACTION_START_SCENE);
|
||||
activityIntent.putExtra(StageActivity.KEY_SCENE_NAME, DownloadsScene.class.getName());
|
||||
activityIntent.putExtra(StageActivity.KEY_SCENE_ARGS, bundle);
|
||||
PendingIntent piActivity = PendingIntent.getActivity(DownloadService.this, 0,
|
||||
activityIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
mDownloadingBuilder = new NotificationCompat.Builder(getApplicationContext())
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.setOngoing(true)
|
||||
@@ -225,8 +216,7 @@ public class DownloadService extends Service implements DownloadManager.Download
|
||||
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
|
||||
.setColor(getResources().getColor(R.color.colorPrimary))
|
||||
.addAction(R.drawable.ic_pause_x24, getString(R.string.stat_download_action_stop_all), piStopAll)
|
||||
.setShowWhen(false)
|
||||
.setContentIntent(piActivity);
|
||||
.setShowWhen(false);
|
||||
|
||||
mDownloadingDelay = new NotificationDelay(this, mNotifyManager, mDownloadingBuilder, ID_DOWNLOADING);
|
||||
}
|
||||
@@ -297,10 +287,20 @@ public class DownloadService extends Service implements DownloadManager.Download
|
||||
|
||||
ensureDownloadingBuilder();
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong(DownloadsScene.KEY_GID, info.gid);
|
||||
Intent activityIntent = new Intent(this, MainActivity.class);
|
||||
activityIntent.setAction(StageActivity.ACTION_START_SCENE);
|
||||
activityIntent.putExtra(StageActivity.KEY_SCENE_NAME, DownloadsScene.class.getName());
|
||||
activityIntent.putExtra(StageActivity.KEY_SCENE_ARGS, bundle);
|
||||
PendingIntent piActivity = PendingIntent.getActivity(DownloadService.this, 0,
|
||||
activityIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
mDownloadingBuilder.setContentTitle(EhUtils.getSuitableTitle(info))
|
||||
.setContentText(null)
|
||||
.setContentInfo(null)
|
||||
.setProgress(0, 0, true);
|
||||
.setProgress(0, 0, true)
|
||||
.setContentIntent(piActivity);
|
||||
|
||||
mDownloadingDelay.startForeground();
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ public class GalleryView extends GLView implements GestureRecognizer.Listener {
|
||||
|
||||
private static final float[] LEFT_AREA = {0.0f, 0.0f, 1.0f / 3.0f, 1f};
|
||||
private static final float[] RIGHT_AREA = {2.0f / 3.0f, 0.0f, 1.0f, 1f};
|
||||
private static final float[] MENU_AREA = {1.0f / 3.0f, 0.0f, 2.0f / 3.0f, 2.0f / 3.0f};
|
||||
private static final float[] SLIDER_AREA = {1.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f, 1.0f};
|
||||
private static final float[] MENU_AREA = {1.0f / 3.0f, 0.0f, 2.0f / 3.0f, 1.0f / 2.0f};
|
||||
private static final float[] SLIDER_AREA = {1.0f / 3.0f, 1.0f / 2.0f, 2.0f / 3.0f, 1.0f};
|
||||
|
||||
private static final int METHOD_ON_SINGLE_TAP_UP = 0;
|
||||
private static final int METHOD_ON_SINGLE_TAP_CONFIRMED = 1;
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.support.annotation.IntDef;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.webkit.MimeTypeMap;
|
||||
@@ -37,8 +38,7 @@ import com.hippo.ehviewer.client.EhConfig;
|
||||
import com.hippo.ehviewer.client.EhRequestBuilder;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.NormalPreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.Image509Exception;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
import com.hippo.ehviewer.client.parser.GalleryDetailParser;
|
||||
@@ -53,6 +53,7 @@ import com.hippo.yorozuya.OSUtils;
|
||||
import com.hippo.yorozuya.PriorityThread;
|
||||
import com.hippo.yorozuya.PriorityThreadFactory;
|
||||
import com.hippo.yorozuya.StringUtils;
|
||||
import com.hippo.yorozuya.Utilities;
|
||||
import com.hippo.yorozuya.io.InputStreamPipe;
|
||||
import com.hippo.yorozuya.io.OutputStreamPipe;
|
||||
import com.hippo.yorozuya.sparse.SparseJLArray;
|
||||
@@ -73,6 +74,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
@@ -680,23 +682,12 @@ public class SpiderQueen implements Runnable {
|
||||
}
|
||||
|
||||
private void readPreviews(String body, SpiderInfo spiderInfo) throws ParseException {
|
||||
try {
|
||||
NormalPreviewSet previewSet = GalleryDetailParser.parseNormalPreviewSet(body);
|
||||
spiderInfo.previewPerPage = previewSet.size();
|
||||
for (int i = 0, n = previewSet.size(); i < n; i++) {
|
||||
GalleryPageUrlParser.Result result = GalleryPageUrlParser.parse(previewSet.getPageUrlAt(i));
|
||||
if (result != null) {
|
||||
spiderInfo.pTokenMap.put(result.page, result.pToken);
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
LargePreviewSet previewSet = GalleryDetailParser.parseLargePreviewSet(body);
|
||||
spiderInfo.previewPerPage = previewSet.size();
|
||||
for (int i = 0, n = previewSet.size(); i < n; i++) {
|
||||
GalleryPageUrlParser.Result result = GalleryPageUrlParser.parse(previewSet.getPageUrlAt(i));
|
||||
if (result != null) {
|
||||
spiderInfo.pTokenMap.put(result.page, result.pToken);
|
||||
}
|
||||
PreviewSet previewSet = GalleryDetailParser.parsePreviewSet(body);
|
||||
spiderInfo.previewPerPage = previewSet.size();
|
||||
for (int i = 0, n = previewSet.size(); i < n; i++) {
|
||||
GalleryPageUrlParser.Result result = GalleryPageUrlParser.parse(previewSet.getPageUrlAt(i));
|
||||
if (result != null) {
|
||||
spiderInfo.pTokenMap.put(result.page, result.pToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1027,7 +1018,11 @@ public class SpiderQueen implements Runnable {
|
||||
break;
|
||||
}
|
||||
|
||||
imageUrl = result.imageUrl;
|
||||
if (Settings.getDownloadOriginImage() && !TextUtils.isEmpty(result.originImageUrl)) {
|
||||
imageUrl = result.originImageUrl;
|
||||
} else {
|
||||
imageUrl = result.imageUrl;
|
||||
}
|
||||
skipHathKey = result.skipHathKey;
|
||||
|
||||
// If it is force request, skip first image
|
||||
@@ -1039,28 +1034,40 @@ public class SpiderQueen implements Runnable {
|
||||
Log.d(TAG, imageUrl);
|
||||
}
|
||||
|
||||
// Start download image
|
||||
OutputStreamPipe pipe = mSpiderDen.openOutputStreamPipe(
|
||||
index, MimeTypeMap.getFileExtensionFromUrl(imageUrl));
|
||||
if (pipe == null) {
|
||||
// Can't get pipe
|
||||
error = GetText.getString(R.string.error_write_failed);
|
||||
break;
|
||||
}
|
||||
|
||||
// Download image
|
||||
OutputStreamPipe pipe = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
if (DEBUG_LOG) {
|
||||
Log.d(TAG, "Start download image " + index);
|
||||
}
|
||||
|
||||
Response response = mHttpClient.newCall(new EhRequestBuilder(imageUrl).build()).execute();
|
||||
Call call = mHttpClient.newCall(new EhRequestBuilder(imageUrl).build());
|
||||
Response response = call.execute();
|
||||
if (response.code() >= 400) {
|
||||
// Maybe 404
|
||||
call.cancel();
|
||||
continue;
|
||||
}
|
||||
ResponseBody responseBody = response.body();
|
||||
|
||||
// Get extension
|
||||
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(
|
||||
responseBody.contentType().toString());
|
||||
// Ensure extension
|
||||
if (!Utilities.contain(GalleryProvider.SUPPORT_IMAGE_EXTENSIONS, extension)) {
|
||||
extension = GalleryProvider.SUPPORT_IMAGE_EXTENSIONS[0];
|
||||
}
|
||||
|
||||
// Get out put pipe
|
||||
pipe = mSpiderDen.openOutputStreamPipe(index, extension);
|
||||
if (null == pipe) {
|
||||
// Can't get pipe
|
||||
error = GetText.getString(R.string.error_write_failed);
|
||||
call.cancel();
|
||||
break;
|
||||
}
|
||||
|
||||
long contentLength = responseBody.contentLength();
|
||||
is = responseBody.byteStream();
|
||||
pipe.obtain();
|
||||
@@ -1072,6 +1079,7 @@ public class SpiderQueen implements Runnable {
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
int bytesRead = is.read(data);
|
||||
if (bytesRead == -1) {
|
||||
call.cancel();
|
||||
break;
|
||||
}
|
||||
os.write(data, 0, bytesRead);
|
||||
@@ -1102,8 +1110,10 @@ public class SpiderQueen implements Runnable {
|
||||
error = GetText.getString(R.string.error_socket);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
pipe.close();
|
||||
pipe.release();
|
||||
if (null != pipe) {
|
||||
pipe.close();
|
||||
pipe.release();
|
||||
}
|
||||
|
||||
if (DEBUG_LOG) {
|
||||
Log.d(TAG, "End download image " + index);
|
||||
|
||||
@@ -331,16 +331,19 @@ public class FilterActivity extends ToolbarActivity {
|
||||
private final List<Filter> mTitleFilterList;
|
||||
private final List<Filter> mUploaderFilterList;
|
||||
private final List<Filter> mTagFilterList;
|
||||
private final List<Filter> mTagNamespaceFilterList;
|
||||
|
||||
private Filter mTitleHeader;
|
||||
private Filter mUploaderHeader;
|
||||
private Filter mTagHeader;
|
||||
private Filter mTagNamespaceHeader;
|
||||
|
||||
public FilterList() {
|
||||
mEhFilter = EhFilter.getInstance();
|
||||
mTitleFilterList = mEhFilter.getTitleFilterList();
|
||||
mUploaderFilterList = mEhFilter.getUploaderFilterList();
|
||||
mTagFilterList = mEhFilter.getTagFilterList();
|
||||
mTagNamespaceFilterList = mEhFilter.getTagNamespaceFilterList();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
@@ -351,6 +354,8 @@ public class FilterActivity extends ToolbarActivity {
|
||||
count += 0 == size ? 0 : size + 1;
|
||||
size = mTagFilterList.size();
|
||||
count += 0 == size ? 0 : size + 1;
|
||||
size = mTagNamespaceFilterList.size();
|
||||
count += 0 == size ? 0 : size + 1;
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -381,6 +386,15 @@ public class FilterActivity extends ToolbarActivity {
|
||||
return mTagHeader;
|
||||
}
|
||||
|
||||
private Filter getTagNamespaceHeader() {
|
||||
if (null == mTagNamespaceHeader) {
|
||||
mTagNamespaceHeader = new Filter();
|
||||
mTagNamespaceHeader.mode = MODE_HEADER;
|
||||
mTagNamespaceHeader.text = getString(R.string.filter_tag_namespace);
|
||||
}
|
||||
return mTagNamespaceHeader;
|
||||
}
|
||||
|
||||
public Filter get(int index) {
|
||||
int size = mTitleFilterList.size();
|
||||
if (0 != size) {
|
||||
@@ -415,6 +429,17 @@ public class FilterActivity extends ToolbarActivity {
|
||||
}
|
||||
}
|
||||
|
||||
size = mTagNamespaceFilterList.size();
|
||||
if (0 != size) {
|
||||
if (index == 0) {
|
||||
return getTagNamespaceHeader();
|
||||
} else if (index <= size) {
|
||||
return mTagNamespaceFilterList.get(index - 1);
|
||||
} else {
|
||||
index -= size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -80,7 +82,6 @@ public class GalleryActivity extends EhActivity
|
||||
public static final String KEY_FILENAME = "filename";
|
||||
public static final String KEY_GALLERY_INFO = "gallery_info";
|
||||
public static final String KEY_PAGE = "page";
|
||||
public static final String KEY_SHOWING = "showing";
|
||||
public static final String KEY_CURRENT_INDEX = "current_index";
|
||||
|
||||
private static final long SLIDER_ANIMATION_DURING = 150;
|
||||
@@ -101,7 +102,7 @@ public class GalleryActivity extends EhActivity
|
||||
|
||||
@Nullable
|
||||
private SystemUiHelper mSystemUiHelper;
|
||||
private boolean mSystemUiShowing = false;
|
||||
private boolean mShowSystemUi;
|
||||
|
||||
@Nullable
|
||||
private View mClock;
|
||||
@@ -116,24 +117,34 @@ public class GalleryActivity extends EhActivity
|
||||
@Nullable
|
||||
private ReversibleSeekBar mSeekBar;
|
||||
|
||||
private ObjectAnimator mSeekBarPanelAnimator;
|
||||
|
||||
private int mLayoutMode;
|
||||
private int mSize;
|
||||
private int mCurrentIndex;
|
||||
|
||||
private final ConcurrentPool<NotifyTask> mNotifyTaskPool = new ConcurrentPool<>(3);
|
||||
|
||||
private final Runnable mRequestLayoutSliderTask = new Runnable() {
|
||||
private final ValueAnimator.AnimatorUpdateListener mUpdateSliderListener = new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mSeekBarPanel != null) {
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
if (null != mSeekBarPanel) {
|
||||
mSeekBarPanel.requestLayout();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final SimpleAnimatorListener mShowSliderListener = new SimpleAnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mSeekBarPanelAnimator = null;
|
||||
}
|
||||
};
|
||||
|
||||
private final SimpleAnimatorListener mHideSliderListener = new SimpleAnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mSeekBarPanelAnimator = null;
|
||||
if (mSeekBarPanel != null) {
|
||||
mSeekBarPanel.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
@@ -199,7 +210,6 @@ public class GalleryActivity extends EhActivity
|
||||
if (mGalleryInfo != null) {
|
||||
outState.putParcelable(KEY_GALLERY_INFO, mGalleryInfo);
|
||||
}
|
||||
outState.putBoolean(KEY_SHOWING, mSystemUiShowing);
|
||||
outState.putInt(KEY_PAGE, mPage);
|
||||
outState.putInt(KEY_CURRENT_INDEX, mCurrentIndex);
|
||||
}
|
||||
@@ -222,7 +232,7 @@ public class GalleryActivity extends EhActivity
|
||||
mGalleryProvider.start();
|
||||
|
||||
setContentView(R.layout.activity_gallery);
|
||||
GLRootView glRootView = (GLRootView) findViewById(R.id.gl_root_view);
|
||||
GLRootView glRootView = (GLRootView) ViewUtils.$$(this, R.id.gl_root_view);
|
||||
mGalleryProvider.setGLRoot(glRootView);
|
||||
mUploader = new ImageTexture.Uploader(glRootView);
|
||||
|
||||
@@ -247,23 +257,18 @@ public class GalleryActivity extends EhActivity
|
||||
}
|
||||
mSystemUiHelper = new SystemUiHelper(this, systemUiLevel,
|
||||
SystemUiHelper.FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES | SystemUiHelper.FLAG_IMMERSIVE_STICKY);
|
||||
if (savedInstanceState == null || !savedInstanceState.getBoolean(KEY_SHOWING, false)) {
|
||||
mSystemUiHelper.hide();
|
||||
mSystemUiShowing = false;
|
||||
} else {
|
||||
mSystemUiHelper.show();
|
||||
mSystemUiShowing = true;
|
||||
}
|
||||
mSystemUiHelper.hide();
|
||||
mShowSystemUi = false;
|
||||
|
||||
mClock = ViewUtils.$$(this, R.id.clock);
|
||||
mBattery = ViewUtils.$$(this, R.id.battery);
|
||||
mClock.setVisibility(Settings.getShowClock() ? View.VISIBLE : View.GONE);
|
||||
mBattery.setVisibility(Settings.getShowBattery() ? View.VISIBLE : View.GONE);
|
||||
|
||||
mSeekBarPanel = findViewById(R.id.seek_bar_panel);
|
||||
mLeftText = (TextView) mSeekBarPanel.findViewById(R.id.left);
|
||||
mRightText = (TextView) mSeekBarPanel.findViewById(R.id.right);
|
||||
mSeekBar = (ReversibleSeekBar) mSeekBarPanel.findViewById(R.id.seek_bar);
|
||||
mSeekBarPanel = ViewUtils.$$(this, R.id.seek_bar_panel);
|
||||
mLeftText = (TextView) ViewUtils.$$(mSeekBarPanel, R.id.left);
|
||||
mRightText = (TextView) ViewUtils.$$(mSeekBarPanel, R.id.right);
|
||||
mSeekBar = (ReversibleSeekBar) ViewUtils.$$(mSeekBarPanel, R.id.seek_bar);
|
||||
mSeekBar.setOnSeekBarChangeListener(this);
|
||||
|
||||
mSize = mGalleryProvider.size();
|
||||
@@ -302,6 +307,8 @@ public class GalleryActivity extends EhActivity
|
||||
mLeftText = null;
|
||||
mRightText = null;
|
||||
mSeekBar = null;
|
||||
|
||||
SimpleHandler.getInstance().removeCallbacks(mHideSliderRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -327,7 +334,7 @@ public class GalleryActivity extends EhActivity
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
|
||||
if (hasFocus && mSystemUiHelper != null) {
|
||||
if (mSystemUiShowing) {
|
||||
if (mShowSystemUi) {
|
||||
mSystemUiHelper.show();
|
||||
} else {
|
||||
mSystemUiHelper.hide();
|
||||
@@ -603,19 +610,44 @@ public class GalleryActivity extends EhActivity
|
||||
}
|
||||
|
||||
private void showSlider(View sliderPanel) {
|
||||
if (null != mSeekBarPanelAnimator) {
|
||||
mSeekBarPanelAnimator.cancel();
|
||||
mSeekBarPanelAnimator = null;
|
||||
}
|
||||
|
||||
sliderPanel.setTranslationY(sliderPanel.getHeight());
|
||||
sliderPanel.setVisibility(View.VISIBLE);
|
||||
sliderPanel.animate().translationY(0.0f).setDuration(SLIDER_ANIMATION_DURING)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR)
|
||||
.setListener(null).start();
|
||||
// Request layout ensure show it
|
||||
SimpleHandler.getInstance().post(mRequestLayoutSliderTask);
|
||||
|
||||
mSeekBarPanelAnimator = ObjectAnimator.ofFloat(sliderPanel, "translationY", 0.0f);
|
||||
mSeekBarPanelAnimator.setDuration(SLIDER_ANIMATION_DURING);
|
||||
mSeekBarPanelAnimator.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR);
|
||||
mSeekBarPanelAnimator.addUpdateListener(mUpdateSliderListener);
|
||||
mSeekBarPanelAnimator.addListener(mShowSliderListener);
|
||||
mSeekBarPanelAnimator.start();
|
||||
|
||||
if (null != mSystemUiHelper) {
|
||||
mSystemUiHelper.show();
|
||||
mShowSystemUi = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void hideSlider(View sliderPanel) {
|
||||
sliderPanel.animate().translationY(sliderPanel.getHeight()).setDuration(SLIDER_ANIMATION_DURING)
|
||||
.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR)
|
||||
.setListener(mHideSliderListener).start();
|
||||
if (null != mSeekBarPanelAnimator) {
|
||||
mSeekBarPanelAnimator.cancel();
|
||||
mSeekBarPanelAnimator = null;
|
||||
}
|
||||
|
||||
mSeekBarPanelAnimator = ObjectAnimator.ofFloat(sliderPanel, "translationY", sliderPanel.getHeight());
|
||||
mSeekBarPanelAnimator.setDuration(SLIDER_ANIMATION_DURING);
|
||||
mSeekBarPanelAnimator.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR);
|
||||
mSeekBarPanelAnimator.addUpdateListener(mUpdateSliderListener);
|
||||
mSeekBarPanelAnimator.addListener(mHideSliderListener);
|
||||
mSeekBarPanelAnimator.start();
|
||||
|
||||
if (null != mSystemUiHelper) {
|
||||
mSystemUiHelper.hide();
|
||||
mShowSystemUi = false;
|
||||
}
|
||||
}
|
||||
|
||||
private class GalleryMenuHelper implements DialogInterface.OnClickListener {
|
||||
|
||||
@@ -79,6 +79,8 @@ public final class MainActivity extends StageActivity
|
||||
|
||||
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
|
||||
|
||||
private static final int REQUEST_CODE_SETTINGS = 0;
|
||||
|
||||
private static final String KEY_NAV_CHECKED_ITEM = "nav_checked_item";
|
||||
|
||||
public static final int CHECK_STEP_SECURITY = 0;
|
||||
@@ -522,7 +524,7 @@ public final class MainActivity extends StageActivity
|
||||
startScene(new Announcer(DownloadsScene.class));
|
||||
} else if (id == R.id.nav_settings) {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
startActivityForResult(intent, REQUEST_CODE_SETTINGS);
|
||||
}
|
||||
|
||||
if (id != R.id.nav_stub && mDrawerLayout != null) {
|
||||
@@ -531,4 +533,18 @@ public final class MainActivity extends StageActivity
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_SETTINGS:
|
||||
if (RESULT_OK == resultCode) {
|
||||
refreshTopScene();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ public final class SettingsActivity extends EhPreferenceActivity {
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == REQUEST_CODE_FRAGMENT) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
setResult(RESULT_OK, data);
|
||||
setResult(RESULT_OK);
|
||||
}
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
@@ -25,18 +29,22 @@ import android.widget.Toast;
|
||||
|
||||
import com.hippo.ehviewer.AppConfig;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.EhDB;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.util.LogCat;
|
||||
import com.hippo.util.ReadableTime;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class AdvancedFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener {
|
||||
|
||||
private static final String KEY_DUMP_LOGCAT = "dump_logcat";
|
||||
private static final String KEY_CLEAR_MEMORY_CACHE = "clear_memory_cache";
|
||||
private static final String KEY_PATTERN_PROTECTION = "pattern_protection";
|
||||
private static final String KEY_EXPORT_DATA = "export_data";
|
||||
private static final String KEY_IMPORT_DATA = "import_data";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -45,9 +53,13 @@ public class AdvancedFragment extends PreferenceFragment implements Preference.O
|
||||
|
||||
Preference dumpLogcat = findPreference(KEY_DUMP_LOGCAT);
|
||||
Preference clearMemoryCache = findPreference(KEY_CLEAR_MEMORY_CACHE);
|
||||
Preference exportData = findPreference(KEY_EXPORT_DATA);
|
||||
Preference importData = findPreference(KEY_IMPORT_DATA);
|
||||
|
||||
dumpLogcat.setOnPreferenceClickListener(this);
|
||||
clearMemoryCache.setOnPreferenceClickListener(this);
|
||||
exportData.setOnPreferenceClickListener(this);
|
||||
importData.setOnPreferenceClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,7 +93,48 @@ public class AdvancedFragment extends PreferenceFragment implements Preference.O
|
||||
} else if (KEY_CLEAR_MEMORY_CACHE.equals(key)) {
|
||||
((EhApplication) getActivity().getApplication()).clearMemoryCache();
|
||||
Runtime.getRuntime().gc();
|
||||
} else if (KEY_EXPORT_DATA.equals(key)) {
|
||||
File dir = AppConfig.getExternalDataDir();
|
||||
if (dir != null) {
|
||||
File file = new File(dir, ReadableTime.getFilenamableTime(System.currentTimeMillis()) + ".db");
|
||||
if (EhDB.exportDB(getActivity(), file)) {
|
||||
Toast.makeText(getActivity(),
|
||||
getString(R.string.settings_advanced_export_data_to, file.getPath()), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Toast.makeText(getActivity(),R.string.settings_advanced_export_data_failed, Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
} else if (KEY_IMPORT_DATA.equals(key)) {
|
||||
importData(getActivity());
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void importData(final Context context) {
|
||||
final File dir = AppConfig.getExternalDataDir();
|
||||
if (null == dir) {
|
||||
Toast.makeText(context, R.string.cant_get_data_dir, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
final String[] files = dir.list();
|
||||
if (null == files || files.length <= 0) {
|
||||
Toast.makeText(context, R.string.cant_find_any_data, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
Arrays.sort(files);
|
||||
new AlertDialog.Builder(context).setItems(files, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
File file = new File(dir, files[which]);
|
||||
String error = EhDB.importDB(context, file);
|
||||
if (null == error) {
|
||||
error = context.getString(R.string.settings_advanced_import_data_successfully);
|
||||
}
|
||||
Toast.makeText(context, error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
@@ -314,6 +314,8 @@ public class DownloadFragment extends PreferenceFragment implements Preference.O
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
mDialog.dismiss();
|
||||
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import com.hippo.ehviewer.Constants;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.yorozuya.Messenger;
|
||||
|
||||
public class EhFragment extends PreferenceFragment
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
@@ -33,16 +32,21 @@ public class EhFragment extends PreferenceFragment
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.eh_settings);
|
||||
|
||||
Preference gallerySite = findPreference(Settings.KEY_GALLERY_SITE);
|
||||
Preference listMode = findPreference(Settings.KEY_LIST_MODE);
|
||||
|
||||
gallerySite.setOnPreferenceChangeListener(this);
|
||||
listMode.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String key = preference.getKey();
|
||||
if (Settings.KEY_LIST_MODE.equals(key)) {
|
||||
Messenger.getInstance().notify(Constants.MESSAGE_ID_LIST_MODE, null);
|
||||
if (Settings.KEY_GALLERY_SITE.equals(key)) {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
return true;
|
||||
} else if (Settings.KEY_LIST_MODE.equals(key)) {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -28,8 +28,6 @@ import com.hippo.ehviewer.Analytics;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.ehviewer.ui.annotation.ViewLifeCircle;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.text.Html;
|
||||
import com.hippo.text.LinkMovementMethod2;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
@@ -37,11 +35,9 @@ import com.hippo.yorozuya.ViewUtils;
|
||||
public class AnalyticsScene extends BaseScene implements View.OnClickListener {
|
||||
|
||||
@Nullable
|
||||
@ViewLifeCircle
|
||||
private View mCancel;
|
||||
private View mReject;
|
||||
@Nullable
|
||||
@ViewLifeCircle
|
||||
private View mOk;
|
||||
private View mAccept;
|
||||
|
||||
@Override
|
||||
public boolean needShowLeftDrawer() {
|
||||
@@ -50,22 +46,19 @@ public class AnalyticsScene extends BaseScene implements View.OnClickListener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_analytics, container, false);
|
||||
|
||||
mCancel = ViewUtils.$$(view, R.id.cancel);
|
||||
mOk = ViewUtils.$$(view, R.id.ok);
|
||||
mReject = ViewUtils.$$(view, R.id.reject);
|
||||
mAccept = ViewUtils.$$(view, R.id.accept);
|
||||
TextView text = (TextView) ViewUtils.$$(view, R.id.text);
|
||||
|
||||
text.setText(Html.fromHtml(getString(R.string.analytics_explain)));
|
||||
text.setMovementMethod(LinkMovementMethod2.getInstance());
|
||||
|
||||
mCancel.setOnClickListener(this);
|
||||
mOk.setOnClickListener(this);
|
||||
|
||||
RippleSalon.addRipple(mCancel, true);
|
||||
RippleSalon.addRipple(mOk, true);
|
||||
mReject.setOnClickListener(this);
|
||||
mAccept.setOnClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
@@ -74,8 +67,8 @@ public class AnalyticsScene extends BaseScene implements View.OnClickListener {
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
mCancel = null;
|
||||
mOk = null;
|
||||
mReject = null;
|
||||
mAccept = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,9 +78,9 @@ public class AnalyticsScene extends BaseScene implements View.OnClickListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCancel == v) {
|
||||
if (mReject == v) {
|
||||
Settings.putEnableAnalytics(false);
|
||||
} else if (mOk == v) {
|
||||
} else if (mAccept == v) {
|
||||
Settings.putEnableAnalytics(true);
|
||||
// Start Analytics
|
||||
Analytics.start(context);
|
||||
|
||||
@@ -22,8 +22,10 @@ import android.os.Bundle;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.annotation.StyleRes;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -38,7 +40,7 @@ public abstract class BaseScene extends SceneFragment {
|
||||
public static final int LENGTH_SHORT = 0;
|
||||
public static final int LENGTH_LONG = 1;
|
||||
|
||||
private boolean mViewCreated;
|
||||
private Context mThemeContext;
|
||||
|
||||
public void updateAvatar() {
|
||||
FragmentActivity activity = getActivity();
|
||||
@@ -124,10 +126,22 @@ public abstract class BaseScene extends SceneFragment {
|
||||
public void onDestroyDrawerView() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public final View onCreateView(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return onCreateView2(LayoutInflater.from(getContext2()), container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mViewCreated = true;
|
||||
|
||||
// Update left drawer locked state
|
||||
if (needShowLeftDrawer()) {
|
||||
@@ -143,19 +157,17 @@ public abstract class BaseScene extends SceneFragment {
|
||||
ActivityHelper.hideSoftInput(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
mViewCreated = false;
|
||||
super.onDestroyView();
|
||||
public void createThemeContext(@StyleRes int style) {
|
||||
mThemeContext = new ContextThemeWrapper(getContext(), style);
|
||||
}
|
||||
|
||||
public boolean isViewCreated() {
|
||||
return mViewCreated;
|
||||
public void destroyThemeContext() {
|
||||
mThemeContext = null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Context getContext2() {
|
||||
return super.getContext();
|
||||
return null != mThemeContext ? mThemeContext : super.getContext();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -180,12 +192,7 @@ public abstract class BaseScene extends SceneFragment {
|
||||
|
||||
@Nullable
|
||||
public LayoutInflater getLayoutInflater2() {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (null != activity) {
|
||||
return activity.getLayoutInflater();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return LayoutInflater.from(getContext2());
|
||||
}
|
||||
|
||||
public void hideSoftInput() {
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
@@ -65,7 +64,8 @@ public class CookieSignInScene extends BaseScene implements EditText.OnEditorAct
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_cookie_sign_in, container, false);
|
||||
mIpbMemberIdLayout = (TextInputLayout) ViewUtils.$$(view, R.id.ipb_member_id_layout);
|
||||
mIpbMemberId = mIpbMemberIdLayout.getEditText();
|
||||
@@ -79,8 +79,6 @@ public class CookieSignInScene extends BaseScene implements EditText.OnEditorAct
|
||||
|
||||
mOk.setOnClickListener(this);
|
||||
|
||||
RippleSalon.addRipple(mOk, true);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CrashScene extends BaseScene implements View.OnClickListener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_crash, container, false);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class DownloadLabelsScene extends ToolbarScene {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_label_list, container, false);
|
||||
|
||||
@@ -147,7 +147,11 @@ public class DownloadLabelsScene extends ToolbarScene {
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
mRecyclerView = null;
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mViewTransition = null;
|
||||
mAdapter = null;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
private static final String TAG = DownloadsScene.class.getSimpleName();
|
||||
|
||||
public static final String KEY_GID = "gid";
|
||||
|
||||
public static final String KEY_ACTION = "action";
|
||||
private static final String KEY_LABEL = "label";
|
||||
|
||||
@@ -133,15 +135,43 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
private ShowcaseView mShowcaseView;
|
||||
|
||||
private int mInitPosition = -1;
|
||||
|
||||
@Override
|
||||
public int getNavCheckedItem() {
|
||||
return R.id.nav_downloads;
|
||||
}
|
||||
|
||||
private void handleArguments(Bundle args) {
|
||||
if (args != null && ACTION_CLEAR_DOWNLOAD_SERVICE.equals(args.getString(KEY_ACTION))) {
|
||||
private boolean handleArguments(Bundle args) {
|
||||
if (null == args) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ACTION_CLEAR_DOWNLOAD_SERVICE.equals(args.getString(KEY_ACTION))) {
|
||||
DownloadService.clear();
|
||||
}
|
||||
|
||||
long gid;
|
||||
if (null != mDownloadManager && -1L != (gid = args.getLong(KEY_GID, -1L))) {
|
||||
DownloadInfo info = mDownloadManager.getDownloadInfo(gid);
|
||||
if (null != info) {
|
||||
mLabel = info.getLabel();
|
||||
updateForLabel();
|
||||
updateView();
|
||||
|
||||
// Get position
|
||||
if (null != mList) {
|
||||
int position = mList.indexOf(info);
|
||||
if (position >= 0 && null != mRecyclerView) {
|
||||
mRecyclerView.scrollToPosition(position);
|
||||
} else {
|
||||
mInitPosition = position;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,8 +183,6 @@ public class DownloadsScene extends ToolbarScene
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
handleArguments(getArguments());
|
||||
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mDownloadManager = EhApplication.getDownloadManager(context);
|
||||
@@ -218,8 +246,10 @@ public class DownloadsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
private void onInit() {
|
||||
mLabel = Settings.getRecentDownloadLabel();
|
||||
updateForLabel();
|
||||
if (!handleArguments(getArguments())) {
|
||||
mLabel = Settings.getRecentDownloadLabel();
|
||||
updateForLabel();
|
||||
}
|
||||
}
|
||||
|
||||
private void onRestore(@NonNull Bundle savedInstanceState) {
|
||||
@@ -235,7 +265,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_download, container, false);
|
||||
|
||||
@@ -274,6 +304,10 @@ public class DownloadsScene extends ToolbarScene
|
||||
int paddingH = context.getResources().getDimensionPixelOffset(R.dimen.list_content_margin_h);
|
||||
int paddingV = context.getResources().getDimensionPixelOffset(R.dimen.list_content_margin_v);
|
||||
mRecyclerView.setPadding(paddingV, paddingH, paddingV, paddingH);
|
||||
if (mInitPosition >= 0) {
|
||||
mRecyclerView.scrollToPosition(mInitPosition);
|
||||
mInitPosition = -1;
|
||||
}
|
||||
|
||||
fastScroller.attachToRecyclerView(mRecyclerView);
|
||||
HandlerDrawable handlerDrawable = new HandlerDrawable();
|
||||
@@ -386,6 +420,10 @@ public class DownloadsScene extends ToolbarScene
|
||||
ViewUtils.removeFromParent(mShowcaseView);
|
||||
mShowcaseView = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mRecyclerView = null;
|
||||
mFabLayout = null;
|
||||
@@ -987,7 +1025,6 @@ public class DownloadsScene extends ToolbarScene
|
||||
public final TextView category;
|
||||
public final View start;
|
||||
public final View stop;
|
||||
public final View delete;
|
||||
public final TextView state;
|
||||
public final ProgressBar progressBar;
|
||||
public final TextView percent;
|
||||
@@ -1003,7 +1040,6 @@ public class DownloadsScene extends ToolbarScene
|
||||
category = (TextView) itemView.findViewById(R.id.category);
|
||||
start = itemView.findViewById(R.id.start);
|
||||
stop = itemView.findViewById(R.id.stop);
|
||||
delete = itemView.findViewById(R.id.delete);
|
||||
state = (TextView) itemView.findViewById(R.id.state);
|
||||
progressBar = (ProgressBar) itemView.findViewById(R.id.progress_bar);
|
||||
percent = (TextView) itemView.findViewById(R.id.percent);
|
||||
@@ -1013,10 +1049,8 @@ public class DownloadsScene extends ToolbarScene
|
||||
thumb.setOnClickListener(this);
|
||||
start.setOnClickListener(this);
|
||||
stop.setOnClickListener(this);
|
||||
delete.setOnClickListener(this);
|
||||
RippleSalon.addRipple(start, false);
|
||||
RippleSalon.addRipple(stop, false);
|
||||
RippleSalon.addRipple(delete, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1055,16 +1089,6 @@ public class DownloadsScene extends ToolbarScene
|
||||
if (null != mDownloadManager) {
|
||||
mDownloadManager.stopDownload(list.get(index).gid);
|
||||
}
|
||||
} else if (delete == v) {
|
||||
GalleryInfo galleryInfo = list.get(index);
|
||||
CheckBoxDialogBuilder builder = new CheckBoxDialogBuilder(context,
|
||||
getString(R.string.download_remove_dialog_message, EhUtils.getSuitableTitle(galleryInfo)),
|
||||
getString(R.string.download_remove_dialog_check_text),
|
||||
Settings.getRemoveImageFiles());
|
||||
DeleteDialogHelper helper = new DeleteDialogHelper(galleryInfo, builder);
|
||||
builder.setTitle(R.string.download_remove_dialog_title)
|
||||
.setPositiveButton(android.R.string.ok, helper)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1098,7 +1122,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
return;
|
||||
}
|
||||
DownloadInfo info = mList.get(position);
|
||||
holder.thumb.load(EhCacheKeyFactory.getThumbKey(info.gid), info.thumb, true);
|
||||
holder.thumb.load(EhCacheKeyFactory.getThumbKey(info.gid), info.thumb);
|
||||
holder.title.setText(EhUtils.getSuitableTitle(info));
|
||||
holder.uploader.setText(info.uploader);
|
||||
holder.rating.setRating(info.rating);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -28,6 +29,7 @@ import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Spannable;
|
||||
@@ -44,6 +46,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.amlcurran.showcaseview.ShowcaseView;
|
||||
import com.github.amlcurran.showcaseview.SimpleShowcaseEventListener;
|
||||
@@ -52,6 +55,7 @@ import com.hippo.annotation.Implemented;
|
||||
import com.hippo.drawable.DrawerArrowDrawable;
|
||||
import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.FastScroller;
|
||||
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.EhDB;
|
||||
import com.hippo.ehviewer.R;
|
||||
@@ -77,7 +81,9 @@ import com.hippo.widget.FabLayout;
|
||||
import com.hippo.widget.SearchBarMover;
|
||||
import com.hippo.widget.refreshlayout.RefreshLayout;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.LayoutUtils;
|
||||
import com.hippo.yorozuya.ObjectUtils;
|
||||
import com.hippo.yorozuya.ResourcesUtils;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
@@ -85,7 +91,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
// TODO Bug for FavoritesScene and GalleryListScene, if list view of SearchBar expand first, RecyclerView padding top will be wrong
|
||||
// TODO Get favorite, modify favorite, add favorite, what a mess!
|
||||
public class FavoritesScene extends BaseScene implements
|
||||
EasyRecyclerView.OnItemClickListener, EasyRecyclerView.OnItemLongClickListener,
|
||||
@@ -98,8 +103,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
private static final String KEY_SEARCH_MODE = "search_mode";
|
||||
private static final String KEY_HAS_FIRST_REFRESH = "has_first_refresh";
|
||||
private static final String KEY_FAV_COUNT_ARRAY = "fav_count_array";
|
||||
private static final String KEY_ALL_COUNT = "all_count";
|
||||
private static final String KEY_ALL_LIMIT = "all_limit";
|
||||
|
||||
@Nullable
|
||||
@ViewLifeCircle
|
||||
@@ -146,8 +149,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
|
||||
@Nullable
|
||||
private int[] mFavCountArray;
|
||||
private int mAllCount = -1;
|
||||
private int mAllLimit = -1;
|
||||
|
||||
private boolean mHasFirstRefresh;
|
||||
private boolean mSearchMode;
|
||||
@@ -164,15 +165,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
// For modify action
|
||||
private boolean mModifyAdd;
|
||||
|
||||
private final Runnable mReturnSearchBarRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mSearchBarMover != null) {
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private ShowcaseView mShowcaseView;
|
||||
|
||||
@Override
|
||||
@@ -210,8 +202,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
mSearchMode = savedInstanceState.getBoolean(KEY_SEARCH_MODE);
|
||||
mHasFirstRefresh = savedInstanceState.getBoolean(KEY_HAS_FIRST_REFRESH);
|
||||
mFavCountArray = savedInstanceState.getIntArray(KEY_FAV_COUNT_ARRAY);
|
||||
mAllCount = savedInstanceState.getInt(KEY_ALL_COUNT);
|
||||
mAllLimit = savedInstanceState.getInt(KEY_ALL_LIMIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,8 +218,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
outState.putParcelable(KEY_URL_BUILDER, mUrlBuilder);
|
||||
outState.putBoolean(KEY_SEARCH_MODE, mSearchMode);
|
||||
outState.putIntArray(KEY_FAV_COUNT_ARRAY, mFavCountArray);
|
||||
outState.putInt(KEY_ALL_COUNT, mAllCount);
|
||||
outState.putInt(KEY_ALL_LIMIT, mAllLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -243,7 +231,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_favorites, container, false);
|
||||
ContentLayout contentLayout = (ContentLayout) view.findViewById(R.id.content_layout);
|
||||
@@ -264,7 +252,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
contentLayout.getFastScroller().setOnDragHandlerListener(this);
|
||||
|
||||
mAdapter = new FavoritesAdapter(inflater, resources, mRecyclerView, Settings.getListMode());
|
||||
mAdapter.register();
|
||||
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
mRecyclerView.setDrawSelectorOnTop(true);
|
||||
mRecyclerView.hasFixedSize();
|
||||
@@ -398,18 +385,19 @@ public class FavoritesScene extends BaseScene implements
|
||||
mShowcaseView = null;
|
||||
}
|
||||
|
||||
if (null != mAdapter) {
|
||||
mAdapter.unregister();
|
||||
mAdapter = null;
|
||||
}
|
||||
if (null != mHelper) {
|
||||
if (1 == mHelper.getShownViewIndex()) {
|
||||
mHasFirstRefresh = false;
|
||||
}
|
||||
mHelper = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mAdapter = null;
|
||||
|
||||
mRecyclerView = null;
|
||||
mSearchBar = null;
|
||||
mFabLayout = null;
|
||||
|
||||
@@ -420,22 +408,85 @@ public class FavoritesScene extends BaseScene implements
|
||||
mOldKeyword = null;
|
||||
}
|
||||
|
||||
private class InfoHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private final TextView key;
|
||||
private final TextView value;
|
||||
|
||||
public InfoHolder(View itemView) {
|
||||
super(itemView);
|
||||
key = (TextView) ViewUtils.$$(itemView, R.id.key);
|
||||
value = (TextView) ViewUtils.$$(itemView, R.id.value);
|
||||
}
|
||||
}
|
||||
|
||||
private class InfoAdapter extends RecyclerView.Adapter<InfoHolder> {
|
||||
|
||||
private static final int TYPE_HEADER = 0;
|
||||
private static final int TYPE_DATA = 1;
|
||||
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public InfoAdapter(LayoutInflater inflater) {
|
||||
mInflater = inflater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return 0 == position ? TYPE_HEADER : TYPE_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return new InfoHolder(mInflater.inflate(TYPE_HEADER == viewType ?
|
||||
R.layout.item_favorite_info_header : R.layout.item_favorite_info_data, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void onBindViewHolder(InfoHolder holder, int position) {
|
||||
if (0 == position) {
|
||||
holder.key.setText(R.string.collections);
|
||||
holder.value.setText(R.string.count);
|
||||
holder.itemView.setEnabled(false);
|
||||
} else {
|
||||
if (null == mFavCatArray || null == mFavCountArray ||
|
||||
mFavCatArray.length < position || mFavCountArray.length < position) {
|
||||
return;
|
||||
}
|
||||
holder.key.setText(mFavCatArray[position - 1]);
|
||||
holder.value.setText(Integer.toString(mFavCountArray[position - 1]));
|
||||
holder.itemView.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 11;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
private void showFavoritesInfoDialog() {
|
||||
Context context = getContext2();
|
||||
if (null == context || null == mFavCatArray || null == mFavCountArray) {
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(mAllCount).append("/").append(mAllLimit).append("\n");
|
||||
for (int i = 0, n = 10; i < n; i++) {
|
||||
sb.append(mFavCatArray[i]).append(": ").append(mFavCountArray[i]).append("\n");
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.favorites_info)
|
||||
.setMessage(sb.toString())
|
||||
.show();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
context = builder.getContext();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
EasyRecyclerView rv = (EasyRecyclerView) inflater.inflate(R.layout.dialog_favorite_info, null);
|
||||
rv.setAdapter(new InfoAdapter(inflater));
|
||||
rv.setLayoutManager(new LinearLayoutManager(context));
|
||||
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
|
||||
LinearDividerItemDecoration.VERTICAL, context.getResources().getColor(R.color.divider),
|
||||
LayoutUtils.dp2pix(context, 1));
|
||||
decoration.setPadding(ResourcesUtils.getAttrDimensionPixelOffset(context, R.attr.dialogPreferredPadding));
|
||||
rv.addItemDecoration(decoration);
|
||||
rv.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
rv.setClipToPadding(false);
|
||||
builder.setView(rv).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -823,17 +874,10 @@ public class FavoritesScene extends BaseScene implements
|
||||
}
|
||||
|
||||
mFavCountArray = result.countArray;
|
||||
if (result.current != -1) {
|
||||
mAllCount = result.current;
|
||||
}
|
||||
if (result.limit != -1) {
|
||||
mAllLimit = result.limit;
|
||||
}
|
||||
|
||||
updateSearchBar();
|
||||
mHelper.setPages(taskId, result.pages);
|
||||
mHelper.onGetPageData(taskId, result.galleryInfoList);
|
||||
SimpleHandler.getInstance().post(mReturnSearchBarRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,7 +904,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
mHelper.setPages(taskId, 1);
|
||||
mHelper.onGetPageData(taskId, list);
|
||||
}
|
||||
SimpleHandler.getInstance().post(mReturnSearchBarRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1046,14 +1089,6 @@ public class FavoritesScene extends BaseScene implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHideRecyclerView() {
|
||||
super.onHideRecyclerView();
|
||||
if (mSearchBarMover != null) {
|
||||
mSearchBarMover.showSearchBar();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Context getContext() {
|
||||
return FavoritesScene.this.getContext2();
|
||||
@@ -1084,6 +1119,22 @@ public class FavoritesScene extends BaseScene implements
|
||||
mAdapter.notifyItemRangeInserted(positionStart, itemCount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowView(View hiddenView, View shownView) {
|
||||
if (null != mSearchBarMover) {
|
||||
mSearchBarMover.showSearchBar();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollToPosition(int postion) {
|
||||
if (0 == postion) {
|
||||
if (null != mSearchBarMover) {
|
||||
mSearchBarMover.showSearchBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddFavoritesListener extends EhCallback<FavoritesScene, Void> {
|
||||
|
||||
@@ -32,9 +32,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.hippo.drawable.TriangleDrawable;
|
||||
import com.hippo.easyrecyclerview.MarginItemDecoration;
|
||||
import com.hippo.ehviewer.Constants;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.EhCacheKeyFactory;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
@@ -42,12 +40,11 @@ import com.hippo.ehviewer.widget.TileThumb;
|
||||
import com.hippo.util.ApiHelper;
|
||||
import com.hippo.widget.recyclerview.AutoGridLayoutManager;
|
||||
import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
|
||||
import com.hippo.yorozuya.Messenger;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> implements Messenger.Receiver {
|
||||
abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
|
||||
|
||||
@IntDef({TYPE_LIST, TYPE_GRID})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@@ -188,18 +185,4 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> implem
|
||||
holder.thumb.setTransitionName(TransitionNameFactory.getThumbTransitionName(gid));
|
||||
}
|
||||
}
|
||||
|
||||
public void register() {
|
||||
Messenger.getInstance().register(Constants.MESSAGE_ID_LIST_MODE, this);
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
Messenger.getInstance().unregister(Constants.MESSAGE_ID_LIST_MODE, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(int id, Object obj) {
|
||||
setType(Settings.getListMode());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
private String mToken;
|
||||
private GalleryComment[] mComments;
|
||||
|
||||
private EasyRecyclerView mRecyclerView;
|
||||
private FloatingActionButton mFab;
|
||||
private View mEditPanel;
|
||||
private ImageView mSendImage;
|
||||
@@ -135,10 +136,10 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_gallery_comments, container, false);
|
||||
EasyRecyclerView recyclerView = (EasyRecyclerView) view.findViewById(R.id.recycler_view);
|
||||
mRecyclerView = (EasyRecyclerView) view.findViewById(R.id.recycler_view);
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mEditPanel = ViewUtils.$$(view, R.id.edit_panel);
|
||||
mSendImage = (ImageView) ViewUtils.$$(mEditPanel, R.id.send);
|
||||
@@ -155,25 +156,25 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
tip.setCompoundDrawables(null, drawable, null, null);
|
||||
|
||||
mAdapter = new CommentAdapter();
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context,
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(context,
|
||||
LinearLayoutManager.VERTICAL, false));
|
||||
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
|
||||
LinearDividerItemDecoration.VERTICAL, context.getResources().getColor(R.color.divider),
|
||||
LayoutUtils.dp2pix(context, 1));
|
||||
decoration.setShowLastDivider(true);
|
||||
recyclerView.addItemDecoration(decoration);
|
||||
recyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setOnItemClickListener(this);
|
||||
recyclerView.setOnItemLongClickListener(this);
|
||||
recyclerView.setPadding(recyclerView.getPaddingLeft(), recyclerView.getPaddingTop(),
|
||||
recyclerView.getPaddingRight(), recyclerView.getPaddingBottom() + paddingBottomFab);
|
||||
mRecyclerView.addItemDecoration(decoration);
|
||||
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOnItemClickListener(this);
|
||||
mRecyclerView.setOnItemLongClickListener(this);
|
||||
mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), mRecyclerView.getPaddingTop(),
|
||||
mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingBottom() + paddingBottomFab);
|
||||
|
||||
mSendImage.setOnClickListener(this);
|
||||
mFab.setOnClickListener(this);
|
||||
|
||||
mViewTransition = new ViewTransition(recyclerView, tip);
|
||||
mViewTransition = new ViewTransition(mRecyclerView, tip);
|
||||
|
||||
if (mComments == null || mComments.length <= 0) {
|
||||
mViewTransition.showView(1);
|
||||
@@ -187,6 +188,12 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mAdapter = null;
|
||||
mViewTransition = null;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
@@ -69,8 +70,8 @@ import com.hippo.ehviewer.client.data.GalleryComment;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.GalleryTagGroup;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.parser.RateGalleryParser;
|
||||
import com.hippo.ehviewer.dao.DownloadInfo;
|
||||
import com.hippo.ehviewer.dao.Filter;
|
||||
@@ -102,7 +103,6 @@ import com.hippo.yorozuya.ViewUtils;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class GalleryDetailScene extends BaseScene implements View.OnClickListener,
|
||||
com.hippo.ehviewer.download.DownloadManager.DownloadInfoListener,
|
||||
@@ -346,15 +346,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
} else {
|
||||
onRestore(savedInstanceState);
|
||||
}
|
||||
|
||||
long gid = getGid();
|
||||
if (gid != -1) {
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mDownloadState = EhApplication.getDownloadManager(context).getDownloadState(gid);
|
||||
} else {
|
||||
mDownloadState = DownloadInfo.STATE_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
private void onInit() {
|
||||
@@ -392,8 +383,18 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
// Get download state
|
||||
long gid = getGid();
|
||||
if (gid != -1) {
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mDownloadState = EhApplication.getDownloadManager(context).getDownloadState(gid);
|
||||
} else {
|
||||
mDownloadState = DownloadInfo.STATE_INVALID;
|
||||
}
|
||||
|
||||
View view = inflater.inflate(R.layout.scene_gallery_detail, container, false);
|
||||
|
||||
ViewGroup main = (ViewGroup) ViewUtils.$$(view, R.id.main);
|
||||
@@ -715,7 +716,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
if (ACTION_GALLERY_INFO.equals(mAction) && mGalleryInfo != null) {
|
||||
GalleryInfo gi = mGalleryInfo;
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gi.gid), gi.thumb, true);
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gi.gid), gi.thumb);
|
||||
mTitle.setText(EhUtils.getSuitableTitle(gi));
|
||||
mUploader.setText(gi.uploader);
|
||||
mCategory.setText(EhUtils.getCategory(gi.category));
|
||||
@@ -733,7 +734,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
return;
|
||||
}
|
||||
|
||||
if (gd.isFavored || EhDB.containLocalFavorites(gd.gid)) {
|
||||
if (gd.isFavorited || EhDB.containLocalFavorites(gd.gid)) {
|
||||
mHeart.setVisibility(View.VISIBLE);
|
||||
mHeartOutline.setVisibility(View.GONE);
|
||||
} else {
|
||||
@@ -756,7 +757,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
Resources resources = getResources2();
|
||||
AssertUtils.assertNotNull(resources);
|
||||
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gd.gid), gd.thumb, true);
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gd.gid), gd.thumb);
|
||||
mTitle.setText(EhUtils.getSuitableTitle(gd));
|
||||
mUploader.setText(gd.uploader);
|
||||
mCategory.setText(EhUtils.getCategory(gd.category));
|
||||
@@ -768,9 +769,9 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
R.plurals.page_count, gd.pages, gd.pages));
|
||||
mSize.setText(gd.size);
|
||||
mPosted.setText(gd.posted);
|
||||
mFavoredTimes.setText(resources.getString(R.string.favored_times, gd.favoredTimes));
|
||||
mFavoredTimes.setText(resources.getString(R.string.favored_times, gd.favoriteCount));
|
||||
|
||||
mRatingText.setText(getAllRatingText(gd.rating, gd.ratedTimes));
|
||||
mRatingText.setText(getAllRatingText(gd.rating, gd.ratingCount));
|
||||
mRating.setRating(gd.rating);
|
||||
|
||||
updateFavoriteDrawable();
|
||||
@@ -861,6 +862,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void bindPreviews(GalleryDetail gd) {
|
||||
LayoutInflater inflater = getLayoutInflater2();
|
||||
Resources resources = getResources2();
|
||||
@@ -869,7 +871,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
mGridLayout.removeAllViews();
|
||||
LargePreviewSet previewSet = gd.previewSet;
|
||||
PreviewSet previewSet = gd.previewSet;
|
||||
if (gd.previewPages <= 0 || previewSet == null || previewSet.size() == 0) {
|
||||
mPreviewText.setText(R.string.no_previews);
|
||||
return;
|
||||
@@ -886,14 +888,12 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
View view = inflater.inflate(R.layout.item_gallery_preview, mGridLayout, false);
|
||||
mGridLayout.addView(view);
|
||||
|
||||
int index = previewSet.getIndexAt(i);
|
||||
String imageUrl = previewSet.getImageUrlAt(i);
|
||||
LoadImageView image = (LoadImageView) view.findViewById(R.id.image);
|
||||
image.load(EhCacheKeyFactory.getLargePreviewKey(gd.gid, index), imageUrl, true);
|
||||
previewSet.load(image, gd.gid, i);
|
||||
image.setTag(R.id.index, i);
|
||||
image.setOnClickListener(this);
|
||||
TextView text = (TextView) view.findViewById(R.id.text);
|
||||
text.setText(String.format(Locale.US, "%d", index + 1));
|
||||
text.setText(Integer.toString(previewSet.getPosition(i) + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -936,10 +936,10 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
private String getAllRatingText(float rating, int ratedTimes) {
|
||||
private String getAllRatingText(float rating, int ratingCount) {
|
||||
Resources resources = getResources2();
|
||||
AssertUtils.assertNotNull(resources);
|
||||
return resources.getString(R.string.rating_text, getRatingText(rating, resources), rating, ratedTimes);
|
||||
return resources.getString(R.string.rating_text, getRatingText(rating, resources), rating, ratingCount);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@@ -1006,6 +1006,14 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
if (null == gd) {
|
||||
return;
|
||||
}
|
||||
String keyword = EhUtils.extractTitle(gd.title);
|
||||
if (null != keyword) {
|
||||
ListUrlBuilder lub = new ListUrlBuilder();
|
||||
lub.setMode(ListUrlBuilder.MODE_NORMAL);
|
||||
lub.setKeyword(keyword);
|
||||
GalleryListScene.startScene(this, lub);
|
||||
return;
|
||||
}
|
||||
String artist = getArtist(gd.tags);
|
||||
if (null != artist) {
|
||||
ListUrlBuilder lub = new ListUrlBuilder();
|
||||
@@ -1085,7 +1093,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
EhDB.removeLocalFavorites(mGalleryDetail.gid);
|
||||
remove = true;
|
||||
}
|
||||
if (mGalleryDetail.isFavored) {
|
||||
if (mGalleryDetail.isFavorited) {
|
||||
mModifingFavorites = true;
|
||||
CommonOperations.removeFromFavorites(activity, mGalleryDetail,
|
||||
new ModifyFavoritesListener(context,
|
||||
@@ -1196,32 +1204,46 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
filter.text = uploader;
|
||||
EhFilter.getInstance().addFilter(filter);
|
||||
|
||||
showTip(getString(R.string.uploader_blocked, uploader), LENGTH_SHORT);
|
||||
showTip(R.string.filter_added, LENGTH_SHORT);
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
private void showBlockTagDialog(final String tag) {
|
||||
Context context = getContext2();
|
||||
private void addTagFilter(String tag) {
|
||||
Filter filter = new Filter();
|
||||
filter.mode = EhFilter.MODE_TAG;
|
||||
filter.text = tag;
|
||||
EhFilter.getInstance().addFilter(filter);
|
||||
showTip(R.string.filter_added, LENGTH_SHORT);
|
||||
}
|
||||
|
||||
private void showTagDialog(final String tag) {
|
||||
final Context context = getContext2();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
String temp;
|
||||
int index = tag.indexOf(':');
|
||||
if (index >= 0) {
|
||||
temp = tag.substring(index + 1);
|
||||
} else {
|
||||
temp = tag;
|
||||
}
|
||||
final String tag2 = temp;
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(getString(R.string.block_the_tag, tag))
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
.setTitle(tag)
|
||||
.setItems(R.array.tag_menu_entries, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (DialogInterface.BUTTON_POSITIVE != which) {
|
||||
return;
|
||||
switch (which) {
|
||||
case 0:
|
||||
UrlOpener.openUrl(context, EhUrl.getTagDefinitionUrl(tag2), false, true);
|
||||
break;
|
||||
case 1:
|
||||
addTagFilter(tag);
|
||||
break;
|
||||
}
|
||||
|
||||
Filter filter = new Filter();
|
||||
filter.mode = EhFilter.MODE_TAG;
|
||||
filter.text = tag;
|
||||
EhFilter.getInstance().addFilter(filter);
|
||||
|
||||
showTip(getString(R.string.tag_blocked, tag), LENGTH_SHORT);
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
@@ -1244,7 +1266,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
} else {
|
||||
String tag = (String) v.getTag(R.id.tag);
|
||||
if (null != tag) {
|
||||
showBlockTagDialog(tag);
|
||||
showTagDialog(tag);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1283,9 +1305,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
break;
|
||||
}
|
||||
mGalleryDetail.comments = comments;
|
||||
if (!isViewCreated()) {
|
||||
break;
|
||||
}
|
||||
bindComments(comments);
|
||||
break;
|
||||
default:
|
||||
@@ -1300,17 +1319,23 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
switch (mDownloadState) {
|
||||
default:
|
||||
case DownloadInfo.STATE_INVALID:
|
||||
case DownloadInfo.STATE_NONE:
|
||||
mDownload.setText(R.string.download);
|
||||
break;
|
||||
case DownloadInfo.STATE_NONE:
|
||||
mDownload.setText(R.string.download_state_none);
|
||||
break;
|
||||
case DownloadInfo.STATE_WAIT:
|
||||
mDownload.setText(R.string.download_state_wait);
|
||||
break;
|
||||
case DownloadInfo.STATE_DOWNLOAD:
|
||||
mDownload.setText(R.string.download_state_downloading);
|
||||
break;
|
||||
case DownloadInfo.STATE_FINISH:
|
||||
case DownloadInfo.STATE_FAILED:
|
||||
mDownload.setText(R.string.download_state_downloaded);
|
||||
break;
|
||||
case DownloadInfo.STATE_FAILED:
|
||||
mDownload.setText(R.string.download_state_failed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1397,11 +1422,9 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
private void onGetGalleryDetailSuccess(GalleryDetail result) {
|
||||
mGalleryDetail = result;
|
||||
if (isViewCreated()) {
|
||||
updateDownloadState();
|
||||
adjustViewVisibility(STATE_NORMAL, true);
|
||||
bindViewSecond();
|
||||
}
|
||||
updateDownloadState();
|
||||
adjustViewVisibility(STATE_NORMAL, true);
|
||||
bindViewSecond();
|
||||
}
|
||||
|
||||
private void onGetGalleryDetailFailure(Exception e) {
|
||||
@@ -1417,12 +1440,12 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
private void onRateGallerySuccess(RateGalleryParser.Result result) {
|
||||
if (mGalleryDetail != null) {
|
||||
mGalleryDetail.rating = result.rating;
|
||||
mGalleryDetail.ratedTimes = result.ratedTimes;
|
||||
mGalleryDetail.ratingCount = result.ratingCount;
|
||||
}
|
||||
|
||||
// Update UI
|
||||
if (mRatingText != null && mRating != null) {
|
||||
mRatingText.setText(getAllRatingText(result.rating, result.ratedTimes));
|
||||
mRatingText.setText(getAllRatingText(result.rating, result.ratingCount));
|
||||
mRating.setRating(result.rating);
|
||||
}
|
||||
}
|
||||
@@ -1430,7 +1453,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
private void onModifyFavoritesSuccess(boolean addOrRemove) {
|
||||
mModifingFavorites = false;
|
||||
if (mGalleryDetail != null) {
|
||||
mGalleryDetail.isFavored = !addOrRemove;
|
||||
mGalleryDetail.isFavorited = !addOrRemove;
|
||||
updateFavoriteDrawable();
|
||||
}
|
||||
}
|
||||
@@ -1602,9 +1625,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
// Put gallery detail to cache
|
||||
EhApplication.getGalleryDetailCache(getApplication()).put(result.gid, result);
|
||||
EhApplication.getLargePreviewSetCache(getApplication()).put(
|
||||
EhCacheKeyFactory.getLargePreviewSetKey(result.gid, 0), result.previewSet);
|
||||
EhApplication.getPreviewPagesCache(getApplication()).put(result.gid, result.previewPages);
|
||||
|
||||
// Add history
|
||||
EhDB.putHistoryInfo(result);
|
||||
@@ -1698,7 +1718,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
GalleryDetail gd = EhApplication.getGalleryDetailCache(getApplication()).get(mGid);
|
||||
if (gd != null) {
|
||||
gd.rating = result.rating;
|
||||
gd.ratedTimes = result.ratedTimes;
|
||||
gd.ratingCount = result.ratingCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
|
||||
@Nullable
|
||||
private ArrayList<String> mValues;
|
||||
|
||||
@Nullable
|
||||
private EasyRecyclerView mRecyclerView;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -112,14 +115,12 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
|
||||
mValues.add(Integer.toString(gd.pages));
|
||||
mKeys.add(resources.getString(R.string.key_size));
|
||||
mValues.add(gd.size);
|
||||
mKeys.add(resources.getString(R.string.key_resize));
|
||||
mValues.add(gd.resize);
|
||||
mKeys.add(resources.getString(R.string.key_favorites));
|
||||
mValues.add(Integer.toString(gd.favoredTimes));
|
||||
mKeys.add(resources.getString(R.string.key_favorite_count));
|
||||
mValues.add(Integer.toString(gd.favoriteCount));
|
||||
mKeys.add(resources.getString(R.string.key_favorited));
|
||||
mValues.add(Boolean.toString(gd.isFavored));
|
||||
mKeys.add(resources.getString(R.string.key_rates));
|
||||
mValues.add(Integer.toString(gd.ratedTimes));
|
||||
mValues.add(Boolean.toString(gd.isFavorited));
|
||||
mKeys.add(resources.getString(R.string.key_rating_count));
|
||||
mValues.add(Integer.toString(gd.ratingCount));
|
||||
mKeys.add(resources.getString(R.string.key_rating));
|
||||
mValues.add(Float.toString(gd.rating));
|
||||
mKeys.add(resources.getString(R.string.key_torrents));
|
||||
@@ -149,26 +150,26 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
|
||||
@SuppressWarnings("deprecation")
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_gallery_info, container, false);
|
||||
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
EasyRecyclerView recyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
|
||||
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
|
||||
InfoAdapter adapter = new InfoAdapter();
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
|
||||
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
|
||||
LinearDividerItemDecoration.VERTICAL, context.getResources().getColor(R.color.divider),
|
||||
LayoutUtils.dp2pix(context, 1));
|
||||
decoration.setPadding(context.getResources().getDimensionPixelOffset(R.dimen.keyline_margin));
|
||||
recyclerView.addItemDecoration(decoration);
|
||||
recyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
recyclerView.setClipToPadding(false);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setOnItemClickListener(this);
|
||||
mRecyclerView.addItemDecoration(decoration);
|
||||
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
mRecyclerView.setClipToPadding(false);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOnItemClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -179,6 +180,16 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
|
||||
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
|
||||
Context context = getContext2();
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.InputType;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
@@ -41,6 +42,7 @@ import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
@@ -62,6 +64,7 @@ import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.EhRequest;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
@@ -78,13 +81,13 @@ import com.hippo.util.ApiHelper;
|
||||
import com.hippo.util.DrawableManager;
|
||||
import com.hippo.view.ViewTransition;
|
||||
import com.hippo.widget.ContentLayout;
|
||||
import com.hippo.widget.FabLayout;
|
||||
import com.hippo.widget.SearchBarMover;
|
||||
import com.hippo.widget.refreshlayout.RefreshLayout;
|
||||
import com.hippo.yorozuya.AnimationUtils;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
import com.hippo.yorozuya.SimpleAnimatorListener;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -94,7 +97,8 @@ import java.util.List;
|
||||
public final class GalleryListScene extends BaseScene
|
||||
implements EasyRecyclerView.OnItemClickListener, EasyRecyclerView.OnItemLongClickListener,
|
||||
SearchBar.Helper, SearchBar.OnStateChangeListener, FastScroller.OnDragHandlerListener,
|
||||
SearchLayout.Helper, View.OnClickListener, SearchBarMover.Helper {
|
||||
SearchLayout.Helper, SearchBarMover.Helper, View.OnClickListener, FabLayout.OnClickFabListener,
|
||||
FabLayout.OnExpandListener {
|
||||
|
||||
@IntDef({STATE_NORMAL, STATE_SIMPLE_SEARCH, STATE_SEARCH, STATE_SEARCH_SHOW_LIST})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@@ -136,7 +140,9 @@ public final class GalleryListScene extends BaseScene
|
||||
@Nullable
|
||||
private SearchBar mSearchBar;
|
||||
@Nullable
|
||||
private FloatingActionButton mFab;
|
||||
private View mSearchFab;
|
||||
@Nullable
|
||||
private FabLayout mFabLayout;
|
||||
@Nullable
|
||||
private ViewTransition mViewTransition;
|
||||
@Nullable
|
||||
@@ -150,7 +156,45 @@ public final class GalleryListScene extends BaseScene
|
||||
@Nullable
|
||||
private SearchBarMover mSearchBarMover;
|
||||
@Nullable
|
||||
private Animator.AnimatorListener mFabAnimatorListener;
|
||||
private AddDeleteDrawable mActionFabDrawable;
|
||||
|
||||
@Nullable
|
||||
private final Animator.AnimatorListener mActionFabAnimatorListener = new SimpleAnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (null != mFabLayout) {
|
||||
mFabLayout.getPrimaryFab().setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
private final Animator.AnimatorListener mSearchFabAnimatorListener = new SimpleAnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (null != mSearchFab) {
|
||||
mSearchFab.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private int mHideActionFabSlop;
|
||||
private boolean mShowActionFab = true;
|
||||
|
||||
@Nullable
|
||||
private final RecyclerView.OnScrollListener mOnScrollListener = new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {}
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy >= mHideActionFabSlop) {
|
||||
hideActionFab();
|
||||
} else if (dy <= -mHideActionFabSlop / 2) {
|
||||
showActionFab();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@State
|
||||
private int mState = STATE_NORMAL;
|
||||
@@ -162,15 +206,6 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
private int mNavCheckedId = 0;
|
||||
|
||||
private final Runnable mReturnSearchBarRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mSearchBarMover != null) {
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private ShowcaseView mShowcaseView;
|
||||
|
||||
@Override
|
||||
@@ -263,7 +298,9 @@ public final class GalleryListScene extends BaseScene
|
||||
Resources resources = context.getResources();
|
||||
Drawable searchImage = DrawableManager.getDrawable(context, R.drawable.v_magnify_x24);
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder(" ");
|
||||
ssb.append(resources.getString(R.string.gallery_list_search_bar_hint));
|
||||
ssb.append(resources.getString(EhUrl.SITE_EX == Settings.getGallerySite() ?
|
||||
R.string.gallery_list_search_bar_hint_exhentai :
|
||||
R.string.gallery_list_search_bar_hint_e_hentai));
|
||||
int textSize = (int) (searchBar.getEditTextTextSize() * 1.25);
|
||||
if (searchImage != null) {
|
||||
searchImage.setBounds(0, 0, textSize, textSize);
|
||||
@@ -307,6 +344,7 @@ public final class GalleryListScene extends BaseScene
|
||||
// Update search edit text
|
||||
if (!TextUtils.isEmpty(keyword) && null != mSearchBar) {
|
||||
mSearchBar.setText(keyword);
|
||||
mSearchBar.cursorToEnd();
|
||||
}
|
||||
|
||||
// Update title
|
||||
@@ -335,7 +373,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_gallery_list, container, false);
|
||||
|
||||
@@ -343,6 +381,9 @@ public final class GalleryListScene extends BaseScene
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
|
||||
mHideActionFabSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
||||
mShowActionFab = true;
|
||||
|
||||
View mainLayout = ViewUtils.$$(view, R.id.main_layout);
|
||||
ContentLayout contentLayout = (ContentLayout) ViewUtils.$$(mainLayout, R.id.content_layout);
|
||||
mRecyclerView = contentLayout.getRecyclerView();
|
||||
@@ -350,7 +391,8 @@ public final class GalleryListScene extends BaseScene
|
||||
RefreshLayout refreshLayout = contentLayout.getRefreshLayout();
|
||||
mSearchLayout = (SearchLayout) ViewUtils.$$(mainLayout, R.id.search_layout);
|
||||
mSearchBar = (SearchBar) ViewUtils.$$(mainLayout, R.id.search_bar);
|
||||
mFab = (FloatingActionButton) ViewUtils.$$(mainLayout, R.id.fab);
|
||||
mFabLayout = (FabLayout) ViewUtils.$$(mainLayout, R.id.fab_layout);
|
||||
mSearchFab = ViewUtils.$$(mainLayout, R.id.search_fab);
|
||||
|
||||
int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.list_padding_top_search_bar);
|
||||
int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.list_padding_bottom_fab);
|
||||
@@ -364,7 +406,6 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
mAdapter = new GalleryListAdapter(inflater, resources,
|
||||
mRecyclerView, Settings.getListMode());
|
||||
mAdapter.register();
|
||||
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
mRecyclerView.setDrawSelectorOnTop(true);
|
||||
mRecyclerView.hasFixedSize();
|
||||
@@ -373,6 +414,7 @@ public final class GalleryListScene extends BaseScene
|
||||
mRecyclerView.setOnItemLongClickListener(this);
|
||||
mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), mRecyclerView.getPaddingTop() + paddingTopSB,
|
||||
mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingBottom());
|
||||
mRecyclerView.addOnScrollListener(mOnScrollListener);
|
||||
|
||||
fastScroller.setPadding(fastScroller.getPaddingLeft(), fastScroller.getPaddingTop() + paddingTopSB,
|
||||
fastScroller.getPaddingRight(), fastScroller.getPaddingBottom());
|
||||
@@ -391,7 +433,17 @@ public final class GalleryListScene extends BaseScene
|
||||
mSearchLayout.setPadding(mSearchLayout.getPaddingLeft(), mSearchLayout.getPaddingTop() + paddingTopSB,
|
||||
mSearchLayout.getPaddingRight(), mSearchLayout.getPaddingBottom() + paddingBottomFab);
|
||||
|
||||
mFab.setOnClickListener(this);
|
||||
mFabLayout.setAutoCancel(true);
|
||||
mFabLayout.setExpanded(false);
|
||||
mFabLayout.setHidePrimaryFab(false);
|
||||
mFabLayout.setOnClickFabListener(this);
|
||||
mFabLayout.setOnExpandListener(this);
|
||||
|
||||
mActionFabDrawable = new AddDeleteDrawable(context);
|
||||
mActionFabDrawable.setColor(resources.getColor(R.color.primary_drawable_dark));
|
||||
mFabLayout.getPrimaryFab().setImageDrawable(mActionFabDrawable);
|
||||
|
||||
mSearchFab.setOnClickListener(this);
|
||||
|
||||
mSearchBarMover = new SearchBarMover(this, mSearchBar, mRecyclerView, mSearchLayout);
|
||||
|
||||
@@ -451,30 +503,30 @@ public final class GalleryListScene extends BaseScene
|
||||
ViewUtils.removeFromParent(mShowcaseView);
|
||||
mShowcaseView = null;
|
||||
}
|
||||
|
||||
if (null != mSearchBarMover) {
|
||||
mSearchBarMover.cancelAnimation();
|
||||
mSearchBarMover = null;
|
||||
}
|
||||
if (null != mAdapter) {
|
||||
mAdapter.unregister();
|
||||
mAdapter = null;
|
||||
}
|
||||
if (null != mHelper) {
|
||||
if (1 == mHelper.getShownViewIndex()) {
|
||||
mHasFirstRefresh = false;
|
||||
}
|
||||
mHelper = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mRecyclerView = null;
|
||||
mAdapter = null;
|
||||
mSearchLayout = null;
|
||||
mSearchBar = null;
|
||||
mFab = null;
|
||||
mFabLayout = null;
|
||||
mSearchFab = null;
|
||||
mViewTransition = null;
|
||||
mLeftDrawable = null;
|
||||
mRightDrawable = null;
|
||||
mFabAnimatorListener = null;
|
||||
mActionFabDrawable = null;
|
||||
}
|
||||
|
||||
private void showQuickSearchTipDialog(final List<QuickSearch> list,
|
||||
@@ -500,12 +552,21 @@ public final class GalleryListScene extends BaseScene
|
||||
private void showAddQuickSearchDialog(final List<QuickSearch> list,
|
||||
final ArrayAdapter<QuickSearch> adapter, final ListView listView, final TextView tip) {
|
||||
Context context = getContext2();
|
||||
if (null == context || null == mUrlBuilder) {
|
||||
final ListUrlBuilder urlBuilder = mUrlBuilder;
|
||||
if (null == context || null == urlBuilder) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check duplicate
|
||||
for (QuickSearch q: list) {
|
||||
if (urlBuilder.equalsQuickSearch(q)) {
|
||||
showTip(getString(R.string.duplicate_quick_search, q.name), LENGTH_SHORT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final EditTextDialogBuilder builder = new EditTextDialogBuilder(context,
|
||||
getSuitableTitleForUrlBuilder(context.getResources(), mUrlBuilder, false), getString(R.string.quick_search));
|
||||
getSuitableTitleForUrlBuilder(context.getResources(), urlBuilder, false), getString(R.string.quick_search));
|
||||
builder.setTitle(R.string.add_quick_search_dialog_title);
|
||||
builder.setPositiveButton(android.R.string.ok, null);
|
||||
final AlertDialog dialog = builder.show();
|
||||
@@ -513,25 +574,36 @@ public final class GalleryListScene extends BaseScene
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String text = builder.getText().trim();
|
||||
|
||||
// Check name empty
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
builder.setError(getString(R.string.name_is_empty));
|
||||
} else {
|
||||
builder.setError(null);
|
||||
dialog.dismiss();
|
||||
QuickSearch quickSearch = mUrlBuilder.toQuickSearch();
|
||||
quickSearch.name = text;
|
||||
EhDB.insertQuickSearch(quickSearch);
|
||||
list.add(quickSearch);
|
||||
adapter.notifyDataSetChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == list.size()) {
|
||||
tip.setVisibility(View.VISIBLE);
|
||||
listView.setVisibility(View.GONE);
|
||||
} else {
|
||||
tip.setVisibility(View.GONE);
|
||||
listView.setVisibility(View.VISIBLE);
|
||||
// Check name duplicate
|
||||
for (QuickSearch q: list) {
|
||||
if (text.equals(q.name)) {
|
||||
builder.setError(getString(R.string.duplicate_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
builder.setError(null);
|
||||
dialog.dismiss();
|
||||
QuickSearch quickSearch = urlBuilder.toQuickSearch();
|
||||
quickSearch.name = text;
|
||||
EhDB.insertQuickSearch(quickSearch);
|
||||
list.add(quickSearch);
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
if (0 == list.size()) {
|
||||
tip.setVisibility(View.VISIBLE);
|
||||
listView.setVisibility(View.GONE);
|
||||
} else {
|
||||
tip.setVisibility(View.GONE);
|
||||
listView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -600,15 +672,6 @@ public final class GalleryListScene extends BaseScene
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mFab == v) {
|
||||
if (mState != STATE_NORMAL && null != mSearchBar) {
|
||||
mSearchBar.applySearch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkDoubleClickExit() {
|
||||
if (getStackIndex() != 0) {
|
||||
return false;
|
||||
@@ -631,6 +694,11 @@ public final class GalleryListScene extends BaseScene
|
||||
return;
|
||||
}
|
||||
|
||||
if (null != mFabLayout && mFabLayout.isExpanded()) {
|
||||
mFabLayout.setExpanded(false);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean handle;
|
||||
switch (mState) {
|
||||
default:
|
||||
@@ -675,6 +743,98 @@ public final class GalleryListScene extends BaseScene
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (STATE_NORMAL != mState && null != mSearchBar) {
|
||||
mSearchBar.applySearch();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickPrimaryFab(FabLayout view, FloatingActionButton fab) {
|
||||
if (STATE_NORMAL == mState) {
|
||||
view.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
private void showGoToDialog() {
|
||||
Context context = getContext2();
|
||||
if (null == context || null == mHelper) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int page = mHelper.getPageForTop();
|
||||
final int pages = mHelper.getPages();
|
||||
String hint = getString(R.string.go_to_hint, page + 1, pages);
|
||||
final EditTextDialogBuilder builder = new EditTextDialogBuilder(context, null, hint);
|
||||
builder.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||
final AlertDialog dialog = builder.setTitle(R.string.go_to)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null == mHelper) {
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
String text = builder.getText().trim();
|
||||
int goTo;
|
||||
try {
|
||||
goTo = Integer.parseInt(text) - 1;
|
||||
} catch (NumberFormatException e){
|
||||
builder.setError(getString(R.string.error_invalid_number));
|
||||
return;
|
||||
}
|
||||
if (goTo < 0 || goTo >= pages) {
|
||||
builder.setError(getString(R.string.error_out_of_range));
|
||||
return;
|
||||
}
|
||||
builder.setError(null);
|
||||
mHelper.goTo(goTo);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickSecondaryFab(FabLayout view, FloatingActionButton fab, int position) {
|
||||
if (null == mHelper) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (position) {
|
||||
case 0: // Go to
|
||||
if (mHelper.canGoTo()) {
|
||||
showGoToDialog();
|
||||
}
|
||||
break;
|
||||
case 1: // Refresh
|
||||
mHelper.refresh();
|
||||
break;
|
||||
}
|
||||
|
||||
view.setExpanded(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpand(boolean expanded) {
|
||||
if (null == mActionFabDrawable) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (expanded) {
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.LEFT);
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT);
|
||||
mActionFabDrawable.setDelete(ANIMATE_TIME);
|
||||
} else {
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.LEFT);
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
|
||||
mActionFabDrawable.setAdd(ANIMATE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick(EasyRecyclerView parent, View view, int position, long id) {
|
||||
final Context context = getContext2();
|
||||
@@ -704,35 +864,94 @@ public final class GalleryListScene extends BaseScene
|
||||
return true;
|
||||
}
|
||||
|
||||
private void showFab() {
|
||||
if (null == mFab) {
|
||||
return;
|
||||
private void showActionFab() {
|
||||
if (null != mFabLayout && STATE_NORMAL == mState && !mShowActionFab) {
|
||||
mShowActionFab = true;
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
fab.animate().scaleX(1.0f).scaleY(1.0f).setListener(null)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(0L)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
|
||||
}
|
||||
|
||||
mFab.setVisibility(View.VISIBLE);
|
||||
mFab.setScaleX(0.0f);
|
||||
mFab.setScaleY(0.0f);
|
||||
mFab.animate().scaleX(1.0f).scaleY(1.0f).setListener(null).setDuration(ANIMATE_TIME)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
|
||||
}
|
||||
|
||||
private void hideFab() {
|
||||
if (null == mFab) {
|
||||
private void hideActionFab() {
|
||||
if (null != mFabLayout && STATE_NORMAL == mState && mShowActionFab) {
|
||||
mShowActionFab = false;
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
fab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mActionFabAnimatorListener)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(0L)
|
||||
.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
|
||||
}
|
||||
}
|
||||
|
||||
private void selectSearchFab(boolean animation) {
|
||||
if (null == mFabLayout || null == mSearchFab) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFabAnimatorListener == null) {
|
||||
mFabAnimatorListener = new SimpleAnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (null != mFab) {
|
||||
mFab.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
mShowActionFab = false;
|
||||
|
||||
if (animation) {
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
long delay;
|
||||
if (View.INVISIBLE == fab.getVisibility()) {
|
||||
delay = 0L;
|
||||
} else {
|
||||
delay = ANIMATE_TIME;
|
||||
fab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mActionFabAnimatorListener)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(0L)
|
||||
.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
|
||||
}
|
||||
mSearchFab.setVisibility(View.VISIBLE);
|
||||
mSearchFab.animate().scaleX(1.0f).scaleY(1.0f).setListener(null)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(delay)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
|
||||
} else {
|
||||
mFabLayout.setExpanded(false, false);
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
fab.setScaleX(0.0f);
|
||||
fab.setScaleY(0.0f);
|
||||
mSearchFab.setVisibility(View.VISIBLE);
|
||||
mSearchFab.setScaleX(1.0f);
|
||||
mSearchFab.setScaleX(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void selectActionFab(boolean animation) {
|
||||
if (null == mFabLayout || null == mSearchFab) {
|
||||
return;
|
||||
}
|
||||
|
||||
mShowActionFab = true;
|
||||
|
||||
if (animation) {
|
||||
long delay;
|
||||
if (View.INVISIBLE == mSearchFab.getVisibility()) {
|
||||
delay = 0L;
|
||||
} else {
|
||||
delay = ANIMATE_TIME;
|
||||
mSearchFab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mSearchFabAnimatorListener)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(0L)
|
||||
.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
|
||||
}
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
fab.animate().scaleX(1.0f).scaleY(1.0f).setListener(null)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(delay)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
|
||||
|
||||
} else {
|
||||
mFabLayout.setExpanded(false, false);
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
fab.setScaleX(1.0f);
|
||||
fab.setScaleY(1.0f);
|
||||
mSearchFab.setVisibility(View.INVISIBLE);
|
||||
mSearchFab.setScaleX(0.0f);
|
||||
mSearchFab.setScaleX(0.0f);
|
||||
}
|
||||
mFab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mFabAnimatorListener)
|
||||
.setDuration(ANIMATE_TIME).setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
|
||||
}
|
||||
|
||||
private void setState(@State int state) {
|
||||
@@ -754,26 +973,26 @@ public final class GalleryListScene extends BaseScene
|
||||
if (state == STATE_SIMPLE_SEARCH) {
|
||||
mSearchBar.setState(SearchBar.STATE_SEARCH_LIST, animation);
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
showFab();
|
||||
selectSearchFab(animation);
|
||||
} else if (state == STATE_SEARCH) {
|
||||
mViewTransition.showView(1, animation);
|
||||
mSearchLayout.scrollSearchContainerToTop();
|
||||
mSearchBar.setState(SearchBar.STATE_SEARCH, animation);
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
showFab();
|
||||
selectSearchFab(animation);
|
||||
} else if (state == STATE_SEARCH_SHOW_LIST) {
|
||||
mViewTransition.showView(1, animation);
|
||||
mSearchLayout.scrollSearchContainerToTop();
|
||||
mSearchBar.setState(SearchBar.STATE_SEARCH_LIST, animation);
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
showFab();
|
||||
selectSearchFab(animation);
|
||||
}
|
||||
break;
|
||||
case STATE_SIMPLE_SEARCH:
|
||||
if (state == STATE_NORMAL) {
|
||||
mSearchBar.setState(SearchBar.STATE_NORMAL, animation);
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
hideFab();
|
||||
selectActionFab(animation);
|
||||
} else if (state == STATE_SEARCH) {
|
||||
mViewTransition.showView(1, animation);
|
||||
mSearchLayout.scrollSearchContainerToTop();
|
||||
@@ -791,7 +1010,7 @@ public final class GalleryListScene extends BaseScene
|
||||
mViewTransition.showView(0, animation);
|
||||
mSearchBar.setState(SearchBar.STATE_NORMAL, animation);
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
hideFab();
|
||||
selectActionFab(animation);
|
||||
} else if (state == STATE_SIMPLE_SEARCH) {
|
||||
mViewTransition.showView(0, animation);
|
||||
mSearchBar.setState(SearchBar.STATE_SEARCH_LIST, animation);
|
||||
@@ -806,7 +1025,7 @@ public final class GalleryListScene extends BaseScene
|
||||
mViewTransition.showView(0, animation);
|
||||
mSearchBar.setState(SearchBar.STATE_NORMAL, animation);
|
||||
mSearchBarMover.returnSearchBarPosition();
|
||||
hideFab();
|
||||
selectActionFab(animation);
|
||||
} else if (state == STATE_SIMPLE_SEARCH) {
|
||||
mViewTransition.showView(0, animation);
|
||||
mSearchBar.setState(SearchBar.STATE_SEARCH_LIST, animation);
|
||||
@@ -1062,26 +1281,35 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHideRecyclerView() {
|
||||
super.onHideRecyclerView();
|
||||
if (mSearchBarMover != null) {
|
||||
public void onShowView(View hiddenView, View shownView) {
|
||||
if (null != mSearchBarMover) {
|
||||
mSearchBarMover.showSearchBar();
|
||||
}
|
||||
showActionFab();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollToPosition(int postion) {
|
||||
if (0 == postion) {
|
||||
if (null != mSearchBarMover) {
|
||||
mSearchBarMover.showSearchBar();
|
||||
}
|
||||
showActionFab();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetGalleryListSuccess(GalleryListParser.Result result, int taskId) {
|
||||
if (mHelper != null && mSearchBarMover != null &&
|
||||
mHelper.isCurrentTask(taskId) && isViewCreated()) {
|
||||
mHelper.isCurrentTask(taskId)) {
|
||||
mHelper.setPages(taskId, result.pages);
|
||||
mHelper.onGetPageData(taskId, result.galleryInfos);
|
||||
SimpleHandler.getInstance().post(mReturnSearchBarRunnable);
|
||||
mHelper.onGetPageData(taskId, result.galleryInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetGalleryListFailure(Exception e, int taskId) {
|
||||
if (mHelper != null && mSearchBarMover != null &&
|
||||
mHelper.isCurrentTask(taskId) && isViewCreated()) {
|
||||
mHelper.isCurrentTask(taskId)) {
|
||||
mHelper.onGetException(taskId, e);
|
||||
}
|
||||
}
|
||||
@@ -1091,13 +1319,12 @@ public final class GalleryListScene extends BaseScene
|
||||
mHelper.isCurrentTask(taskId)) {
|
||||
mHelper.setPages(taskId, 1);
|
||||
mHelper.onGetPageData(taskId, result);
|
||||
SimpleHandler.getInstance().post(mReturnSearchBarRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetWhatsHotFailure(Exception e, int taskId) {
|
||||
if (mHelper != null && mSearchBarMover != null &&
|
||||
mHelper.isCurrentTask(taskId) && isViewCreated()) {
|
||||
mHelper.isCurrentTask(taskId)) {
|
||||
mHelper.onGetException(taskId, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -37,13 +38,12 @@ import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.MarginItemDecoration;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhCacheKeyFactory;
|
||||
import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.EhRequest;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.GalleryPreview;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.ui.GalleryActivity;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
@@ -54,7 +54,6 @@ import com.hippo.widget.Slider;
|
||||
import com.hippo.widget.recyclerview.AutoGridLayoutManager;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.LayoutUtils;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -77,6 +76,8 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
View life cycle
|
||||
---------------*/
|
||||
@Nullable
|
||||
private EasyRecyclerView mRecyclerView;
|
||||
@Nullable
|
||||
private GalleryPreviewAdapter mAdapter;
|
||||
@Nullable
|
||||
private GalleryPreviewHelper mHelper;
|
||||
@@ -127,28 +128,28 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
ContentLayout contentLayout = (ContentLayout) inflater.inflate(
|
||||
R.layout.scene_gallery_previews, container, false);
|
||||
contentLayout.hideFastScroll();
|
||||
EasyRecyclerView recyclerView = contentLayout.getRecyclerView();
|
||||
mRecyclerView = contentLayout.getRecyclerView();
|
||||
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
|
||||
mAdapter = new GalleryPreviewAdapter();
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
int columnWidth = resources.getDimensionPixelOffset(R.dimen.preview_grid_column_width);
|
||||
AutoGridLayoutManager layoutManager = new AutoGridLayoutManager(context, columnWidth);
|
||||
layoutManager.setStrategy(AutoGridLayoutManager.STRATEGY_SUITABLE_SIZE);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
int padding = LayoutUtils.dp2pix(context, 4);
|
||||
recyclerView.setPadding(padding, padding, padding, padding);
|
||||
recyclerView.setClipToPadding(false);
|
||||
recyclerView.addItemDecoration(new MarginItemDecoration(padding));
|
||||
recyclerView.setOnItemClickListener(this);
|
||||
mRecyclerView.setPadding(padding, padding, padding, padding);
|
||||
mRecyclerView.setClipToPadding(false);
|
||||
mRecyclerView.addItemDecoration(new MarginItemDecoration(padding));
|
||||
mRecyclerView.setOnItemClickListener(this);
|
||||
|
||||
mHelper = new GalleryPreviewHelper();
|
||||
contentLayout.setHelper(mHelper);
|
||||
@@ -172,6 +173,10 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
}
|
||||
mHelper = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mAdapter = null;
|
||||
}
|
||||
@@ -229,7 +234,7 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
Intent intent = new Intent(context, GalleryActivity.class);
|
||||
intent.setAction(GalleryActivity.ACTION_EH);
|
||||
intent.putExtra(GalleryActivity.KEY_GALLERY_INFO, mGalleryInfo);
|
||||
intent.putExtra(GalleryActivity.KEY_PAGE, p.index);
|
||||
intent.putExtra(GalleryActivity.KEY_PAGE, p.getPosition());
|
||||
startActivity(intent);
|
||||
}
|
||||
return true;
|
||||
@@ -263,11 +268,12 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void onBindViewHolder(GalleryPreviewHolder holder, int position) {
|
||||
if (null != mHelper && null != mGalleryInfo) {
|
||||
if (null != mHelper) {
|
||||
GalleryPreview preview = mHelper.getDataAt(position);
|
||||
holder.image.load(EhCacheKeyFactory.getLargePreviewKey(mGalleryInfo.gid, preview.index), preview.imageUrl);
|
||||
holder.text.setText(String.format(Locale.US, "%d", preview.index + 1));
|
||||
preview.load(holder.image);
|
||||
holder.text.setText(Integer.toString(preview.getPosition() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,24 +293,11 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
return;
|
||||
}
|
||||
|
||||
final LargePreviewSet previewSet = EhApplication.getLargePreviewSetCache(
|
||||
getContext()).get(EhCacheKeyFactory.getLargePreviewSetKey(mGalleryInfo.gid, page));
|
||||
final Integer pages = EhApplication.getPreviewPagesCache(getContext()).get(mGalleryInfo.gid);
|
||||
if (previewSet != null && pages != null) {
|
||||
SimpleHandler.getInstance().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onGetLargePreviewSetSuccess(Pair.create(previewSet, pages), taskId);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
String url = EhUrl.getGalleryDetailUrl(mGalleryInfo.gid, mGalleryInfo.token, page, false);
|
||||
EhRequest request = new EhRequest();
|
||||
request.setMethod(EhClient.METHOD_GET_LARGE_PREVIEW_SET);
|
||||
request.setCallback(new GetLargePreviewSetListener(getContext(),
|
||||
activity.getStageId(), getTag(), taskId, mGalleryInfo.gid, page));
|
||||
request.setMethod(EhClient.METHOD_GET_PREVIEW_SET);
|
||||
request.setCallback(new GetPreviewSetListener(getContext(),
|
||||
activity.getStageId(), getTag(), taskId));
|
||||
request.setArgs(url);
|
||||
mClient.execute(request);
|
||||
}
|
||||
@@ -336,17 +329,13 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetLargePreviewSetSuccess(Pair<LargePreviewSet, Integer> result, int taskId) {
|
||||
if (mHelper != null && mHelper.isCurrentTask(taskId) && isViewCreated()) {
|
||||
LargePreviewSet previewSet = result.first;
|
||||
private void onGetPreviewSetSuccess(Pair<PreviewSet, Integer> result, int taskId) {
|
||||
if (null != mHelper && mHelper.isCurrentTask(taskId) && null != mGalleryInfo) {
|
||||
PreviewSet previewSet = result.first;
|
||||
int size = previewSet.size();
|
||||
ArrayList<GalleryPreview> list = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
GalleryPreview preview = new GalleryPreview();
|
||||
preview.imageUrl = previewSet.getImageUrlAt(i);
|
||||
preview.pageUrl = previewSet.getPageUrlAt(i);
|
||||
preview.index = previewSet.getIndexAt(i);
|
||||
list.add(preview);
|
||||
list.add(previewSet.getGalleryPreview(mGalleryInfo.gid, i));
|
||||
}
|
||||
|
||||
mHelper.setPages(taskId, result.second);
|
||||
@@ -354,34 +343,26 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetLargePreviewSetFailure(Exception e, int taskId) {
|
||||
if (mHelper != null && mHelper.isCurrentTask(taskId) && isViewCreated()) {
|
||||
private void onGetPreviewSetFailure(Exception e, int taskId) {
|
||||
if (mHelper != null && mHelper.isCurrentTask(taskId)) {
|
||||
mHelper.onGetException(taskId, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetLargePreviewSetListener extends EhCallback<GalleryPreviewsScene, Pair<LargePreviewSet, Integer>> {
|
||||
private static class GetPreviewSetListener extends EhCallback<GalleryPreviewsScene, Pair<PreviewSet, Integer>> {
|
||||
|
||||
private final int mTaskId;
|
||||
private final long mGid;
|
||||
private final int mPage;
|
||||
|
||||
public GetLargePreviewSetListener(Context context, int stageId, String sceneTag, int taskId, long gid, int page) {
|
||||
public GetPreviewSetListener(Context context, int stageId, String sceneTag, int taskId) {
|
||||
super(context, stageId, sceneTag);
|
||||
mTaskId = taskId;
|
||||
mGid = gid;
|
||||
mPage = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Pair<LargePreviewSet, Integer> result) {
|
||||
EhApplication.getLargePreviewSetCache(getApplication()).put(
|
||||
EhCacheKeyFactory.getLargePreviewSetKey(mGid, mPage), result.first);
|
||||
EhApplication.getPreviewPagesCache(getApplication()).put(mGid, result.second);
|
||||
|
||||
public void onSuccess(Pair<PreviewSet, Integer> result) {
|
||||
GalleryPreviewsScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onGetLargePreviewSetSuccess(result, mTaskId);
|
||||
scene.onGetPreviewSetSuccess(result, mTaskId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,7 +370,7 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
public void onFailure(Exception e) {
|
||||
GalleryPreviewsScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onGetLargePreviewSetFailure(e, mTaskId);
|
||||
scene.onGetPreviewSetFailure(e, mTaskId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
@@ -74,6 +76,8 @@ public class HistoryScene extends ToolbarScene
|
||||
View life cycle
|
||||
---------------*/
|
||||
@Nullable
|
||||
private EasyRecyclerView mRecyclerView;
|
||||
@Nullable
|
||||
private ViewTransition mViewTransition;
|
||||
@Nullable
|
||||
private RecyclerView.Adapter<?> mAdapter;
|
||||
@@ -87,11 +91,11 @@ public class HistoryScene extends ToolbarScene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_history, container, false);
|
||||
View content = ViewUtils.$$(view, R.id.content);
|
||||
EasyRecyclerView recyclerView = (EasyRecyclerView) ViewUtils.$$(content, R.id.recycler_view);
|
||||
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(content, R.id.recycler_view);
|
||||
FastScroller fastScroller = (FastScroller) ViewUtils.$$(content, R.id.fast_scroller);
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mViewTransition = new ViewTransition(content, tip);
|
||||
@@ -111,25 +115,25 @@ public class HistoryScene extends ToolbarScene
|
||||
mAdapter = new HistoryAdapter();
|
||||
mAdapter.setHasStableIds(true);
|
||||
mAdapter = swipeManager.createWrappedAdapter(mAdapter);
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
recyclerView.setItemAnimator(animator);
|
||||
mRecyclerView.setItemAnimator(animator);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
recyclerView.setDrawSelectorOnTop(true);
|
||||
recyclerView.hasFixedSize();
|
||||
recyclerView.setClipToPadding(false);
|
||||
recyclerView.setOnItemClickListener(this);
|
||||
recyclerView.setOnItemLongClickListener(this);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
mRecyclerView.setDrawSelectorOnTop(true);
|
||||
mRecyclerView.hasFixedSize();
|
||||
mRecyclerView.setClipToPadding(false);
|
||||
mRecyclerView.setOnItemClickListener(this);
|
||||
mRecyclerView.setOnItemLongClickListener(this);
|
||||
int paddingH = resources.getDimensionPixelOffset(R.dimen.list_content_margin_h);
|
||||
int paddingV = resources.getDimensionPixelOffset(R.dimen.list_content_margin_v);
|
||||
recyclerView.setPadding(paddingV, paddingH, paddingV, paddingH);
|
||||
guardManager.attachRecyclerView(recyclerView);
|
||||
swipeManager.attachRecyclerView(recyclerView);
|
||||
mRecyclerView.setPadding(paddingV, paddingH, paddingV, paddingH);
|
||||
guardManager.attachRecyclerView(mRecyclerView);
|
||||
swipeManager.attachRecyclerView(mRecyclerView);
|
||||
|
||||
fastScroller.attachToRecyclerView(recyclerView);
|
||||
fastScroller.attachToRecyclerView(mRecyclerView);
|
||||
HandlerDrawable handlerDrawable = new HandlerDrawable();
|
||||
handlerDrawable.setColor(ResourcesUtils.getAttrColor(context, R.attr.colorAccent));
|
||||
fastScroller.setHandlerDrawable(handlerDrawable);
|
||||
@@ -155,6 +159,10 @@ public class HistoryScene extends ToolbarScene
|
||||
mLazyList.close();
|
||||
mLazyList = null;
|
||||
}
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mViewTransition = null;
|
||||
mAdapter = null;
|
||||
@@ -326,6 +334,7 @@ public class HistoryScene extends ToolbarScene
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public void onBindViewHolder(HistoryHolder holder, int position) {
|
||||
if (null == mLazyList) {
|
||||
return;
|
||||
@@ -344,6 +353,12 @@ public class HistoryScene extends ToolbarScene
|
||||
}
|
||||
holder.posted.setText(gi.posted);
|
||||
holder.simpleLanguage.setText(gi.simpleLanguage);
|
||||
|
||||
// Update transition name
|
||||
if (ApiHelper.SUPPORT_TRANSITION) {
|
||||
long gid = gi.gid;
|
||||
holder.thumb.setTransitionName(TransitionNameFactory.getThumbTransitionName(gid));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -162,7 +162,7 @@ public final class ProgressScene extends BaseScene implements View.OnClickListen
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_progress, container, false);
|
||||
View progress = ViewUtils.$$(view, R.id.progress);
|
||||
|
||||
@@ -66,6 +66,8 @@ public final class QuickSearchScene extends ToolbarScene {
|
||||
View life cycle
|
||||
---------------*/
|
||||
@Nullable
|
||||
private EasyRecyclerView mRecyclerView;
|
||||
@Nullable
|
||||
private ViewTransition mViewTransition;
|
||||
@Nullable
|
||||
private RecyclerView.Adapter mAdapter;
|
||||
@@ -85,13 +87,13 @@ public final class QuickSearchScene extends ToolbarScene {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_label_list, container, false);
|
||||
|
||||
EasyRecyclerView recyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
|
||||
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mViewTransition = new ViewTransition(recyclerView, tip);
|
||||
mViewTransition = new ViewTransition(mRecyclerView, tip);
|
||||
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
@@ -118,13 +120,13 @@ public final class QuickSearchScene extends ToolbarScene {
|
||||
mAdapter = adapter;
|
||||
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
recyclerView.hasFixedSize();
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setItemAnimator(animator);
|
||||
guardManager.attachRecyclerView(recyclerView);
|
||||
swipeManager.attachRecyclerView(recyclerView);
|
||||
dragDropManager.attachRecyclerView(recyclerView);
|
||||
mRecyclerView.hasFixedSize();
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
mRecyclerView.setItemAnimator(animator);
|
||||
guardManager.attachRecyclerView(mRecyclerView);
|
||||
swipeManager.attachRecyclerView(mRecyclerView);
|
||||
dragDropManager.attachRecyclerView(mRecyclerView);
|
||||
|
||||
updateView();
|
||||
|
||||
@@ -142,6 +144,11 @@ public final class QuickSearchScene extends ToolbarScene {
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
if (null != mRecyclerView) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
mViewTransition = null;
|
||||
mAdapter = null;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,11 @@ public class SecurityScene extends BaseScene implements
|
||||
|
||||
private int mRetryTimes;
|
||||
|
||||
@Override
|
||||
public boolean needShowLeftDrawer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -110,7 +115,7 @@ public class SecurityScene extends BaseScene implements
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_security, container, false);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SelectSiteScene extends BaseScene implements View.OnClickListener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_select_site, container, false);
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.parser.ProfileParser;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
@@ -114,7 +113,7 @@ public final class SignInScene extends BaseScene implements EditText.OnEditorAct
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_login, container, false);
|
||||
|
||||
@@ -144,9 +143,6 @@ public final class SignInScene extends BaseScene implements EditText.OnEditorAct
|
||||
mSignInViaCookies.setOnClickListener(this);
|
||||
mSkipSigningIn.setOnClickListener(this);
|
||||
|
||||
RippleSalon.addRipple(mRegister, true);
|
||||
RippleSalon.addRipple(mSignIn, true);
|
||||
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(container);
|
||||
EhApplication application = (EhApplication) context.getApplicationContext();
|
||||
|
||||
@@ -39,20 +39,20 @@ public abstract class ToolbarScene extends BaseScene {
|
||||
private CharSequence mTempTitle;
|
||||
|
||||
@Nullable
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public final View onCreateView(LayoutInflater inflater,
|
||||
public final View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_toolbar, container, false);
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
FrameLayout contentPanel = (FrameLayout) view.findViewById(R.id.content_panel);
|
||||
|
||||
View contentView = onCreateView2(inflater, contentPanel, savedInstanceState);
|
||||
View contentView = onCreateView3(inflater, contentPanel, savedInstanceState);
|
||||
if (contentView == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
||||
@@ -26,19 +26,15 @@ import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.ehviewer.ui.annotation.ViewLifeCircle;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
public final class WarningScene extends BaseScene implements View.OnClickListener {
|
||||
|
||||
private static final String TAG = WarningScene.class.getSimpleName();
|
||||
|
||||
@Nullable
|
||||
private View mReject;
|
||||
@Nullable
|
||||
@ViewLifeCircle
|
||||
private View mCancel;
|
||||
@Nullable
|
||||
@ViewLifeCircle
|
||||
private View mOk;
|
||||
private View mAccept;
|
||||
|
||||
@Override
|
||||
public boolean needShowLeftDrawer() {
|
||||
@@ -47,18 +43,15 @@ public final class WarningScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_warning, container, false);
|
||||
|
||||
mCancel = ViewUtils.$$(view, R.id.cancel);
|
||||
mOk = ViewUtils.$$(view, R.id.ok);
|
||||
mReject = ViewUtils.$$(view, R.id.reject);
|
||||
mAccept = ViewUtils.$$(view, R.id.accept);
|
||||
|
||||
mCancel.setOnClickListener(this);
|
||||
mOk.setOnClickListener(this);
|
||||
|
||||
RippleSalon.addRipple(mCancel, true);
|
||||
RippleSalon.addRipple(mOk, true);
|
||||
mReject.setOnClickListener(this);
|
||||
mAccept.setOnClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
@@ -67,15 +60,15 @@ public final class WarningScene extends BaseScene implements View.OnClickListene
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
mCancel = null;
|
||||
mOk = null;
|
||||
mReject = null;
|
||||
mAccept = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mCancel == v) {
|
||||
if (mReject == v) {
|
||||
finishStage();
|
||||
} else if (mOk == v) {
|
||||
} else if (mAccept == v) {
|
||||
// Never show this warning anymore
|
||||
Settings.putShowWarning(false);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class WebViewSignInScene extends BaseScene {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
@@ -130,9 +130,9 @@ public class GalleryGuideView extends ViewGroup implements View.OnClickListener
|
||||
mRightText.measure(MeasureSpec.makeMeasureSpec(widthSize / 3, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY));
|
||||
mMenuText.measure(MeasureSpec.makeMeasureSpec(widthSize / 3, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(heightSize * 2 / 3, MeasureSpec.EXACTLY));
|
||||
MeasureSpec.makeMeasureSpec(heightSize / 2, MeasureSpec.EXACTLY));
|
||||
mProgressText.measure(MeasureSpec.makeMeasureSpec(widthSize / 3, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(heightSize / 3, MeasureSpec.EXACTLY));
|
||||
MeasureSpec.makeMeasureSpec(heightSize / 2, MeasureSpec.EXACTLY));
|
||||
break;
|
||||
default:
|
||||
case 1:
|
||||
@@ -153,8 +153,8 @@ public class GalleryGuideView extends ViewGroup implements View.OnClickListener
|
||||
case 0:
|
||||
mLeftText.layout(0, 0, width / 3, height);
|
||||
mRightText.layout(width * 2 / 3, 0, width, height);
|
||||
mMenuText.layout(width / 3, 0, width * 2 / 3, height * 2 / 3);
|
||||
mProgressText.layout(width / 3, height * 2 / 3, width * 2 / 3, height);
|
||||
mMenuText.layout(width / 3, 0, width * 2 / 3, height / 2);
|
||||
mProgressText.layout(width / 3, height / 2, width * 2 / 3, height);
|
||||
break;
|
||||
default:
|
||||
case 1:
|
||||
@@ -179,9 +179,9 @@ public class GalleryGuideView extends ViewGroup implements View.OnClickListener
|
||||
mPoints[7] = h;
|
||||
|
||||
mPoints[8] = w / 3;
|
||||
mPoints[9] = h * 2 / 3;
|
||||
mPoints[9] = h / 2;
|
||||
mPoints[10] = w * 2 / 3;
|
||||
mPoints[11] = h * 2 / 3;
|
||||
mPoints[11] = h / 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +209,10 @@ public class SearchBar extends FrameLayout implements View.OnClickListener,
|
||||
return mEditText.getText().toString();
|
||||
}
|
||||
|
||||
public void cursorToEnd() {
|
||||
mEditText.setSelection(mEditText.getText().length());
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
mTitleTextView.setText(title);
|
||||
}
|
||||
|
||||
@@ -17,13 +17,16 @@
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
public class SeekBarPanel extends LinearLayout {
|
||||
|
||||
private SeekBar mSeekBar;
|
||||
@@ -41,17 +44,9 @@ public class SeekBarPanel extends LinearLayout {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View child) {
|
||||
if (child instanceof SeekBar) {
|
||||
mSeekBar = (SeekBar) child;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View child) {
|
||||
if (child == mSeekBar) {
|
||||
mSeekBar = null;
|
||||
}
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mSeekBar = (SeekBar) ViewUtils.$$(this, R.id.seek_bar);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,4 +62,11 @@ public class SeekBarPanel extends LinearLayout {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected boolean fitSystemWindows(Rect insets) {
|
||||
insets.top = 0;
|
||||
return super.fitSystemWindows(insets);
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ public abstract class StageActivity extends EhActivity {
|
||||
}
|
||||
|
||||
// Commit
|
||||
transaction.commit();
|
||||
transaction.commitAllowingStateLoss();
|
||||
|
||||
// New arguments
|
||||
if (args != null && fragment instanceof SceneFragment) {
|
||||
@@ -382,7 +382,7 @@ public abstract class StageActivity extends EhActivity {
|
||||
transaction.add(getContainerViewId(), newScene, newTag);
|
||||
|
||||
// Commit
|
||||
transaction.commit();
|
||||
transaction.commitAllowingStateLoss();
|
||||
|
||||
// Check request
|
||||
if (announcer.requestFrom != null) {
|
||||
@@ -458,7 +458,7 @@ public abstract class StageActivity extends EhActivity {
|
||||
}
|
||||
|
||||
// Commit
|
||||
transaction.commit();
|
||||
transaction.commitAllowingStateLoss();
|
||||
|
||||
if (!createNewScene && args != null) {
|
||||
// TODO Call onNewArguments when view created ?
|
||||
@@ -536,7 +536,7 @@ public abstract class StageActivity extends EhActivity {
|
||||
transaction.attach(next);
|
||||
}
|
||||
transaction.remove(scene);
|
||||
transaction.commit();
|
||||
transaction.commitAllowingStateLoss();
|
||||
|
||||
// Remove tag
|
||||
mSceneTagList.remove(index);
|
||||
@@ -547,6 +547,22 @@ public abstract class StageActivity extends EhActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshTopScene() {
|
||||
int index = mSceneTagList.size() - 1;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
String tag = mSceneTagList.get(index);
|
||||
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
Fragment fragment = fragmentManager.findFragmentByTag(tag);
|
||||
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
transaction.detach(fragment);
|
||||
transaction.attach(fragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
int size = mSceneTagList.size();
|
||||
|
||||
@@ -33,6 +33,8 @@ public class ViewTransition {
|
||||
private Animator mAnimator1;
|
||||
private Animator mAnimator2;
|
||||
|
||||
private OnShowViewListener mOnShowViewListener;
|
||||
|
||||
public ViewTransition(View... views) {
|
||||
if (views.length < 2) {
|
||||
throw new IllegalStateException("You must pass view to ViewTransition");
|
||||
@@ -47,6 +49,10 @@ public class ViewTransition {
|
||||
showView(0, false);
|
||||
}
|
||||
|
||||
public void setOnShowViewListener(OnShowViewListener listener) {
|
||||
mOnShowViewListener = listener;
|
||||
}
|
||||
|
||||
public int getShownViewIndex() {
|
||||
return mShownView;
|
||||
}
|
||||
@@ -97,6 +103,10 @@ public class ViewTransition {
|
||||
}
|
||||
}
|
||||
|
||||
if (null != mOnShowViewListener) {
|
||||
mOnShowViewListener.onShowView(views[oldShownView], views[shownView]);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -128,4 +138,8 @@ public class ViewTransition {
|
||||
oa2.start();
|
||||
mAnimator2 = oa2;
|
||||
}
|
||||
|
||||
public interface OnShowViewListener {
|
||||
void onShowView(View hiddenView, View shownView);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class ContentLayout extends FrameLayout {
|
||||
super.onRestoreInstanceState(mContentHelper.restoreInstanceState(state));
|
||||
}
|
||||
|
||||
public abstract static class ContentHelper<E extends Parcelable> {
|
||||
public abstract static class ContentHelper<E extends Parcelable> implements ViewTransition.OnShowViewListener {
|
||||
|
||||
private static final String TAG = ContentHelper.class.getSimpleName();
|
||||
|
||||
@@ -287,8 +287,8 @@ public class ContentLayout extends FrameLayout {
|
||||
private final LayoutManagerUtils.OnScrollToPositionListener mOnScrollToPositionListener =
|
||||
new LayoutManagerUtils.OnScrollToPositionListener() {
|
||||
@Override
|
||||
public void onScrollToPosition() {
|
||||
ContentHelper.this.onScrollToPosition();
|
||||
public void onScrollToPosition(int position) {
|
||||
ContentHelper.this.onScrollToPosition(position);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -307,6 +307,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mTipView.setCompoundDrawables(null, drawable, null, null);
|
||||
|
||||
mViewTransition = new ViewTransition(mContentView, mProgressView, mTipView);
|
||||
mViewTransition.setOnShowViewListener(this);
|
||||
|
||||
mRecyclerView.addOnScrollListener(mOnScrollListener);
|
||||
mRefreshLayout.setOnRefreshListener(mOnRefreshListener);
|
||||
@@ -335,11 +336,10 @@ public class ContentLayout extends FrameLayout {
|
||||
|
||||
protected abstract void notifyItemRangeInserted(int positionStart, int itemCount);
|
||||
|
||||
protected void onScrollToPosition() {
|
||||
}
|
||||
protected void onScrollToPosition(int postion) {}
|
||||
|
||||
protected void onHideRecyclerView() {
|
||||
}
|
||||
@Override
|
||||
public void onShowView(View hiddenView, View shownView) {}
|
||||
|
||||
public int getShownViewIndex() {
|
||||
return mViewTransition.getShownViewIndex();
|
||||
@@ -459,7 +459,7 @@ public class ContentLayout extends FrameLayout {
|
||||
// RecyclerView scroll
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(0);
|
||||
}
|
||||
break;
|
||||
case TYPE_PRE_PAGE:
|
||||
@@ -489,7 +489,7 @@ public class ContentLayout extends FrameLayout {
|
||||
// RecyclerView scroll, to top
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -518,7 +518,7 @@ public class ContentLayout extends FrameLayout {
|
||||
} else {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -546,7 +546,7 @@ public class ContentLayout extends FrameLayout {
|
||||
// RecyclerView scroll
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(oldDataSize);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -570,11 +570,10 @@ public class ContentLayout extends FrameLayout {
|
||||
if (mCurrentTaskType == TYPE_NEXT_PAGE_KEEP_POS) {
|
||||
mRecyclerView.stopScroll();
|
||||
mRecyclerView.smoothScrollBy(0, mNextPageScrollSize);
|
||||
onScrollToPosition();
|
||||
} else {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), oldDataSize, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(oldDataSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -618,7 +617,7 @@ public class ContentLayout extends FrameLayout {
|
||||
// RecyclerView scroll
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), 0, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(0);
|
||||
}
|
||||
break;
|
||||
case TYPE_REFRESH_PAGE:
|
||||
@@ -655,7 +654,7 @@ public class ContentLayout extends FrameLayout {
|
||||
if (newIndexEnd > oldIndexEnd && newIndexEnd > 0) {
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), newIndexEnd - 1, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(newIndexEnd - 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -697,16 +696,12 @@ public class ContentLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
public void showProgressBar(boolean animation) {
|
||||
if (mViewTransition.showView(1, animation)) {
|
||||
onHideRecyclerView();
|
||||
}
|
||||
mViewTransition.showView(1, animation);
|
||||
}
|
||||
|
||||
public void showText(CharSequence text) {
|
||||
mTipView.setText(text);
|
||||
if (mViewTransition.showView(2)) {
|
||||
onHideRecyclerView();
|
||||
}
|
||||
mViewTransition.showView(2);
|
||||
}
|
||||
|
||||
public void showEmptyString() {
|
||||
@@ -799,11 +794,11 @@ public class ContentLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
public int getPageForTop() {
|
||||
return getPageForPosition(LayoutManagerUtils.getFirstVisibleItemPostion(mRecyclerView.getLayoutManager()));
|
||||
return getPageForPosition(LayoutManagerUtils.getFirstVisibleItemPosition(mRecyclerView.getLayoutManager()));
|
||||
}
|
||||
|
||||
public int getPageForBottom() {
|
||||
return getPageForPosition(LayoutManagerUtils.getLastVisibleItemPostion(mRecyclerView.getLayoutManager()));
|
||||
return getPageForPosition(LayoutManagerUtils.getLastVisibleItemPosition(mRecyclerView.getLayoutManager()));
|
||||
}
|
||||
|
||||
public boolean canGoTo() {
|
||||
@@ -825,7 +820,7 @@ public class ContentLayout extends FrameLayout {
|
||||
int position = getPageStart(page);
|
||||
mRecyclerView.stopScroll();
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mRecyclerView.getLayoutManager(), position, 0);
|
||||
onScrollToPosition();
|
||||
onScrollToPosition(position);
|
||||
} else if (page == mStartPage - 1) {
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
mRefreshLayout.setHeaderRefreshing(true);
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.hippo.conaco.ConacoTask;
|
||||
import com.hippo.conaco.DataContainer;
|
||||
import com.hippo.conaco.Unikery;
|
||||
import com.hippo.conaco.ValueHolder;
|
||||
import com.hippo.drawable.PreciselyClipDrawable;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
@@ -49,6 +50,11 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Bitma
|
||||
private DataContainer mContainer;
|
||||
private boolean mUseNetwork;
|
||||
|
||||
private int mOffsetX = Integer.MIN_VALUE;
|
||||
private int mOffsetY = Integer.MIN_VALUE;
|
||||
private int mClipWidth = Integer.MIN_VALUE;
|
||||
private int mClipHeight = Integer.MIN_VALUE;
|
||||
|
||||
private ValueHolder<Bitmap> mHolder;
|
||||
|
||||
private boolean mFailed;
|
||||
@@ -152,6 +158,20 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Bitma
|
||||
load(key, url, null, true);
|
||||
}
|
||||
|
||||
public void setClip(int offsetX, int offsetY, int clipWidth, int clipHeight) {
|
||||
mOffsetX = offsetX;
|
||||
mOffsetY = offsetY;
|
||||
mClipWidth = clipWidth;
|
||||
mClipHeight = clipHeight;
|
||||
}
|
||||
|
||||
public void resetClip() {
|
||||
mOffsetX = Integer.MIN_VALUE;
|
||||
mOffsetY = Integer.MIN_VALUE;
|
||||
mClipWidth = Integer.MIN_VALUE;
|
||||
mClipHeight = Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
public void load(String key, String url, boolean useNetwork) {
|
||||
load(key, url, null, useNetwork);
|
||||
}
|
||||
@@ -252,6 +272,10 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Bitma
|
||||
Bitmap bitmap = holder.getValue();
|
||||
Drawable drawable = new BitmapDrawable(getResources(), bitmap);
|
||||
|
||||
if (Integer.MIN_VALUE != mOffsetX) {
|
||||
drawable = new PreciselyClipDrawable(drawable, mOffsetX, mOffsetY, mClipWidth, mClipHeight);
|
||||
}
|
||||
|
||||
if ((source == Conaco.Source.DISK || source == Conaco.Source.NETWORK)) {
|
||||
Drawable[] layers = new Drawable[2];
|
||||
layers[0] = new ColorDrawable(Color.TRANSPARENT);
|
||||
|
||||
|
Before Width: | Height: | Size: 440 B |
|
Before Width: | Height: | Size: 431 B |
|
Before Width: | Height: | Size: 284 B |
|
Before Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 392 B |
|
Before Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 720 B |
|
Before Width: | Height: | Size: 720 B |
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/primary_drawable_dark"
|
||||
android:pathData="@string/pd_refresh"/>
|
||||
|
||||
</vector>
|
||||
@@ -23,7 +23,7 @@
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/primary_drawable_light"
|
||||
android:fillColor="@color/yellow_800"
|
||||
android:pathData="@string/pd_star_half"/>
|
||||
|
||||
</vector>
|
||||
@@ -23,7 +23,7 @@
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/primary_drawable_light"
|
||||
android:fillColor="@color/yellow_800"
|
||||
android:pathData="@string/pd_star_outline"/>
|
||||
|
||||
</vector>
|
||||
@@ -23,7 +23,7 @@
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/primary_drawable_light"
|
||||
android:fillColor="@color/yellow_800"
|
||||
android:pathData="@string/pd_star"/>
|
||||
|
||||
</vector>
|
||||
@@ -56,6 +56,7 @@
|
||||
android:paddingRight="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/gallery_slider_background"
|
||||
android:fitsSystemWindows="true"
|
||||
android:visibility="invisible">
|
||||
|
||||
<TextView
|
||||
@@ -65,12 +66,18 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
<com.hippo.ehviewer.widget.ReversibleSeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
<FrameLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.hippo.ehviewer.widget.ReversibleSeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/right"
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
</FrameLayout>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<com.hippo.easyrecyclerview.EasyRecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="@dimen/abc_dialog_padding_top_material"
|
||||
android:paddingBottom="@dimen/abc_dialog_padding_top_material"
|
||||
style="@style/Indicating"/>
|
||||
@@ -29,6 +29,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/colorAccent"/>
|
||||
android:textColor="?attr/colorAccent"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -31,7 +31,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/colorPrimary"/>
|
||||
android:background="?attr/colorPrimary"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
@@ -150,7 +150,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/read"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -88,6 +88,6 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/more_information"
|
||||
android:textColor="@color/colorAccent"/>
|
||||
android:textColor="?attr/colorAccent"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -38,6 +38,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/colorAccent"/>
|
||||
android:textColor="?attr/colorAccent"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -28,7 +28,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:text="@string/no_tags"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -70,44 +70,29 @@
|
||||
android:textColor="@android:color/white"
|
||||
android:textAllCaps="true"/>
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/actions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/thumb"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginRight="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/v_play_x24"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/stop"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/v_pause_x24"/>
|
||||
|
||||
</FrameLayout>
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/delete"
|
||||
android:id="@+id/start"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/v_close_x24"/>
|
||||
app:srcCompat="@drawable/v_play_x24"/>
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/stop"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="8dp"
|
||||
app:srcCompat="@drawable/v_pause_x24"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/state"
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2015 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="?attr/dialogPreferredPadding"
|
||||
android:paddingRight="?attr/dialogPreferredPadding">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/key"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textColor="@color/primary_text_light"
|
||||
android:padding="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/primary_text_light"
|
||||
android:padding="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="?attr/dialogPreferredPadding"
|
||||
android:paddingRight="?attr/dialogPreferredPadding">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/key"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textColor="@color/secondary_text_light"
|
||||
android:padding="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/secondary_text_light"
|
||||
android:padding="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -57,33 +57,36 @@
|
||||
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cancel"
|
||||
style="@style/CardButton"
|
||||
<Button
|
||||
android:id="@+id/reject"
|
||||
style="?attr/buttonBarNegativeButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@android:string/cancel"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_purple_2dp"/>
|
||||
android:textStyle="bold"
|
||||
android:text="@string/reject"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ok"
|
||||
style="@style/CardButton"
|
||||
<Button
|
||||
android:id="@+id/accept"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@android:string/ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_teal_2dp"/>
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/accept"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
@@ -15,99 +15,120 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<ScrollView
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/login_form"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
android:padding="@dimen/keyline_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<ImageView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="@dimen/keyline_margin"
|
||||
app:srcCompat="@drawable/v_cookie_brown_x48"/>
|
||||
|
||||
<com.hippo.widget.MaxSizeContainer
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:maxWidth="@dimen/single_max_width">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/keyline_margin"
|
||||
android:paddingBottom="@dimen/keyline_margin"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cookie_explain"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/text_little_small"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/ipb_member_id_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/keyline_margin"
|
||||
android:minWidth="@dimen/single_max_width">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/ipb_member_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="ipb_member_id"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
tools:ignore="HardcodedText"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/ipb_pass_hash_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:minWidth="@dimen/single_max_width">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/ipb_pass_hash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="ipb_pass_hash"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
tools:ignore="HardcodedText"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/keyline_margin"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<ImageView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="@dimen/keyline_margin"
|
||||
app:srcCompat="@drawable/v_cookie_brown_x48"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cookie_explain"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/text_little_small"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/ipb_member_id_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/keyline_margin"
|
||||
android:minWidth="@dimen/single_max_width">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/ipb_member_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="ipb_member_id"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/ipb_pass_hash_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:minWidth="@dimen/single_max_width">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/ipb_pass_hash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="ipb_pass_hash"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="wrap_content"
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<Button
|
||||
android:id="@+id/ok"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:layout_weight="1"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@android:string/ok"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ok"
|
||||
style="@style/CardButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@android:string/ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_teal_2dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
@@ -57,33 +57,36 @@
|
||||
</ScrollView>
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<TextView
|
||||
<Button
|
||||
android:id="@+id/cancel"
|
||||
style="@style/CardButton"
|
||||
style="?attr/buttonBarNegativeButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@android:string/cancel"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_purple_2dp"/>
|
||||
android:textStyle="bold"
|
||||
android:text="@android:string/cancel"/>
|
||||
|
||||
<TextView
|
||||
<Button
|
||||
android:id="@+id/send"
|
||||
style="@style/CardButton"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@string/send"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_teal_2dp"/>
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/send"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
@@ -85,7 +85,7 @@
|
||||
style="@style/Widget.Design.FloatingActionButton.Mini"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/v_close_dark_x24"
|
||||
app:srcCompat="@drawable/v_delete_dark_x24"
|
||||
app:backgroundTint="?attr/colorPrimary"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/colorPrimary">
|
||||
android:background="?attr/colorPrimary">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_text"
|
||||
@@ -65,13 +65,16 @@
|
||||
android:layout_weight="1"
|
||||
android:minHeight="56dp"
|
||||
android:maxHeight="112dp"
|
||||
android:gravity="left|top"
|
||||
android:gravity="left|center_vertical"
|
||||
android:background="@null"
|
||||
android:padding="@dimen/keyline_margin"
|
||||
android:inputType="textMultiLine"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/send"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:padding="16dp"
|
||||
app:srcCompat="@drawable/v_send_dark_x24"/>
|
||||
|
||||
|
||||
@@ -41,18 +41,49 @@
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<com.hippo.widget.FabLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/fab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingRight="@dimen/corner_fab_margin"
|
||||
android:paddingBottom="@dimen/corner_fab_margin">
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/v_go_to_dark_x24"
|
||||
app:backgroundTint="?attr/colorPrimary"
|
||||
style="@style/Widget.Design.FloatingActionButton.Mini"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/v_refresh_dark_x24"
|
||||
app:backgroundTint="?attr/colorPrimary"
|
||||
style="@style/Widget.Design.FloatingActionButton.Mini"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Design.FloatingActionButton"/>
|
||||
|
||||
</com.hippo.widget.FabLayout>
|
||||
|
||||
<com.hippo.widget.FabLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingRight="@dimen/corner_fab_margin"
|
||||
android:paddingBottom="@dimen/corner_fab_margin">
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/search_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/v_magnify_dark_x24"
|
||||
android:visibility="invisible"
|
||||
android:scaleX="0"
|
||||
android:scaleY="0"
|
||||
style="@style/Widget.Design.FloatingActionButton"/>
|
||||
|
||||
</com.hippo.widget.FabLayout>
|
||||
|
||||
@@ -83,34 +83,38 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<TextView
|
||||
<Button
|
||||
android:id="@+id/register"
|
||||
style="@style/CardButton"
|
||||
style="?attr/buttonBarNegativeButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@string/register"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_purple_2dp"/>
|
||||
android:textStyle="bold"
|
||||
android:text="@string/register"/>
|
||||
|
||||
<TextView
|
||||
<Button
|
||||
android:id="@+id/sign_in"
|
||||
style="@style/CardButton"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@string/sign_in"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_teal_2dp"/>
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/sign_in"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sign_in_via_webview"
|
||||
|
||||
@@ -22,83 +22,102 @@
|
||||
android:padding="@dimen/keyline_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
<com.hippo.widget.MaxSizeContainer
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:maxWidth="@dimen/single_max_width">
|
||||
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:text="@string/select_scene"/>
|
||||
android:orientation="vertical">
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="24dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/site_e"
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/site_e"/>
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:text="@string/select_scene"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/site_ex"
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/site_ex"/>
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="@dimen/keyline_margin">
|
||||
|
||||
</RadioGroup>
|
||||
<RadioButton
|
||||
android:id="@+id/site_e"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/keyline_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="@dimen/text_medium"
|
||||
android:text="@string/site_e"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
<RadioButton
|
||||
android:id="@+id/site_ex"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="@dimen/text_medium"
|
||||
android:text="@string/site_ex"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/select_scene_explain"/>
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/select_scene_explain"/>
|
||||
|
||||
<LinearLayout
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
<Button
|
||||
android:id="@+id/ok"
|
||||
style="@style/CardButton"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@android:string/ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_teal_2dp"/>
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@android:string/ok"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
@@ -56,32 +56,36 @@
|
||||
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cancel"
|
||||
style="@style/CardButton"
|
||||
<Button
|
||||
android:id="@+id/reject"
|
||||
style="?attr/buttonBarNegativeButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@android:string/cancel"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_purple_2dp"/>
|
||||
android:textStyle="bold"
|
||||
android:text="@string/reject"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ok"
|
||||
style="@style/CardButton"
|
||||
<Button
|
||||
android:id="@+id/accept"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="@dimen/keyline_margin"
|
||||
android:text="@android:string/ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:background="@drawable/card_teal_2dp"/>
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/accept"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
@@ -15,7 +15,7 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<transitionSet>
|
||||
<changeTransform/>
|
||||
<changeBounds/>
|
||||
</transitionSet>
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<string name="default_display_name">Little Hippo</string>
|
||||
|
||||
<string name="cookie_explain">Cookie 是存储在浏览器里的一小块数据。如果您不清楚 Cookie 什么或者怎么获取 Cookie,最好搜索一下。\n\n可以通过输入特定的 Cookie 来登陆。</string>
|
||||
<string name="cookie_explain">Cookie 是存储在浏览器里的一小块数据。如果您不清楚 Cookie 什么或者怎么获取 Cookie,最好搜索一下。\n\n请输入特定的 Cookie 来登陆。</string>
|
||||
<string name="text_is_empty">文本为空</string>
|
||||
<string name="waring">警告</string>
|
||||
<string name="wrong_cookie_warning">看起来您输入的 Cookie 是错误的,最好检查一下。</string>
|
||||
@@ -69,11 +69,12 @@
|
||||
<string name="error_509">509</string>
|
||||
<string name="error_invalid_url">无效链接</string>
|
||||
<string name="error_get_ptoken_error">获取 pToken 错误</string>
|
||||
<string name="error_invalid_specify_gallery">指定画廊的关键字应该看起来像 \"618395 0439fa3666\"</string>
|
||||
<string name="error_invalid_specify_gallery">指定画廊的关键字应该看起来像 “618395 0439fa3666”</string>
|
||||
<string name="error_cant_create_temp_file">无法创建临时文件</string>
|
||||
<string name="error_cant_save_image">无法保存图片</string>
|
||||
<string name="error_invalid_number">非法数字</string>
|
||||
|
||||
<string name="app_waring">本应用中内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。本应用作者不会对由本应用造成的后果负责。您是否愿意继续使用该应用?</string>
|
||||
<string name="app_waring">本应用中内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。本应用作者不会对由本应用造成的任何后果负责。</string>
|
||||
<string name="error_username_cannot_empty">用户名不可为空</string>
|
||||
<string name="error_password_cannot_empty">密码不可为空</string>
|
||||
<string name="skip_signing_in">跳过登陆</string>
|
||||
@@ -85,6 +86,8 @@
|
||||
<string name="you_rejected_me">好痛</string>
|
||||
<string name="analytics_explain">您同意让开发者收集您的设备信息与使用情况吗?这将对开发有很大帮助。<br><br>数据统计服务由 Google Analytics 提供,其隐私政策可在 <a href="https://www.google.com/policies/privacy/">https://www.google.com/policies/privacy/</a> 查看。<br><br>若您同意参与数据统计,您的设备信息与应用使用情况将会被记录,其包括但不限于:Android API 版本、设备型号、语言所在地、本应用版本号、会话时长、应用功能使用次数。开发者承诺以下信息并不会被记录:电话号码、电子邮件地址、IMEI。<br><br>在您同意参与数据统计之前,您的信息不会被记录。<br><br>被记录的数据会由 Google Analytics 进行分析,分析报表仅可被本应用开发者访问。</string>
|
||||
<string name="get_it">知道了</string>
|
||||
<string name="accept">接受</string>
|
||||
<string name="reject">拒绝</string>
|
||||
|
||||
<!-- Crash -->
|
||||
<string name="send">发送</string>
|
||||
@@ -101,7 +104,8 @@
|
||||
<string name="update_to_date">EhViewer 已是最新版本</string>
|
||||
|
||||
<!-- Gallery List -->
|
||||
<string name="gallery_list_search_bar_hint">搜索 ExHentai</string>
|
||||
<string name="gallery_list_search_bar_hint_exhentai">搜索 ExHentai</string>
|
||||
<string name="gallery_list_search_bar_hint_e_hentai">搜索 E-Hentai</string>
|
||||
<string name="gallery_list_empty_hit">什么都没有找到</string>
|
||||
|
||||
<string name="search">搜索</string>
|
||||
@@ -139,6 +143,10 @@
|
||||
<string name="no_quick_search">这里是快速搜索</string>
|
||||
<string name="add_quick_search_tip">画廊列表的状态将被保存为快速搜索。如果你想保存搜索面板的状态,请先执行搜索。</string>
|
||||
<string name="readme">读我</string>
|
||||
<string name="duplicate_quick_search">已存在相同的快速搜索,名称为“%s”。</string>
|
||||
<string name="duplicate_name">已存在相同名称</string>
|
||||
|
||||
<string name="go_to_hint">第 %1$d 页,共 %2$d 页</string>
|
||||
|
||||
<!-- search_min_rating -->
|
||||
<string name="star_2">2 星</string>
|
||||
@@ -182,10 +190,8 @@
|
||||
<string name="remove_from_favorite_success">移除收藏</string>
|
||||
<string name="add_to_favorite_failure">添加收藏失败</string>
|
||||
<string name="remove_from_favorite_failure">移除收藏失败</string>
|
||||
<string name="block_the_uploader">屏蔽上传者:%s?</string>
|
||||
<string name="block_the_tag">屏蔽标签:%s?</string>
|
||||
<string name="uploader_blocked">已屏蔽上传者 \"%s\"</string>
|
||||
<string name="tag_blocked">已屏蔽标签 \"%s\"</string>
|
||||
<string name="block_the_uploader">添加上传者过滤项“%s”?</string>
|
||||
<string name="filter_added">已添加过滤项</string>
|
||||
|
||||
<!-- Rating -->
|
||||
<string name="rating10">根本把持不住</string>
|
||||
@@ -219,10 +225,9 @@
|
||||
<string name="key_language">语言</string>
|
||||
<string name="key_pages">页数</string>
|
||||
<string name="key_size">大小</string>
|
||||
<string name="key_resize">压缩情况</string>
|
||||
<string name="key_favorites">收藏次数</string>
|
||||
<string name="key_favorite_count">收藏次数</string>
|
||||
<string name="key_favorited">收藏</string>
|
||||
<string name="key_rates">评价次数</string>
|
||||
<string name="key_rating_count">评价次数</string>
|
||||
<string name="key_rating">评分</string>
|
||||
<string name="key_torrents">种子个数</string>
|
||||
<string name="key_torrent_url">种子</string>
|
||||
@@ -283,9 +288,6 @@
|
||||
<string name="rename_label_title">重命名标签</string>
|
||||
<string name="delete_label_title">删除标签</string>
|
||||
<string name="delete_label_message">删除“%s”?</string>
|
||||
<string name="tip">提示</string>
|
||||
<string name="add_filter">添加过滤项</string>
|
||||
<string name="filter_text">过滤项文本</string>
|
||||
|
||||
<!-- History -->
|
||||
<string name="no_history">这里是阅读历史</string>
|
||||
@@ -298,11 +300,16 @@
|
||||
<string name="filter_title">标题</string>
|
||||
<string name="filter_uploader">上传者</string>
|
||||
<string name="filter_tag">标签</string>
|
||||
<string name="delete_title_filter">删除标题过滤项:%s?</string>
|
||||
<string name="delete_uploader_filter">删除上传者过滤项:%s?</string>
|
||||
<string name="delete_tag_filter">删除标签过滤项:%s?</string>
|
||||
<string name="delete_filter">删除过滤项:%s?</string>
|
||||
<string name="filter_tip">标题过滤项:排除标题含有该关键字的画廊。\n\n上传者过滤项:排除该上传者上传的画廊。\n\n标签过滤项:排除包含该关键字的画廊,这会使获取画廊列表花费更多时间。</string>
|
||||
<string name="filter_tag_namespace">标签组</string>
|
||||
<string name="delete_title_filter">删除标题过滤项“%s”?</string>
|
||||
<string name="delete_uploader_filter">删除上传者过滤项“%s”?</string>
|
||||
<string name="delete_tag_filter">删除标签过滤项“%s”?</string>
|
||||
<string name="delete_filter">删除过滤项“%s”?</string>
|
||||
<string name="tip">提示</string>
|
||||
<string name="add_filter">添加过滤项</string>
|
||||
<string name="show_definition">查看定义</string>
|
||||
<string name="filter_text">过滤项文本</string>
|
||||
<string name="filter_tip">标题过滤项:排除标题含有该关键字的画廊。\n\n上传者过滤项:排除该上传者上传的画廊。\n\n标签过滤项:排除包含该标签的画廊,这会使获取画廊列表花费更多时间。\n\n标签组过滤项:排除包含该标签组的画廊,这会使获取画廊列表花费更多时间。</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">设置图案保护</string>
|
||||
@@ -343,7 +350,7 @@
|
||||
<string name="settings_eh_show_jpn_title_summary_on">尝试显示日文标题。这会使获取画廊列表花费更多时间</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_off">显示默认标题。一般是英文标题</string>
|
||||
<string name="settings_eh_filter">过滤</string>
|
||||
<string name="settings_eh_filter_summary">过滤标题,上传者和标签</string>
|
||||
<string name="settings_eh_filter_summary">过滤标题,上传者,标签和标签组</string>
|
||||
|
||||
<string name="settings_read">阅读</string>
|
||||
<string name="settings_read_reading_direction_title">阅读方向</string>
|
||||
@@ -372,7 +379,7 @@
|
||||
<string name="settings_download_invalid_download_location">无效的下载路径</string>
|
||||
<string name="settings_download_cant_get_download_location">无法获取下载路径</string>
|
||||
<string name="settings_download_pick_dir_kk">在 KitKat 中您无法把数据写入外置 SD 卡,除非您做了奇怪的事情</string>
|
||||
<string name="settings_download_pick_dir_l">Lollipop 提供了新的写入外置 SD 卡的 API。如果您想把下载路径设置到外置 SD 卡上,点击 \"文档\" 按钮</string>
|
||||
<string name="settings_download_pick_dir_l">Lollipop 提供了新的写入外置 SD 卡的 API。如果您想把下载路径设置到外置 SD 卡上,点击“文档”按钮</string>
|
||||
<string name="settings_download_document">文档</string>
|
||||
<string name="settings_download_restore_download_items">恢复下载项</string>
|
||||
<string name="settings_download_restore_download_items_summary">恢复下载目录里的所有下载项</string>
|
||||
@@ -380,6 +387,8 @@
|
||||
<string name="settings_download_multi_thread_download_summary">最多同时下载 %s 张图片</string>
|
||||
<string name="settings_download_preload_image">预载图片</string>
|
||||
<string name="settings_download_preload_image_summary">向后预载 %s 张图片</string>
|
||||
<string name="settings_download_download_origin_image">下载原图</string>
|
||||
<string name="settings_download_download_origin_image_summary">这很危险!勾选此项会导致下载配额迅速流失</string>
|
||||
<string name="settings_download_restoring">恢复中</string>
|
||||
<string name="settings_download_restore_not_found">未找到可恢复下载项</string>
|
||||
<string name="settings_download_restore_failed">恢复失败</string>
|
||||
@@ -400,6 +409,13 @@
|
||||
<string name="settings_advanced_pattern_protection_title">图案保护</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">未设置图案保护</string>
|
||||
<string name="settings_advanced_pattern_protection_set">已设置图案保护</string>
|
||||
<string name="settings_advanced_export_data">导出数据</string>
|
||||
<string name="settings_advanced_export_data_summary">保存数据至外置存储器,例如下载列表,快速搜索列表</string>
|
||||
<string name="settings_advanced_export_data_to">已导出数据至 %s</string>
|
||||
<string name="settings_advanced_export_data_failed">导出数据失败</string>
|
||||
<string name="settings_advanced_import_data">导入数据</string>
|
||||
<string name="settings_advanced_import_data_summary">从置存储器已导出的数据</string>
|
||||
<string name="settings_advanced_import_data_successfully">导入数据成功</string>
|
||||
|
||||
<string name="settings_about">关于</string>
|
||||
<string name="settings_about_author">作者</string>
|
||||
@@ -454,6 +470,10 @@
|
||||
<string name="domain_not_supported">不支持域名</string>
|
||||
<string name="invalid_port">无效的端口</string>
|
||||
|
||||
<string name="cant_get_data_dir">无法获取数据文件夹</string>
|
||||
<string name="cant_find_any_data">找不到任何数据</string>
|
||||
<string name="cant_read_the_file">无法读取文件</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="license">开源许可</string>
|
||||
|
||||
@@ -474,6 +494,8 @@
|
||||
<string name="let_me_select">让我选择</string>
|
||||
<string name="favorites_info">收藏信息</string>
|
||||
<string name="collections">收藏夹</string>
|
||||
<string name="count">数量</string>
|
||||
<string name="need_sign_in">需要登录</string>
|
||||
|
||||
<!-- Progress Scene -->
|
||||
<string name="error_something_wrong_happened">被玩坏了</string>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<string name="default_display_name">Little Hippo</string>
|
||||
|
||||
<string name="cookie_explain">Cookie 是存儲在瀏覽器裏的一小塊數據。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜索一下。\n\n可以通過輸入特定的 Cookie 來登陸。</string>
|
||||
<string name="cookie_explain">Cookie 是存儲在瀏覽器裏的一小塊數據。如果您不清楚 Cookie 什麼或者怎麼獲取 Cookie,最好搜索一下。\n\n請輸入特定的 Cookie 來登陸。</string>
|
||||
<string name="text_is_empty">文本為空</string>
|
||||
<string name="waring">警告</string>
|
||||
<string name="wrong_cookie_warning">看起來您輸入的 Cookie 是錯誤的,最好檢查一下。</string>
|
||||
@@ -69,11 +69,12 @@
|
||||
<string name="error_509">509</string>
|
||||
<string name="error_invalid_url">無效鏈接</string>
|
||||
<string name="error_get_ptoken_error">獲取 pToken 錯誤</string>
|
||||
<string name="error_invalid_specify_gallery">指定畫廊的關鍵字應該看起來像 \"618395 0439fa3666\"</string>
|
||||
<string name="error_invalid_specify_gallery">指定畫廊的關鍵字應該看起來像 “618395 0439fa3666”</string>
|
||||
<string name="error_cant_create_temp_file">無法創建臨時文件</string>
|
||||
<string name="error_cant_save_image">無法保存圖片</string>
|
||||
<string name="error_invalid_number">非法數字</string>
|
||||
|
||||
<string name="app_waring">本應用中內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的後果負責。您是否願意繼續使用該應用?</string>
|
||||
<string name="app_waring">本應用中內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。</string>
|
||||
<string name="error_username_cannot_empty">用户名不可為空</string>
|
||||
<string name="error_password_cannot_empty">密碼不可為空</string>
|
||||
<string name="skip_signing_in">跳過登陸</string>
|
||||
@@ -85,6 +86,8 @@
|
||||
<string name="you_rejected_me">好痛</string>
|
||||
<string name="analytics_explain">您同意讓開發者收集您的設備信息與使用情況嗎?這將對開發有很大幫助。<br><br>數據統計服務由 Google Analytics 提供,其隱私政策可在 <a href="https://www.google.com/policies/privacy/">https://www.google.com/policies/privacy/</a> 查看。<br><br>若您同意參與數據統計,您的設備信息與應用使用情況將會被記錄,其包括但不限於:Android API 版本、設備型號、語言所在地、本應用版本號、會話時長、應用功能使用次數。開發者承諾以下信息並不會被記錄:電話號碼、電子郵件地址、IMEI。<br><br>在您同意參與數據統計之前,您的信息不會被記錄。<br><br>被記錄的數據會由 Google Analytics 進行分析,分析報表僅可被本應用開發者訪問。</string>
|
||||
<string name="get_it">知道了</string>
|
||||
<string name="accept">接受</string>
|
||||
<string name="reject">拒絕</string>
|
||||
|
||||
<!-- Crash -->
|
||||
<string name="send">發送</string>
|
||||
@@ -101,7 +104,8 @@
|
||||
<string name="update_to_date">EhViewer 已是最新版本</string>
|
||||
|
||||
<!-- Gallery List -->
|
||||
<string name="gallery_list_search_bar_hint">搜索 ExHentai</string>
|
||||
<string name="gallery_list_search_bar_hint_exhentai">搜索 ExHentai</string>
|
||||
<string name="gallery_list_search_bar_hint_e_hentai">搜索 E-Hentai</string>
|
||||
<string name="gallery_list_empty_hit">什麼都沒有找到</string>
|
||||
|
||||
<string name="search">搜索</string>
|
||||
@@ -139,6 +143,10 @@
|
||||
<string name="no_quick_search">這裏是快速搜索</string>
|
||||
<string name="add_quick_search_tip">畫廊列表的狀態將被保存為快速搜索。如果你想保存搜索面板的狀態,請先執行搜索。</string>
|
||||
<string name="readme">讀我</string>
|
||||
<string name="duplicate_quick_search">已存在相同的快速搜索,名稱為“%s”。</string>
|
||||
<string name="duplicate_name">已存在相同名稱</string>
|
||||
|
||||
<string name="go_to_hint">第 %1$d 頁,共 %2$d 頁</string>
|
||||
|
||||
<!-- search_min_rating -->
|
||||
<string name="star_2">2 星</string>
|
||||
@@ -182,10 +190,8 @@
|
||||
<string name="remove_from_favorite_success">移除收藏</string>
|
||||
<string name="add_to_favorite_failure">添加收藏失敗</string>
|
||||
<string name="remove_from_favorite_failure">移除收藏失敗</string>
|
||||
<string name="block_the_uploader">屏蔽上傳者:%s?</string>
|
||||
<string name="block_the_tag">屏蔽標籤:%s?</string>
|
||||
<string name="uploader_blocked">已屏蔽上傳者 \"%s\"</string>
|
||||
<string name="tag_blocked">已屏蔽標籤 \"%s\"</string>
|
||||
<string name="block_the_uploader">添加上傳者過濾項“%s”?</string>
|
||||
<string name="filter_added">已添加過濾項</string>
|
||||
|
||||
<!-- Rating -->
|
||||
<string name="rating10">根本把持不住</string>
|
||||
@@ -219,10 +225,9 @@
|
||||
<string name="key_language">語言</string>
|
||||
<string name="key_pages">頁數</string>
|
||||
<string name="key_size">大小</string>
|
||||
<string name="key_resize">壓縮情況</string>
|
||||
<string name="key_favorites">收藏次數</string>
|
||||
<string name="key_favorite_count">收藏次數</string>
|
||||
<string name="key_favorited">收藏</string>
|
||||
<string name="key_rates">評價次數</string>
|
||||
<string name="key_rating_count">評價次數</string>
|
||||
<string name="key_rating">評分</string>
|
||||
<string name="key_torrents">種子個數</string>
|
||||
<string name="key_torrent_url">種子</string>
|
||||
@@ -283,9 +288,6 @@
|
||||
<string name="rename_label_title">重命名標籤</string>
|
||||
<string name="delete_label_title">刪除標籤</string>
|
||||
<string name="delete_label_message">刪除“%s”?</string>
|
||||
<string name="tip">提示</string>
|
||||
<string name="add_filter">添加過濾項</string>
|
||||
<string name="filter_text">過濾項文本</string>
|
||||
|
||||
<!-- History -->
|
||||
<string name="no_history">這裏是閲讀歷史</string>
|
||||
@@ -298,11 +300,16 @@
|
||||
<string name="filter_title">標題</string>
|
||||
<string name="filter_uploader">上傳者</string>
|
||||
<string name="filter_tag">標籤</string>
|
||||
<string name="delete_title_filter">刪除標題過濾項:%s?</string>
|
||||
<string name="delete_uploader_filter">刪除上傳者過濾項:%s?</string>
|
||||
<string name="delete_tag_filter">刪除標籤過濾項:%s?</string>
|
||||
<string name="delete_filter">刪除過濾項:%s?</string>
|
||||
<string name="filter_tip">標題過濾項:排除標題含有該關鍵字的畫廊。\n\n上傳者過濾項:排除該上傳者上傳的畫廊。\n\n標籤過濾項:排除包含該關鍵字的畫廊,這會使獲取畫廊列表花費更多時間。</string>
|
||||
<string name="filter_tag_namespace">標籤組</string>
|
||||
<string name="delete_title_filter">刪除標題過濾項“%s”?</string>
|
||||
<string name="delete_uploader_filter">刪除上傳者過濾項“%s”?</string>
|
||||
<string name="delete_tag_filter">刪除標籤過濾項“%s”?</string>
|
||||
<string name="delete_filter">刪除過濾項“%s”?</string>
|
||||
<string name="tip">提示</string>
|
||||
<string name="add_filter">添加過濾項</string>
|
||||
<string name="show_definition">查看定義</string>
|
||||
<string name="filter_text">過濾項文本</string>
|
||||
<string name="filter_tip">標題過濾項:排除標題含有該關鍵字的畫廊。\n\n上傳者過濾項:排除該上傳者上傳的畫廊。\n\n標籤過濾項:排除包含該標籤的畫廊,這會使獲取畫廊列表花費更多時間。\n\n標籤組過濾項:排除包含該標籤組的畫廊,這會使獲取畫廊列表花費更多時間。</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">設置圖案保護</string>
|
||||
@@ -343,7 +350,7 @@
|
||||
<string name="settings_eh_show_jpn_title_summary_on">嘗試顯示日文標題。這會使獲取畫廊列表花費更多時間</string>
|
||||
<string name="settings_eh_show_jpn_title_summary_off">顯示默認標題。一般是英文標題</string>
|
||||
<string name="settings_eh_filter">過濾</string>
|
||||
<string name="settings_eh_filter_summary">過濾標題,上傳者和標籤</string>
|
||||
<string name="settings_eh_filter_summary">過濾標題,上傳者,標籤和標籤組</string>
|
||||
|
||||
<string name="settings_read">閲讀</string>
|
||||
<string name="settings_read_reading_direction_title">閲讀方向</string>
|
||||
@@ -372,7 +379,7 @@
|
||||
<string name="settings_download_invalid_download_location">無效的下載路徑</string>
|
||||
<string name="settings_download_cant_get_download_location">無法獲取下載路徑</string>
|
||||
<string name="settings_download_pick_dir_kk">在 KitKat 中您無法把數據寫入外置 SD 卡,除非您做了奇怪的事情</string>
|
||||
<string name="settings_download_pick_dir_l">Lollipop 提供了新的寫入外置 SD 卡的 API。如果您想把下載路徑設置到外置 SD 卡上,點擊 \"文檔\" 按鈕</string>
|
||||
<string name="settings_download_pick_dir_l">Lollipop 提供了新的寫入外置 SD 卡的 API。如果您想把下載路徑設置到外置 SD 卡上,點擊“文檔”按鈕</string>
|
||||
<string name="settings_download_document">文檔</string>
|
||||
<string name="settings_download_restore_download_items">恢復下載項</string>
|
||||
<string name="settings_download_restore_download_items_summary">恢復下載目錄裏的所有下載項</string>
|
||||
@@ -380,6 +387,8 @@
|
||||
<string name="settings_download_multi_thread_download_summary">最多同時下載 %s 張圖片</string>
|
||||
<string name="settings_download_preload_image">預載圖片</string>
|
||||
<string name="settings_download_preload_image_summary">向後預載 %s 張圖片</string>
|
||||
<string name="settings_download_download_origin_image">下載原圖</string>
|
||||
<string name="settings_download_download_origin_image_summary">這很危險!勾選此項會導致下載配額迅速流失</string>
|
||||
<string name="settings_download_restoring">恢復中</string>
|
||||
<string name="settings_download_restore_not_found">未找到可恢復下載項</string>
|
||||
<string name="settings_download_restore_failed">恢復失敗</string>
|
||||
@@ -400,6 +409,13 @@
|
||||
<string name="settings_advanced_pattern_protection_title">圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">未設置圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_set">已設置圖案保護</string>
|
||||
<string name="settings_advanced_export_data">導出數據</string>
|
||||
<string name="settings_advanced_export_data_summary">保存數據至外置存儲器,例如下載列表,快速搜索列表</string>
|
||||
<string name="settings_advanced_export_data_to">已導出數據至 %s</string>
|
||||
<string name="settings_advanced_export_data_failed">導出數據失敗</string>
|
||||
<string name="settings_advanced_import_data">導入數據</string>
|
||||
<string name="settings_advanced_import_data_summary">從置存儲器已導出的數據</string>
|
||||
<string name="settings_advanced_import_data_successfully">導入數據成功</string>
|
||||
|
||||
<string name="settings_about">關於</string>
|
||||
<string name="settings_about_author">作者</string>
|
||||
@@ -454,6 +470,10 @@
|
||||
<string name="domain_not_supported">不支持域名</string>
|
||||
<string name="invalid_port">無效的端口</string>
|
||||
|
||||
<string name="cant_get_data_dir">無法獲取數據文件夾</string>
|
||||
<string name="cant_find_any_data">找不到任何數據</string>
|
||||
<string name="cant_read_the_file">無法讀取文件</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="license">開源許可</string>
|
||||
|
||||
@@ -474,6 +494,8 @@
|
||||
<string name="let_me_select">讓我選擇</string>
|
||||
<string name="favorites_info">收藏信息</string>
|
||||
<string name="collections">收藏夾</string>
|
||||
<string name="count">數量</string>
|
||||
<string name="need_sign_in">需要登錄</string>
|
||||
|
||||
<!-- Progress Scene -->
|
||||
<string name="error_something_wrong_happened">被玩壞了</string>
|
||||
|
||||