Reformat Code
This commit is contained in:
1 parent
8d1fc85638
commit
a859941845
22 files changed
+85
-85
No files matched your search
@@ -250,21 +250,7 @@ public final class DiskLruCache implements Closeable {
|
||||
|
||||
private static String inputStreamToString(InputStream in) throws IOException {
|
||||
return Util.readFully(new InputStreamReader(in, Util.UTF_8));
|
||||
} private final Callable<Void> cleanupCallable = new Callable<>() {
|
||||
public Void call() throws Exception {
|
||||
synchronized (DiskLruCache.this) {
|
||||
if (journalWriter == null) {
|
||||
return null; // Closed.
|
||||
}
|
||||
trimToSize();
|
||||
if (journalRebuildRequired()) {
|
||||
rebuildJournal();
|
||||
redundantOpCount = 0;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void readJournal() throws IOException {
|
||||
StrictLineReader reader = new StrictLineReader(new FileInputStream(journalFile), Util.US_ASCII);
|
||||
@@ -304,7 +290,21 @@ public final class DiskLruCache implements Closeable {
|
||||
} finally {
|
||||
Util.closeQuietly(reader);
|
||||
}
|
||||
}
|
||||
} private final Callable<Void> cleanupCallable = new Callable<>() {
|
||||
public Void call() throws Exception {
|
||||
synchronized (DiskLruCache.this) {
|
||||
if (journalWriter == null) {
|
||||
return null; // Closed.
|
||||
}
|
||||
trimToSize();
|
||||
if (journalRebuildRequired()) {
|
||||
rebuildJournal();
|
||||
redundantOpCount = 0;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
private void readJournalLine(String line) throws IOException {
|
||||
int firstSpace = line.indexOf(' ');
|
||||
|
||||
@@ -27,7 +27,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.hippo.ehviewer.client.EhConfig;
|
||||
import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.FavListUrlBuilder;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
import com.hippo.ehviewer.ui.scene.GalleryListScene;
|
||||
@@ -67,8 +66,6 @@ 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
|
||||
********************/
|
||||
@@ -102,6 +99,8 @@ public class Settings {
|
||||
public static final String KEY_DOMAIN_FRONTING = "domain_fronting";
|
||||
public static final String KEY_APP_LANGUAGE = "app_language";
|
||||
public static final String KEY_LIST_THUMB_SIZE = "list_tile_size";
|
||||
private static final String KEY_HIDE_HV_EVENTS = "hide_hv_events";
|
||||
private static final boolean DEFAULT_HIDE_HV_EVENTS = true;
|
||||
private static final String KEY_SHOW_COMMENTS = "show_gallery_comments";
|
||||
private static final boolean DEFAULT_SHOW_COMMENTS = true;
|
||||
private static final String KEY_PREVIEW_NUM = "preview_num";
|
||||
|
||||
@@ -55,9 +55,8 @@ public class EhClient {
|
||||
public static final int METHOD_DOWNLOAD_ARCHIVE = 18;
|
||||
public static final int METHOD_VOTE_TAG = 19;
|
||||
public static final int METHOD_GET_UCONFIG = 20;
|
||||
|
||||
private final ThreadPoolExecutor mRequestThreadPool;
|
||||
private static final OkHttpClient mOkHttpClient = EhApplication.getOkHttpClient();
|
||||
private final ThreadPoolExecutor mRequestThreadPool;
|
||||
|
||||
public EhClient() {
|
||||
mRequestThreadPool = IoThreadPoolExecutor.getInstance();
|
||||
|
||||
@@ -814,7 +814,7 @@ public class EhEngine {
|
||||
}
|
||||
|
||||
public static Void getUConfig(@Nullable EhClient.Task task,
|
||||
OkHttpClient okHttpClient) throws Throwable {
|
||||
OkHttpClient okHttpClient) throws Throwable {
|
||||
String url = EhUrl.getUConfigUrl();
|
||||
Log.d(TAG, url);
|
||||
Request request = new EhRequestBuilder(url, null).build();
|
||||
|
||||
@@ -520,6 +520,15 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
if (mGLRootView != null) {
|
||||
mGLRootView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (mGLRootView != null) {
|
||||
mGLRootView.onResume();
|
||||
}
|
||||
} ActivityResultLauncher<String> requestStoragePermissionLauncher = registerForActivityResult(
|
||||
new ActivityResultContracts.RequestPermission(),
|
||||
result -> {
|
||||
@@ -531,15 +540,6 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
mSavingPage = -1;
|
||||
});
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (mGLRootView != null) {
|
||||
mGLRootView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
|
||||
@@ -232,7 +232,7 @@ public class FavoritesScene extends SearchBarScene implements
|
||||
@NonNull
|
||||
@Override
|
||||
public View onCreateViewWithToolbar(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_favorites, container, false);
|
||||
ContentLayout mContentLayout = view.findViewById(R.id.content_layout);
|
||||
MainActivity activity = getMainActivity();
|
||||
@@ -245,7 +245,7 @@ public class FavoritesScene extends SearchBarScene implements
|
||||
mRecyclerView = mContentLayout.getRecyclerView();
|
||||
FastScroller fastScroller = mContentLayout.getFastScroller();
|
||||
mFabLayout = (FabLayout) ViewUtils.$$(view, R.id.fab_layout);
|
||||
((ViewGroup)mFabLayout.getParent()).removeView(mFabLayout);
|
||||
((ViewGroup) mFabLayout.getParent()).removeView(mFabLayout);
|
||||
AssertUtils.assertNotNull(container);
|
||||
container.addView(mFabLayout);
|
||||
ViewCompat.setWindowInsetsAnimationCallback(view, new WindowInsetsAnimationHelper(
|
||||
@@ -365,7 +365,7 @@ public class FavoritesScene extends SearchBarScene implements
|
||||
mRecyclerView = null;
|
||||
}
|
||||
if (null != mFabLayout) {
|
||||
((ViewGroup)mFabLayout.getParent()).removeView(mFabLayout);
|
||||
((ViewGroup) mFabLayout.getParent()).removeView(mFabLayout);
|
||||
removeAboveSnackView(mFabLayout);
|
||||
mFabLayout = null;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ import com.google.android.material.snackbar.Snackbar;
|
||||
import com.hippo.app.BaseDialogBuilder;
|
||||
import com.hippo.app.CheckBoxDialogBuilder;
|
||||
import com.hippo.app.EditTextDialogBuilder;
|
||||
import com.hippo.ehviewer.AppConfig;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.EhDB;
|
||||
import com.hippo.ehviewer.R;
|
||||
@@ -119,7 +118,6 @@ import com.hippo.yorozuya.IntIdGenerator;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
import com.hippo.yorozuya.collect.IntList;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -267,11 +267,6 @@ public final class GalleryListScene extends SearchBarScene
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMenuResId() {
|
||||
return R.menu.scene_gallery_list_searchbar_menu;
|
||||
}
|
||||
|
||||
public static void startScene(SceneFragment scene, ListUrlBuilder lub) {
|
||||
scene.startScene(getStartAnnouncer(lub));
|
||||
}
|
||||
@@ -283,6 +278,11 @@ public final class GalleryListScene extends SearchBarScene
|
||||
return new Announcer(GalleryListScene.class).setArgs(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMenuResId() {
|
||||
return R.menu.scene_gallery_list_searchbar_menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNavCheckedItem() {
|
||||
return mNavCheckedId;
|
||||
@@ -558,7 +558,7 @@ public final class GalleryListScene extends SearchBarScene
|
||||
mFabLayout,
|
||||
(View) mSearchFab.getParent()
|
||||
));
|
||||
((ViewGroup)mFabLayout.getParent()).removeView(mFabLayout);
|
||||
((ViewGroup) mFabLayout.getParent()).removeView(mFabLayout);
|
||||
container.addView(mFabLayout);
|
||||
|
||||
int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.gallery_padding_top_search_bar);
|
||||
@@ -601,7 +601,7 @@ public final class GalleryListScene extends SearchBarScene
|
||||
int colorID = ResourcesKt.resolveColor(getTheme(), com.google.android.material.R.attr.colorOnSurface);
|
||||
mActionFabDrawable = new AddDeleteDrawable(context, colorID);
|
||||
mFabLayout.getPrimaryFab().setImageDrawable(mActionFabDrawable);
|
||||
mSearchFab.setOnClickListener( (v) -> {
|
||||
mSearchFab.setOnClickListener((v) -> {
|
||||
if (STATE_NORMAL != mState) {
|
||||
onApplySearch();
|
||||
hideSoftInput();
|
||||
@@ -640,7 +640,7 @@ public final class GalleryListScene extends SearchBarScene
|
||||
mRecyclerView = null;
|
||||
}
|
||||
if (null != mFabLayout) {
|
||||
((ViewGroup)mFabLayout.getParent()).removeView(mFabLayout);
|
||||
((ViewGroup) mFabLayout.getParent()).removeView(mFabLayout);
|
||||
removeAboveSnackView(mFabLayout);
|
||||
mFabLayout = null;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ abstract class SearchBarScene : ToolbarScene() {
|
||||
inflater.inflate(R.layout.scene_searchbar, container, false) as ViewGroup
|
||||
mToolbar = view.findViewById(R.id.toolbar)
|
||||
mAppBarLayout = view.findViewById(R.id.appbar)
|
||||
mAppBarLayout?.statusBarForeground = MaterialShapeDrawable.createWithElevationOverlay(context)
|
||||
mAppBarLayout?.statusBarForeground =
|
||||
MaterialShapeDrawable.createWithElevationOverlay(context)
|
||||
|
||||
mSearchView = view.findViewById(R.id.searchview)
|
||||
mRecyclerView = view.findViewById(R.id.search_bar_list)
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.hippo.glview.image.ImageWrapper;
|
||||
import com.hippo.glview.view.GLRoot;
|
||||
import com.hippo.image.Image;
|
||||
import com.hippo.yorozuya.ConcurrentPool;
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
import com.hippo.yorozuya.OSUtils;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.hippo.glview.image;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
@@ -118,6 +118,12 @@ public class BatteryView extends AppCompatTextView {
|
||||
stopCharger();
|
||||
mAttached = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void registerReceiver() {
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||
getContext().registerReceiver(mIntentReceiver, filter, null, getHandler());
|
||||
} private final Runnable mCharger = new Runnable() {
|
||||
|
||||
private int level = 0;
|
||||
@@ -133,12 +139,6 @@ public class BatteryView extends AppCompatTextView {
|
||||
}
|
||||
};
|
||||
|
||||
private void registerReceiver() {
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||
getContext().registerReceiver(mIntentReceiver, filter, null, getHandler());
|
||||
}
|
||||
|
||||
private void unregisterReceiver() {
|
||||
getContext().unregisterReceiver(mIntentReceiver);
|
||||
}
|
||||
|
||||
@@ -119,6 +119,10 @@ public class TextClock extends AppCompatTextView {
|
||||
|
||||
chooseFormat();
|
||||
onTimeChanged();
|
||||
}
|
||||
|
||||
public boolean is24HourModeEnabled() {
|
||||
return DateFormat.is24HourFormat(getContext());
|
||||
} private final Runnable mTicker = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -131,10 +135,6 @@ public class TextClock extends AppCompatTextView {
|
||||
}
|
||||
};
|
||||
|
||||
public boolean is24HourModeEnabled() {
|
||||
return DateFormat.is24HourFormat(getContext());
|
||||
}
|
||||
|
||||
public String getTimeZone() {
|
||||
return mTimeZone;
|
||||
}
|
||||
@@ -236,6 +236,16 @@ public class TextClock extends AppCompatTextView {
|
||||
|
||||
private void unregisterReceiver() {
|
||||
getContext().unregisterReceiver(mIntentReceiver);
|
||||
}
|
||||
|
||||
private void unregisterObserver() {
|
||||
final ContentResolver resolver = getContext().getContentResolver();
|
||||
resolver.unregisterContentObserver(mFormatChangeObserver);
|
||||
}
|
||||
|
||||
private void onTimeChanged() {
|
||||
mTime.setTimeInMillis(System.currentTimeMillis());
|
||||
setText(DateFormat.format(mFormat, mTime));
|
||||
} private final ContentObserver mFormatChangeObserver = new ContentObserver(new Handler()) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
@@ -250,16 +260,6 @@ public class TextClock extends AppCompatTextView {
|
||||
}
|
||||
};
|
||||
|
||||
private void unregisterObserver() {
|
||||
final ContentResolver resolver = getContext().getContentResolver();
|
||||
resolver.unregisterContentObserver(mFormatChangeObserver);
|
||||
}
|
||||
|
||||
private void onTimeChanged() {
|
||||
mTime.setTimeInMillis(System.currentTimeMillis());
|
||||
setText(DateFormat.format(mFormat, mTime));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
app:cardBackgroundColor="@android:color/transparent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:checkable="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
android:focusable="true"
|
||||
app:cardBackgroundColor="@android:color/transparent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
android:id="@+id/card"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
android:layout_width="match_parent"
|
||||
app:cardBackgroundColor="@android:color/transparent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:checkable="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
android:focusable="true"
|
||||
app:cardBackgroundColor="@android:color/transparent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||
app:titleCollapseMode="scale"
|
||||
app:maxLines="3">
|
||||
app:maxLines="3"
|
||||
app:titleCollapseMode="scale">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:navigationIcon="@drawable/ic_baseline_menu_24"/>
|
||||
app:navigationIcon="@drawable/ic_baseline_menu_24" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
-->
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
android:id="@+id/action_add"
|
||||
android:icon="@drawable/v_plus_dark_x24"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/settings" />
|
||||
android:title="@string/settings"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_default_download_label"
|
||||
android:icon="@drawable/v_download_box_dark_x24"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/default_download_label" />
|
||||
android:title="@string/default_download_label"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
</menu>
|
||||
@@ -6,6 +6,6 @@
|
||||
android:id="@+id/action_search_more"
|
||||
android:icon="@drawable/v_plus_dark_x24"
|
||||
android:title=""
|
||||
app:showAsAction="always"/>
|
||||
app:showAsAction="always" />
|
||||
|
||||
</menu>
|
||||
@@ -60,16 +60,22 @@
|
||||
<!-- Apply blur on Android 12 above -->
|
||||
<style name="BottomSheetDialogTheme" parent="ThemeOverlay.Material3.BottomSheetDialog">
|
||||
<item name="android:windowBlurBehindEnabled" tools:targetApi="s">true</item>
|
||||
<item name="android:windowBlurBehindRadius" tools:ignore="PxUsage" tools:targetApi="s">20px</item>
|
||||
<item name="android:windowBlurBehindRadius" tools:ignore="PxUsage" tools:targetApi="s">
|
||||
20px
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="MaterialAlertDialogTheme" parent="ThemeOverlay.Material3.MaterialAlertDialog">
|
||||
<item name="android:windowBlurBehindEnabled" tools:targetApi="s">true</item>
|
||||
<item name="android:windowBlurBehindRadius" tools:ignore="PxUsage" tools:targetApi="s">20px</item>
|
||||
<item name="android:windowBlurBehindRadius" tools:ignore="PxUsage" tools:targetApi="s">
|
||||
20px
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="MaterialCalendarTheme" parent="ThemeOverlay.Material3.MaterialCalendar">
|
||||
<item name="android:windowBlurBehindEnabled" tools:targetApi="s">true</item>
|
||||
<item name="android:windowBlurBehindRadius" tools:ignore="PxUsage" tools:targetApi="s">20px</item>
|
||||
<item name="android:windowBlurBehindRadius" tools:ignore="PxUsage" tools:targetApi="s">
|
||||
20px
|
||||
</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -98,10 +98,10 @@
|
||||
android:defaultValue="120"
|
||||
android:key="thumb_size_"
|
||||
android:max="400"
|
||||
app:seekBarIncrement="80"
|
||||
android:title="@string/settings_eh_thumb_size"
|
||||
app:iconSpaceReserved="false"
|
||||
app:min="80"
|
||||
app:seekBarIncrement="80"
|
||||
app:showSeekBarValue="true" />
|
||||
|
||||
<rikka.preference.SimpleMenuPreference
|
||||
@@ -151,8 +151,8 @@
|
||||
android:defaultValue="60"
|
||||
android:key="preview_num"
|
||||
android:max="200"
|
||||
android:title="@string/settings_eh_preview_num"
|
||||
android:summary="@string/settings_eh_preview_num_summary"
|
||||
android:title="@string/settings_eh_preview_num"
|
||||
app:iconSpaceReserved="false"
|
||||
app:min="10"
|
||||
app:showSeekBarValue="true"
|
||||
|
||||
Reference in new issue
Block a user