Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44a84f2bc2 | ||
|
|
5fb3b61669 | ||
|
|
57a9865d99 | ||
|
|
250e1256b9 | ||
|
|
015bcce8a3 | ||
|
|
b874a259fe | ||
|
|
c8ab84aa9e | ||
|
|
d6efe2c7ba | ||
|
|
46915fed3a | ||
|
|
5d1f599f48 | ||
|
|
9d5877e867 | ||
|
|
e998f80574 |
No files matched your search
@@ -10,8 +10,8 @@ android {
|
||||
applicationId "com.hippo.ehviewer"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 23
|
||||
versionCode 54
|
||||
versionName "1.0.1"
|
||||
versionCode 55
|
||||
versionName "1.0.2"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ dependencies {
|
||||
compile 'com.android.support:design:23.2.1'
|
||||
compile 'com.github.amlcurran.showcaseview:library:5.4.1'
|
||||
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.7'
|
||||
compile 'de.greenrobot:greendao:2.1.0'
|
||||
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
|
||||
compile 'org.jsoup:jsoup:1.8.3'
|
||||
}
|
||||
@@ -55,6 +55,19 @@
|
||||
<data android:host="g.e-hentai.org"/>
|
||||
<data android:host="lofi.e-hentai.org"/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter android:label="@string/keyword_search">
|
||||
<action android:name="android.intent.action.SEND"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter android:label="@string/image_search">
|
||||
<action android:name="android.intent.action.SEND"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:mimeType="image/*"/>
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
||||
@@ -162,7 +162,12 @@ public class EhDB {
|
||||
gi.category = cursor.getInt(4);
|
||||
gi.thumb = cursor.getString(5);
|
||||
gi.uploader = cursor.getString(6);
|
||||
gi.rating = cursor.getFloat(7);
|
||||
try {
|
||||
// In 0.6.x version, NaN is stored
|
||||
gi.rating = cursor.getFloat(7);
|
||||
} catch (Exception e) {
|
||||
gi.rating = -1.0f;
|
||||
}
|
||||
|
||||
map.put(gi.gid, gi);
|
||||
|
||||
|
||||
@@ -459,6 +459,28 @@ public class Settings {
|
||||
putBoolean(KEY_VOLUME_PAGE, value);
|
||||
}
|
||||
|
||||
private static final String KEY_CUSTOM_SCREEN_LIGHTNESS = "custom_screen_lightness";
|
||||
private static final boolean DEFAULT_CUSTOM_SCREEN_LIGHTNESS = false;
|
||||
|
||||
public static boolean getCustomScreenLightness() {
|
||||
return getBoolean(KEY_CUSTOM_SCREEN_LIGHTNESS, DEFAULT_CUSTOM_SCREEN_LIGHTNESS);
|
||||
}
|
||||
|
||||
public static void putCustomScreenLightness(boolean value) {
|
||||
putBoolean(KEY_CUSTOM_SCREEN_LIGHTNESS, value);
|
||||
}
|
||||
|
||||
private static final String KEY_SCREEN_LIGHTNESS = "screen_lightness";
|
||||
private static final int DEFAULT_SCREEN_LIGHTNESS = 50;
|
||||
|
||||
public static int getScreenLightness() {
|
||||
return getInt(KEY_SCREEN_LIGHTNESS, DEFAULT_SCREEN_LIGHTNESS);
|
||||
}
|
||||
|
||||
public static void putScreenLightness(int value) {
|
||||
putInt(KEY_SCREEN_LIGHTNESS, value);
|
||||
}
|
||||
|
||||
/********************
|
||||
****** Download
|
||||
********************/
|
||||
|
||||
@@ -198,7 +198,7 @@ public class GalleryDetailParser {
|
||||
if (null != rating_label) {
|
||||
String ratingStr = StringUtils.trim(rating_label.text());
|
||||
if ("Not Yet Rated".equals(ratingStr)) {
|
||||
gd.rating = Float.NaN;
|
||||
gd.rating = -1.0f;
|
||||
} else {
|
||||
int index = ratingStr.indexOf(' ');
|
||||
if (index == -1 || index >= ratingStr.length()) {
|
||||
@@ -208,7 +208,7 @@ public class GalleryDetailParser {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gd.rating = Float.NaN;
|
||||
gd.rating = -1.0f;
|
||||
}
|
||||
|
||||
// isFavorited
|
||||
|
||||
@@ -162,10 +162,10 @@ public class GalleryListParser {
|
||||
// Rating
|
||||
Element it4r = JsoupUtils.getElementByClass(e, "it4r");
|
||||
if (null != it4r) {
|
||||
gi.rating = NumberUtils.parseFloatSafely(parseRating(it4r.attr("style")), Float.NaN);
|
||||
gi.rating = NumberUtils.parseFloatSafely(parseRating(it4r.attr("style")), -1.0f);
|
||||
} else {
|
||||
Log.w(TAG, "Can't parse gallery info rating");
|
||||
gi.rating = Float.NaN;
|
||||
gi.rating = -1.0f;
|
||||
}
|
||||
// Uploader
|
||||
Element itu = JsoupUtils.getElementByClass(e, "itu");
|
||||
|
||||
@@ -36,8 +36,10 @@ import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Spinner;
|
||||
@@ -63,8 +65,10 @@ import com.hippo.gl.view.GLRootView;
|
||||
import com.hippo.image.Image;
|
||||
import com.hippo.unifile.UniFile;
|
||||
import com.hippo.util.SystemUiHelper;
|
||||
import com.hippo.widget.ColorView;
|
||||
import com.hippo.yorozuya.AnimationUtils;
|
||||
import com.hippo.yorozuya.ConcurrentPool;
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
import com.hippo.yorozuya.SimpleAnimatorListener;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
@@ -105,6 +109,8 @@ public class GalleryActivity extends EhActivity
|
||||
private SystemUiHelper mSystemUiHelper;
|
||||
private boolean mShowSystemUi;
|
||||
|
||||
@Nullable
|
||||
private ColorView mMaskView;
|
||||
@Nullable
|
||||
private View mClock;
|
||||
@Nullable
|
||||
@@ -254,13 +260,14 @@ public class GalleryActivity extends EhActivity
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
systemUiLevel = SystemUiHelper.LEVEL_IMMERSIVE;
|
||||
} else {
|
||||
systemUiLevel = SystemUiHelper.LEVEL_LOW_PROFILE;
|
||||
systemUiLevel = SystemUiHelper.LEVEL_HIDE_STATUS_BAR;
|
||||
}
|
||||
mSystemUiHelper = new SystemUiHelper(this, systemUiLevel,
|
||||
SystemUiHelper.FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES | SystemUiHelper.FLAG_IMMERSIVE_STICKY);
|
||||
mSystemUiHelper.hide();
|
||||
mShowSystemUi = false;
|
||||
|
||||
mMaskView = (ColorView) ViewUtils.$$(this, R.id.mask);
|
||||
mClock = ViewUtils.$$(this, R.id.clock);
|
||||
mBattery = ViewUtils.$$(this, R.id.battery);
|
||||
mClock.setVisibility(Settings.getShowClock() ? View.VISIBLE : View.GONE);
|
||||
@@ -300,6 +307,9 @@ public class GalleryActivity extends EhActivity
|
||||
}
|
||||
setRequestedOrientation(orientation);
|
||||
|
||||
// Screen lightness
|
||||
setScreenLightness(Settings.getCustomScreenLightness(), Settings.getScreenLightness());
|
||||
|
||||
if (Settings.getGuideGallery()) {
|
||||
FrameLayout mainLayout = (FrameLayout) ViewUtils.$$(this, R.id.main);
|
||||
mainLayout.addView(new GalleryGuideView(this));
|
||||
@@ -320,6 +330,9 @@ public class GalleryActivity extends EhActivity
|
||||
mGalleryProvider = null;
|
||||
}
|
||||
|
||||
mMaskView = null;
|
||||
mClock = null;
|
||||
mBattery = null;
|
||||
mSeekBarPanel = null;
|
||||
mLeftText = null;
|
||||
mRightText = null;
|
||||
@@ -667,6 +680,34 @@ public class GalleryActivity extends EhActivity
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lightness 0 - 200
|
||||
*/
|
||||
private void setScreenLightness(boolean enable, int lightness) {
|
||||
if (null == mMaskView) {
|
||||
return;
|
||||
}
|
||||
|
||||
Window w = getWindow();
|
||||
WindowManager.LayoutParams lp = w.getAttributes();
|
||||
if (enable) {
|
||||
lightness = MathUtils.clamp(lightness, 0, 200);
|
||||
if (lightness > 100) {
|
||||
mMaskView.setColor(0);
|
||||
// Avoid BRIGHTNESS_OVERRIDE_OFF,
|
||||
// screen may be off when lp.screenBrightness is 0.0f
|
||||
lp.screenBrightness = Math.max((lightness - 100) / 100.0f, 0.01f);
|
||||
} else {
|
||||
mMaskView.setColor(MathUtils.lerp(0xde, 0x00, lightness / 100.0f) << 24);
|
||||
lp.screenBrightness = 0.01f;
|
||||
}
|
||||
} else {
|
||||
mMaskView.setColor(0);
|
||||
lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
|
||||
}
|
||||
w.setAttributes(lp);
|
||||
}
|
||||
|
||||
private class GalleryMenuHelper implements DialogInterface.OnClickListener {
|
||||
|
||||
private final View mView;
|
||||
@@ -678,6 +719,8 @@ public class GalleryActivity extends EhActivity
|
||||
private final SwitchCompat mShowClock;
|
||||
private final SwitchCompat mShowBattery;
|
||||
private final SwitchCompat mVolumePage;
|
||||
private final SwitchCompat mCustomScreenLightness;
|
||||
private final SeekBar mScreenLightness;
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
public GalleryMenuHelper(Context context) {
|
||||
@@ -690,6 +733,8 @@ public class GalleryActivity extends EhActivity
|
||||
mShowClock = (SwitchCompat) mView.findViewById(R.id.show_clock);
|
||||
mShowBattery = (SwitchCompat) mView.findViewById(R.id.show_battery);
|
||||
mVolumePage = (SwitchCompat) mView.findViewById(R.id.volume_page);
|
||||
mCustomScreenLightness = (SwitchCompat) mView.findViewById(R.id.custom_screen_lightness);
|
||||
mScreenLightness = (SeekBar) mView.findViewById(R.id.screen_lightness);
|
||||
|
||||
mScreenRotation.setSelection(Settings.getScreenRotation());
|
||||
mReadingDirection.setSelection(Settings.getReadingDirection());
|
||||
@@ -699,6 +744,16 @@ public class GalleryActivity extends EhActivity
|
||||
mShowClock.setChecked(Settings.getShowClock());
|
||||
mShowBattery.setChecked(Settings.getShowBattery());
|
||||
mVolumePage.setChecked(Settings.getVolumePage());
|
||||
mCustomScreenLightness.setChecked(Settings.getCustomScreenLightness());
|
||||
mScreenLightness.setProgress(Settings.getScreenLightness());
|
||||
mScreenLightness.setEnabled(Settings.getCustomScreenLightness());
|
||||
|
||||
mCustomScreenLightness.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mScreenLightness.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
@@ -715,6 +770,8 @@ public class GalleryActivity extends EhActivity
|
||||
boolean showClock = mShowClock.isChecked();
|
||||
boolean showBattery = mShowBattery.isChecked();
|
||||
boolean volumePage = mVolumePage.isChecked();
|
||||
boolean customScreenLightness = mCustomScreenLightness.isChecked();
|
||||
int screenLightness = mScreenLightness.getProgress();
|
||||
|
||||
Settings.putScreenRotation(screenRotation);
|
||||
Settings.putReadingDirection(layoutMode);
|
||||
@@ -724,6 +781,8 @@ public class GalleryActivity extends EhActivity
|
||||
Settings.putShowClock(showClock);
|
||||
Settings.putShowBattery(showBattery);
|
||||
Settings.putVolumePage(volumePage);
|
||||
Settings.putCustomScreenLightness(customScreenLightness);
|
||||
Settings.putScreenLightness(screenLightness);
|
||||
|
||||
int orientation;
|
||||
switch (screenRotation) {
|
||||
@@ -755,6 +814,7 @@ public class GalleryActivity extends EhActivity
|
||||
if (mBattery != null) {
|
||||
mBattery.setVisibility(showBattery ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
setScreenLightness(customScreenLightness, screenLightness);
|
||||
|
||||
// Update slider
|
||||
mLayoutMode = layoutMode;
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.hippo.ehviewer.ui;
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
@@ -39,11 +41,13 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hippo.ehviewer.AppConfig;
|
||||
import com.hippo.ehviewer.Crash;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.EhUrlOpener;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
import com.hippo.ehviewer.ui.scene.AnalyticsScene;
|
||||
import com.hippo.ehviewer.ui.scene.BaseScene;
|
||||
import com.hippo.ehviewer.ui.scene.CookieSignInScene;
|
||||
@@ -64,16 +68,24 @@ import com.hippo.ehviewer.ui.scene.SelectSiteScene;
|
||||
import com.hippo.ehviewer.ui.scene.SignInScene;
|
||||
import com.hippo.ehviewer.ui.scene.WarningScene;
|
||||
import com.hippo.ehviewer.ui.scene.WebViewSignInScene;
|
||||
import com.hippo.io.UniFileInputStreamPipe;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
import com.hippo.scene.StageActivity;
|
||||
import com.hippo.unifile.UniFile;
|
||||
import com.hippo.util.BitmapUtils;
|
||||
import com.hippo.util.PermissionRequester;
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.widget.slidingdrawerlayout.SlidingDrawerLayout;
|
||||
import com.hippo.yorozuya.IOUtils;
|
||||
import com.hippo.yorozuya.ResourcesUtils;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public final class MainActivity extends StageActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
@@ -253,6 +265,38 @@ public final class MainActivity extends StageActivity
|
||||
return announcer;
|
||||
}
|
||||
|
||||
private File saveImageToTempFile(UniFile file) {
|
||||
if (null == file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
bitmap = BitmapUtils.decodeStream(new UniFileInputStreamPipe(file), -1, -1, 500 * 500, false, false, null);
|
||||
} catch (OutOfMemoryError e) {
|
||||
// Ignore
|
||||
}
|
||||
if (null == bitmap) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File temp = AppConfig.createTempFile();
|
||||
if (null == temp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(temp);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, os);
|
||||
return temp;
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleIntent(Intent intent) {
|
||||
if (intent == null) {
|
||||
return false;
|
||||
@@ -265,6 +309,29 @@ public final class MainActivity extends StageActivity
|
||||
startScene(processAnnouncer(announcer));
|
||||
return true;
|
||||
}
|
||||
} else if (Intent.ACTION_SEND.equals(action)) {
|
||||
String type = intent.getType();
|
||||
if ("text/plain".equals(type)) {
|
||||
ListUrlBuilder builder = new ListUrlBuilder();
|
||||
builder.setKeyword(intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||
startScene(processAnnouncer(GalleryListScene.getStartAnnouncer(builder)));
|
||||
return true;
|
||||
} else if (type.startsWith("image/")) {
|
||||
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
if (null != uri) {
|
||||
UniFile file = UniFile.fromUri(this, uri);
|
||||
File temp = saveImageToTempFile(file);
|
||||
if (null != temp) {
|
||||
ListUrlBuilder builder = new ListUrlBuilder();
|
||||
builder.setMode(ListUrlBuilder.MODE_IMAGE_SEARCH);
|
||||
builder.setImagePath(temp.getPath());
|
||||
builder.setUseSimilarityScan(true);
|
||||
builder.setShowExpunged(true);
|
||||
startScene(processAnnouncer(GalleryListScene.getStartAnnouncer(builder)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -490,7 +490,8 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
mFab.setY(fabStartY);
|
||||
mFab.setScaleX(0.0f);
|
||||
mFab.setScaleY(0.0f);
|
||||
mFab.animate().translationX(0.0f).translationY(0.0f).scaleX(1.0f).scaleY(1.0f)
|
||||
mFab.setRotation(-45.0f);
|
||||
mFab.animate().translationX(0.0f).translationY(0.0f).scaleX(1.0f).scaleY(1.0f).rotation(0.0f)
|
||||
.setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR)
|
||||
.setDuration(300L).setListener(new SimpleAnimatorListener() {
|
||||
@Override
|
||||
|
||||
@@ -913,7 +913,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
private static String getRatingText(float rating, Resources resources) {
|
||||
String undefine = "(´_ゝ`)";
|
||||
if (Float.isNaN(rating)) {
|
||||
if (-1.0f == rating) {
|
||||
return undefine;
|
||||
}
|
||||
|
||||
|
||||
@@ -881,7 +881,8 @@ public final class GalleryListScene extends BaseScene
|
||||
mShowActionFab = true;
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
fab.animate().scaleX(1.0f).scaleY(1.0f).setListener(null)
|
||||
fab.setRotation(-45.0f);
|
||||
fab.animate().scaleX(1.0f).scaleY(1.0f).rotation(0.0f).setListener(null)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(0L)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
|
||||
}
|
||||
@@ -916,7 +917,8 @@ public final class GalleryListScene extends BaseScene
|
||||
.setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
|
||||
}
|
||||
mSearchFab.setVisibility(View.VISIBLE);
|
||||
mSearchFab.animate().scaleX(1.0f).scaleY(1.0f).setListener(null)
|
||||
mSearchFab.setRotation(-45.0f);
|
||||
mSearchFab.animate().scaleX(1.0f).scaleY(1.0f).rotation(0.0f).setListener(null)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(delay)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
|
||||
} else {
|
||||
@@ -950,7 +952,8 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
View fab = mFabLayout.getPrimaryFab();
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
fab.animate().scaleX(1.0f).scaleY(1.0f).setListener(null)
|
||||
fab.setRotation(-45.0f);
|
||||
fab.animate().scaleX(1.0f).scaleY(1.0f).rotation(0.0f).setListener(null)
|
||||
.setDuration(ANIMATE_TIME).setStartDelay(delay)
|
||||
.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
|
||||
|
||||
@@ -1227,10 +1230,14 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
|
||||
public static void startScene(SceneFragment scene, ListUrlBuilder lub) {
|
||||
scene.startScene(getStartAnnouncer(lub));
|
||||
}
|
||||
|
||||
public static Announcer getStartAnnouncer(ListUrlBuilder lub) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(KEY_ACTION, ACTION_LIST_URL_BUILDER);
|
||||
args.putParcelable(KEY_LIST_URL_BUILDER, lub);
|
||||
scene.startScene(new Announcer(GalleryListScene.class).setArgs(args));
|
||||
return new Announcer(GalleryListScene.class).setArgs(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -111,7 +111,7 @@ public class SearchBar extends FrameLayout implements View.OnClickListener,
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
setBackgroundResource(R.drawable.card_white_2dp);
|
||||
setBackgroundResource(R.drawable.card_white_no_padding_2dp);
|
||||
|
||||
mSearchDatabase = SearchDatabase.getInstance(getContext());
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@ import android.view.View;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.util.DrawableManager;
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
|
||||
/**
|
||||
* 5 stars, from 0 to 10
|
||||
*/
|
||||
public class SimpleRatingView extends View {
|
||||
|
||||
private Drawable mStarDrawable;
|
||||
@@ -96,7 +100,7 @@ public class SimpleRatingView extends View {
|
||||
public void setRating(float rating) {
|
||||
if (mRating != rating) {
|
||||
mRating = rating;
|
||||
int ratingInt = (int) Math.ceil(rating * 2);
|
||||
int ratingInt = MathUtils.clamp((int) Math.ceil(rating * 2), 0, 10);
|
||||
if (mRatingInt != ratingInt) {
|
||||
mRatingInt = ratingInt;
|
||||
invalidate();
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* 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.preference;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.preference.Preference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class SeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener {
|
||||
|
||||
private int mProgress;
|
||||
private int mMax;
|
||||
private boolean mTrackingTouch;
|
||||
|
||||
public SeekBarPreference(Context context) {
|
||||
super(context);
|
||||
init(context, null, 0, 0);
|
||||
}
|
||||
|
||||
public SeekBarPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context, attrs, 0, 0);
|
||||
}
|
||||
|
||||
public SeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs, defStyleAttr, 0);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SeekBarPreference, defStyleAttr, defStyleRes);
|
||||
setMax(a.getInt(R.styleable.SeekBarPreference_max, mMax));
|
||||
a.recycle();
|
||||
|
||||
setLayoutResource(R.layout.preference_widget_seekbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindView(View view) {
|
||||
super.onBindView(view);
|
||||
SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
|
||||
seekBar.setOnSeekBarChangeListener(this);
|
||||
seekBar.setMax(mMax);
|
||||
seekBar.setProgress(mProgress);
|
||||
seekBar.setEnabled(isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
|
||||
setProgress(restoreValue ? getPersistedInt(mProgress)
|
||||
: (Integer) defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object onGetDefaultValue(TypedArray a, int index) {
|
||||
return a.getInt(index, 0);
|
||||
}
|
||||
|
||||
public void setMax(int max) {
|
||||
if (max != mMax) {
|
||||
mMax = max;
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
setProgress(progress, true);
|
||||
}
|
||||
|
||||
private void setProgress(int progress, boolean notifyChanged) {
|
||||
if (progress > mMax) {
|
||||
progress = mMax;
|
||||
}
|
||||
if (progress < 0) {
|
||||
progress = 0;
|
||||
}
|
||||
if (progress != mProgress) {
|
||||
mProgress = progress;
|
||||
persistInt(progress);
|
||||
if (notifyChanged) {
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return mProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the seekBar's progress value if callChangeListener
|
||||
* returns true, otherwise set the seekBar's progress to the stored value
|
||||
*/
|
||||
void syncProgress(SeekBar seekBar) {
|
||||
int progress = seekBar.getProgress();
|
||||
if (progress != mProgress) {
|
||||
if (callChangeListener(progress)) {
|
||||
setProgress(progress, false);
|
||||
} else {
|
||||
seekBar.setProgress(mProgress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(
|
||||
SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (fromUser && !mTrackingTouch) {
|
||||
syncProgress(seekBar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
mTrackingTouch = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
mTrackingTouch = false;
|
||||
if (seekBar.getProgress() != mProgress) {
|
||||
syncProgress(seekBar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Parcelable onSaveInstanceState() {
|
||||
/*
|
||||
* Suppose a client uses this preference type without persisting. We
|
||||
* must save the instance state so it is able to, for example, survive
|
||||
* orientation changes.
|
||||
*/
|
||||
|
||||
final Parcelable superState = super.onSaveInstanceState();
|
||||
if (isPersistent()) {
|
||||
// No need to save instance state since it's persistent
|
||||
return superState;
|
||||
}
|
||||
|
||||
// Save the instance state
|
||||
final SavedState myState = new SavedState(superState);
|
||||
myState.progress = mProgress;
|
||||
myState.max = mMax;
|
||||
return myState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Parcelable state) {
|
||||
if (!state.getClass().equals(SavedState.class)) {
|
||||
// Didn't save state for us in onSaveInstanceState
|
||||
super.onRestoreInstanceState(state);
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore the instance state
|
||||
SavedState myState = (SavedState) state;
|
||||
super.onRestoreInstanceState(myState.getSuperState());
|
||||
mProgress = myState.progress;
|
||||
mMax = myState.max;
|
||||
notifyChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* SavedState, a subclass of {@link BaseSavedState}, will store the state
|
||||
* of MyPreference, a subclass of Preference.
|
||||
* <p>
|
||||
* It is important to always call through to super methods.
|
||||
*/
|
||||
private static class SavedState extends BaseSavedState {
|
||||
int progress;
|
||||
int max;
|
||||
|
||||
public SavedState(Parcel source) {
|
||||
super(source);
|
||||
|
||||
// Restore the click counter
|
||||
progress = source.readInt();
|
||||
max = source.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
|
||||
// Save the click counter
|
||||
dest.writeInt(progress);
|
||||
dest.writeInt(max);
|
||||
}
|
||||
|
||||
public SavedState(Parcelable superState) {
|
||||
super(superState);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static final Parcelable.Creator<SavedState> CREATOR =
|
||||
new Parcelable.Creator<SavedState>() {
|
||||
@Override
|
||||
public SavedState createFromParcel(Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SavedState[] newArray(int size) {
|
||||
return new SavedState[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2014 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.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class ColorView extends View {
|
||||
|
||||
private int mColor;
|
||||
|
||||
public ColorView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public ColorView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public ColorView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
if (mColor != color) {
|
||||
mColor = color;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawColor(mColor);
|
||||
}
|
||||
}
|
||||
@@ -256,14 +256,20 @@ public class FabLayout extends ViewGroup implements View.OnClickListener {
|
||||
|
||||
|
||||
private void setPrimaryFabAnimation(final View child, final boolean expanded, boolean delay) {
|
||||
float startRotation;
|
||||
float endRotation;
|
||||
float startScale;
|
||||
float endScale;
|
||||
Interpolator interpolator;
|
||||
if (expanded) {
|
||||
startRotation = -45.0f;
|
||||
endRotation = 0.0f;
|
||||
startScale = 0.0f;
|
||||
endScale = 1.0f;
|
||||
interpolator = AnimationUtils.FAST_SLOW_INTERPOLATOR;
|
||||
} else {
|
||||
startRotation = 0.0f;
|
||||
endRotation = 0.0f;
|
||||
startScale = 1.0f;
|
||||
endScale = 0.0f;
|
||||
interpolator = AnimationUtils.SLOW_FAST_INTERPOLATOR;
|
||||
@@ -271,9 +277,11 @@ public class FabLayout extends ViewGroup implements View.OnClickListener {
|
||||
|
||||
child.setScaleX(startScale);
|
||||
child.setScaleY(startScale);
|
||||
child.setRotation(startRotation);
|
||||
child.animate()
|
||||
.scaleX(endScale)
|
||||
.scaleY(endScale)
|
||||
.rotation(endRotation)
|
||||
.setStartDelay(delay ? ANIMATE_TIME : 0L)
|
||||
.setDuration(ANIMATE_TIME)
|
||||
.setInterpolator(interpolator)
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
@@ -98,6 +99,16 @@ public class SlidingDrawerLayout extends ViewGroup implements ValueAnimator.Anim
|
||||
Build.VERSION.SDK_INT >= 21;
|
||||
private static final int DRAWER_ELEVATION = 10; //dp
|
||||
|
||||
private static final SlidingDrawerLayoutInsetsHelper INSETS_HELPER;
|
||||
|
||||
static {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
INSETS_HELPER = new SlidingDrawerLayoutInsetsHelperL();
|
||||
} else {
|
||||
INSETS_HELPER = null;
|
||||
}
|
||||
}
|
||||
|
||||
private float mDrawerElevation;
|
||||
|
||||
private int mMinDrawerMargin;
|
||||
@@ -139,8 +150,8 @@ public class SlidingDrawerLayout extends ViewGroup implements ValueAnimator.Anim
|
||||
private int mFitPaddingTop = 0;
|
||||
private int mFitPaddingBottom = 0;
|
||||
|
||||
private int mStatusBarColor = Color.BLACK;
|
||||
private int mNavigationBarColor = Color.BLACK;
|
||||
private Paint mStatusBarPaint;
|
||||
private Paint mNavigationBarPaint;
|
||||
|
||||
private static int sDefaultMinDrawerMargin = 56;
|
||||
|
||||
@@ -214,8 +225,16 @@ public class SlidingDrawerLayout extends ViewGroup implements ValueAnimator.Anim
|
||||
mAnimator.setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR);
|
||||
mCancelAnimation = false;
|
||||
mDrawerElevation = LayoutUtils.dp2pix(context, DRAWER_ELEVATION);
|
||||
mStatusBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
|
||||
mStatusBarPaint.setColor(Color.BLACK);
|
||||
mNavigationBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
|
||||
mNavigationBarPaint.setColor(Color.BLACK);
|
||||
|
||||
setWillNotDraw(false);
|
||||
|
||||
if (INSETS_HELPER != null) {
|
||||
INSETS_HELPER.setupForWindowInsets(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDrawerListener(DrawerListener listener) {
|
||||
@@ -978,11 +997,11 @@ public class SlidingDrawerLayout extends ViewGroup implements ValueAnimator.Anim
|
||||
}
|
||||
|
||||
public void setStatusBarColor(int statusBarColor) {
|
||||
mStatusBarColor = statusBarColor;
|
||||
mStatusBarPaint.setColor(statusBarColor);
|
||||
}
|
||||
|
||||
public void setNavigationBarColor(int navigationBarColor) {
|
||||
mNavigationBarColor = navigationBarColor;
|
||||
mNavigationBarPaint.setColor(navigationBarColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1012,18 +1031,12 @@ public class SlidingDrawerLayout extends ViewGroup implements ValueAnimator.Anim
|
||||
super.onDraw(canvas);
|
||||
|
||||
if (mFitPaddingTop != 0) {
|
||||
int saved = canvas.save();
|
||||
canvas.clipRect(0, 0, getWidth(), mFitPaddingTop);
|
||||
canvas.drawColor(mStatusBarColor);
|
||||
canvas.restoreToCount(saved);
|
||||
canvas.drawRect(0, 0, getWidth(), mFitPaddingTop, mStatusBarPaint);
|
||||
}
|
||||
|
||||
if (mFitPaddingBottom != 0) {
|
||||
int saved = canvas.save();
|
||||
int height = getHeight();
|
||||
canvas.clipRect(0, height - mFitPaddingBottom, getWidth(), height);
|
||||
canvas.drawColor(mNavigationBarColor);
|
||||
canvas.restoreToCount(saved);
|
||||
canvas.drawRect(0, height - mFitPaddingBottom, getWidth(), height, mNavigationBarPaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.widget.slidingdrawerlayout;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface SlidingDrawerLayoutInsetsHelper {
|
||||
void setupForWindowInsets(View view);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.widget.slidingdrawerlayout;
|
||||
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.view.View;
|
||||
|
||||
public class SlidingDrawerLayoutInsetsHelperL implements SlidingDrawerLayoutInsetsHelper {
|
||||
|
||||
@Override
|
||||
public void setupForWindowInsets(View view) {
|
||||
if (ViewCompat.getFitsSystemWindows(view)) {
|
||||
// Now set the sys ui flags to enable us to lay out in the window insets
|
||||
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 380 B |
|
After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 342 B |
|
After Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 343 B |
|
After Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 643 B |
|
After Width: | Height: | Size: 641 B |
|
Before Width: | Height: | Size: 636 B |
|
After Width: | Height: | Size: 639 B |
@@ -18,7 +18,7 @@
|
||||
<selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_activated="true" android:drawable="@drawable/card_grey_2dp"/>
|
||||
<item android:drawable="@drawable/card_white_2dp"/>
|
||||
<item android:state_activated="true" android:drawable="@drawable/card_grey_no_padding_2dp"/>
|
||||
<item android:drawable="@drawable/card_white_no_padding_2dp"/>
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
|
||||
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
|
||||
android:background="?android:attr/activatedBackgroundIndicator"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:ellipsize="marquee" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/title"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:maxLines="10" />
|
||||
|
||||
<!-- Preference should place its actual preference widget here. -->
|
||||
<LinearLayout
|
||||
android:id="@android:id/widget_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@android:id/summary"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:minWidth="@dimen/preference_widget_width"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/summary"
|
||||
android:layout_toRightOf="@android:id/widget_frame"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -40,12 +40,11 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ok"
|
||||
style="@style/CardButton"
|
||||
style="?attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:text="@android:string/ok"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:background="@null"/>
|
||||
android:textColor="?attr/colorPrimary"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -87,4 +87,10 @@
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
</com.hippo.ehviewer.widget.SeekBarPanel>
|
||||
|
||||
<com.hippo.widget.ColorView
|
||||
android:id="@+id/mask"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -18,8 +18,7 @@
|
||||
<com.hippo.widget.SafeCoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.hippo.widget.slidingdrawerlayout.SlidingDrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
@@ -31,8 +30,7 @@
|
||||
<com.hippo.ehviewer.widget.EhStageLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"/>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@@ -41,7 +39,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="left"
|
||||
android:maxWidth="@dimen/drawer_max_width"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_main"
|
||||
app:menu="@menu/nav_drawer_main"/>
|
||||
|
||||
|
||||
@@ -150,5 +150,18 @@
|
||||
android:text="@string/settings_read_volume_page"
|
||||
android:textColor="@color/primary_text_dark"/>
|
||||
|
||||
<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"/>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/screen_lightness"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:max="200"/>
|
||||
|
||||
</LinearLayout>
|
||||
</com.hippo.widget.IndicatingScrollView>
|
||||
@@ -128,7 +128,7 @@
|
||||
android:layout_marginLeft="@dimen/keyline_margin"
|
||||
android:layout_marginRight="@dimen/keyline_margin"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/card_white_2dp">
|
||||
android:background="@drawable/card_white_no_padding_2dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/card_background">
|
||||
android:background="@drawable/card_background_no_padding">
|
||||
|
||||
<com.hippo.widget.LoadImageView
|
||||
android:id="@+id/thumb"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/card_background">
|
||||
android:background="@drawable/card_background_no_padding">
|
||||
|
||||
<com.hippo.widget.LoadImageView
|
||||
android:id="@+id/thumb"
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/preference_item_padding_side"
|
||||
android:paddingRight="?android:attr/scrollbarSize"
|
||||
android:background="?android:attr/activatedBackgroundIndicator">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="@dimen/preference_item_padding_inner"
|
||||
android:paddingTop="6dip"
|
||||
android:paddingBottom="6dip">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/title"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:maxLines="10"/>
|
||||
|
||||
<!-- Preference should place its actual preference widget here. -->
|
||||
<LinearLayout
|
||||
android:id="@android:id/widget_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@android:id/summary"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:minWidth="@dimen/preference_widget_width"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/summary"
|
||||
android:layout_toRightOf="@android:id/widget_frame"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -18,7 +18,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/card_white_2dp">
|
||||
android:background="@drawable/card_white_no_padding_2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Custom preference -->
|
||||
<dimen name="preference_widget_width">72dp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Custom preference -->
|
||||
<dimen name="preference_widget_width">56dp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Custom preference -->
|
||||
<dimen name="preference_widget_width">64dp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
@@ -401,6 +401,8 @@
|
||||
<string name="settings_read_show_clock">显示时钟</string>
|
||||
<string name="settings_read_show_battery">显示电量</string>
|
||||
<string name="settings_read_volume_page">使用音量键翻页</string>
|
||||
<string name="settings_read_custom_screen_lightness">自定义屏幕亮度</string>
|
||||
<string name="settings_read_screen_lightness">屏幕亮度</string>
|
||||
|
||||
<string name="settings_download">下载</string>
|
||||
<string name="settings_download_download_location">下载路径</string>
|
||||
|
||||
@@ -401,6 +401,8 @@
|
||||
<string name="settings_read_show_clock">顯示時鐘</string>
|
||||
<string name="settings_read_show_battery">顯示電量</string>
|
||||
<string name="settings_read_volume_page">使用音量鍵翻頁</string>
|
||||
<string name="settings_read_custom_screen_lightness">自定義屏幕亮度</string>
|
||||
<string name="settings_read_screen_lightness">屏幕亮度</string>
|
||||
|
||||
<string name="settings_download">下載</string>
|
||||
<string name="settings_download_download_location">下載路徑</string>
|
||||
|
||||
@@ -401,6 +401,8 @@
|
||||
<string name="settings_read_show_clock">顯示時鐘</string>
|
||||
<string name="settings_read_show_battery">顯示電量</string>
|
||||
<string name="settings_read_volume_page">使用音量鍵翻頁</string>
|
||||
<string name="settings_read_custom_screen_lightness">自定義螢幕亮度</string>
|
||||
<string name="settings_read_screen_lightness">螢幕亮度</string>
|
||||
|
||||
<string name="settings_download">下載</string>
|
||||
<string name="settings_download_download_location">下載路徑</string>
|
||||
|
||||
@@ -137,4 +137,8 @@
|
||||
<attr name="url" format="string"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="SeekBarPreference">
|
||||
<attr name="max" format="integer"/>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -44,7 +44,7 @@
|
||||
<dimen name="list_content_margin_v">4dp</dimen>
|
||||
<dimen name="list_content_interval">4dp</dimen>
|
||||
<dimen name="list_search_bar_margin">4dp</dimen>
|
||||
<dimen name="list_padding_top_search_bar">77dp</dimen>
|
||||
<dimen name="list_padding_top_search_bar">72dp</dimen>
|
||||
<dimen name="list_padding_bottom_fab">80dp</dimen>
|
||||
|
||||
<dimen name="gallery_list_column_width">320dp</dimen>
|
||||
@@ -109,4 +109,9 @@
|
||||
<dimen name="lock_pattern_dot_size">12dp</dimen>
|
||||
<dimen name="lock_pattern_dot_size_activated">28dp</dimen>
|
||||
|
||||
<!-- Custom preference -->
|
||||
<dimen name="preference_widget_width">48dp</dimen>
|
||||
<dimen name="preference_item_padding_side">8dip</dimen>
|
||||
<dimen name="preference_item_padding_inner">8dip</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -154,8 +154,8 @@
|
||||
|
||||
<string name="search">Search</string>
|
||||
|
||||
<string name="keyword_search">Keyword Search</string>
|
||||
<string name="image_search">Image Search</string>
|
||||
<string name="keyword_search">Keyword search</string>
|
||||
<string name="image_search">Image search</string>
|
||||
|
||||
<string name="search_normal">Normal Search</string>
|
||||
<string name="search_advance">Advance Options</string>
|
||||
@@ -443,6 +443,8 @@
|
||||
<string name="settings_read_show_clock">Show clock</string>
|
||||
<string name="settings_read_show_battery">Show battery</string>
|
||||
<string name="settings_read_volume_page">Use volume key to turn pages</string>
|
||||
<string name="settings_read_custom_screen_lightness">Custom screen lightness</string>
|
||||
<string name="settings_read_screen_lightness">Screen lightness</string>
|
||||
|
||||
<string name="settings_download">Download</string>
|
||||
<string name="settings_download_download_location">Download location</string>
|
||||
|
||||
@@ -39,14 +39,6 @@
|
||||
<item name="android:minHeight">76dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Card Button -->
|
||||
<style name="CardButton">
|
||||
<item name="android:minWidth">88dp</item>
|
||||
<item name="android:minHeight">48dp</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:background">@drawable/card_white_2dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.CardTitle">
|
||||
<item name="android:textSize">@dimen/text_little_small</item>
|
||||
<item name="android:textColor">@color/primary_text_light</item>
|
||||
|
||||
@@ -71,4 +71,16 @@
|
||||
android:title="@string/settings_read_volume_page"
|
||||
android:defaultValue="false"/>
|
||||
|
||||
<com.hippo.preference.SwitchPreference
|
||||
android:key="custom_screen_lightness"
|
||||
android:title="@string/settings_read_custom_screen_lightness"
|
||||
android:defaultValue="false"/>
|
||||
|
||||
<com.hippo.preference.SeekBarPreference
|
||||
android:key="screen_lightness"
|
||||
android:title="@string/settings_read_screen_lightness"
|
||||
android:dependency="custom_screen_lightness"
|
||||
app:max="200"
|
||||
android:defaultValue="50"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.0-alpha4'
|
||||
classpath 'com.android.tools.build:gradle:2.1.0-alpha5'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||