Update
This commit is contained in:
1 parent
c832589ac6
commit
30ff85e25b
18 files changed
+208
-309
No files matched your search
@@ -21,6 +21,7 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.webkit.CookieSyncManager;
|
||||
|
||||
import com.hippo.beerbelly.SimpleDiskCache;
|
||||
import com.hippo.conaco.Conaco;
|
||||
import com.hippo.ehviewer.network.EhOkHttpClient;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
@@ -29,10 +30,12 @@ import com.hippo.util.Log;
|
||||
import com.hippo.vectorold.content.VectorContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class EhApplication extends SceneApplication {
|
||||
|
||||
private Conaco mConaco;
|
||||
private SimpleDiskCache mReadcache;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -52,6 +55,12 @@ public class EhApplication extends SceneApplication {
|
||||
conacoBuilder.diskCacheMaxSize = 50 * 1024 * 1024;
|
||||
conacoBuilder.httpClient = EhOkHttpClient.getInstance();
|
||||
mConaco = conacoBuilder.build();
|
||||
|
||||
try {
|
||||
mReadcache = new SimpleDiskCache(new File(getCacheDir(), "readCache"), 200 * 1024 * 1024);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int getMemoryCacheMaxSize() {
|
||||
@@ -79,4 +88,9 @@ public class EhApplication extends SceneApplication {
|
||||
EhApplication application = (EhApplication) context.getApplicationContext();
|
||||
return application.mConaco;
|
||||
}
|
||||
|
||||
public static SimpleDiskCache getReadCache(Context context) {
|
||||
EhApplication application = (EhApplication) context.getApplicationContext();
|
||||
return application.mReadcache;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2015 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
public class GalleryActivity extends AppCompatActivity {
|
||||
}
|
||||
@@ -421,8 +421,6 @@ public class GalleryDetailScene extends Scene implements View.OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean AAA = false;
|
||||
|
||||
private class EhDetailListener extends EhClient.OnGetGalleryDetailListener {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.ui.ContentActivity;
|
||||
@@ -67,7 +68,7 @@ public final class MainSettingsScene extends PreferenceHeaderScene {
|
||||
private PreferenceHeader newPreferenceHeader(int drawableId, int titleId, Class clazz) {
|
||||
Resources resources = getStageActivity().getResources();
|
||||
return new PreferenceHeader(
|
||||
resources.getDrawable(drawableId),
|
||||
ContextCompat.getDrawable(getStageActivity(), drawableId),
|
||||
resources.getString(titleId),
|
||||
clazz
|
||||
);
|
||||
|
||||
@@ -162,7 +162,6 @@ public class SearchBar extends CardView implements View.OnClickListener,
|
||||
}
|
||||
});
|
||||
|
||||
// TODO get source from config
|
||||
setSource(Config.getEhSource());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
@@ -17,6 +16,7 @@ import com.hippo.util.ViewUtils;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
// Do not ues it when Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2
|
||||
public class RippleCurtain extends Curtain {
|
||||
|
||||
private static final String TAG = RippleCurtain.class.getSimpleName();
|
||||
@@ -47,11 +47,6 @@ public class RippleCurtain extends Curtain {
|
||||
enterView.setStartPoint(mStartX, mStartY);
|
||||
ViewUtils.setVisibility(enterView, View.INVISIBLE);
|
||||
|
||||
// Canvas.clipPath() not work for pre-JELLY_BEAN_MR2 when hardware accelerated
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
ViewUtils.removeHardwareAccelerationSupport(enterView);
|
||||
}
|
||||
|
||||
enterView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
@@ -92,11 +87,6 @@ public class RippleCurtain extends Curtain {
|
||||
dispatchOpenFinished(enter, exit);
|
||||
hideSceneOnOpen(exit);
|
||||
mAnimatorSet = null;
|
||||
|
||||
// Canvas.clipPath() not work for pre-JELLY_BEAN_MR2 when hardware accelerated
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
ViewUtils.addHardwareAccelerationSupport(enterView);
|
||||
}
|
||||
}
|
||||
});
|
||||
mAnimatorSet.start();
|
||||
@@ -113,11 +103,6 @@ public class RippleCurtain extends Curtain {
|
||||
final SceneView exitView = exit.getSceneView();
|
||||
exitView.setStartPoint(mStartX, mStartY);
|
||||
|
||||
// Canvas.clipPath() not work for pre-JELLY_BEAN_MR2 when hardware accelerated
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
ViewUtils.removeHardwareAccelerationSupport(exitView);
|
||||
}
|
||||
|
||||
PropertyValuesHolder circlePercentPvh = PropertyValuesHolder.ofFloat("circlePercent", 1f, 0f);
|
||||
ObjectAnimator animFrame = ObjectAnimator.ofPropertyValuesHolder(exitView, circlePercentPvh);
|
||||
animFrame.setDuration(ANIMATE_TIME);
|
||||
@@ -130,11 +115,6 @@ public class RippleCurtain extends Curtain {
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
dispatchCloseFinished(enter, exit);
|
||||
mAnimatorSet = null;
|
||||
|
||||
// Canvas.clipPath() not work for pre-JELLY_BEAN_MR2 when hardware accelerated
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
ViewUtils.addHardwareAccelerationSupport(exitView);
|
||||
}
|
||||
}
|
||||
});
|
||||
mAnimatorSet.start();
|
||||
|
||||
@@ -60,7 +60,6 @@ public abstract class Scene {
|
||||
|
||||
private @Nullable Announcer mAnnouncer;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private SceneView mSceneView;
|
||||
|
||||
private int mBackgroundColor = 0xffeeeeee; // TODO Need a better to set background color
|
||||
@@ -184,9 +183,14 @@ public abstract class Scene {
|
||||
if (mSceneView == null) {
|
||||
// Not call setContentView in onCreate, create scene view by ourself
|
||||
mSceneView = createSceneView(getStageActivity());
|
||||
initBackground(mSceneView);
|
||||
}
|
||||
|
||||
mSceneView.setBackgroundColor(mBackgroundColor);
|
||||
|
||||
mSceneView.setFocusable(true);
|
||||
mSceneView.setFocusableInTouchMode(true);
|
||||
mSceneView.requestFocus();
|
||||
|
||||
// Make sure scene view is attach from stage
|
||||
attachToStage();
|
||||
|
||||
@@ -212,16 +216,16 @@ public abstract class Scene {
|
||||
}
|
||||
|
||||
void destroy(boolean die) {
|
||||
// Make sure soft key broad is hidden
|
||||
InputMethodManager imm = (InputMethodManager) getStageActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(getSceneView().getWindowToken(), 0);
|
||||
|
||||
onDestroy(die);
|
||||
}
|
||||
|
||||
void die(boolean keepView) {
|
||||
onDie();
|
||||
|
||||
// Make sure soft key broad is hidden
|
||||
InputMethodManager imm = (InputMethodManager) getStageActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(getSceneView().getWindowToken(), 0);
|
||||
|
||||
if (!keepView) {
|
||||
detachFromeStage();
|
||||
}
|
||||
@@ -238,6 +242,8 @@ public abstract class Scene {
|
||||
void resume() {
|
||||
getSceneView().setEnableTouch(true);
|
||||
|
||||
mSceneView.requestFocus();
|
||||
|
||||
onResume();
|
||||
}
|
||||
|
||||
@@ -332,7 +338,6 @@ public abstract class Scene {
|
||||
protected void setContentView(int resId) {
|
||||
StageActivity sa = getStageActivity();
|
||||
mSceneView = createSceneView(sa);
|
||||
initBackground(mSceneView);
|
||||
mSceneView.setBackgroundColor(mBackgroundColor);
|
||||
sa.getLayoutInflater().inflate(resId, mSceneView);
|
||||
}
|
||||
@@ -340,18 +345,10 @@ public abstract class Scene {
|
||||
protected void setContentView(View view) {
|
||||
StageActivity sa = getStageActivity();
|
||||
mSceneView = createSceneView(sa);
|
||||
initBackground(mSceneView);
|
||||
mSceneView.addView(view, new FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
private void initBackground(@NonNull View bg) {
|
||||
bg.setBackgroundColor(mBackgroundColor);
|
||||
bg.setFocusable(true);
|
||||
bg.setFocusableInTouchMode(true);
|
||||
bg.requestFocus();
|
||||
}
|
||||
|
||||
protected void onNewAnnouncer(Announcer announcer) {
|
||||
}
|
||||
|
||||
|
||||
@@ -44,17 +44,12 @@ public class CardButton extends Button implements CardViewDelegate {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPadding(int left, int top, int right, int bottom) {
|
||||
public void setCardPadding(int left, int top, int right, int bottom) {
|
||||
if (mCardHelper != null) {
|
||||
mCardHelper.setPadding(left, top, right, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRawPadding(int left, int top, int right, int bottom) {
|
||||
super.setPadding(left, top, right, bottom);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void setRawBackgroundDrawable(Drawable drawable) {
|
||||
|
||||
@@ -44,17 +44,12 @@ public class CardLinearLayout extends LinearLayout implements CardViewDelegate {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPadding(int left, int top, int right, int bottom) {
|
||||
public void setCardPadding(int left, int top, int right, int bottom) {
|
||||
if (mCardHelper != null) {
|
||||
mCardHelper.setPadding(left, top, right, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRawPadding(int left, int top, int right, int bottom) {
|
||||
super.setPadding(left, top, right, bottom);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void setRawBackgroundDrawable(Drawable drawable) {
|
||||
|
||||
Reference in new issue
Block a user