Compare commits

...
89 Commits
Author SHA1 Message Date
seven332 a472d0509a 1.2.0 2018-10-25 20:08:37 +08:00
seven332 3f71a97cbd Change colorEdgeEffect 2018-10-25 19:26:06 +08:00
seven332 ed8c818d4f Adjust dark theme color 2018-10-25 18:40:27 +08:00
seven332 1db14cd998 Parse gallery list in thumbnail view 2018-10-25 16:02:04 +08:00
seven332 d06dd87ff4 Adjust text color 2018-10-25 14:32:26 +08:00
seven332 a31a64efd6 Revert textColor of ButtonInCard 2018-10-25 14:14:18 +08:00
seven332 cfa87a5a02 Adjust text color 2018-10-25 14:00:03 +08:00
seven332 2833691c34 Adjust text color 2018-10-25 13:37:25 +08:00
seven332 22d6ed8c39 Revert colorPrimary and colorAccent 2018-10-24 19:05:29 +08:00
seven332 110bae7cb7 Adjust progress view color 2018-10-22 13:45:15 +08:00
seven332 5bd7d6fae3 Adjust gallery detail header button background color 2018-10-22 13:35:59 +08:00
seven332 afa45fd8d9 Change black colorPrimary and colorAccent to grey_700 2018-10-22 13:08:16 +08:00
seven332 2c544607ec Add tagGroupBackgroundColor and tagBackgroundColor attribute 2018-10-22 13:05:38 +08:00
seven332 730b52d6cd Fix RatingBar color 2018-10-20 01:45:54 +08:00
seven332 0704579d26 Adjust card elevation 2018-10-20 01:41:20 +08:00
seven332 cb92fbad3d Don't finish the activity in second level of SettingsActivity 2018-10-19 23:07:45 +08:00
seven332 c7c6f8f706 Disable right swipe of HistoryScene 2018-10-19 23:04:06 +08:00
seven332 fdd81e21b1 Adjust card color 2018-10-19 22:54:02 +08:00
seven332 1093da6565 Update strings.xml 2018-10-19 22:13:12 +08:00
seven332 c625315a76 Apply theme to GalleryActivity 2018-10-19 22:09:04 +08:00
seven332 1deb4c2d6c Add dark widget color 2018-10-19 21:55:48 +08:00
seven332 9201b9baed Apply theme to dialog background 2018-10-19 21:52:43 +08:00
seven332 557bd9f54b Apply theme to play icon 2018-10-19 21:47:28 +08:00
seven332 0353dbdb27 Add activated color to reactive items 2018-10-19 21:45:13 +08:00
seven332 8b07cf62a9 Yellow RatingBar 2018-10-19 21:12:32 +08:00
seven332 111025cb98 Change colorControlActivated 2018-10-19 20:39:57 +08:00
seven332 b3d9c4c2b9 Apply theme to Security 2018-10-19 20:04:32 +08:00
seven332 f2695b6a2c Apply theme to some drawables 2018-10-19 19:39:52 +08:00
seven332 f6ec40e8ed Revert colorPrimary and colorAccent 2018-10-19 19:19:39 +08:00
seven332 9bc6920448 Add galleryDetailDivider attribute 2018-10-19 19:03:31 +08:00
seven332 abb8483723 Apply theme to Guides 2018-10-19 18:47:53 +08:00
seven332 81eadbb794 Apply theme to image_failed 2018-10-19 18:11:33 +08:00
seven332 22cc32778d Use system image in Html 2018-10-19 16:56:59 +08:00
seven332 c9d432b7c8 Change colorPrimary and colorAccent of dark theme and black theme 2018-10-19 16:48:53 +08:00
seven332 168a1dcfb2 Apply theme to text 2018-10-19 16:39:42 +08:00
seven332 b6718078f2 Add widgetColorThemePrimary and widgetColorThemeAccent attributes 2018-10-19 15:59:59 +08:00
seven332 960a7751ad Apply theme to ShadowLinearLayout 2018-10-19 15:34:22 +08:00
seven332 e5335de859 Apply theme to content color 2018-10-19 15:26:46 +08:00
seven332 1eb960eaf9 Clean theme 2018-10-19 14:57:09 +08:00
seven332 6bc9f0da64 Apply theme to big icons 2018-10-19 14:08:48 +08:00
seven332 f4d986a5bd Rename attributes
colorDivider -> dividerColor
colorToolbar -> toolbarColor
colorDrawablePrimary -> textColorThemeAccent
colorDrawableThemePrimary -> drawableColorPrimary
colorTextThemeAccent -> drawableColorThemePrimary
2018-10-19 13:56:33 +08:00
seven332 9aa22aab34 Apply theme to accent text 2018-10-18 23:08:31 +08:00
seven332 afa839ed0b Rename color drawable attribute
colorDrawableOpposite -> colorDrawablePrimary
colorDrawablePrimary -> colorDrawableThemePrimary
2018-10-18 23:01:57 +08:00
seven332 f2725331fe Fix duplicate clipboard text test 2018-10-18 22:20:55 +08:00
seven332 590963024a Apply theme to Ripple 2018-10-18 22:10:50 +08:00
seven332 1f55977182 Apply theme to the color of comment vote 2018-10-18 21:51:18 +08:00
seven332 4bed3d5b8e Rename colorXXXDrawable to colorDrawableXXX 2018-10-18 21:45:42 +08:00
seven332 7eab4e00e1 Replace @color/primary_text_light with ?android:attr/textColorPrimary 2018-10-18 21:39:28 +08:00
seven332 776813df17 Add colorPrimaryDrawable attribute 2018-10-18 21:36:22 +08:00
seven332 12beeedf29 Rename colorPrimaryDrawable to colorOppositeDrawable 2018-10-18 20:06:11 +08:00
seven332 d0e7f25fd9 Apply theme to AddDeleteDrawable and DrawerArrowDrawable 2018-10-18 19:58:50 +08:00
seven332 ab2a066992 Optimize themes.xml 2018-10-18 18:42:19 +08:00
seven332 596f95e463 Fix toolbarPopupTheme 2018-10-18 16:43:46 +08:00
seven332 79d07f98a8 Change Toolbar popup them 2018-10-18 15:53:42 +08:00
seven332 22ec2e8926 Change Toolbar background color 2018-10-18 15:33:53 +08:00
seven332 bc4d20d0a4 Fix SearchBar animations 2018-10-18 14:44:47 +08:00
seven332 84ed520c1c Change divider color 2018-10-18 14:37:59 +08:00
seven332 34eb6a423a Use CardView instead of card 9 png drawable 2018-10-18 13:28:07 +08:00
seven332 7dc1491c26 Use ?android:attr/windowBackground to draw background 2018-10-18 13:02:25 +08:00
seven332 6ecce9ddc5 Add dark theme and black theme 2018-10-18 12:56:56 +08:00
seven332 029373a8d2 Recreate all activities if theme changed 2018-10-18 12:44:43 +08:00
seven332 e8c06fd876 Add theme setting 2018-10-17 23:07:01 +08:00
seven332 8c9218e8af Use a non-reflect way to change how PreferenceActivity looks
Android P doesn't support invoking hidden API.
2018-10-15 22:31:53 +08:00
jerry855202 f922d41775 Fixed rCN text in rTW
"不允許螢幕抓取" was still rCN, fixed in this commit
2018-10-13 17:59:29 +08:00
seven332 e483105eb2 Android Studio 3.2.0 2018-10-10 18:26:20 +08:00
seven332 9aecb79b17 Calculate height of history item at runtime 2018-10-10 18:25:33 +08:00
seven332 bfc6bf07d9 Calculate height of download item at runtime 2018-10-10 15:51:39 +08:00
seven332 b671999e5a Calculate height of gallery list item at runtime 2018-10-10 13:13:20 +08:00
seven332 3ed2cb329c Remove the link of Google+ Community
Google+ is dying.
2018-10-09 15:20:05 +08:00
seven332 fe9970523f Avoid detecting current gallery 2018-09-23 16:00:30 +08:00
seven332 62944f7b71 Lint on release builds 2018-09-19 20:00:09 +08:00
seven332 a7e1101c87 Statement about about donation 2018-09-19 19:58:40 +08:00
seven332 b79d991b25 Set favoriteName null if isFavorited is false 2018-09-19 16:19:08 +08:00
seven332 10a15fc5cf fix: only update favoriteName after success 2018-09-19 15:50:37 +08:00
Tsukatsuki Kanade 428a5ab20e fix: change favoriteName b4 send request 2018-09-19 15:47:58 +08:00
Tsukatsuki Kanade b3d19d752b fix: update favoriteName after added favorite 2018-09-19 15:47:58 +08:00
Tsukatsuki Kanade 73b702aa56 feat: Add favorite gallery name to scene 2018-09-19 15:47:58 +08:00
hzy980512 3360035402 Fix choices of words 2018-09-18 10:19:26 +08:00
hzy980512 b97069a04e A little fix 2018-09-18 10:19:26 +08:00
hzy980512 9df8d050b2 Add some new translations 2018-09-18 10:19:26 +08:00
hzy980512 ba4ca96b77 Add some translations 2018-09-18 10:19:26 +08:00
hzy980512 fd93baf583 Add some new translations 2018-09-18 10:19:26 +08:00
hzy980512 0a9a1976cd Grammar fix 2018-09-18 10:19:26 +08:00
hzy980512 450e05c819 Make some sentences shorter 2018-09-18 10:19:26 +08:00
hzy980512 59d36d29da Fix some bugs, where quotes break the sentences 2018-09-18 10:19:26 +08:00
seven332 f0cd92f82e Check settings while try showing gallery page count 2018-09-17 11:34:32 +08:00
seven332 e847338ef4 Light background toolbar popup 2018-09-17 00:32:17 +08:00
seven332 23c34258ff Update strings.xml 2018-09-16 23:36:58 +08:00
seven332 d441960107 Update strings.xml 2018-09-16 23:35:53 +08:00
152 changed files with 2087 additions and 1255 deletions

No files matched your search

