app: Do code cleanup

This commit is contained in:
tarsin committed 2022-07-18 20:47:04 +08:00
1 parent 9dcc24f4d9
commit 191db14398
72 files changed
+471 -506

No files matched your search

+9 -3
View File
@@ -15,8 +15,14 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
@@ -44,10 +50,10 @@
<activity
android:name="com.hippo.ehviewer.ui.MainActivity"
android:banner="@mipmap/ic_leanback_banner"
android:configChanges="screenSize"
android:exported="true"
android:launchMode="singleTask"
android:banner="@mipmap/ic_leanback_banner"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
<intent-filter>
@@ -166,7 +166,16 @@ public final class DiskLruCache implements Closeable {
* a sequence number each time an edit is committed. A snapshot is stale if
* its sequence number is not equal to its entry's sequence number.
*/
private long nextSequenceNumber = 0; private final Callable<Void> cleanupCallable = new Callable<>() {
private long nextSequenceNumber = 0;
private DiskLruCache(File directory, int appVersion, int valueCount, long maxSize) {
this.directory = directory;
this.appVersion = appVersion;
this.journalFile = new File(directory, JOURNAL_FILE);
this.journalFileTmp = new File(directory, JOURNAL_FILE_TEMP);
this.journalFileBackup = new File(directory, JOURNAL_FILE_BACKUP);
this.valueCount = valueCount;
this.maxSize = maxSize;
} private final Callable<Void> cleanupCallable = new Callable<>() {
public Void call() throws Exception {
synchronized (DiskLruCache.this) {
if (journalWriter == null) {
@@ -182,16 +191,6 @@ public final class DiskLruCache implements Closeable {
}
};
private DiskLruCache(File directory, int appVersion, int valueCount, long maxSize) {
this.directory = directory;
this.appVersion = appVersion;
this.journalFile = new File(directory, JOURNAL_FILE);
this.journalFileTmp = new File(directory, JOURNAL_FILE_TEMP);
this.journalFileBackup = new File(directory, JOURNAL_FILE_BACKUP);
this.valueCount = valueCount;
this.maxSize = maxSize;
}
/**
* Opens the cache in {@code directory}, creating a cache if none exists
* there.
@@ -980,4 +979,6 @@ public final class DiskLruCache implements Closeable {
}
}
@@ -302,13 +302,6 @@ public class EhApplication extends SceneApplication {
return application.mFavouriteStatusRouter;
}
static class EhlifecycleObserver implements DefaultLifecycleObserver {
@Override
public void onPause(@NonNull LifecycleOwner owner) {
locked = true;
}
}
@SuppressLint("StaticFieldLeak")
@Override
public void onCreate() {
@@ -593,4 +586,11 @@ public class EhApplication extends SceneApplication {
return null;
}
}
static class EhlifecycleObserver implements DefaultLifecycleObserver {
@Override
public void onPause(@NonNull LifecycleOwner owner) {
locked = true;
}
}
}
@@ -15,25 +15,24 @@
*/
package com.hippo.ehviewer.preference
import com.google.android.material.textfield.TextInputLayout
import android.widget.EditText
import com.hippo.ehviewer.R
import com.hippo.ehviewer.EhProxySelector
import android.text.TextUtils
import com.hippo.network.InetValidator
import android.annotation.SuppressLint
import android.content.Context
import android.content.DialogInterface
import android.text.TextUtils
import android.util.AttributeSet
import android.view.View
import android.widget.AutoCompleteTextView
import android.widget.EditText
import androidx.appcompat.app.AlertDialog
import com.google.android.material.textfield.TextInputLayout
import com.hippo.ehviewer.EhApplication
import com.hippo.ehviewer.EhProxySelector
import com.hippo.ehviewer.R
import com.hippo.ehviewer.Settings
import com.hippo.network.InetValidator
import com.hippo.preference.DialogPreference
import com.hippo.yorozuya.MathUtils
import com.hippo.yorozuya.ViewUtils
import java.lang.NumberFormatException
class ProxyPreference @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
@@ -95,7 +94,13 @@ class ProxyPreference @JvmOverloads constructor(
mPortInputLayout = ViewUtils.`$$`(dialog, R.id.port_input_layout) as TextInputLayout
mPort = ViewUtils.`$$`(dialog, R.id.port) as EditText
val type = Settings.getProxyType()
(mType!!.editText as AutoCompleteTextView).setText(array[MathUtils.clamp(type, 0, array.size)], false)
(mType!!.editText as AutoCompleteTextView).setText(
array[MathUtils.clamp(
type,
0,
array.size
)], false
)
mIp!!.setText(Settings.getProxyIp())
val portString: String?
val port = Settings.getProxyPort()
@@ -296,16 +296,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
break;
}
super.attachBaseContext(newBase);
} ActivityResultLauncher<String> requestStoragePermissionLauncher = registerForActivityResult(
new ActivityResultContracts.RequestPermission(),
result -> {
if (result && mSavingPage != -1) {
saveImage(mSavingPage);
} else {
Toast.makeText(this, R.string.error_cant_save_image, Toast.LENGTH_SHORT).show();
}
mSavingPage = -1;
});
}
@Override
@SuppressWarnings({"WrongConstant"})
@@ -473,7 +464,16 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
FrameLayout mainLayout = (FrameLayout) ViewUtils.$$(this, R.id.main);
mainLayout.addView(new GalleryGuideView(this));
}
}
} ActivityResultLauncher<String> requestStoragePermissionLauncher = registerForActivityResult(
new ActivityResultContracts.RequestPermission(),
result -> {
if (result && mSavingPage != -1) {
saveImage(mSavingPage);
} else {
Toast.makeText(this, R.string.error_cant_save_image, Toast.LENGTH_SHORT).show();
}
mSavingPage = -1;
});
@Override
protected void onDestroy() {
@@ -53,7 +53,6 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -63,7 +63,7 @@ public class BasePreferenceFragment extends PreferenceFragmentCompat
public boolean onPreferenceTreeClick(Preference preference) {
String key = preference.getKey();
try {
Fragment classObj = (Fragment)Class.forName(key).newInstance();
Fragment classObj = (Fragment) Class.forName(key).newInstance();
requireActivity().getSupportFragmentManager()
.beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
@@ -39,9 +39,7 @@ import com.hippo.ehviewer.R
import com.hippo.ehviewer.client.EhFilter
import com.hippo.ehviewer.dao.Filter
import com.hippo.view.ViewTransition
import com.hippo.yorozuya.LayoutUtils
import com.hippo.yorozuya.ViewUtils
import rikka.core.res.resolveColor
class FilterFragment : BaseFragment() {
private var mViewTransition: ViewTransition? = null
@@ -41,14 +41,11 @@ import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.Hosts;
import com.hippo.ehviewer.R;
import com.hippo.view.ViewTransition;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ViewUtils;
import java.util.List;
import java.util.Locale;
import rikka.core.res.ResourcesKt;
public class HostsFragment extends BaseFragment
implements View.OnClickListener {
@@ -21,9 +21,6 @@ package com.hippo.ehviewer.ui.fragment;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.preference.Preference;
import com.hippo.ehviewer.R;
@@ -82,8 +82,6 @@ import com.hippo.widget.LinkifyTextView;
import com.hippo.widget.ObservedTextView;
import com.hippo.yorozuya.AnimationUtils;
import com.hippo.yorozuya.AssertUtils;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ResourcesUtils;
import com.hippo.yorozuya.SimpleAnimatorListener;
import com.hippo.yorozuya.StringUtils;
import com.hippo.yorozuya.ViewUtils;
@@ -37,13 +37,10 @@ import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.client.data.GalleryDetail;
import com.hippo.util.ClipboardUtil;
import com.hippo.yorozuya.AssertUtils;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ViewUtils;
import java.util.ArrayList;
import rikka.core.res.ResourcesKt;
public final class GalleryInfoScene extends ToolbarScene {
public static final String KEY_GALLERY_DETAIL = "gallery_detail";
@@ -30,8 +30,6 @@ import com.hippo.ehviewer.R;
import com.hippo.ehviewer.Settings;
import com.hippo.yorozuya.ViewUtils;
import rikka.core.res.ResourcesKt;
public class GalleryGuideView extends ViewGroup implements View.OnClickListener {
private final float[] mPoints = new float[3 * 4];
@@ -52,7 +52,6 @@ import com.hippo.ehviewer.R;
import com.hippo.ehviewer.client.EhTagDatabase;
import com.hippo.view.ViewTransition;
import com.hippo.yorozuya.AnimationUtils;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.MathUtils;
import com.hippo.yorozuya.SimpleAnimatorListener;
import com.hippo.yorozuya.ViewUtils;
@@ -60,8 +59,6 @@ import com.hippo.yorozuya.ViewUtils;
import java.util.ArrayList;
import java.util.List;
import rikka.core.res.ResourcesKt;
public class SearchBar extends MaterialCardView implements View.OnClickListener,
TextView.OnEditorActionListener, TextWatcher,
SearchEditText.SearchEditTextListener {
@@ -28,15 +28,16 @@ import java.io.InputStream;
import java.io.OutputStream;
final class Contracts {
private Contracts() {}
private Contracts() {
}
static String queryForString(Context context, Uri self, String column,
String defaultValue) {
String defaultValue) {
final ContentResolver resolver = context.getContentResolver();
Cursor c = null;
try {
c = resolver.query(self, new String[] { column }, null, null, null);
c = resolver.query(self, new String[]{column}, null, null, null);
if (c != null && c.moveToFirst() && !c.isNull(0)) {
return c.getString(0);
} else {
@@ -51,17 +52,17 @@ final class Contracts {
}
static int queryForInt(Context context, Uri self, String column,
int defaultValue) {
int defaultValue) {
return (int) queryForLong(context, self, column, defaultValue);
}
static long queryForLong(Context context, Uri self, String column,
long defaultValue) {
long defaultValue) {
final ContentResolver resolver = context.getContentResolver();
Cursor c = null;
try {
c = resolver.query(self, new String[] { column }, null, null, null);
c = resolver.query(self, new String[]{column}, null, null, null);
if (c != null && c.moveToFirst() && !c.isNull(0)) {
return c.getLong(0);
} else {
@@ -30,10 +30,11 @@ import android.util.Log;
@TargetApi(Build.VERSION_CODES.KITKAT)
final class DocumentsContractApi19 {
private DocumentsContractApi19() {}
private static final String TAG = DocumentsContractApi19.class.getSimpleName();
private DocumentsContractApi19() {
}
public static boolean isDocumentUri(Context context, Uri self) {
return DocumentsContract.isDocumentUri(context, self);
}
@@ -132,8 +133,8 @@ final class DocumentsContractApi19 {
Cursor c = null;
try {
c = resolver.query(self, new String[] {
DocumentsContract.Document.COLUMN_DOCUMENT_ID }, null, null, null);
c = resolver.query(self, new String[]{
DocumentsContract.Document.COLUMN_DOCUMENT_ID}, null, null, null);
return null != c && c.getCount() > 0;
} catch (Throwable e) {
Utils.throwIfFatal(e);
@@ -24,20 +24,20 @@ import android.net.Uri;
import android.os.Build;
import android.provider.DocumentsContract;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
final class DocumentsContractApi21 {
private DocumentsContractApi21() {}
private static final String TAG = DocumentsContractApi21.class.getSimpleName();
private static final String PATH_DOCUMENT = "document";
private static final String PATH_TREE = "tree";
private DocumentsContractApi21() {
}
public static Uri createFile(Context context, Uri self, String mimeType,
String displayName) {
String displayName) {
try {
return DocumentsContract.createDocument(context.getContentResolver(), self, mimeType,
displayName);
@@ -79,8 +79,8 @@ final class DocumentsContractApi21 {
Cursor c = null;
try {
c = resolver.query(childrenUri, new String[] {
DocumentsContract.Document.COLUMN_DOCUMENT_ID }, null, null, null);
c = resolver.query(childrenUri, new String[]{
DocumentsContract.Document.COLUMN_DOCUMENT_ID}, null, null, null);
if (null != c) {
while (c.moveToNext()) {
final String documentId = c.getString(0);
@@ -18,7 +18,6 @@ package com.hippo.unifile;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.system.ErrnoException;
import android.system.Os;
@@ -34,196 +33,195 @@ import java.lang.annotation.RetentionPolicy;
class FileDescriptorRandomAccessFile implements UniRandomAccessFile {
@IntDef({FLUSH_NONE, FLUSH_FSYNC, FLUSH_FDATASYNC})
@Retention(RetentionPolicy.SOURCE)
public @interface FlushMode {}
public static final int FLUSH_NONE = 0;
public static final int FLUSH_FSYNC = 1;
public static final int FLUSH_FDATASYNC = 2;
private final ParcelFileDescriptor pfd;
private final FileDescriptor fd;
private final int flushAfterWrite;
private final Object closeLock = new Object();
private volatile boolean closed = false;
private FileDescriptorRandomAccessFile(ParcelFileDescriptor pfd, FileDescriptor fd, String mode) {
this.pfd = pfd;
this.fd = fd;
public static final int FLUSH_NONE = 0;
public static final int FLUSH_FSYNC = 1;
public static final int FLUSH_FDATASYNC = 2;
private final ParcelFileDescriptor pfd;
private final FileDescriptor fd;
private final int flushAfterWrite;
private final Object closeLock = new Object();
private volatile boolean closed = false;
private FileDescriptorRandomAccessFile(ParcelFileDescriptor pfd, FileDescriptor fd, String mode) {
this.pfd = pfd;
this.fd = fd;
switch (mode) {
case "rws":
flushAfterWrite = FLUSH_FSYNC;
break;
case "rwd":
flushAfterWrite = FLUSH_FDATASYNC;
break;
default:
flushAfterWrite = FLUSH_NONE;
break;
}
}
private void maybeSync() {
if (flushAfterWrite == FLUSH_FSYNC) {
try {
fd.sync();
} catch (IOException e) {
// Ignored
}
} else if (flushAfterWrite == FLUSH_FDATASYNC) {
try {
Os.fdatasync(fd);
} catch (ErrnoException e) {
// Ignored
}
}
}
@Override
public void close() throws IOException {
synchronized (closeLock) {
if (closed) {
return;
}
closed = true;
switch (mode) {
case "rws":
flushAfterWrite = FLUSH_FSYNC;
break;
case "rwd":
flushAfterWrite = FLUSH_FDATASYNC;
break;
default:
flushAfterWrite = FLUSH_NONE;
break;
}
}
pfd.close();
@NonNull
static FileDescriptorRandomAccessFile create(Context context, Uri uri, String mode) throws IOException {
// Get FileDescriptor
ParcelFileDescriptor pfd;
try {
pfd = context.getContentResolver().openFileDescriptor(uri, mode);
} catch (Throwable e) {
Utils.throwIfFatal(e);
throw new IOException("Can't get ParcelFileDescriptor", e);
}
if (pfd == null) {
throw new IOException("Can't get ParcelFileDescriptor");
}
FileDescriptor fd;
try {
fd = pfd.getFileDescriptor();
} catch (SecurityException e) {
pfd.close();
throw new IOException("Can't get FileDescriptor", e);
}
if (fd == null) {
pfd.close();
throw new IOException("Can't get FileDescriptor");
}
try {
Os.close(fd);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
@Override
public long getFilePointer() throws IOException {
try {
return Os.lseek(fd, 0L, OsConstants.SEEK_CUR);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
@Override
public void seek(long pos) throws IOException {
if (pos < 0) {
throw new IOException("offset < 0: " + pos);
} else {
try {
Os.lseek(fd, pos, OsConstants.SEEK_SET);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
}
@Override
public int skipBytes(int n) throws IOException {
long pos;
long len;
long newpos;
if (n <= 0) {
return 0;
}
pos = getFilePointer();
len = length();
newpos = pos + n;
if (newpos > len) {
newpos = len;
}
seek(newpos);
/* return the actual number of bytes skipped */
return (int) (newpos - pos);
}
@Override
public long length() throws IOException {
try {
return Os.fstat(fd).st_size;
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
@Override
public void setLength(long newLength) throws IOException {
if (newLength < 0) {
throw new IllegalArgumentException("newLength < 0");
}
try {
Os.ftruncate(fd, newLength);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
return new FileDescriptorRandomAccessFile(pfd, fd, mode);
}
long filePointer = getFilePointer();
if (filePointer > newLength) {
seek(newLength);
private void maybeSync() {
if (flushAfterWrite == FLUSH_FSYNC) {
try {
fd.sync();
} catch (IOException e) {
// Ignored
}
} else if (flushAfterWrite == FLUSH_FDATASYNC) {
try {
Os.fdatasync(fd);
} catch (ErrnoException e) {
// Ignored
}
}
}
maybeSync();
}
@Override
public void close() throws IOException {
synchronized (closeLock) {
if (closed) {
return;
}
closed = true;
}
@Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
pfd.close();
@Override
public int read(byte[] b, int off, int len) throws IOException {
try {
return Os.read(fd, b, off, len);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
@Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
try {
Os.write(fd, b, off, len);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
maybeSync();
}
@NonNull
static FileDescriptorRandomAccessFile create(Context context, Uri uri, String mode) throws IOException {
// Get FileDescriptor
ParcelFileDescriptor pfd;
try {
pfd = context.getContentResolver().openFileDescriptor(uri, mode);
} catch (Throwable e) {
Utils.throwIfFatal(e);
throw new IOException("Can't get ParcelFileDescriptor", e);
}
if (pfd == null) {
throw new IOException("Can't get ParcelFileDescriptor");
}
FileDescriptor fd;
try {
fd = pfd.getFileDescriptor();
} catch (SecurityException e) {
pfd.close();
throw new IOException("Can't get FileDescriptor", e);
}
if (fd == null) {
pfd.close();
throw new IOException("Can't get FileDescriptor");
try {
Os.close(fd);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
return new FileDescriptorRandomAccessFile(pfd, fd, mode);
}
@Override
public long getFilePointer() throws IOException {
try {
return Os.lseek(fd, 0L, OsConstants.SEEK_CUR);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
@Override
public void seek(long pos) throws IOException {
if (pos < 0) {
throw new IOException("offset < 0: " + pos);
} else {
try {
Os.lseek(fd, pos, OsConstants.SEEK_SET);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
}
@Override
public int skipBytes(int n) throws IOException {
long pos;
long len;
long newpos;
if (n <= 0) {
return 0;
}
pos = getFilePointer();
len = length();
newpos = pos + n;
if (newpos > len) {
newpos = len;
}
seek(newpos);
/* return the actual number of bytes skipped */
return (int) (newpos - pos);
}
@Override
public long length() throws IOException {
try {
return Os.fstat(fd).st_size;
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
@Override
public void setLength(long newLength) throws IOException {
if (newLength < 0) {
throw new IllegalArgumentException("newLength < 0");
}
try {
Os.ftruncate(fd, newLength);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
long filePointer = getFilePointer();
if (filePointer > newLength) {
seek(newLength);
}
maybeSync();
}
@Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
try {
return Os.read(fd, b, off, len);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
}
@Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
try {
Os.write(fd, b, off, len);
} catch (ErrnoException e) {
throw new IOException("An ErrnoException occurs", e);
}
maybeSync();
}
@IntDef({FLUSH_NONE, FLUSH_FSYNC, FLUSH_FDATASYNC})
@Retention(RetentionPolicy.SOURCE)
public @interface FlushMode {
}
}
@@ -28,13 +28,11 @@ public interface FilenameFilter {
/**
* Indicates if a specific filename matches this filter.
*
* @param dir
* the directory in which the {@code filename} was found.
* @param filename
* the name of the file in {@code dir} to test.
* @return {@code true} if the filename matches the filter
* and can be included in the list, {@code false}
* otherwise.
* @param dir the directory in which the {@code filename} was found.
* @param filename the name of the file in {@code dir} to test.
* @return {@code true} if the filename matches the filter
* and can be included in the list, {@code false}
* otherwise.
*/
boolean accept(UniFile dir, String filename);
}
@@ -21,7 +21,8 @@ import android.net.Uri;
import android.provider.MediaStore;
final class MediaContract {
private MediaContract() {}
private MediaContract() {
}
public static String getName(Context context, Uri self) {
return Contracts.queryForString(context, self, MediaStore.MediaColumns.DISPLAY_NAME, null);
@@ -18,7 +18,6 @@ package com.hippo.unifile;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.NonNull;
@@ -38,6 +37,10 @@ class MediaFile extends UniFile {
mUri = uri;
}
static boolean isMediaUri(Context context, Uri uri) {
return null != MediaContract.getName(context, uri);
}
@Override
public UniFile createFile(String displayName) {
return null;
@@ -54,10 +57,6 @@ class MediaFile extends UniFile {
return mUri;
}
static boolean isMediaUri(Context context, Uri uri) {
return null != MediaContract.getName(context, uri);
}
@Override
public String getName() {
return MediaContract.getName(mContext, mUri);
@@ -43,6 +43,36 @@ class RawFile extends UniFile {
mFile = file;
}
private static String getTypeForName(String name) {
final int lastDot = name.lastIndexOf('.');
if (lastDot >= 0) {
final String extension = name.substring(lastDot + 1).toLowerCase();
final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
if (mime != null) {
return mime;
}
}
return "application/octet-stream";
}
private static boolean deleteContents(File dir) {
File[] files = dir.listFiles();
boolean success = true;
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
success &= deleteContents(file);
}
if (!file.delete()) {
Log.w(TAG, "Failed to delete " + file);
success = false;
}
}
}
return success;
}
@Override
public UniFile createFile(String displayName) {
final File target = new File(mFile, displayName);
@@ -239,34 +269,4 @@ class RawFile extends UniFile {
public UniRandomAccessFile createRandomAccessFile(String mode) throws FileNotFoundException {
return new RawRandomAccessFile(new RandomAccessFile(mFile, mode));
}
private static String getTypeForName(String name) {
final int lastDot = name.lastIndexOf('.');
if (lastDot >= 0) {
final String extension = name.substring(lastDot + 1).toLowerCase();
final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
if (mime != null) {
return mime;
}
}
return "application/octet-stream";
}
private static boolean deleteContents(File dir) {
File[] files = dir.listFiles();
boolean success = true;
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
success &= deleteContents(file);
}
if (!file.delete()) {
Log.w(TAG, "Failed to delete " + file);
success = false;
}
}
}
return success;
}
}
@@ -18,7 +18,6 @@ package com.hippo.unifile;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.NonNull;
@@ -67,7 +67,7 @@ public abstract class UniFile {
/**
* Create a {@link UniFile} representing the given {@link File}.
*
* @param file the file to wrap
* @return the {@link UniFile} representing the given {@link File}.
*/
@@ -83,8 +83,8 @@ public abstract class UniFile {
* {@code null} when called on earlier platform versions.
*
* @param singleUri the {@link Intent#getData()} from a successful
* {@link Intent#ACTION_OPEN_DOCUMENT} or
* {@link Intent#ACTION_CREATE_DOCUMENT} request.
* {@link Intent#ACTION_OPEN_DOCUMENT} or
* {@link Intent#ACTION_CREATE_DOCUMENT} request.
* @return the {@link UniFile} representing the given {@link Uri}.
*/
public static UniFile fromSingleUri(Context context, Uri singleUri) {
@@ -103,7 +103,7 @@ public abstract class UniFile {
* {@code null} when called on earlier platform versions.
*
* @param treeUri the {@link Intent#getData()} from a successful
* {@link Intent#ACTION_OPEN_DOCUMENT_TREE} request.
* {@link Intent#ACTION_OPEN_DOCUMENT_TREE} request.
* @return the {@link UniFile} representing the given {@link Uri}.
*/
public static UniFile fromTreeUri(Context context, Uri treeUri) {
@@ -198,7 +198,7 @@ public abstract class UniFile {
* @param displayName name of new file
* @return file representing newly created document, or null if failed
* @see android.provider.DocumentsContract#createDocument(ContentResolver,
* Uri, String, String)
* Uri, String, String)
*/
public abstract UniFile createFile(String displayName);
@@ -208,7 +208,7 @@ public abstract class UniFile {
* @param displayName name of new directory
* @return file representing newly created directory, or null if failed
* @see android.provider.DocumentsContract#createDocument(ContentResolver,
* Uri, String, String)
* Uri, String, String)
*/
public abstract UniFile createDirectory(String displayName);
@@ -267,7 +267,7 @@ public abstract class UniFile {
* Indicates if this file represents a <em>directory</em>.
*
* @return {@code true} if this file is a directory, {@code false}
* otherwise.
* otherwise.
* @see android.provider.DocumentsContract.Document#MIME_TYPE_DIR
*/
public abstract boolean isDirectory();
@@ -311,7 +311,7 @@ public abstract class UniFile {
* Indicates whether the current context is allowed to write to this file.
*
* @return {@code true} if this file can be written, {@code false}
* otherwise.
* otherwise.
* @see android.provider.DocumentsContract.Document#COLUMN_FLAGS
* @see android.provider.DocumentsContract.Document#FLAG_SUPPORTS_DELETE
* @see android.provider.DocumentsContract.Document#FLAG_SUPPORTS_WRITE
@@ -323,7 +323,7 @@ public abstract class UniFile {
* It works like mkdirs, but it will return true if the UniFile is directory
*
* @return {@code true} if the directory was created
* or if the directory already existed.
* or if the directory already existed.
*/
public abstract boolean ensureDir();
@@ -331,7 +331,7 @@ public abstract class UniFile {
* Make sure the UniFile is file
*
* @return {@code true} if the file can be created
* or if the file already existed.
* or if the file already existed.
*/
public abstract boolean ensureFile();
@@ -351,7 +351,7 @@ public abstract class UniFile {
*
* @return {@code true} if this file was deleted, {@code false} otherwise.
* @see android.provider.DocumentsContract#deleteDocument(ContentResolver,
* Uri)
* Uri)
*/
public abstract boolean delete();
@@ -368,7 +368,7 @@ public abstract class UniFile {
*
* @return an array of files or {@code null}.
* @see android.provider.DocumentsContract#buildChildDocumentsUriUsingTree(Uri,
* String)
* String)
*/
@Nullable
public abstract UniFile[] listFiles();
@@ -408,7 +408,7 @@ public abstract class UniFile {
* @param displayName the new display name.
* @return true on success.
* @see android.provider.DocumentsContract#renameDocument(ContentResolver,
* Uri, String)
* Uri, String)
*/
public abstract boolean renameTo(String displayName);
@@ -80,8 +80,8 @@ public interface UniRandomAccessFile {
*
* @param b the buffer into which the data is read
* @return the total number of bytes read into the buffer, or
* {@code -1} if there is no more data because the end of
* the file has been reached.
* {@code -1} if there is no more data because the end of
* the file has been reached.
* @throws IOException if an I/O error occurs
*/
int read(byte[] b) throws IOException;
@@ -90,12 +90,12 @@ public interface UniRandomAccessFile {
* Reads exactly len bytes from this file into the byte array,
* starting at the current file pointer.
*
* @param b the buffer into which the data is read
* @param b the buffer into which the data is read
* @param off the start offset of the data
* @param len the number of bytes to read
* @return the total number of bytes read into the buffer, or
* {@code -1} if there is no more data because the end of
* the file has been reached.
* {@code -1} if there is no more data because the end of
* the file has been reached.
* @throws IOException
*/
int read(byte[] b, int off, int len) throws IOException;
@@ -112,7 +112,7 @@ public interface UniRandomAccessFile {
/**
* Writes len bytes from the specified byte array starting at offset off to this file.
*
* @param b the data
* @param b the data
* @param off the start offset in the data
* @param len the number of bytes to write
* @throws IOException
@@ -45,12 +45,6 @@ class UriOutputStream extends FileOutputStream {
mPfd = pfd;
}
@Override
public void close() throws IOException {
mPfd.close();
super.close();
}
@NonNull
static OutputStream create(Context context, Uri uri, String mode) throws IOException {
ParcelFileDescriptor pfd;
@@ -70,4 +64,10 @@ class UriOutputStream extends FileOutputStream {
return new UriOutputStream(pfd, fd);
}
@Override
public void close() throws IOException {
mPfd.close();
super.close();
}
}
@@ -73,6 +73,15 @@ public class BatteryView extends AppCompatTextView {
int height = (int) getTextSize();
mDrawable.setBounds(0, 0, (int) (height / 0.618f), height);
setCompoundDrawables(mDrawable, null, null, null);
}
@Override
public void setTextColor(int color) {
if (mCurrentColor == color) {
return;
}
mCurrentColor = color;
super.setTextColor(color);
} private final Runnable mCharger = new Runnable() {
private int level = 0;
@@ -88,15 +97,6 @@ public class BatteryView extends AppCompatTextView {
}
};
@Override
public void setTextColor(int color) {
if (mCurrentColor == color) {
return;
}
mCurrentColor = color;
super.setTextColor(color);
}
private void startCharger() {
if (!mIsChargerWorking) {
getHandler().post(mCharger);
@@ -143,6 +143,8 @@ public class BatteryView extends AppCompatTextView {
getContext().unregisterReceiver(mIntentReceiver);
}
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
@@ -175,6 +177,4 @@ public class BatteryView extends AppCompatTextView {
};
}
@@ -89,6 +89,14 @@ public class TextClock extends AppCompatTextView {
createTime(mTimeZone);
// Wait until onAttachedToWindow() to handle the ticker
chooseFormat(false);
}
private void createTime(String timeZone) {
if (timeZone != null) {
mTime = Calendar.getInstance(TimeZone.getTimeZone(timeZone));
} else {
mTime = Calendar.getInstance();
}
} private final Runnable mTicker = new Runnable() {
@Override
public void run() {
@@ -101,14 +109,6 @@ public class TextClock extends AppCompatTextView {
}
};
private void createTime(String timeZone) {
if (timeZone != null) {
mTime = Calendar.getInstance(TimeZone.getTimeZone(timeZone));
} else {
mTime = Calendar.getInstance();
}
}
public CharSequence getFormat12Hour() {
return mFormat12;
}
@@ -133,6 +133,17 @@ public class TextClock extends AppCompatTextView {
public boolean is24HourModeEnabled() {
return DateFormat.is24HourFormat(getContext());
}
public String getTimeZone() {
return mTimeZone;
}
public void setTimeZone(String timeZone) {
mTimeZone = timeZone;
createTime(timeZone);
onTimeChanged();
} private final ContentObserver mFormatChangeObserver = new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
@@ -147,17 +158,6 @@ public class TextClock extends AppCompatTextView {
}
};
public String getTimeZone() {
return mTimeZone;
}
public void setTimeZone(String timeZone) {
mTimeZone = timeZone;
createTime(timeZone);
onTimeChanged();
}
/**
* Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()}
* depending on whether the user has selected 24-hour format.
@@ -27,8 +27,8 @@ import java.util.Set;
*/
public abstract class AbstractMultimap<K, V, C extends Collection<V>> implements Map<K, C> {
protected Map<K, C> map;
protected final boolean threadSafeCollections;
protected Map<K, C> map;
protected AbstractMultimap(Map<K, C> map, boolean threadSafeCollections) {
this.map = map;
@@ -120,7 +120,9 @@ public abstract class AbstractMultimap<K, V, C extends Collection<V>> implements
return map.entrySet();
}
/** @return true if the collection was changed. */
/**
* @return true if the collection was changed.
*/
public synchronized boolean putElements(K key, Collection<V> values) {
C collection = map.get(key);
if (collection == null) {
@@ -130,7 +132,9 @@ public abstract class AbstractMultimap<K, V, C extends Collection<V>> implements
return collection.addAll(values);
}
/** @return true if the given element was removed. */
/**
* @return true if the given element was removed.
*/
public synchronized boolean removeElement(K key, V value) {
C collection = map.get(key);
if (collection == null) {
@@ -42,12 +42,13 @@ public class CollectionUtils {
/**
* Appends an element to the end of the array, growing the array if there is no more room.
* @param array The array to which to append the element. This must NOT be null.
*
* @param array The array to which to append the element. This must NOT be null.
* @param currentSize The number of elements in the array. Must be less than or equal to
* array.length.
* @param element The element to append.
* @param element The element to append.
* @return the array to which the element was appended. This may be different than the given
* array.
* array.
*/
public static <T> T[] append(T[] array, int currentSize, T element) {
if (currentSize + 1 > array.length) {
@@ -103,12 +104,12 @@ public class CollectionUtils {
* Inserts an element into the array at the specified index, growing the array if there is no
* more room.
*
* @param array The array to which to append the element. Must NOT be null.
* @param array The array to which to append the element. Must NOT be null.
* @param currentSize The number of elements in the array. Must be less than or equal to
* array.length.
* @param element The element to insert.
* @param element The element to insert.
* @return the array to which the element was appended. This may be different than the given
* array.
* array.
*/
public static <T> T[] insert(T[] array, int currentSize, int index, T element) {
if (currentSize + 1 <= array.length) {
@@ -60,7 +60,7 @@ public class ContainerHelpers {
}
public static <T> int binarySearch(T[] array, int size, T value,
Comparator<? super T> comparator) {
Comparator<? super T> comparator) {
int lo = 0;
int hi = size - 1;
@@ -21,8 +21,19 @@ import android.os.Parcelable;
public class IntList implements Parcelable {
private static final int MIN_CAPACITY_INCREMENT = 12;
public static final Parcelable.Creator<IntList> CREATOR = new Parcelable.Creator<IntList>() {
@Override
public IntList createFromParcel(Parcel source) {
return new IntList(source);
}
@Override
public IntList[] newArray(int size) {
return new IntList[size];
}
};
private static final int MIN_CAPACITY_INCREMENT = 12;
private int[] mArray;
private int mSize = 0;
@@ -34,6 +45,16 @@ public class IntList implements Parcelable {
mArray = new int[capacity];
}
protected IntList(Parcel in) {
this(in.readInt());
mSize = in.readInt();
int s = mSize;
int[] a = mArray;
for (int i = 0; i < s; i++) {
a[i] = in.readInt();
}
}
static void throwIndexOutOfBoundsException(int index, int size) {
throw new IndexOutOfBoundsException("Invalid index " + index + ", size is " + size);
}
@@ -193,27 +214,4 @@ public class IntList implements Parcelable {
dest.writeInt(a[i]);
}
}
protected IntList(Parcel in) {
this(in.readInt());
mSize = in.readInt();
int s = mSize;
int[] a = mArray;
for (int i = 0; i < s; i++) {
a[i] = in.readInt();
}
}
public static final Parcelable.Creator<IntList> CREATOR = new Parcelable.Creator<IntList>() {
@Override
public IntList createFromParcel(Parcel source) {
return new IntList(source);
}
@Override
public IntList[] newArray(int size) {
return new IntList[size];
}
};
}
@@ -21,8 +21,19 @@ import android.os.Parcelable;
public class LongList implements Parcelable {
private static final int MIN_CAPACITY_INCREMENT = 12;
public static final Creator<LongList> CREATOR = new Creator<LongList>() {
@Override
public LongList createFromParcel(Parcel source) {
return new LongList(source);
}
@Override
public LongList[] newArray(int size) {
return new LongList[size];
}
};
private static final int MIN_CAPACITY_INCREMENT = 12;
private long[] mArray;
private int mSize = 0;
@@ -34,6 +45,16 @@ public class LongList implements Parcelable {
mArray = new long[capacity];
}
protected LongList(Parcel in) {
this(in.readInt());
mSize = in.readInt();
int s = mSize;
long[] a = mArray;
for (int i = 0; i < s; i++) {
a[i] = in.readLong();
}
}
static void throwIndexOutOfBoundsException(int index, int size) {
throw new IndexOutOfBoundsException("Invalid index " + index + ", size is " + size);
}
@@ -193,27 +214,4 @@ public class LongList implements Parcelable {
dest.writeLong(a[i]);
}
}
protected LongList(Parcel in) {
this(in.readInt());
mSize = in.readInt();
int s = mSize;
long[] a = mArray;
for (int i = 0; i < s; i++) {
a[i] = in.readLong();
}
}
public static final Creator<LongList> CREATOR = new Creator<LongList>() {
@Override
public LongList createFromParcel(Parcel source) {
return new LongList(source);
}
@Override
public LongList[] newArray(int size) {
return new LongList[size];
}
};
}
@@ -29,6 +29,10 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
// Top level class to get rid of 3rd generic collection parameter for more convenient usage.
public class Multimap<K, V> extends AbstractMultimap<K, V, List<V>> {
protected Multimap(Map<K, List<V>> map, boolean threadSafeCollections) {
super(map, threadSafeCollections);
}
public static <K, V> Multimap<K, V> create() {
return new Multimap<>(new HashMap<K, List<V>>(), false);
}
@@ -37,10 +41,6 @@ public class Multimap<K, V> extends AbstractMultimap<K, V, List<V>> {
return new Multimap<>(new HashMap<K, List<V>>(), true);
}
protected Multimap(Map<K, List<V>> map, boolean threadSafeCollections) {
super(map, threadSafeCollections);
}
protected List<V> createNewCollection() {
return threadSafeCollections ? new CopyOnWriteArrayList<V>() : new ArrayList<V>();
}
@@ -31,6 +31,10 @@ import java.util.concurrent.CopyOnWriteArraySet;
// Top level class to get rid of 3rd generic collection parameter for more convenient usage.
public class MultimapSet<K, V> extends AbstractMultimap<K, V, Set<V>> {
protected MultimapSet(Map<K, Set<V>> map, boolean threadSafeSets) {
super(map, threadSafeSets);
}
public static <K, V> MultimapSet<K, V> create() {
return new MultimapSet<>(new HashMap<K, Set<V>>(), false);
}
@@ -39,10 +43,6 @@ public class MultimapSet<K, V> extends AbstractMultimap<K, V, Set<V>> {
return new MultimapSet<>(new HashMap<K, Set<V>>(), true);
}
protected MultimapSet(Map<K, Set<V>> map, boolean threadSafeSets) {
super(map, threadSafeSets);
}
protected Set<V> createNewCollection() {
return threadSafeCollections ? new CopyOnWriteArraySet<V>() : new HashSet<V>();
}
@@ -238,7 +238,7 @@ public class SparseIJArray {
StringBuilder buffer = new StringBuilder(mSize * 28);
buffer.append('{');
for (int i=0; i<mSize; i++) {
for (int i = 0; i < mSize; i++) {
if (i > 0) {
buffer.append(", ");
}
@@ -172,7 +172,7 @@ public class SparseILArray<E> implements Cloneable {
* Remove a range of mappings as a batch.
*
* @param index Index to begin at
* @param size Number of mappings to remove
* @param size Number of mappings to remove
*/
public void removeAtRange(int index, int size) {
final int end = Math.min(mSize, index + size);
@@ -388,7 +388,7 @@ public class SparseILArray<E> implements Cloneable {
StringBuilder buffer = new StringBuilder(mSize * 28);
buffer.append('{');
for (int i=0; i<mSize; i++) {
for (int i = 0; i < mSize; i++) {
if (i > 0) {
buffer.append(", ");
}
@@ -39,6 +39,10 @@ package com.hippo.yorozuya.collect;
* order in the case of <code>valueAt(int)</code>.</p>
*/
public class SparseJBArray implements Cloneable {
private long[] mKeys;
private boolean[] mValues;
private int mSize;
/**
* Creates a new SparseJBArray containing no mappings.
*/
@@ -238,7 +242,7 @@ public class SparseJBArray implements Cloneable {
StringBuilder buffer = new StringBuilder(mSize * 28);
buffer.append('{');
for (int i=0; i<mSize; i++) {
for (int i = 0; i < mSize; i++) {
if (i > 0) {
buffer.append(", ");
}
@@ -251,8 +255,4 @@ public class SparseJBArray implements Cloneable {
buffer.append('}');
return buffer.toString();
}
private long[] mKeys;
private boolean[] mValues;
private int mSize;
}
@@ -172,7 +172,7 @@ public class SparseJLArray<E> {
* Remove a range of mappings as a batch.
*
* @param index Index to begin at
* @param size Number of mappings to remove
* @param size Number of mappings to remove
*/
public void removeAtRange(int index, int size) {
final int end = Math.min(mSize, index + size);
@@ -388,7 +388,7 @@ public class SparseJLArray<E> {
StringBuilder buffer = new StringBuilder(mSize * 28);
buffer.append('{');
for (int i=0; i<mSize; i++) {
for (int i = 0; i < mSize; i++) {
if (i > 0) {
buffer.append(", ");
}
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -22,7 +22,7 @@
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M18,15v3H6v-3H4v3c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-3H18zM7,9l1.41,1.41L11,7.83V16h2V7.83l2.59,2.58L17,9l-5,-5L7,9z"
android:fillColor="@android:color/white"/>
<path
android:fillColor="@android:color/white"
android:pathData="M18,15v3H6v-3H4v3c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-3H18zM7,9l1.41,1.41L11,7.83V16h2V7.83l2.59,2.58L17,9l-5,-5L7,9z" />
</vector>
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -16,9 +16,9 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
app:fitsSystemWindowsInsets="top|bottom">
@@ -76,13 +76,13 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ipb_member_id"
tools:ignore="HardcodedText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:singleLine="true" />
android:singleLine="true"
tools:ignore="HardcodedText" />
</com.google.android.material.textfield.TextInputLayout>
@@ -97,13 +97,13 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ipb_pass_hash"
tools:ignore="HardcodedText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:singleLine="true" />
android:singleLine="true"
tools:ignore="HardcodedText" />
</com.google.android.material.textfield.TextInputLayout>
@@ -118,13 +118,13 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/igneous"
tools:ignore="HardcodedText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1"
android:singleLine="true" />
android:singleLine="true"
tools:ignore="HardcodedText" />
<Space
android:layout_width="wrap_content"
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -13,8 +13,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -29,9 +29,9 @@
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="@dimen/keyline_margin"
android:paddingRight="@dimen/keyline_margin"
android:clipToPadding="false"
app:fitsSystemWindowsInsets="bottom" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -14,8 +14,8 @@
~ limitations under the License.
-->
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_help"
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
+2 -2
View File
@@ -52,7 +52,7 @@
<declare-styleable name="FixedThumb">
<attr name="minAspect" format="float" />
<attr name="maxAspect" format="float" />
<attr name="alwaysCutAndScale" format="boolean"/>
<attr name="alwaysCutAndScale" format="boolean" />
</declare-styleable>
<declare-styleable name="CheckTextView">
@@ -143,6 +143,6 @@
<attr name="draggable" format="boolean" />
</declare-styleable>
<attr name="filterChipStyle"/>
<attr name="filterChipStyle" />
</resources>
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
+1 -1
View File
@@ -62,5 +62,5 @@
<item name="indicatorColor">?attr/dividerColor</item>
</style>
<style name="Guide.Title" parent="TextAppearance.Material3.TitleMedium"/>
<style name="Guide.Title" parent="TextAppearance.Material3.TitleMedium" />
</resources>
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
+1 -2
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2022 Tarsin Norbin
~
~ This file is part of EhViewer
+6 -6
View File
@@ -17,32 +17,32 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:key="com.hippo.ehviewer.ui.fragment.EhFragment"
android:icon="@drawable/v_sad_panda_primary_x24"
android:key="com.hippo.ehviewer.ui.fragment.EhFragment"
android:title="@string/settings_eh" />
<Preference
android:key="com.hippo.ehviewer.ui.fragment.ReadFragment"
android:icon="@drawable/v_book_open_primary_x24"
android:key="com.hippo.ehviewer.ui.fragment.ReadFragment"
android:title="@string/settings_read" />
<Preference
android:key="com.hippo.ehviewer.ui.fragment.DownloadFragment"
android:icon="@drawable/v_download_primary_x24"
android:key="com.hippo.ehviewer.ui.fragment.DownloadFragment"
android:title="@string/settings_download" />
<Preference
android:key="com.hippo.ehviewer.ui.fragment.PrivacyFragment"
android:icon="@drawable/v_sec_primary_x24"
android:key="com.hippo.ehviewer.ui.fragment.PrivacyFragment"
android:title="@string/settings_privacy" />
<Preference
android:key="com.hippo.ehviewer.ui.fragment.AdvancedFragment"
android:icon="@drawable/v_adb_primary_x24"
android:key="com.hippo.ehviewer.ui.fragment.AdvancedFragment"
android:title="@string/settings_advanced" />
<Preference
android:key="com.hippo.ehviewer.ui.fragment.AboutFragment"
android:icon="@drawable/v_info_primary_x24"
android:key="com.hippo.ehviewer.ui.fragment.AboutFragment"
android:title="@string/settings_about" />
</PreferenceScreen>