Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e568e688f5 | ||
|
|
a201c930c2 | ||
|
|
7d927dde6b | ||
|
|
f76fece81d | ||
|
|
069d7e2382 | ||
|
|
e2e0562719 | ||
|
|
347aaadb43 | ||
|
|
6ddd64232f | ||
|
|
e532b3b05b | ||
|
|
d7c17d80e7 | ||
|
|
b35980cf60 | ||
|
|
263853d6a7 | ||
|
|
6a100b8250 | ||
|
|
893560e589 | ||
|
|
6b7ce7de5b | ||
|
|
6082d8cc1a | ||
|
|
ec37c9cab2 |
No files matched your search
+5
-6
@@ -31,8 +31,8 @@ android {
|
||||
applicationId "moe.tarsin.ehviewer"
|
||||
minSdkVersion 28
|
||||
targetSdkVersion 33
|
||||
versionCode 180025
|
||||
versionName "1.8.4.0-alpha01"
|
||||
versionCode 180026
|
||||
versionName "1.8.4.0-alpha02"
|
||||
resConfigs 'zh', 'zh-rCN', 'zh-rHK', 'zh-rTW', 'es', 'ja', 'ko', 'fr', 'de', 'th'
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ android {
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += "/META-INF/**"
|
||||
excludes += "/okhttp3/**"
|
||||
excludes += "/kotlin/**"
|
||||
excludes += "**.txt"
|
||||
excludes += "**.bin"
|
||||
@@ -134,7 +133,7 @@ dependencies {
|
||||
|
||||
implementation "androidx.compose.material3:material3:1.0.1"
|
||||
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.2.0-alpha04"
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.2.0-alpha05"
|
||||
implementation "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
|
||||
|
||||
def core_version = "1.9.0"
|
||||
@@ -144,7 +143,7 @@ dependencies {
|
||||
implementation "androidx.customview:customview:1.2.0-alpha02"
|
||||
implementation "androidx.dynamicanimation:dynamicanimation:1.1.0-alpha03"
|
||||
|
||||
def fragment_version = "1.6.0-alpha03"
|
||||
def fragment_version = "1.6.0-alpha04"
|
||||
implementation "androidx.fragment:fragment:$fragment_version"
|
||||
implementation "androidx.fragment:fragment-ktx:$fragment_version"
|
||||
|
||||
@@ -169,7 +168,7 @@ dependencies {
|
||||
implementation 'androidx.preference:preference:1.2.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.0-rc01'
|
||||
|
||||
def room_version = "2.5.0-beta02"
|
||||
def room_version = "2.5.0-rc01"
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
implementation "androidx.room:room-paging:$room_version"
|
||||
|
||||
@@ -122,29 +122,6 @@ bool copy_pixels(const void *src, int src_w, int src_h, int src_x, int src_y,
|
||||
return true;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_hippo_image_Image_nativeRender(JNIEnv *env, jclass clazz, jobject srcBitmap, jint src_x,
|
||||
jint src_y, jobject dst, jint dst_x, jint dst_y, jint width,
|
||||
jint height) {
|
||||
AndroidBitmapInfo dstInfo;
|
||||
AndroidBitmapInfo srcInfo;
|
||||
void *srcPixels = NULL;
|
||||
void *dstPixels = NULL;
|
||||
|
||||
AndroidBitmap_lockPixels(env, srcBitmap, &srcPixels);
|
||||
AndroidBitmap_lockPixels(env, dst, &dstPixels);
|
||||
AndroidBitmap_getInfo(env, srcBitmap, &srcInfo);
|
||||
AndroidBitmap_getInfo(env, dst, &dstInfo);
|
||||
|
||||
copy_pixels(srcPixels, srcInfo.width, srcInfo.height, src_x, src_y, dstPixels, dstInfo.width,
|
||||
dstInfo.height, dst_x, dst_y,
|
||||
width,
|
||||
height);
|
||||
|
||||
AndroidBitmap_unlockPixels(env, dst);
|
||||
AndroidBitmap_unlockPixels(env, srcBitmap);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_hippo_image_Image_nativeTexImage(JNIEnv *env, jclass clazz, jobject bitmap, jboolean init,
|
||||
jint offset_x, jint offset_y, jint width, jint height) {
|
||||
|
||||
@@ -170,6 +170,9 @@ class EhApplication : SceneApplication() {
|
||||
}
|
||||
|
||||
fun showEventPane(html: String) {
|
||||
if (Settings.getHideHvEvents() && html.contains("You have encountered a monster!")) {
|
||||
return;
|
||||
}
|
||||
val activity = topActivity
|
||||
activity?.runOnUiThread {
|
||||
val dialog = BaseDialogBuilder(activity)
|
||||
|
||||
@@ -398,11 +398,10 @@ public class EhDB {
|
||||
db.filterDao().update(filter);
|
||||
}
|
||||
|
||||
private static <T> boolean copyDao(BasicDao<T> from, BasicDao<T> to) {
|
||||
private static <T> void copyDao(BasicDao<T> from, BasicDao<T> to) {
|
||||
List<T> list = from.list();
|
||||
for (T item : list)
|
||||
to.insert(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static synchronized boolean exportDB(Context context, Uri uri) {
|
||||
@@ -414,20 +413,18 @@ public class EhDB {
|
||||
|
||||
try {
|
||||
// Copy data to a export db
|
||||
if (copyDao(db.downloadsDao(), newDb.downloadsDao()))
|
||||
return false;
|
||||
if (copyDao(db.downloadLabelDao(), newDb.downloadLabelDao()))
|
||||
return false;
|
||||
if (copyDao(db.downloadDirnameDao(), newDb.downloadDirnameDao()))
|
||||
return false;
|
||||
if (copyDao(db.historyDao(), newDb.historyDao()))
|
||||
return false;
|
||||
if (copyDao(db.quickSearchDao(), newDb.quickSearchDao()))
|
||||
return false;
|
||||
if (copyDao(db.localFavoritesDao(), newDb.localFavoritesDao()))
|
||||
return false;
|
||||
if (copyDao(db.filterDao(), newDb.filterDao()))
|
||||
return false;
|
||||
copyDao(db.downloadsDao(), newDb.downloadsDao());
|
||||
copyDao(db.downloadLabelDao(), newDb.downloadLabelDao());
|
||||
copyDao(db.downloadDirnameDao(), newDb.downloadDirnameDao());
|
||||
copyDao(db.historyDao(), newDb.historyDao());
|
||||
copyDao(db.quickSearchDao(), newDb.quickSearchDao());
|
||||
copyDao(db.localFavoritesDao(), newDb.localFavoritesDao());
|
||||
copyDao(db.filterDao(), newDb.filterDao());
|
||||
|
||||
// Close export db so we can copy it
|
||||
if (newDb.isOpen()) {
|
||||
newDb.close();
|
||||
}
|
||||
|
||||
// Copy export db to data dir
|
||||
File dbFile = context.getDatabasePath(ehExportName);
|
||||
@@ -447,6 +444,7 @@ public class EhDB {
|
||||
IOUtils.closeQuietly(is);
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
|
||||
// Delete failed file
|
||||
return false;
|
||||
} finally {
|
||||
@@ -460,6 +458,8 @@ public class EhDB {
|
||||
public static synchronized String importDB(Context context, Uri uri) {
|
||||
try {
|
||||
InputStream inputStream = context.getContentResolver().openInputStream(uri);
|
||||
|
||||
// Copy file to cache dir
|
||||
File file = File.createTempFile("importDatabase", "");
|
||||
FileOutputStream outputStream = new FileOutputStream(file);
|
||||
byte[] buff = new byte[1024];
|
||||
@@ -474,6 +474,7 @@ public class EhDB {
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
|
||||
// Check database version
|
||||
SQLiteDatabase oldDB = SQLiteDatabase.openDatabase(
|
||||
file.getPath(), null, SQLiteDatabase.NO_LOCALIZED_COLLATORS);
|
||||
int newVersion = CUR_DB_VER;
|
||||
@@ -482,9 +483,10 @@ public class EhDB {
|
||||
upgradeDB(oldDB, oldVersion);
|
||||
oldDB.setVersion(newVersion);
|
||||
} else if (oldVersion > newVersion) {
|
||||
return context.getString(R.string.cant_read_the_file);
|
||||
return context.getString(R.string.db_version_too_high);
|
||||
}
|
||||
|
||||
// Crete temp room database from cache file
|
||||
String tmpDBName = "tmp.db";
|
||||
context.deleteDatabase(tmpDBName);
|
||||
EhDatabase oldRoomDatabase = Room.databaseBuilder(context, EhDatabase.class, tmpDBName)
|
||||
@@ -565,6 +567,12 @@ public class EhDB {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
// Delete temp database
|
||||
if (oldRoomDatabase.isOpen()) {
|
||||
oldRoomDatabase.close();
|
||||
}
|
||||
context.deleteDatabase(tmpDBName);
|
||||
|
||||
return null;
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
|
||||
@@ -67,6 +67,8 @@ public class Settings {
|
||||
public static final int DEFAULT_DEFAULT_CATEGORIES = EhConfig.ALL_CATEGORY;
|
||||
public static final String KEY_EXCLUDED_TAG_NAMESPACES = "excluded_tag_namespaces";
|
||||
public static final String KEY_EXCLUDED_LANGUAGES = "excluded_languages";
|
||||
private static final String KEY_HIDE_HV_EVENTS = "hide_hv_events";
|
||||
private static final boolean DEFAULT_HIDE_HV_EVENTS = true;
|
||||
/********************
|
||||
****** Privacy and Security
|
||||
********************/
|
||||
@@ -551,6 +553,10 @@ public class Settings {
|
||||
return getBoolean(KEY_REQUEST_NEWS, DEFAULT_REQUEST_NEWS);
|
||||
}
|
||||
|
||||
public static boolean getHideHvEvents() {
|
||||
return getBoolean(KEY_HIDE_HV_EVENTS, DEFAULT_HIDE_HV_EVENTS);
|
||||
}
|
||||
|
||||
public static boolean getShowJpnTitle() {
|
||||
return getBoolean(KEY_SHOW_JPN_TITLE, DEFAULT_SHOW_JPN_TITLE);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ public class ArchiveGalleryProvider extends GalleryProvider2 {
|
||||
Image image = null;
|
||||
if (buffer != null) {
|
||||
try {
|
||||
image = Image.decode(buffer, false, () -> {
|
||||
image = Image.decode(buffer, () -> {
|
||||
archiveAccessor.releaseByteBuffer(buffer);
|
||||
return null;
|
||||
});
|
||||
|
||||
@@ -259,7 +259,7 @@ public class DirGalleryProvider extends GalleryProvider2 implements Runnable {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = files[index].openInputStream();
|
||||
Image image = Image.decode((FileInputStream) is, false);
|
||||
Image image = Image.decode((FileInputStream) is);
|
||||
mDecodingIndex.lazySet(GalleryPageView.INVALID_INDEX);
|
||||
notifyPageSucceed(index, image);
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -1679,7 +1679,7 @@ public final class SpiderQueen implements Runnable {
|
||||
|
||||
if (is != null) {
|
||||
try {
|
||||
image = Image.decode(((FileInputStream) is), false);
|
||||
image = Image.decode(((FileInputStream) is));
|
||||
} catch (ImageDecoder.DecodeException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
@@ -18,4 +18,9 @@ abstract class CollapsingToolbarScene : ToolbarScene() {
|
||||
val contentView = onCreateViewWithToolbar(inflater, view, savedInstanceState)
|
||||
return view.apply { addView(contentView, 0) }
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mAppBarLayout?.setExpanded(false, true)
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo
|
||||
import com.hippo.ehviewer.dao.DownloadInfo
|
||||
import com.hippo.ehviewer.dao.HistoryInfo
|
||||
import com.hippo.ehviewer.download.DownloadManager
|
||||
import com.hippo.ehviewer.download.DownloadManager.DownloadInfoListener
|
||||
import com.hippo.ehviewer.ui.CommonOperations
|
||||
import com.hippo.ehviewer.ui.GalleryActivity
|
||||
@@ -59,6 +58,7 @@ import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import rikka.core.res.resolveColor
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
class HistoryScene : ToolbarScene() {
|
||||
private var mRecyclerView: RecyclerView? = null
|
||||
private val mAdapter: HistoryAdapter by lazy {
|
||||
@@ -131,7 +131,7 @@ class HistoryScene : ToolbarScene() {
|
||||
setLiftOnScrollTargetView(recyclerView)
|
||||
val mFastScroller = ViewUtils.`$$`(content, R.id.fast_scroller) as FastScroller
|
||||
val mTip = ViewUtils.`$$`(view, R.id.tip) as TextView
|
||||
ViewTransition(content, mTip)
|
||||
val mViewTransition = ViewTransition(content, mTip)
|
||||
val resources = requireContext().resources
|
||||
val drawable = ContextCompat.getDrawable(requireContext(), R.drawable.big_history)
|
||||
drawable!!.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight)
|
||||
@@ -164,6 +164,15 @@ class HistoryScene : ToolbarScene() {
|
||||
)
|
||||
}
|
||||
}
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
mAdapter.onPagesUpdatedFlow.collectLatest {
|
||||
if (mAdapter.itemCount == 0) {
|
||||
mViewTransition.showView(1, true)
|
||||
} else {
|
||||
mViewTransition.showView(0, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
|
||||
@@ -237,11 +237,10 @@ public abstract class GalleryProvider {
|
||||
|
||||
private static class ImageCache extends LruCache<Integer, ImageWrapper> {
|
||||
|
||||
private static final long MAX_CACHE_SIZE = 128 * 1024 * 1024;
|
||||
private static final long MIN_CACHE_SIZE = 32 * 1024 * 1024;
|
||||
private static final int CACHE_SIZE = 512 * 1024 * 1024;
|
||||
|
||||
public ImageCache() {
|
||||
super((int) MathUtils.clamp(OSUtils.getTotalMemory() / 16, MIN_CACHE_SIZE, MAX_CACHE_SIZE));
|
||||
super(CACHE_SIZE);
|
||||
}
|
||||
|
||||
public void add(Integer key, ImageWrapper value) {
|
||||
|
||||
@@ -122,15 +122,6 @@ public class ImageWrapper {
|
||||
return mCut.height();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#render(int, int, Bitmap, int, int, int, int)
|
||||
*/
|
||||
public void render(int srcX, int srcY, Bitmap dst, int dstX, int dstY,
|
||||
int width, int height, boolean fillBlank, int defaultColor) {
|
||||
mImage.render(srcX + mCut.left, srcY + mCut.top, dst, dstX, dstY,
|
||||
width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Image#texImage(boolean, int, int, int, int)
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.content.res.Resources
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.ImageDecoder
|
||||
import android.graphics.ImageDecoder.ALLOCATOR_DEFAULT
|
||||
import android.graphics.ImageDecoder.ALLOCATOR_SOFTWARE
|
||||
import android.graphics.ImageDecoder.DecodeException
|
||||
import android.graphics.ImageDecoder.ImageInfo
|
||||
@@ -39,10 +38,9 @@ import kotlin.math.max
|
||||
|
||||
class Image private constructor(
|
||||
source: Source?, drawable: Drawable? = null,
|
||||
val hardware: Boolean = true,
|
||||
val release: () -> Unit? = {}
|
||||
) {
|
||||
internal var mObtainedDrawable: Drawable?
|
||||
private var mObtainedDrawable: Drawable?
|
||||
private var mBitmap: Bitmap? = null
|
||||
private var mCanvas: Canvas? = null
|
||||
|
||||
@@ -51,7 +49,7 @@ class Image private constructor(
|
||||
source?.let {
|
||||
mObtainedDrawable =
|
||||
ImageDecoder.decodeDrawable(source) { decoder: ImageDecoder, info: ImageInfo, src: Source ->
|
||||
decoder.allocator = if (hardware) ALLOCATOR_DEFAULT else ALLOCATOR_SOFTWARE
|
||||
decoder.allocator = ALLOCATOR_SOFTWARE
|
||||
// Sadly we must use software memory since we need copy it to tile buffer, fuck glgallery
|
||||
// Idk it will cause how much performance regression
|
||||
|
||||
@@ -63,7 +61,6 @@ class Image private constructor(
|
||||
), 1
|
||||
)
|
||||
)
|
||||
// Don't
|
||||
} // Should we lazy decode it?
|
||||
}
|
||||
if (mObtainedDrawable == null) {
|
||||
@@ -105,31 +102,7 @@ class Image private constructor(
|
||||
mObtainedDrawable!!.draw(mCanvas!!)
|
||||
}
|
||||
|
||||
fun render(
|
||||
srcX: Int, srcY: Int, dst: Bitmap, dstX: Int, dstY: Int,
|
||||
width: Int, height: Int
|
||||
) {
|
||||
check(!hardware) { "Hardware buffer cannot be used in glgallery" }
|
||||
val bitmap: Bitmap = if (animated) {
|
||||
updateBitmap()
|
||||
mBitmap!!
|
||||
} else {
|
||||
(mObtainedDrawable as BitmapDrawable).bitmap
|
||||
}
|
||||
nativeRender(
|
||||
bitmap,
|
||||
srcX,
|
||||
srcY,
|
||||
dst,
|
||||
dstX,
|
||||
dstY,
|
||||
width,
|
||||
height
|
||||
)
|
||||
}
|
||||
|
||||
fun texImage(init: Boolean, offsetX: Int, offsetY: Int, width: Int, height: Int) {
|
||||
check(!hardware) { "Hardware buffer cannot be used in glgallery" }
|
||||
val bitmap: Bitmap? = if (animated) {
|
||||
updateBitmap()
|
||||
mBitmap
|
||||
@@ -177,37 +150,30 @@ class Image private constructor(
|
||||
|
||||
@Throws(DecodeException::class)
|
||||
@JvmStatic
|
||||
fun decode(stream: FileInputStream, hardware: Boolean = true): Image {
|
||||
fun decode(stream: FileInputStream): Image {
|
||||
val src = ImageDecoder.createSource(
|
||||
stream.channel.map(
|
||||
FileChannel.MapMode.READ_ONLY, 0,
|
||||
stream.available().toLong()
|
||||
)
|
||||
)
|
||||
return Image(src, hardware = hardware)
|
||||
return Image(src)
|
||||
}
|
||||
|
||||
@Throws(DecodeException::class)
|
||||
@JvmStatic
|
||||
fun decode(buffer: ByteBuffer, hardware: Boolean = true, release: () -> Unit? = {}): Image {
|
||||
fun decode(buffer: ByteBuffer, release: () -> Unit? = {}): Image {
|
||||
val src = ImageDecoder.createSource(buffer)
|
||||
return Image(src, hardware = hardware) {
|
||||
return Image(src) {
|
||||
release()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun create(bitmap: Bitmap): Image {
|
||||
return Image(null, bitmap.toDrawable(Resources.getSystem()), false)
|
||||
return Image(null, bitmap.toDrawable(Resources.getSystem()))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeRender(
|
||||
bitmap: Bitmap,
|
||||
srcX: Int, srcY: Int, dst: Bitmap, dstX: Int, dstY: Int,
|
||||
width: Int, height: Int
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
private external fun nativeTexImage(
|
||||
bitmap: Bitmap,
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.IntIdGenerator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -81,7 +80,7 @@ public abstract class StageActivity extends EhActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
Class clazz;
|
||||
Class<?> clazz;
|
||||
try {
|
||||
clazz = Class.forName(clazzStr);
|
||||
} catch (ClassNotFoundException e) {
|
||||
@@ -188,7 +187,7 @@ public abstract class StageActivity extends EhActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(KEY_STAGE_ID, mStageId);
|
||||
outState.putStringArrayList(KEY_SCENE_TAG_LIST, mSceneTagList);
|
||||
@@ -480,7 +479,7 @@ public abstract class StageActivity extends EhActivity {
|
||||
}
|
||||
|
||||
void sortSceneViews(List<View> views) {
|
||||
Collections.sort(views, mSceneViewComparator);
|
||||
views.sort(mSceneViewComparator);
|
||||
}
|
||||
|
||||
public void finishScene(SceneFragment scene) {
|
||||
@@ -572,10 +571,10 @@ public abstract class StageActivity extends EhActivity {
|
||||
if (mSceneTagList.size() == 0)
|
||||
return false;
|
||||
String tag = mSceneTagList.get(0);
|
||||
GalleryListScene fragment = (GalleryListScene) getSupportFragmentManager().findFragmentByTag(tag);
|
||||
if (fragment == null)
|
||||
return false;
|
||||
return !fragment.isBackpressCanPreviewLauncherStatus();
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
|
||||
if (fragment instanceof GalleryListScene)
|
||||
return !((GalleryListScene) fragment).isBackpressCanPreviewLauncherStatus();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateBackPressCallBackStatus() {
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
|
||||
public class SafeCoordinatorLayout extends CoordinatorLayout {
|
||||
|
||||
public SafeCoordinatorLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SafeCoordinatorLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SafeCoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onTouchEvent(ev);
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.hippo.widget.SafeCoordinatorLayout
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/snackbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@@ -43,7 +43,7 @@
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</com.hippo.widget.SafeCoordinatorLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
</com.hippo.widget.IgnoreFitsSystemWindowsFullyDraggableDrawerContentLayout>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@@ -26,9 +27,11 @@
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
style="@style/Widget.Material3.CollapsingToolbar.Large"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/collapsingToolbarLayoutMediumSize"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed"
|
||||
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||
app:titleCollapseMode="scale"
|
||||
app:maxLines="3">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
|
||||
@@ -507,6 +507,7 @@
|
||||
<string name="proxy_invalid_port">无效的端口</string>
|
||||
|
||||
<string name="cant_read_the_file">无法读取文件</string>
|
||||
<string name="db_version_too_high">数据库版本过高</string>
|
||||
|
||||
<string name="app_language_system">系统语言(默认)</string>
|
||||
|
||||
@@ -608,7 +609,8 @@
|
||||
<string name="settings_eh_metered_network_warning">流量计费网络警告</string>
|
||||
<string name="metered_network_warning">正在使用流量计费网络</string>
|
||||
<string name="read_from">从第 %d 页阅读</string>
|
||||
<string name="settings_request_news_title">启动时请求新闻页面</string>
|
||||
<string name="settings_eh_request_news">启动时请求新闻页面</string>
|
||||
<string name="settings_eh_hide_hv_events">隐藏 HV 事件通知</string>
|
||||
<string name="copy_trans">复制翻译</string>
|
||||
<string name="reset_download_location">恢复默认路径</string>
|
||||
<string name="pick_new_download_location">选择新路径</string>
|
||||
|
||||
@@ -604,7 +604,7 @@
|
||||
<string name="settings_eh_metered_network_warning">流量計費網路警告</string>
|
||||
<string name="metered_network_warning">正在使用流量計費網路</string>
|
||||
<string name="read_from">從第 %d 頁閱讀</string>
|
||||
<string name="settings_request_news_title">啟動時請求新聞頁面</string>
|
||||
<string name="settings_eh_request_news">啟動時請求新聞頁面</string>
|
||||
<string name="copy_trans">複製翻譯</string>
|
||||
<string name="reset_download_location">恢復預設路徑</string>
|
||||
<string name="pick_new_download_location">選擇新路徑</string>
|
||||
|
||||
@@ -554,6 +554,7 @@
|
||||
<string name="proxy_invalid_port">Invalid port</string>
|
||||
|
||||
<string name="cant_read_the_file">Can\'t read the file</string>
|
||||
<string name="db_version_too_high">Database version too high</string>
|
||||
|
||||
<string name="app_language_system">System Language (Default)</string>
|
||||
<string name="app_language_de">Deutsch</string>
|
||||
@@ -671,7 +672,8 @@
|
||||
<string name="settings_eh_metered_network_warning">Metered network warning</string>
|
||||
<string name="metered_network_warning">Connected to metered networks</string>
|
||||
<string name="read_from">Read page %d</string>
|
||||
<string name="settings_request_news_title">Request news page on start</string>
|
||||
<string name="settings_eh_request_news">Request news page on start</string>
|
||||
<string name="settings_eh_hide_hv_events">Hide HV event Notifications</string>
|
||||
<string name="copy_trans">Copy translation</string>
|
||||
<string name="reset_download_location">Reset to default</string>
|
||||
<string name="pick_new_download_location">Pick a new location</string>
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:forceDarkAllowed" tools:targetApi="29">false</item>
|
||||
|
||||
@@ -173,7 +173,13 @@
|
||||
<rikka.material.preference.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="request_news"
|
||||
android:title="@string/settings_request_news_title"
|
||||
android:title="@string/settings_eh_request_news"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<rikka.material.preference.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="hide_hv_events"
|
||||
android:title="@string/settings_eh_hide_hv_events"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
</PreferenceScreen>
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
id 'com.android.application' version '8.0.0-alpha09' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.0-Beta' apply false
|
||||
id 'com.google.devtools.ksp' version '1.8.0-Beta-1.0.8' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.0-RC' apply false
|
||||
id 'com.google.devtools.ksp' version '1.8.0-RC-1.0.8' apply false
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-milestone-4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-milestone-5-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
Reference in new issue
Block a user