+7 -4
View File
@@ -8,8 +8,8 @@ android {
applicationId "com.hippo.ehviewer"
minSdkVersion 14
targetSdkVersion 27
versionCode 84
versionName "1.1.0"
versionCode 85
versionName "1.2.0"
vectorDrawables.useSupportLibrary = true
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
"es", "ja", "ko", "fr", "de"
@@ -21,8 +21,9 @@ android {
}
lintOptions {
abortOnError false
checkReleaseBuilds false
disable 'MissingTranslation'
abortOnError true
checkReleaseBuilds true
}
buildTypes {
@@ -61,9 +62,11 @@ clean {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$supportLibrary"
implementation "com.android.support:cardview-v7:$supportLibrary"
implementation "com.android.support:design:$supportLibrary"
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'com.github.seven332:android-recaptcha:2bbb3459a8'
implementation 'com.github.seven332:android-resource:0.1.0'
implementation 'com.github.seven332:animator:0.1.0'
implementation 'com.github.seven332:beerbelly:0.1.4'
implementation 'com.github.seven332:conaco:0.1.5-eh'
+8 -8
View File
@@ -103,48 +103,48 @@
<activity
android:name="com.hippo.ehviewer.ui.SettingsActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme"/>
android:theme="@style/AppTheme.Settings"/>
<activity
android:name="com.hippo.ehviewer.ui.ExcludedLanguagesActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/excluded_languages"/>
<activity
android:name="com.hippo.ehviewer.ui.DirPickerActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/dir_picker"/>
<activity
android:name="com.hippo.ehviewer.ui.LicenseActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/license"/>
<activity
android:name="com.hippo.ehviewer.ui.FilterActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/filter"/>
<activity
android:name="com.hippo.ehviewer.ui.SetSecurityActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/set_pattern_protection"/>
<activity
android:name="com.hippo.ehviewer.ui.UConfigActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/u_config"/>
<activity
android:name="com.hippo.ehviewer.ui.HostsActivity"
android:configChanges="screenSize|uiMode"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme.Toolbar"
android:label="@string/hosts"/>
<activity
@@ -0,0 +1,108 @@
/*
* Copyright 2018 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.app;
import android.content.Context;
import android.preference.PreferenceActivity;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
import com.hippo.ehviewer.R;
import java.util.ArrayList;
import java.util.List;
public abstract class PrettyPreferenceActivity extends AppCompatPreferenceActivity {
@Override
public void setListAdapter(ListAdapter adapter) {
int count = adapter.getCount();
List<PreferenceActivity.Header> headers = new ArrayList<>(count);
for (int i = 0; i < count; ++i) {
headers.add((PreferenceActivity.Header) adapter.getItem(i));
}
super.setListAdapter(new HeaderAdapter(this, headers, R.layout.item_preference_header, true));
}
private static class HeaderAdapter extends ArrayAdapter<PreferenceActivity.Header> {
private static class HeaderViewHolder {
ImageView icon;
TextView title;
TextView summary;
}
private LayoutInflater mInflater;
private int mLayoutResId;
private boolean mRemoveIconIfEmpty;
private HeaderAdapter(Context context, List<PreferenceActivity.Header> objects, int layoutResId,
boolean removeIconBehavior) {
super(context, 0, objects);
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mLayoutResId = layoutResId;
mRemoveIconIfEmpty = removeIconBehavior;
}
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
HeaderViewHolder holder;
View view;
if (convertView == null) {
view = mInflater.inflate(mLayoutResId, parent, false);
holder = new HeaderViewHolder();
holder.icon = view.findViewById(android.R.id.icon);
holder.title = view.findViewById(android.R.id.title);
holder.summary = view.findViewById(android.R.id.summary);
view.setTag(holder);
} else {
view = convertView;
holder = (HeaderViewHolder) view.getTag();
}
// All view fields must be updated every time, because the view may be recycled
PreferenceActivity.Header header = getItem(position);
if (mRemoveIconIfEmpty) {
if (header.iconRes == 0) {
holder.icon.setVisibility(View.GONE);
} else {
holder.icon.setVisibility(View.VISIBLE);
holder.icon.setImageResource(header.iconRes);
}
} else {
holder.icon.setImageResource(header.iconRes);
}
holder.title.setText(header.getTitle(getContext().getResources()));
CharSequence summary = header.getSummary(getContext().getResources());
if (!TextUtils.isEmpty(summary)) {
holder.summary.setVisibility(View.VISIBLE);
holder.summary.setText(summary);
} else {
holder.summary.setVisibility(View.GONE);
}
return view;
}
}
}
@@ -46,13 +46,13 @@ public class AddDeleteDrawable extends Drawable {
/**
* @param context used to get the configuration for the drawable from
*/
public AddDeleteDrawable(Context context) {
public AddDeleteDrawable(Context context, int color) {
Resources resources = context.getResources();
mSize = resources.getDimensionPixelSize(R.dimen.add_size);
float barThickness = Math.round(resources.getDimension(R.dimen.add_thickness));
mPaint.setColor(resources.getColor(R.color.primary_drawable_light));
mPaint.setColor(color);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeJoin(Paint.Join.MITER);
mPaint.setStrokeCap(Paint.Cap.BUTT);
@@ -28,6 +28,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import com.hippo.ehviewer.R;
import com.hippo.yorozuya.MathUtils;
@@ -66,11 +67,11 @@ public class DrawerArrowDrawable extends Drawable {
/**
* @param context used to get the configuration for the drawable from
*/
public DrawerArrowDrawable(Context context) {
public DrawerArrowDrawable(Context context, int color) {
Resources resources = context.getResources();
mPaint.setAntiAlias(true);
mPaint.setColor(resources.getColor(R.color.primary_drawable_light));
mPaint.setColor(color);
mSize = resources.getDimensionPixelSize(R.dimen.dad_drawable_size);
// round this because having this floating may cause bad measurements
mBarSize = Math.round(resources.getDimension(R.dimen.dad_bar_size));
@@ -144,6 +145,11 @@ public class DrawerArrowDrawable extends Drawable {
canvas.restore();
}
public void setColor(@ColorInt int color) {
mPaint.setColor(color);
invalidateSelf();
}
@Override
public void setAlpha(int i) {
mPaint.setAlpha(i);
@@ -237,6 +237,17 @@ public class Settings {
/********************
****** Eh
********************/
public static final String KEY_THEME = "theme";
public static final int THEME_LIGHT = 0;
public static final int THEME_DARK = 1;
public static final int THEME_BLACK = 2;
private static final int DEFAULT_THEME = THEME_LIGHT;
public static int getTheme() {
return getIntFromStr(KEY_THEME, DEFAULT_THEME);
}
public static final String KEY_GALLERY_SITE = "gallery_site";
private static final int DEFAULT_GALLERY_SITE = 1;
@@ -40,6 +40,7 @@ public class GalleryDetail extends GalleryInfo {
public GalleryComment[] comments;
public int previewPages;
public PreviewSet previewSet;
public String favoriteName;
@Override
public int describeContents() {
@@ -64,6 +65,7 @@ public class GalleryDetail extends GalleryInfo {
dest.writeParcelableArray(this.comments, 0);
dest.writeInt(this.previewPages);
dest.writeParcelable(previewSet, flags);
dest.writeString(this.favoriteName);
}
public GalleryDetail() {
@@ -96,6 +98,7 @@ public class GalleryDetail extends GalleryInfo {
}
this.previewPages = in.readInt();
this.previewSet = in.readParcelable(PreviewSet.class.getClassLoader());
this.favoriteName = in.readString();
}
public static final Creator<GalleryDetail> CREATOR = new Creator<GalleryDetail>() {
@@ -227,6 +227,14 @@ public class GalleryDetailParser {
// isFavorited
Element gdf = gm.getElementById("gdf");
gd.isFavorited = null != gdf && !StringUtils.trim(gdf.text()).equals("Add to Favorites");
if (gdf != null) {
final String favoriteName = StringUtils.trim(gdf.text());
if (favoriteName.equals("Add to Favorites")) {
gd.favoriteName = null;
} else {
gd.favoriteName = StringUtils.trim(gdf.text());
}
}
} catch (Exception e) {
throw new ParseException("Can't parse gallery detail", body);
}
@@ -182,6 +182,60 @@ public class GalleryListParser {
return gi;
}
@Nullable
private static GalleryInfo parseGalleryInfoThumbVersion(Element e) {
GalleryInfo gi = new GalleryInfo();
// Title (required)
Element id2 = JsoupUtils.getElementByClass(e, "id2");
if (id2 == null) {
return null;
}
gi.title = id2.text().trim();
// gid, token (required)
Element a = id2.children().first();
if (a == null) {
return null;
}
GalleryDetailUrlParser.Result result = GalleryDetailUrlParser.parse(a.attr("href"));
if (result == null) {
return null;
}
gi.gid = result.gid;
gi.token = result.token;
// Thumbnail
Element id3 = JsoupUtils.getElementByClass(e, "id3");
if (id3 != null) {
a = id3.children().first();
if (a != null) {
Element img = a.children().first();
if (img != null) {
gi.thumb = EhUtils.handleThumbUrlResolution(img.attr("src"));
}
}
}
// Category
Element id41 = JsoupUtils.getElementByClass(e, "id41");
if (id41 != null) {
gi.category = EhUtils.getCategory(id41.attr("title").trim());
} else {
gi.category = EhUtils.UNKNOWN;
}
// Rating
Element id43 = JsoupUtils.getElementByClass(e, "id43");
if (id43 != null) {
gi.rating = NumberUtils.parseFloatSafely(parseRating(id43.attr("style")), -1.0f);
} else {
gi.rating = -1.0f;
}
return gi;
}
public static Result parse(@NonNull String body) throws Exception {
Result result = new Result();
Document d = Jsoup.parse(body);
@@ -213,6 +267,23 @@ public class GalleryListParser {
throw new ParseException("Can't parse gallery list", body);
}
// Maybe it's thumbnail version
if (result.galleryInfoList.isEmpty()) {
try {
Elements es = d.getElementsByClass("itg").first().children();
List<GalleryInfo> list = new ArrayList<>(es.size() - 1);
for (int i = 0; i < es.size(); i++) {
GalleryInfo gi = parseGalleryInfoThumbVersion(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;
}
}
@@ -33,6 +33,7 @@ import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.UrlOpener;
import com.hippo.ehviewer.client.EhClient;
import com.hippo.ehviewer.client.EhRequest;
import com.hippo.ehviewer.client.data.GalleryDetail;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.dao.DownloadLabel;
import com.hippo.ehviewer.download.DownloadManager;
@@ -185,33 +186,31 @@ public final class CommonOperations {
public static void addToFavorites(final Activity activity, final GalleryInfo galleryInfo,
final EhClient.Callback<Void> listener) {
int slot = Settings.getDefaultFavSlot();
String[] items = new String[11];
items[0] = activity.getString(R.string.local_favorites);
String[] favCat = Settings.getFavCat();
System.arraycopy(favCat, 0, items, 1, 10);
if (slot >= -1 && slot <= 9) {
doAddToFavorites(activity, galleryInfo, slot, listener);
String newFavoriteName = slot >= 0 ? items[slot + 1] : null;
doAddToFavorites(activity, galleryInfo, slot, galleryInfo instanceof GalleryDetail
? new UpdateFavoriteNameCallback(listener, (GalleryDetail) galleryInfo, newFavoriteName)
: listener);
} else {
String[] items = new String[11];
items[0] = activity.getString(R.string.local_favorites);
String[] favCat = Settings.getFavCat();
System.arraycopy(favCat, 0, items, 1, 10);
new ListCheckBoxDialogBuilder(activity, items,
new ListCheckBoxDialogBuilder.OnItemClickListener() {
@Override
public void onItemClick(ListCheckBoxDialogBuilder builder, AlertDialog dialog, int position) {
int slot = position - 1;
doAddToFavorites(activity, galleryInfo, slot, listener);
if (builder.isChecked()) {
Settings.putDefaultFavSlot(slot);
} else {
Settings.putDefaultFavSlot(Settings.INVALID_DEFAULT_FAV_SLOT);
}
(builder, dialog, position) -> {
int slot1 = position - 1;
String newFavoriteName = (slot1 >= 0 && slot1 <= 9) ? items[slot1+1] : null;
doAddToFavorites(activity, galleryInfo, slot1, galleryInfo instanceof GalleryDetail
? new UpdateFavoriteNameCallback(listener, (GalleryDetail) galleryInfo, newFavoriteName)
: listener);
if (builder.isChecked()) {
Settings.putDefaultFavSlot(slot1);
} else {
Settings.putDefaultFavSlot(Settings.INVALID_DEFAULT_FAV_SLOT);
}
}, activity.getString(R.string.remember_favorite_collection), false)
.setTitle(R.string.add_favorites_dialog_title)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
listener.onCancel();
}
})
.setOnCancelListener(dialog -> listener.onCancel())
.show();
}
}
@@ -222,10 +221,42 @@ public final class CommonOperations {
EhRequest request = new EhRequest();
request.setMethod(EhClient.METHOD_ADD_FAVORITES);
request.setArgs(galleryInfo.gid, galleryInfo.token, -1, "");
request.setCallback(listener);
request.setCallback(galleryInfo instanceof GalleryDetail
? new UpdateFavoriteNameCallback(listener, (GalleryDetail) galleryInfo, null)
: listener);
client.execute(request);
}
private static class UpdateFavoriteNameCallback implements EhClient.Callback<Void> {
private final EhClient.Callback<Void> delegate;
private final GalleryDetail detail;
private final String newFavoriteName;
UpdateFavoriteNameCallback(EhClient.Callback<Void> delegate, GalleryDetail detail,
String newFavoriteName) {
this.delegate = delegate;
this.detail = detail;
this.newFavoriteName = newFavoriteName;
}
@Override
public void onSuccess(Void result) {
detail.favoriteName = newFavoriteName;
delegate.onSuccess(result);
}
@Override
public void onFailure(Exception e) {
delegate.onFailure(e);
}
@Override
public void onCancel() {
delegate.onCancel();
}
}
// TODO Add context if activity and context are different style
public static void startDownload(final MainActivity activity, final GalleryInfo galleryInfo, boolean forceDefault) {
final DownloadManager dm = EhApplication.getDownloadManager(activity);
@@ -25,12 +25,11 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.R;
import com.hippo.ripple.Ripple;
import com.hippo.widget.DirExplorer;
import com.hippo.yorozuya.ViewUtils;
import java.io.File;
public class DirPickerActivity extends ToolbarActivity
@@ -70,7 +69,7 @@ public class DirPickerActivity extends ToolbarActivity
mDirExplorer.setCurrentFile(file);
mDirExplorer.setOnChangeDirListener(this);
Ripple.addRipple(mOk, false);
Ripple.addRipple(mOk, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme));
mOk.setOnClickListener(this);
@@ -19,6 +19,7 @@ package com.hippo.ehviewer.ui;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;
import com.google.analytics.tracking.android.EasyTracker;
@@ -31,8 +32,13 @@ public abstract class EhActivity extends AppCompatActivity {
private boolean mTrackStarted;
@StyleRes
protected abstract int getThemeResId(int theme);
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setTheme(getThemeResId(Settings.getTheme()));
super.onCreate(savedInstanceState);
((EhApplication) getApplication()).registerActivity(this);
@@ -20,20 +20,26 @@ import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.view.WindowManager;
import com.google.analytics.tracking.android.EasyTracker;
import com.hippo.app.AppCompatPreferenceActivity;
import com.hippo.app.PrettyPreferenceActivity;
import com.hippo.content.ContextLocalWrapper;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.Settings;
import java.util.Locale;
public abstract class EhPreferenceActivity extends AppCompatPreferenceActivity {
public abstract class EhPreferenceActivity extends PrettyPreferenceActivity {
private boolean mTrackStarted;
@StyleRes
protected abstract int getThemeResId(int theme);
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setTheme(getThemeResId(Settings.getTheme()));
super.onCreate(savedInstanceState);
((EhApplication) getApplication()).registerActivity(this);
@@ -25,7 +25,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
@@ -164,11 +164,12 @@ public class ExcludedLanguagesActivity extends ToolbarActivity
mDeselectAll.setOnClickListener(this);
mInvertSelection.setOnClickListener(this);
Ripple.addRipple(mCancel, false);
Ripple.addRipple(mOk, false);
Ripple.addRipple(mSelectAll, false);
Ripple.addRipple(mDeselectAll, false);
Ripple.addRipple(mInvertSelection, false);
boolean isDarkTheme = !AttrResources.getAttrBoolean(this, R.attr.isLightTheme);
Ripple.addRipple(mCancel, isDarkTheme);
Ripple.addRipple(mOk, isDarkTheme);
Ripple.addRipple(mSelectAll, isDarkTheme);
Ripple.addRipple(mDeselectAll, isDarkTheme);
Ripple.addRipple(mInvertSelection, isDarkTheme);
}
private boolean isDecimal(String str) {
@@ -48,7 +48,7 @@ import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.AppConfig;
import com.hippo.ehviewer.BuildConfig;
import com.hippo.ehviewer.R;
@@ -76,7 +76,6 @@ import com.hippo.yorozuya.ResourcesUtils;
import com.hippo.yorozuya.SimpleAnimatorListener;
import com.hippo.yorozuya.SimpleHandler;
import com.hippo.yorozuya.ViewUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -182,6 +181,19 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
}
};
@Override
protected int getThemeResId(int theme) {
switch (theme) {
case Settings.THEME_LIGHT:
default:
return R.style.AppTheme_Gallery;
case Settings.THEME_DARK:
return R.style.AppTheme_Gallery_Dark;
case Settings.THEME_BLACK:
return R.style.AppTheme_Gallery_Black;
}
}
private void buildProvider() {
if (mGalleryProvider != null) {
return;
@@ -281,22 +293,21 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
mGLRootView = (GLRootView) ViewUtils.$$(this, R.id.gl_root_view);
mGalleryAdapter = new GalleryAdapter(mGLRootView, mGalleryProvider);
Resources resources = getResources();
int primaryColor = ResourcesUtils.getAttrColor(this, R.attr.colorPrimary);
mGalleryView = new GalleryView.Builder(this, mGalleryAdapter)
.setListener(this)
.setLayoutMode(Settings.getReadingDirection())
.setScaleMode(Settings.getPageScaling())
.setStartPosition(Settings.getStartPosition())
.setStartPage(startPage)
.setBackgroundColor(resources.getColor(R.color.gallery_background))
.setEdgeColor(primaryColor & 0xffffff | 0x33000000)
.setBackgroundColor(AttrResources.getAttrColor(this, android.R.attr.colorBackground))
.setEdgeColor(AttrResources.getAttrColor(this, R.attr.colorEdgeEffect) & 0xffffff | 0x33000000)
.setPagerInterval(Settings.getShowPageInterval() ? resources.getDimensionPixelOffset(R.dimen.gallery_pager_interval) : 0)
.setScrollInterval(Settings.getShowPageInterval() ? resources.getDimensionPixelOffset(R.dimen.gallery_scroll_interval) : 0)
.setPageMinHeight(resources.getDimensionPixelOffset(R.dimen.gallery_page_min_height))
.setPageInfoInterval(resources.getDimensionPixelOffset(R.dimen.gallery_page_info_interval))
.setProgressColor(primaryColor)
.setProgressColor(ResourcesUtils.getAttrColor(this, R.attr.colorPrimary))
.setProgressSize(resources.getDimensionPixelOffset(R.dimen.gallery_progress_size))
.setPageTextColor(resources.getColor(R.color.secondary_text_default_dark))
.setPageTextColor(AttrResources.getAttrColor(this, android.R.attr.textColorSecondary))
.setPageTextSize(resources.getDimensionPixelOffset(R.dimen.gallery_page_text_size))
.setPageTextTypeface(Typeface.DEFAULT)
.setErrorTextColor(resources.getColor(R.color.red_500))
@@ -37,6 +37,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
import com.hippo.ehviewer.EhApplication;
@@ -81,11 +82,11 @@ public class HostsActivity extends ToolbarActivity
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
LinearDividerItemDecoration.VERTICAL,
getResources().getColor(R.color.divider),
AttrResources.getAttrColor(this, R.attr.dividerColor),
LayoutUtils.dp2pix(this, 1));
decoration.setShowLastDivider(true);
recyclerView.addItemDecoration(decoration);
recyclerView.setSelector(Ripple.generateRippleDrawable(this, false));
recyclerView.setSelector(Ripple.generateRippleDrawable(this, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme)));
recyclerView.setHasFixedSize(true);
recyclerView.setOnItemClickListener(this);
recyclerView.setPadding(
@@ -142,6 +142,19 @@ public final class MainActivity extends StageActivity
registerLaunchMode(ProgressScene.class, SceneFragment.LAUNCH_MODE_STANDARD);
}
@Override
protected int getThemeResId(int theme) {
switch (theme) {
case Settings.THEME_LIGHT:
default:
return R.style.AppTheme_Main;
case Settings.THEME_DARK:
return R.style.AppTheme_Main_Dark;
case Settings.THEME_BLACK:
return R.style.AppTheme_Main_Black;
}
}
@Override
public int getContainerViewId() {
return R.id.fragment_container;
@@ -444,7 +457,7 @@ public final class MainActivity extends StageActivity
String text = getTextFromClipboard();
int hashCode = text != null ? text.hashCode() : 0;
if (text != null && hashCode != 0 && mClipTextHashCode != hashCode) {
if (text != null && hashCode != 0 && mClipTextHashCode != hashCode && Settings.getClipboardTextHashCode() != hashCode) {
Pair<Long, String> pair = EhUrl.parseGalleryDetailUrl(text);
if (pair != null) {
long gid = pair.first;
@@ -17,31 +17,22 @@
package com.hippo.ehviewer.ui;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.StringRes;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.ui.fragment.AboutFragment;
import com.hippo.ehviewer.ui.fragment.AdvancedFragment;
import com.hippo.ehviewer.ui.fragment.DownloadFragment;
import com.hippo.ehviewer.ui.fragment.EhFragment;
import com.hippo.ehviewer.ui.fragment.ReadFragment;
import com.hippo.ehviewer.ui.fragment.PrivacyFragment;
import com.hippo.ehviewer.ui.fragment.ReadFragment;
import com.hippo.util.DrawableManager;
import java.lang.reflect.Field;
import java.util.List;
public final class SettingsActivity extends EhPreferenceActivity {
@@ -57,75 +48,17 @@ public final class SettingsActivity extends EhPreferenceActivity {
PrivacyFragment.class.getName(),
};
private class FakeLayoutInflater extends LayoutInflater {
private final LayoutInflater mInflater;
protected FakeLayoutInflater(LayoutInflater inflater) {
super(null);
mInflater = inflater;
}
@Override
public LayoutInflater cloneInContext(Context newContext) {
return null;
}
@Override
public View inflate(int resource, ViewGroup root, boolean attachToRoot) {
return mInflater.inflate(R.layout.item_preference_header, root, attachToRoot);
}
}
@SuppressWarnings("TryWithIdenticalCatches")
private void replaceHeaderLayoutResId() {
try {
ListAdapter adapter = getListAdapter();
Class headerAdapterClazz = Class.forName("android.preference.PreferenceActivity$HeaderAdapter");
if (!headerAdapterClazz.isInstance(adapter)) {
return;
}
boolean ok = false;
// For lollipop and above this work
try {
Field field = headerAdapterClazz.getDeclaredField("mLayoutResId");
field.setAccessible(true);
field.setInt(adapter, R.layout.item_preference_header);
ok = true;
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
// For pre-lollipop this work
if (!ok) {
try {
Field field = headerAdapterClazz.getDeclaredField("mInflater");
field.setAccessible(true);
field.set(adapter, new FakeLayoutInflater((LayoutInflater) field.get(adapter)));
ok = true;
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (ClassCastException e) {
e.printStackTrace();
}
}
if (ok) {
getListView().setDivider(new ColorDrawable(Color.TRANSPARENT));
getListView().setDividerHeight(0);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
@Override
protected int getThemeResId(int theme) {
switch (theme) {
case Settings.THEME_LIGHT:
default:
return R.style.AppTheme_Settings;
case Settings.THEME_DARK:
return R.style.AppTheme_Settings_Dark;
case Settings.THEME_BLACK:
return R.style.AppTheme_Settings_Black;
}
}
private void setActionBarUpIndicator(Drawable drawable) {
@@ -145,15 +78,13 @@ public final class SettingsActivity extends EhPreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarUpIndicator(DrawableManager.getDrawable(this, R.drawable.v_arrow_left_dark_x24));
replaceHeaderLayoutResId();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
@@ -25,9 +25,23 @@ import android.view.View;
import android.view.ViewGroup;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
public abstract class ToolbarActivity extends EhActivity {
@Override
protected int getThemeResId(int theme) {
switch (theme) {
case Settings.THEME_LIGHT:
default:
return R.style.AppTheme_Toolbar;
case Settings.THEME_DARK:
return R.style.AppTheme_Toolbar_Dark;
case Settings.THEME_BLACK:
return R.style.AppTheme_Toolbar_Black;
}
}
@Override
public void setContentView(@LayoutRes int layoutResID) {
super.setContentView(R.layout.activity_toolbar);
@@ -19,18 +19,20 @@ package com.hippo.ehviewer.ui.fragment;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.support.v7.app.AlertDialog;
import android.util.Base64;
import android.widget.TextView;
import android.widget.Toast;
import com.hippo.ehviewer.Analytics;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.ui.CommonOperations;
import com.hippo.util.AppHelper;
import java.io.UnsupportedEncodingException;
public class AboutFragment extends PreferenceFragment
implements Preference.OnPreferenceClickListener {
@@ -49,14 +51,12 @@ public class AboutFragment extends PreferenceFragment
Preference checkForUpdate = findPreference(KEY_CHECK_FOR_UPDATES);
author.setSummary(getString(R.string.settings_about_author_summary).replace('$', '@'));
donate.setSummary(getString(R.string.settings_about_donate_summary).replace('$', '@'));
author.setOnPreferenceClickListener(this);
donate.setOnPreferenceClickListener(this);
checkForUpdate.setOnPreferenceClickListener(this);
}
@Override
public boolean onPreferenceClick(Preference preference) {
String key = preference.getKey();
@@ -64,17 +64,51 @@ public class AboutFragment extends PreferenceFragment
AppHelper.sendEmail(getActivity(), EhApplication.getDeveloperEmail(),
"About EhViewer", null);
} else if (KEY_DONATE.equals(key)) {
ClipboardManager cmb = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setPrimaryClip(ClipData.newPlainText(null, "seven332$163.com".replace('$', '@')));
Toast.makeText(getActivity(), R.string.settings_about_donate_toast, Toast.LENGTH_SHORT).show();
new AlertDialog.Builder(getActivity())
.setTitle(R.string.settings_about_donate)
.setMessage(getString(R.string.settings_about_donate_message).replace('$', '@'))
.show();
showDonationDialog();
} else if (KEY_CHECK_FOR_UPDATES.equals(key)) {
CommonOperations.checkUpdate(getActivity(), true);
}
return true;
}
private void showDonationDialog() {
AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setView(R.layout.dialog_donate)
.show();
String alipayStr = base64Decode("c2V2ZW4zMzJAMTYzLmNvbQ==");
TextView alipayText = dialog.findViewById(R.id.alipay_text);
alipayText.setText(alipayStr);
dialog.findViewById(R.id.alipay_copy).setOnClickListener(v -> copyToClipboard(alipayStr));
String paypalStr = base64Decode("aHR0cHM6Ly9wYXlwYWwubWUvc2V2ZW4zMzI=");
TextView paypalText = dialog.findViewById(R.id.paypal_text);
paypalText.setText(paypalStr);
dialog.findViewById(R.id.paypal_open).setOnClickListener(v -> openUrl(paypalStr));
dialog.findViewById(R.id.paypal_copy).setOnClickListener(v -> copyToClipboard(paypalStr));
}
private static String base64Decode(String encoded) {
byte[] bytes = Base64.decode(encoded, Base64.DEFAULT);
try {
return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
}
private void copyToClipboard(String text) {
ClipboardManager cmb = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
if (cmb != null) {
cmb.setPrimaryClip(ClipData.newPlainText(null, text));
Toast.makeText(getActivity(), R.string.settings_about_donate_copied, Toast.LENGTH_SHORT).show();
}
}
private void openUrl(String url) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
Intent chooser = Intent.createChooser(intent, "");
startActivity(chooser);
}
}
@@ -20,7 +20,7 @@ import android.app.Activity;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
@@ -32,11 +32,13 @@ public class EhFragment extends PreferenceFragment
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.eh_settings);
Preference theme = findPreference(Settings.KEY_THEME);
Preference gallerySite = findPreference(Settings.KEY_GALLERY_SITE);
Preference listMode = findPreference(Settings.KEY_LIST_MODE);
Preference detailSize = findPreference(Settings.KEY_DETAIL_SIZE);
Preference thumbSize = findPreference(Settings.KEY_THUMB_SIZE);
theme.setOnPreferenceChangeListener(this);
gallerySite.setOnPreferenceChangeListener(this);
listMode.setOnPreferenceChangeListener(this);
detailSize.setOnPreferenceChangeListener(this);
@@ -46,7 +48,10 @@ public class EhFragment extends PreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
if (Settings.KEY_GALLERY_SITE.equals(key)) {
if (Settings.KEY_THEME.equals(key)) {
((EhApplication) getActivity().getApplication()).recreate();
return true;
} else if (Settings.KEY_GALLERY_SITE.equals(key)) {
getActivity().setResult(Activity.RESULT_OK);
return true;
} else if (Settings.KEY_LIST_MODE.equals(key)) {
@@ -21,7 +21,7 @@ import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.Crash;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
@@ -70,8 +70,9 @@ public class CrashScene extends SolidScene implements View.OnClickListener {
mCancel.setOnClickListener(this);
mSend.setOnClickListener(this);
Ripple.addRipple(mCancel, true);
Ripple.addRipple(mSend, true);
boolean isDarkTheme = !AttrResources.getAttrBoolean(getContext2(), R.attr.isLightTheme);
Ripple.addRipple(mCancel, isDarkTheme);
Ripple.addRipple(mSend, isDarkTheme);
return view;
}
@@ -50,11 +50,11 @@ import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.github.amlcurran.showcaseview.ShowcaseView;
import com.github.amlcurran.showcaseview.SimpleShowcaseEventListener;
import com.github.amlcurran.showcaseview.targets.PointTarget;
import com.github.amlcurran.showcaseview.targets.ViewTarget;
import com.hippo.android.resource.AttrResources;
import com.hippo.app.CheckBoxDialogBuilder;
import com.hippo.conaco.DataContainer;
import com.hippo.conaco.ProgressNotifier;
@@ -91,18 +91,15 @@ import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
import com.hippo.yorozuya.FileUtils;
import com.hippo.yorozuya.IOUtils;
import com.hippo.yorozuya.ObjectUtils;
import com.hippo.yorozuya.ResourcesUtils;
import com.hippo.yorozuya.ViewUtils;
import com.hippo.yorozuya.collect.LongList;
import junit.framework.Assert;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import junit.framework.Assert;
public class DownloadsScene extends ToolbarScene
implements DownloadManager.DownloadInfoListener,
@@ -301,7 +298,7 @@ public class DownloadsScene extends ToolbarScene
mLayoutManager.setColumnSize(resources.getDimensionPixelOffset(Settings.getDetailSizeResId()));
mLayoutManager.setStrategy(AutoStaggeredGridLayoutManager.STRATEGY_MIN_SIZE);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
mRecyclerView.setDrawSelectorOnTop(true);
mRecyclerView.hasFixedSize();
mRecyclerView.setClipToPadding(false);
@@ -327,7 +324,7 @@ public class DownloadsScene extends ToolbarScene
fastScroller.attachToRecyclerView(mRecyclerView);
HandlerDrawable handlerDrawable = new HandlerDrawable();
handlerDrawable.setColor(ResourcesUtils.getAttrColor(context, R.attr.colorAccent));
handlerDrawable.setColor(AttrResources.getAttrColor(context, R.attr.widgetColorThemeAccent));
fastScroller.setHandlerDrawable(handlerDrawable);
fastScroller.setOnDragHandlerListener(this);
@@ -1085,8 +1082,10 @@ public class DownloadsScene extends ToolbarScene
thumb.setOnClickListener(this);
start.setOnClickListener(this);
stop.setOnClickListener(this);
Ripple.addRipple(start, false);
Ripple.addRipple(stop, false);
boolean isDarkTheme = !AttrResources.getAttrBoolean(getContext2(), R.attr.isLightTheme);
Ripple.addRipple(start, isDarkTheme);
Ripple.addRipple(stop, isDarkTheme);
}
@Override
@@ -1132,10 +1131,17 @@ public class DownloadsScene extends ToolbarScene
private class DownloadAdapter extends RecyclerView.Adapter<DownloadHolder> {
private final LayoutInflater mInflater;
private final int mListThumbWidth;
private final int mListThumbHeight;
public DownloadAdapter() {
mInflater = getLayoutInflater2();
Assert.assertNotNull(mInflater);
View calculator = mInflater.inflate(R.layout.item_gallery_list_thumb_height, null);
ViewUtils.measureView(calculator, 1024, ViewGroup.LayoutParams.WRAP_CONTENT);
mListThumbHeight = calculator.getMeasuredHeight();
mListThumbWidth = mListThumbHeight * 2 / 3;
}
@Override
@@ -1148,7 +1154,14 @@ public class DownloadsScene extends ToolbarScene
@Override
public DownloadHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new DownloadHolder(mInflater.inflate(R.layout.item_download, parent, false));
DownloadHolder holder = new DownloadHolder(mInflater.inflate(R.layout.item_download, parent, false));
ViewGroup.LayoutParams lp = holder.thumb.getLayoutParams();
lp.width = mListThumbWidth;
lp.height = mListThumbHeight;
holder.thumb.setLayoutParams(lp);
return holder;
}
@Override
@@ -49,6 +49,7 @@ import android.widget.TextView;
import com.github.amlcurran.showcaseview.ShowcaseView;
import com.github.amlcurran.showcaseview.SimpleShowcaseEventListener;
import com.github.amlcurran.showcaseview.targets.PointTarget;
import com.hippo.android.resource.AttrResources;
import com.hippo.annotation.Implemented;
import com.hippo.drawable.DrawerArrowDrawable;
import com.hippo.easyrecyclerview.EasyRecyclerView;
@@ -259,7 +260,7 @@ public class FavoritesScene extends BaseScene implements
contentLayout.getFastScroller().setOnDragHandlerListener(this);
mAdapter = new FavoritesAdapter(inflater, resources, mRecyclerView, Settings.getListMode());
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
mRecyclerView.setDrawSelectorOnTop(true);
mRecyclerView.hasFixedSize();
mRecyclerView.setClipToPadding(false);
@@ -273,7 +274,7 @@ public class FavoritesScene extends BaseScene implements
refreshLayout.setHeaderTranslationY(paddingTopSB);
mLeftDrawable = new DrawerArrowDrawable(context);
mLeftDrawable = new DrawerArrowDrawable(context, AttrResources.getAttrColor(context, R.attr.drawableColorPrimary));
mSearchBar.setLeftDrawable(mLeftDrawable);
mSearchBar.setRightDrawable(DrawableManager.getDrawable(context, R.drawable.v_magnify_x24));
mSearchBar.setHelper(this);
@@ -38,6 +38,7 @@ import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.widget.TileThumb;
import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
import com.hippo.yorozuya.ViewUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -58,6 +59,8 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
private final int mPaddingTopSB;
private MarginItemDecoration mListDecoration;
private MarginItemDecoration mGirdDecoration;
private final int mListThumbWidth;
private final int mListThumbHeight;
private int mType = TYPE_INVALID;
public GalleryAdapter(@NonNull LayoutInflater inflater, @NonNull Resources resources,
@@ -71,6 +74,11 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
mRecyclerView.setAdapter(this);
mRecyclerView.setLayoutManager(mLayoutManager);
View calculator = inflater.inflate(R.layout.item_gallery_list_thumb_height, null);
ViewUtils.measureView(calculator, 1024, ViewGroup.LayoutParams.WRAP_CONTENT);
mListThumbHeight = calculator.getMeasuredHeight();
mListThumbWidth = mListThumbHeight * 2 / 3;
setType(type);
}
@@ -146,7 +154,17 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
layoutId = R.layout.item_gallery_grid;
break;
}
return new GalleryHolder(mInflater.inflate(layoutId, parent, false));
GalleryHolder holder = new GalleryHolder(mInflater.inflate(layoutId, parent, false));
if (viewType == TYPE_LIST) {
ViewGroup.LayoutParams lp = holder.thumb.getLayoutParams();
lp.width = mListThumbWidth;
lp.height = mListThumbHeight;
holder.thumb.setLayoutParams(lp);
}
return holder;
}
@Override
@@ -178,7 +196,7 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
category.setBackgroundColor(EhUtils.getCategoryColor(gi.category));
}
holder.posted.setText(gi.posted);
if (gi.pages == 0) {
if (gi.pages == 0 || !Settings.getShowGalleryPages()) {
holder.pages.setText(null);
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.simpleLanguage.getLayoutParams();
lp.addRule(RelativeLayout.LEFT_OF, 0);
@@ -51,7 +51,7 @@ import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
import com.hippo.ehviewer.EhApplication;
@@ -83,11 +83,9 @@ import com.hippo.yorozuya.SimpleAnimatorListener;
import com.hippo.yorozuya.StringUtils;
import com.hippo.yorozuya.ViewUtils;
import com.hippo.yorozuya.collect.IntList;
import junit.framework.Assert;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
public final class GalleryCommentsScene extends ToolbarScene
implements EasyRecyclerView.OnItemClickListener,
@@ -205,11 +203,11 @@ public final class GalleryCommentsScene extends ToolbarScene
mRecyclerView.setLayoutManager(new LinearLayoutManager(context,
LinearLayoutManager.VERTICAL, false));
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
LinearDividerItemDecoration.VERTICAL, context.getResources().getColor(R.color.divider),
LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor),
LayoutUtils.dp2pix(context, 1));
decoration.setShowLastDivider(true);
mRecyclerView.addItemDecoration(decoration);
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setOnItemClickListener(this);
mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), mRecyclerView.getPaddingTop(),
@@ -338,11 +336,11 @@ public final class GalleryCommentsScene extends ToolbarScene
});
rv.setLayoutManager(new LinearLayoutManager(context));
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
LinearDividerItemDecoration.VERTICAL, context.getResources().getColor(R.color.divider),
LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor),
LayoutUtils.dp2pix(context, 1));
decoration.setPadding(ResourcesUtils.getAttrDimensionPixelOffset(context, R.attr.dialogPreferredPadding));
rv.addItemDecoration(decoration);
rv.setSelector(Ripple.generateRippleDrawable(context, false));
rv.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
rv.setClipToPadding(false);
builder.setView(rv).show();
}
@@ -637,7 +635,7 @@ public final class GalleryCommentsScene extends ToolbarScene
SpannableString ss = new SpannableString(scoreString);
ss.setSpan(new RelativeSizeSpan(0.8f), 0, scoreString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new StyleSpan(Typeface.BOLD), 0, scoreString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new ForegroundColorSpan(context.getResources().getColor(R.color.secondary_text_default_light))
ss.setSpan(new ForegroundColorSpan(AttrResources.getAttrColor(context, android.R.attr.textColorSecondary))
, 0, scoreString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ssb.append(" ").append(ss);
}
@@ -53,7 +53,7 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RatingBar;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.beerbelly.BeerBelly;
import com.hippo.drawable.RoundSideRectDrawable;
import com.hippo.ehviewer.AppConfig;
@@ -106,9 +106,6 @@ import com.hippo.yorozuya.IOUtils;
import com.hippo.yorozuya.IntIdGenerator;
import com.hippo.yorozuya.SimpleHandler;
import com.hippo.yorozuya.ViewUtils;
import junit.framework.Assert;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -116,6 +113,7 @@ import java.io.OutputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import junit.framework.Assert;
public class GalleryDetailScene extends BaseScene implements View.OnClickListener,
com.hippo.ehviewer.download.DownloadManager.DownloadInfoListener,
@@ -431,6 +429,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mTip.setCompoundDrawables(null, drawable, null, null);
mTip.setOnClickListener(this);
boolean isDarkTheme = !AttrResources.getAttrBoolean(context, R.attr.isLightTheme);
mHeader = ViewUtils.$$(mainView, R.id.header);
mColorBg = ViewUtils.$$(mHeader, R.id.color_bg);
mThumb = (LoadImageView) ViewUtils.$$(mHeader, R.id.thumb);
@@ -441,9 +440,9 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mActionGroup = (ViewGroup) ViewUtils.$$(mHeader, R.id.action_card);
mDownload = (TextView) ViewUtils.$$(mActionGroup, R.id.download);
mRead = ViewUtils.$$(mActionGroup, R.id.read);
Ripple.addRipple(mOtherActions, false);
Ripple.addRipple(mDownload, false);
Ripple.addRipple(mRead, false);
Ripple.addRipple(mOtherActions, isDarkTheme);
Ripple.addRipple(mDownload, isDarkTheme);
Ripple.addRipple(mRead, isDarkTheme);
mUploader.setOnClickListener(this);
mCategory.setOnClickListener(this);
mOtherActions.setOnClickListener(this);
@@ -462,7 +461,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mSize = (TextView) ViewUtils.$$(mInfo, R.id.size);
mPosted = (TextView) ViewUtils.$$(mInfo, R.id.posted);
mFavoredTimes = (TextView) ViewUtils.$$(mInfo, R.id.favoredTimes);
Ripple.addRipple(mInfo, false);
Ripple.addRipple(mInfo, isDarkTheme);
mInfo.setOnClickListener(this);
mActions = ViewUtils.$$(belowHeader, R.id.actions);
@@ -477,13 +476,13 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mRate = (TextView) ViewUtils.$$(mActions, R.id.rate);
mSimilar = (TextView) ViewUtils.$$(mActions, R.id.similar);
mSearchCover = (TextView) ViewUtils.$$(mActions, R.id.search_cover);
Ripple.addRipple(mHeartGroup, false);
Ripple.addRipple(mTorrent, false);
Ripple.addRipple(mArchive, false);
Ripple.addRipple(mShare, false);
Ripple.addRipple(mRate, false);
Ripple.addRipple(mSimilar, false);
Ripple.addRipple(mSearchCover, false);
Ripple.addRipple(mHeartGroup, isDarkTheme);
Ripple.addRipple(mTorrent, isDarkTheme);
Ripple.addRipple(mArchive, isDarkTheme);
Ripple.addRipple(mShare, isDarkTheme);
Ripple.addRipple(mRate, isDarkTheme);
Ripple.addRipple(mSimilar, isDarkTheme);
Ripple.addRipple(mSearchCover, isDarkTheme);
mHeartGroup.setOnClickListener(this);
mTorrent.setOnClickListener(this);
mArchive.setOnClickListener(this);
@@ -498,13 +497,13 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mComments = (LinearLayout) ViewUtils.$$(belowHeader, R.id.comments);
mCommentsText = (TextView) ViewUtils.$$(mComments, R.id.comments_text);
Ripple.addRipple(mComments, false);
Ripple.addRipple(mComments, isDarkTheme);
mComments.setOnClickListener(this);
mPreviews = ViewUtils.$$(belowHeader, R.id.previews);
mGridLayout = (SimpleGridAutoSpanLayout) ViewUtils.$$(mPreviews, R.id.grid_layout);
mPreviewText = (TextView) ViewUtils.$$(mPreviews, R.id.preview_text);
Ripple.addRipple(mPreviews, false);
Ripple.addRipple(mPreviews, isDarkTheme);
mPreviews.setOnClickListener(this);
mProgress = ViewUtils.$$(mainView, R.id.progress);
@@ -724,7 +723,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
}
if ((oldState == STATE_INIT || oldState == STATE_FAILED || oldState == STATE_REFRESH) &&
(state == STATE_NORMAL || state == STATE_REFRESH_HEADER)) {
(state == STATE_NORMAL || state == STATE_REFRESH_HEADER) && AttrResources.getAttrBoolean(getContext2(), R.attr.isLightTheme)) {
if (!createCircularReveal()) {
SimpleHandler.getInstance().post(new Runnable() {
@Override
@@ -766,6 +765,11 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
if (gd.isFavorited || EhDB.containLocalFavorites(gd.gid)) {
mHeart.setVisibility(View.VISIBLE);
if (gd.favoriteName == null) {
mHeart.setText(R.string.local_favorites);
} else {
mHeart.setText(gd.favoriteName);
}
mHeartOutline.setVisibility(View.GONE);
} else {
mHeart.setVisibility(View.GONE);
@@ -830,8 +834,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
mNoTags.setVisibility(View.GONE);
}
int colorTag = resources.getColor(R.color.colorPrimary);
int colorName = resources.getColor(R.color.purple_a400);
int colorTag = AttrResources.getAttrColor(context, R.attr.tagBackgroundColor);
int colorName = AttrResources.getAttrColor(context, R.attr.tagGroupBackgroundColor);
for (GalleryTagGroup tg : tagGroups) {
LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.gallery_tag_group, mTags, false);
ll.setOrientation(LinearLayout.HORIZONTAL);
@@ -1533,7 +1537,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
private void onModifyFavoritesSuccess(boolean addOrRemove) {
mModifingFavorites = false;
if (mGalleryDetail != null) {
mGalleryDetail.isFavorited = !addOrRemove;
mGalleryDetail.isFavorited = !addOrRemove && mGalleryDetail.favoriteName != null;
updateFavoriteDrawable();
}
}
@@ -29,20 +29,19 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.ehviewer.client.EhUrl;
import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.GalleryDetail;
import com.hippo.ripple.Ripple;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ViewUtils;
import junit.framework.Assert;
import java.util.ArrayList;
import junit.framework.Assert;
public final class GalleryInfoScene extends ToolbarScene implements EasyRecyclerView.OnItemClickListener {
@@ -128,6 +127,8 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
mValues.add(Integer.toString(gd.torrentCount));
mKeys.add(resources.getString(R.string.key_torrent_url));
mValues.add(gd.torrentUrl);
mKeys.add(resources.getString(R.string.favorite_name));
mValues.add(gd.favoriteName);
}
protected void onInit() {
@@ -163,11 +164,12 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
mRecyclerView.setAdapter(adapter);
mRecyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
LinearDividerItemDecoration.VERTICAL, context.getResources().getColor(R.color.divider),
LinearDividerItemDecoration.VERTICAL,
AttrResources.getAttrColor(context, R.attr.dividerColor),
LayoutUtils.dp2pix(context, 1));
decoration.setPadding(context.getResources().getDimensionPixelOffset(R.dimen.keyline_margin));
mRecyclerView.addItemDecoration(decoration);
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
mRecyclerView.setClipToPadding(false);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setOnItemClickListener(this);
@@ -197,6 +199,12 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler
if (null != context && 0 != position && null != mValues) {
ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setPrimaryClip(ClipData.newPlainText(null, mValues.get(position)));
if (position == 3) {
// Save it to avoid detect the gallery
Settings.putClipboardTextHashCode(mValues.get(position).hashCode());
}
showTip(R.string.copied_to_clipboard, LENGTH_SHORT);
return true;
} else {
@@ -49,10 +49,10 @@ 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;
import com.github.amlcurran.showcaseview.targets.PointTarget;
import com.hippo.android.resource.AttrResources;
import com.hippo.app.CheckBoxDialogBuilder;
import com.hippo.app.EditTextDialogBuilder;
import com.hippo.drawable.AddDeleteDrawable;
@@ -92,13 +92,11 @@ import com.hippo.yorozuya.MathUtils;
import com.hippo.yorozuya.SimpleAnimatorListener;
import com.hippo.yorozuya.StringUtils;
import com.hippo.yorozuya.ViewUtils;
import junit.framework.Assert;
import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import junit.framework.Assert;
public final class GalleryListScene extends BaseScene
implements EasyRecyclerView.OnItemClickListener, EasyRecyclerView.OnItemLongClickListener,
@@ -414,7 +412,7 @@ public final class GalleryListScene extends BaseScene
mAdapter = new GalleryListAdapter(inflater, resources,
mRecyclerView, Settings.getListMode());
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
mRecyclerView.setDrawSelectorOnTop(true);
mRecyclerView.hasFixedSize();
mRecyclerView.setClipToPadding(false);
@@ -427,8 +425,8 @@ public final class GalleryListScene extends BaseScene
refreshLayout.setHeaderTranslationY(paddingTopSB);
mLeftDrawable = new DrawerArrowDrawable(context);
mRightDrawable = new AddDeleteDrawable(context);
mLeftDrawable = new DrawerArrowDrawable(context, AttrResources.getAttrColor(context, R.attr.drawableColorPrimary));
mRightDrawable = new AddDeleteDrawable(context, AttrResources.getAttrColor(context, R.attr.drawableColorPrimary));
mSearchBar.setLeftDrawable(mLeftDrawable);
mSearchBar.setRightDrawable(mRightDrawable);
mSearchBar.setHelper(this);
@@ -446,8 +444,7 @@ public final class GalleryListScene extends BaseScene
mFabLayout.setOnExpandListener(this);
addAboveSnackView(mFabLayout);
mActionFabDrawable = new AddDeleteDrawable(context);
mActionFabDrawable.setColor(resources.getColor(R.color.primary_drawable_dark));
mActionFabDrawable = new AddDeleteDrawable(context, resources.getColor(R.color.primary_drawable_dark));
mFabLayout.getPrimaryFab().setImageDrawable(mActionFabDrawable);
mSearchFab.setOnClickListener(this);
@@ -31,7 +31,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator;
import com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator;
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager;
@@ -42,6 +41,7 @@ import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultAct
import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultActionRemoveItem;
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager;
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractSwipeableItemViewHolder;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.FastScroller;
import com.hippo.easyrecyclerview.HandlerDrawable;
@@ -64,12 +64,9 @@ import com.hippo.util.DrawableManager;
import com.hippo.view.ViewTransition;
import com.hippo.widget.LoadImageView;
import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
import com.hippo.yorozuya.ResourcesUtils;
import com.hippo.yorozuya.ViewUtils;
import junit.framework.Assert;
import de.greenrobot.dao.query.LazyList;
import junit.framework.Assert;
public class HistoryScene extends ToolbarScene
implements EasyRecyclerView.OnItemClickListener,
@@ -127,7 +124,7 @@ public class HistoryScene extends ToolbarScene
layoutManager.setColumnSize(resources.getDimensionPixelOffset(Settings.getDetailSizeResId()));
layoutManager.setStrategy(AutoStaggeredGridLayoutManager.STRATEGY_MIN_SIZE);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
mRecyclerView.setDrawSelectorOnTop(true);
mRecyclerView.hasFixedSize();
mRecyclerView.setClipToPadding(false);
@@ -144,7 +141,7 @@ public class HistoryScene extends ToolbarScene
fastScroller.attachToRecyclerView(mRecyclerView);
HandlerDrawable handlerDrawable = new HandlerDrawable();
handlerDrawable.setColor(ResourcesUtils.getAttrColor(context, R.attr.colorAccent));
handlerDrawable.setColor(AttrResources.getAttrColor(context, R.attr.widgetColorThemeAccent));
fastScroller.setHandlerDrawable(handlerDrawable);
updateLazyList();
@@ -323,9 +320,16 @@ public class HistoryScene extends ToolbarScene
implements SwipeableItemAdapter<HistoryHolder> {
private final LayoutInflater mInflater;
private final int mListThumbWidth;
private final int mListThumbHeight;
public HistoryAdapter() {
mInflater = getLayoutInflater2();
View calculator = mInflater.inflate(R.layout.item_gallery_list_thumb_height, null);
ViewUtils.measureView(calculator, 1024, ViewGroup.LayoutParams.WRAP_CONTENT);
mListThumbHeight = calculator.getMeasuredHeight();
mListThumbWidth = mListThumbHeight * 2 / 3;
}
@Override
@@ -339,7 +343,14 @@ public class HistoryScene extends ToolbarScene
@Override
public HistoryHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new HistoryHolder(mInflater.inflate(R.layout.item_gallery_list, parent, false));
HistoryHolder holder = new HistoryHolder(mInflater.inflate(R.layout.item_gallery_list, parent, false));
ViewGroup.LayoutParams lp = holder.thumb.getLayoutParams();
lp.width = mListThumbWidth;
lp.height = mListThumbHeight;
holder.thumb.setLayoutParams(lp);
return holder;
}
@Override
@@ -376,7 +387,7 @@ public class HistoryScene extends ToolbarScene
@Override
public int onGetSwipeReactionType(HistoryHolder holder, int position, int x, int y) {
return SwipeableItemConstants.REACTION_CAN_SWIPE_BOTH_H;
return SwipeableItemConstants.REACTION_CAN_SWIPE_LEFT;
}
@Override
@@ -386,8 +397,8 @@ public class HistoryScene extends ToolbarScene
public SwipeResultAction onSwipeItem(HistoryHolder holder, int position, int result) {
switch (result) {
case SwipeableItemConstants.RESULT_SWIPED_LEFT:
case SwipeableItemConstants.RESULT_SWIPED_RIGHT:
return new SwipeResultActionClear(position);
case SwipeableItemConstants.RESULT_SWIPED_RIGHT:
case SwipeableItemConstants.RESULT_CANCELED:
default:
return new SwipeResultActionDefault();
@@ -18,15 +18,13 @@ package com.hippo.ehviewer.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.yorozuya.ViewUtils;
@@ -60,9 +58,9 @@ public class GalleryGuideView extends ViewGroup implements View.OnClickListener
}
private void init(Context context) {
mBgColor = ContextCompat.getColor(context, R.color.guide_bg);
mBgColor = AttrResources.getAttrColor(context, R.attr.guideBackgroundColor);
mPaint = new Paint();
mPaint.setColor(Color.WHITE);
mPaint.setColor(AttrResources.getAttrColor(context, R.attr.guideTitleColor));
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(context.getResources().getDimension(R.dimen.gallery_guide_divider_width));
setOnClickListener(this);
@@ -26,6 +26,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@@ -38,23 +39,20 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.hippo.ehviewer.R;
import com.hippo.view.ViewTransition;
import com.hippo.yorozuya.AnimationUtils;
import com.hippo.yorozuya.MathUtils;
import com.hippo.yorozuya.SimpleAnimatorListener;
import com.hippo.yorozuya.ViewUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class SearchBar extends FrameLayout implements View.OnClickListener,
public class SearchBar extends CardView implements View.OnClickListener,
TextView.OnEditorActionListener, TextWatcher,
SearchEditText.SearchEditTextListener {
@@ -111,8 +109,6 @@ public class SearchBar extends FrameLayout implements View.OnClickListener,
}
private void init(Context context) {
setBackgroundResource(R.drawable.card_white_no_padding_2dp);
mSearchDatabase = SearchDatabase.getInstance(getContext());
LayoutInflater inflater = LayoutInflater.from(context);
@@ -37,7 +37,7 @@ import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.MarginItemDecoration;
import com.hippo.ehviewer.R;
@@ -46,7 +46,6 @@ import com.hippo.ehviewer.client.exception.EhException;
import com.hippo.ripple.Ripple;
import com.hippo.widget.RadioGridGroup;
import com.hippo.yorozuya.ViewUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -139,7 +138,7 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC
mNormalSearchModeHelp = (ImageView) normalView.findViewById(R.id.normal_search_mode_help);
mEnableAdvanceSwitch = (SwitchCompat) normalView.findViewById(R.id.search_enable_advance);
mNormalSearchModeHelp.setOnClickListener(this);
Ripple.addRipple(mNormalSearchModeHelp, false);
Ripple.addRipple(mNormalSearchModeHelp, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme));
mEnableAdvanceSwitch.setOnCheckedChangeListener(SearchLayout.this);
mEnableAdvanceSwitch.setSwitchPadding(resources.getDimensionPixelSize(R.dimen.switch_padding));
@@ -24,6 +24,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.R;
import com.hippo.yorozuya.collect.IntList;
@@ -102,7 +103,7 @@ public class SceneFragment extends Fragment {
super.onViewCreated(view, savedInstanceState);
view.setTag(R.id.fragment_tag, getTag());
view.setBackgroundColor(getResources().getColor(R.color.background_light));
view.setBackgroundDrawable(AttrResources.getAttrDrawable(getContext(), android.R.attr.windowBackground));
// Notify
FragmentActivity activity = getActivity();
+5 -9
View File
@@ -46,9 +46,10 @@ import android.text.style.TextAppearanceSpan;
import android.text.style.TypefaceSpan;
import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
import com.hippo.ehviewer.R;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Locale;
import org.ccil.cowan.tagsoup.HTMLSchema;
import org.ccil.cowan.tagsoup.Parser;
import org.xml.sax.Attributes;
@@ -58,11 +59,6 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Locale;
/**
* This class processes HTML strings into displayable styled text.
* Not all HTML tags are supported.
@@ -678,7 +674,7 @@ class HtmlToSpannedConverter implements ContentHandler {
}
if (d == null) {
d = Html.sResources.getDrawable(R.drawable.image_failed);
d = Resources.getSystem().getDrawable(android.R.drawable.ic_menu_report_image);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
}
@@ -30,7 +30,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.FastScroller;
import com.hippo.easyrecyclerview.HandlerDrawable;
@@ -43,9 +43,7 @@ import com.hippo.util.ExceptionUtils;
import com.hippo.view.ViewTransition;
import com.hippo.yorozuya.IntIdGenerator;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ResourcesUtils;
import com.hippo.yorozuya.collect.IntList;
import java.util.ArrayList;
import java.util.List;
@@ -92,7 +90,7 @@ public class ContentLayout extends FrameLayout {
mFastScroller.attachToRecyclerView(mRecyclerView);
HandlerDrawable drawable = new HandlerDrawable();
drawable.setColor(ResourcesUtils.getAttrColor(context, R.attr.colorAccent));
drawable.setColor(AttrResources.getAttrColor(context, R.attr.widgetColorThemeAccent));
mFastScroller.setHandlerDrawable(drawable);
mRefreshLayout.setHeaderColorSchemeResources(
@@ -24,13 +24,12 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.hippo.android.resource.AttrResources;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
import com.hippo.ehviewer.R;
import com.hippo.ripple.Ripple;
import com.hippo.yorozuya.LayoutUtils;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
@@ -73,11 +72,11 @@ public class DirExplorer extends EasyRecyclerView implements EasyRecyclerView.On
setAdapter(mAdapter);
setLayoutManager(new LinearLayoutManager(context));
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
LinearDividerItemDecoration.VERTICAL, getResources().getColor(R.color.divider),
LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor),
LayoutUtils.dp2pix(context, 1));
decoration.setShowLastDivider(true);
addItemDecoration(decoration);
setSelector(Ripple.generateRippleDrawable(context, false));
setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme)));
setOnItemClickListener(this);
mCurrentFile = Environment.getExternalStorageDirectory();
@@ -29,7 +29,6 @@ import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import com.hippo.conaco.Conaco;
import com.hippo.conaco.ConacoTask;
import com.hippo.conaco.DataContainer;
@@ -40,7 +39,7 @@ import com.hippo.ehviewer.R;
import com.hippo.image.ImageBitmap;
import com.hippo.image.ImageDrawable;
import com.hippo.image.RecycledException;
import com.hippo.util.DrawableManager;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -309,7 +308,7 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Image
public void onFailure() {
mFailed = true;
clearDrawable();
setImageDrawable(getContext().getResources().getDrawable(R.drawable.image_failed));
setImageDrawable(DrawableManager.getDrawable(getContext(), R.drawable.image_failed));
if (mRetryType == RETRY_TYPE_CLICK) {
setOnClickListener(this);
} else if (mRetryType == RETRY_TYPE_LONG_CLICK) {
@@ -38,9 +38,8 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.R;
import java.util.ArrayList;
import java.util.List;
@@ -270,7 +269,8 @@ public class LockPatternView extends View {
mPathPaint.setAntiAlias(true);
mPathPaint.setDither(true);
mRegularColor = getResources().getColor(R.color.lock_pattern_view_regular_color);
mRegularColor = getResources().getColor(AttrResources.getAttrBoolean(context, R.attr.isLightTheme) ?
R.color.lock_pattern_view_regular_color_light : R.color.lock_pattern_view_regular_color_dark);
mErrorColor = getResources().getColor(R.color.lock_pattern_view_error_color);
mSuccessColor = getResources().getColor(R.color.lock_pattern_view_success_color);
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2015 Hippo Seven
~ Copyright 2018 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -17,8 +17,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:color="@color/colorPrimary"/>
<item android:state_enabled="false" android:color="@color/primary_text_disabled_light"/>
<item android:color="@color/primary_text_default_light"/>
<item android:state_activated="true" android:color="@color/content_activated_black"/>
<item android:color="@color/content_black"/>
</selector>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2015 Hippo Seven
~ Copyright 2018 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/primary_text_disabled_light"/>
<item android:color="@color/primary_text_default_light"/>
<item android:state_activated="true" android:color="@color/content_activated_dark"/>
<item android:color="@color/content_dark"/>
</selector>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2015 Hippo Seven
~ Copyright 2018 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/secondary_text_disabled_dark"/>
<item android:color="@color/secondary_text_default_dark"/>
<item android:state_activated="true" android:color="@color/content_activated_light"/>
<item android:color="@color/content_light"/>
</selector>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2015 Hippo Seven
~ Copyright 2018 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -16,6 +16,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/primary_text_disabled_dark"/>
<item android:color="@color/primary_text_default_dark"/>
<item android:state_enabled="false" android:color="@color/primary_text_disabled_material_black"/>
<item android:color="@color/primary_text_default_material_black"/>
</selector>
@@ -1,21 +0,0 @@
<?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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/secondary_text_disabled_light"/>
<item android:color="@color/secondary_text_default_light"/>
</selector>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/big_icon"
android:fillColor="?attr/drawableColorSecondary"
android:pathData="@string/pd_big_download"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/big_icon"
android:fillColor="?attr/drawableColorSecondary"
android:pathData="@string/pd_big_filter"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/big_icon"
android:fillColor="?attr/drawableColorSecondary"
android:pathData="@string/pd_big_history"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/big_icon"
android:fillColor="?attr/drawableColorSecondary"
android:pathData="@string/pd_big_label"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/big_icon"
android:fillColor="?attr/drawableColorSecondary"
android:pathData="@string/pd_big_search"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/big_icon"
android:fillColor="?attr/drawableColorSecondary"
android:pathData="@string/pd_big_weird_face"/>
</vector>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2016 Hippo Seven
~ Copyright 2018 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -15,10 +15,13 @@
~ limitations under the License.
-->
<selector
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@drawable/card_grey_no_padding_2dp"/>
<item android:drawable="@drawable/card_white_no_padding_2dp"/>
<solid
android:color="@color/divider_dark"/>
</selector>
<size
android:height="1dp"/>
</shape>
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/divider"/>
android:color="@color/divider_light"/>
<size
android:height="1dp"/>
@@ -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="48dp"
android:width="48dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?attr/drawableColorPrimary"
android:pathData="@string/pd_file_image"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_adb"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24.0">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_archive"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_book_open"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/primary_drawable_light"
android:fillColor="?attr/drawableColorPrimary"
android:pathData="@string/pd_delete"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_download"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_file_find"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_heart_outline"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_heart"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/primary_drawable_light"
android:fillColor="?attr/drawableColorPrimary"
android:pathData="@string/pd_help_circle"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_info"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/primary_drawable_light"
android:fillColor="?attr/drawableColorPrimary"
android:pathData="@string/pd_magnify"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/primary_drawable_light"
android:fillColor="?attr/drawableColorPrimary"
android:pathData="@string/pd_pause"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/primary_drawable_light"
android:fillColor="?attr/drawableColorPrimary"
android:pathData="@string/pd_play"/>
</vector>
+1 -1
View File
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="@color/primary_drawable_light"
android:fillColor="?attr/drawableColorPrimary"
android:pathData="@string/pd_reorder"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_sad_panda"/>
</vector>
@@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="M12,1L3,5v6c0,5.55 3.84,10.74 9,12 5.16,-1.26 9,-6.45 9,-12L21,5l-9,-4zM12,11.99h7c-0.53,4.12 -3.28,7.79 -7,8.94L12,12L5,12L5,6.3l7,-3.11v8.8z"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_share"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_similar"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_thumb_up"/>
</vector>
@@ -23,7 +23,7 @@
android:viewportHeight="24">
<path
android:fillColor="?attr/colorPrimary"
android:fillColor="?attr/drawableColorThemePrimary"
android:pathData="@string/pd_utorrent"/>
</vector>
+5 -3
View File
@@ -22,13 +22,15 @@
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="?attr/toolbarColor"
android:elevation="8dp"
android:saveEnabled="false"/>
android:saveEnabled="false"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="?attr/toolbarPopupTheme"/>
<FrameLayout
android:layout_width="match_parent"
@@ -22,13 +22,15 @@
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="?attr/toolbarColor"
android:elevation="8dp"
android:saveEnabled="false"/>
android:saveEnabled="false"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="?attr/toolbarPopupTheme"/>
<FrameLayout
android:layout_width="match_parent"
@@ -22,12 +22,14 @@
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:background="?attr/toolbarColor"
android:elevation="8dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:elevation="8dp"/>
app:popupTheme="?attr/toolbarPopupTheme"/>
<FrameLayout
android:id="@+id/content_panel"
+4 -4
View File
@@ -33,7 +33,7 @@
android:layout_gravity="right"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:layout_marginRight="@dimen/gallery_widget_margin_h"
android:textColor="@color/secondary_text_dark"/>
android:textColor="?android:attr/textColorSecondary"/>
<TextView
android:id="@+id/progress"
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:textColor="@color/secondary_text_dark"/>
android:textColor="?android:attr/textColorSecondary"/>
<com.hippo.widget.BatteryView
xmlns:app="http://schemas.android.com/apk/res-auto"
@@ -52,7 +52,7 @@
android:layout_marginTop="@dimen/gallery_widget_margin_v"
android:layout_marginLeft="@dimen/gallery_widget_margin_h"
android:drawablePadding="4dp"
app:color="@color/secondary_text_dark"
app:color="?android:attr/textColorSecondary"
app:warningColor="@color/red_500"/>
<com.hippo.ehviewer.widget.SeekBarPanel
@@ -63,7 +63,7 @@
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="horizontal"
android:background="@color/gallery_slider_background"
android:background="?attr/gallerySliderBackgroundColor"
android:fitsSystemWindows="true"
android:visibility="invisible">
+1 -1
View File
@@ -49,7 +49,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/v_plus_dark_x24"
app:backgroundTint="?attr/colorPrimary"
app:backgroundTint="?attr/widgetColorThemePrimary"
style="@style/Widget.Design.FloatingActionButton"/>
</com.hippo.widget.FabLayout>
+1 -1
View File
@@ -48,7 +48,7 @@
android:layout_height="match_parent"
android:layout_gravity="right"
android:maxWidth="@dimen/drawer_max_width"
android:background="@color/background_light"
android:background="?android:attr/windowBackground"
android:clickable="true"/>
</com.hippo.ehviewer.widget.EhDrawerLayout>
@@ -78,6 +78,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="?attr/colorAccent"
android:text="@android:string/cancel"/>
<Button
@@ -86,6 +87,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="?attr/colorPrimary"
android:text="@string/set"/>
</LinearLayout>
+101
View File
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 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="vertical"
android:padding="@dimen/keyline_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/settings_about_donate_message"/>
<Space
android:layout_width="wrap_content"
android:layout_height="@dimen/keyline_margin"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/settings_about_donate_alipay"
android:textColor="?attr/textColorThemePrimary"
android:textStyle="bold"
android:textSize="@dimen/text_little_small"/>
<TextView
android:id="@+id/alipay_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"/>
<Button
android:id="@+id/alipay_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/settings_about_donate_copy"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
<Space
android:layout_width="wrap_content"
android:layout_height="@dimen/keyline_margin"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/settings_about_donate_paypal"
android:textColor="?attr/textColorThemePrimary"
android:textStyle="bold"
android:textSize="@dimen/text_little_small"/>
<TextView
android:id="@+id/paypal_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/paypal_open"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_about_donate_open"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="@+id/paypal_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_about_donate_copy"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
</LinearLayout>
</LinearLayout>
+13 -13
View File
@@ -17,7 +17,7 @@
<com.hippo.widget.IndicatingScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Indicating.Dark"
style="@style/Indicating"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -41,7 +41,7 @@
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/settings_read_screen_rotation"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<com.hippo.widget.CuteSpinner
android:id="@+id/screen_rotation"
@@ -64,7 +64,7 @@
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/settings_read_reading_direction"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<com.hippo.widget.CuteSpinner
android:id="@+id/reading_direction"
@@ -87,7 +87,7 @@
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/settings_read_page_scaling"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<com.hippo.widget.CuteSpinner
android:id="@+id/page_scaling"
@@ -110,7 +110,7 @@
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/settings_read_start_position"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<com.hippo.widget.CuteSpinner
android:id="@+id/start_position"
@@ -127,56 +127,56 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_keep_screen_on"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_clock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_show_clock"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_show_progress"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_show_battery"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_page_interval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_show_page_interval"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/volume_page"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_volume_page"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/reading_fullscreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_reading_fullscreen"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/custom_screen_lightness"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_read_custom_screen_lightness"
android:textColor="@color/primary_text_dark"/>
android:textColor="?android:attr/textColorPrimary"/>
<SeekBar
android:id="@+id/screen_lightness"
+3 -2
View File
@@ -29,12 +29,13 @@
android:layout_marginBottom="16dp"
android:gravity="center_horizontal"
android:textSize="@dimen/text_little_small"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
<com.hippo.ehviewer.widget.GalleryRatingBar
android:id="@+id/rating_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
android:layout_gravity="center_horizontal"
android:theme="@style/RatingBarTheme"/>
</LinearLayout>
+4 -2
View File
@@ -22,12 +22,14 @@
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:background="?attr/toolbarColor"
android:saveEnabled="false"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:saveEnabled="false"/>
app:popupTheme="?attr/toolbarPopupTheme"/>
<FrameLayout
android:layout_width="match_parent"
+4 -2
View File
@@ -22,12 +22,14 @@
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:background="?attr/toolbarColor"
android:saveEnabled="false"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:saveEnabled="false"/>
app:popupTheme="?attr/toolbarPopupTheme"/>
<FrameLayout
android:layout_width="match_parent"
@@ -53,7 +53,7 @@
android:gravity="center_horizontal"
android:text="@string/favorited"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/heart_outline"
@@ -62,7 +62,7 @@
android:gravity="center_horizontal"
android:text="@string/not_favorited"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
</FrameLayout>
@@ -73,7 +73,7 @@
android:gravity="center_horizontal"
android:text="@string/rate"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/share"
@@ -82,7 +82,7 @@
android:gravity="center_horizontal"
android:text="@string/share"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/torrent"
@@ -90,7 +90,7 @@
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/archive"
@@ -99,7 +99,7 @@
android:text="@string/archive"
android:gravity="center_horizontal"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/similar"
@@ -108,7 +108,7 @@
android:gravity="center_horizontal"
android:text="@string/similar_gallery"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/search_cover"
@@ -117,7 +117,7 @@
android:gravity="center_horizontal"
android:text="@string/search_cover"
android:drawablePadding="8dp"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
</LinearLayout>
</HorizontalScrollView>
@@ -128,13 +128,14 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_gravity="center_horizontal"
android:isIndicator="true"/>
android:isIndicator="true"
android:theme="@style/RatingBarTheme"/>
<TextView
android:id="@+id/rating_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/primary_text_light"/>
android:textColor="?android:attr/textColorPrimary"/>
</LinearLayout>
@@ -29,6 +29,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="?attr/colorAccent"/>
android:textColor="?attr/textColorThemeAccent"/>
</LinearLayout>
@@ -33,7 +33,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:divider="@drawable/divider_gallery_detail"
android:divider="?attr/galleryDetailDivider"
android:showDividers="middle"
android:dividerPadding="@dimen/keyline_margin">
Loaded 100 of 152 files, more files were not shown because too many files have changed in this diff. Show more