mirror of
https://github.com/seven332/EhViewer
synced 2026-12-03 20:39:02 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0631c2925a | ||
|
|
fbd9e93560 | ||
|
|
8b49cfe89c | ||
|
|
8e91fdaffe |
No files matched your search
+2
-2
@@ -16,8 +16,8 @@
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hippo.ehviewer"
|
||||
android:versionCode="29"
|
||||
android:versionName="0.6.8" >
|
||||
android:versionCode="30"
|
||||
android:versionName="0.6.9" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
Version 0.6.9 (2014-11-12)
|
||||
* 可能修正部分机型部分系统的布局错误
|
||||
* 调整 Android 4.1 至 4.3 的全屏效果
|
||||
|
||||
Version 0.6.8 (2014-11-11)
|
||||
* 调整界面
|
||||
* 允许阅读时常亮
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
<item name="android:actionBarStyle">@style/ActionBar</item>
|
||||
<item name="android:actionOverflowButtonStyle">@style/OverFlow</item>
|
||||
<item name="android:homeAsUpIndicator">@drawable/ic_ab_back</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
|
||||
<!-- <item name="@android:listChoiceIndicatorSingle">@drawable/btn_radio_material_anim</item> -->
|
||||
<item name="android:listChoiceIndicatorMultiple">@drawable/btn_check_material</item>
|
||||
@@ -57,6 +56,7 @@
|
||||
|
||||
<style name="AppTheme.Gallery">
|
||||
<item name="android:icon">@android:color/transparent</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:actionBarStyle">@style/ActionBar.Gallery</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -45,7 +45,9 @@ import com.hippo.ehviewer.util.FullScreenHelper;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
|
||||
public class GalleryActivity extends Activity
|
||||
implements GalleryView.GalleryViewListener, SeekBar.OnSeekBarChangeListener {
|
||||
implements GalleryView.GalleryViewListener, SeekBar.OnSeekBarChangeListener,
|
||||
FullScreenHelper.OnFullScreenBrokenListener, MaterialAlertDialog.OnClickListener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final static String TAG = GalleryActivity.class.getSimpleName();
|
||||
|
||||
@@ -84,27 +86,30 @@ public class GalleryActivity extends Activity
|
||||
void setFullScreen(final boolean fullScreen) {
|
||||
mFullScreenHelper.setFullScreen(fullScreen);
|
||||
|
||||
AlphaAnimation aa = fullScreen ? new AlphaAnimation(1.0f, 0.0f) : new AlphaAnimation(0.0f, 1.0f);
|
||||
aa.setDuration(Constants.ANIMATE_TIME);
|
||||
aa.setAnimationListener(new AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
if (!fullScreen)
|
||||
if (!(fullScreen && mFooter.getVisibility() == View.GONE) &&
|
||||
!(!fullScreen && mFooter.getVisibility() == View.VISIBLE)) {
|
||||
AlphaAnimation aa = fullScreen ? new AlphaAnimation(1.0f, 0.0f) :
|
||||
new AlphaAnimation(0.0f, 1.0f);
|
||||
aa.setDuration(Constants.ANIMATE_TIME);
|
||||
aa.setAnimationListener(new AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
mFooter.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
if (fullScreen)
|
||||
mFooter.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
if (fullScreen)
|
||||
mFooter.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
// Empty
|
||||
}
|
||||
});
|
||||
mFooter.startAnimation(aa);
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
// Empty
|
||||
}
|
||||
});
|
||||
mFooter.startAnimation(aa);
|
||||
}
|
||||
|
||||
if (!fullScreen)
|
||||
startFullScreenTask();
|
||||
@@ -112,6 +117,18 @@ public class GalleryActivity extends Activity
|
||||
cancelFullScreenTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
// When dialog show, full screen may be broken
|
||||
setFullScreen(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFullScreenBroken(boolean fullScreen) {
|
||||
setFullScreen(!fullScreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -124,6 +141,7 @@ public class GalleryActivity extends Activity
|
||||
setContentView(R.layout.gl_root_group);
|
||||
|
||||
mFullScreenHelper = new FullScreenHelper(this);
|
||||
mFullScreenHelper.setOnFullScreenBrokenListener(this);
|
||||
mFullScreenHelper.setFullScreen(true);
|
||||
|
||||
mFooter = findViewById(R.id.footer);
|
||||
@@ -185,6 +203,7 @@ public class GalleryActivity extends Activity
|
||||
new MaterialAlertDialog.Builder(this).setTitle(R.string.tip)
|
||||
.setMessage(R.string.gallery_tip)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(this)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,16 +25,29 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
public class FullScreenHelper {
|
||||
public final class FullScreenHelper implements View.OnSystemUiVisibilityChangeListener {
|
||||
|
||||
private static final String TAG = FullScreenHelper.class.getSimpleName();
|
||||
|
||||
private final int NOT_FULL_SCREEN_JELLY_BEAN =
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
|
||||
private final int FULL_SCREEN_JELLY_BEAN =
|
||||
NOT_FULL_SCREEN_JELLY_BEAN |
|
||||
View.SYSTEM_UI_FLAG_LOW_PROFILE |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
|
||||
private final int FULL_SCREEN_FLAG_JELLY_BEAN =
|
||||
View.SYSTEM_UI_FLAG_LOW_PROFILE |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
|
||||
private final int NOT_FULL_SCREEN_KITKAT =
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
NOT_FULL_SCREEN_JELLY_BEAN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
|
||||
private final int FULL_SCREEN_KITKAT =
|
||||
NOT_FULL_SCREEN_KITKAT |
|
||||
View.SYSTEM_UI_FLAG_LOW_PROFILE |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
@@ -45,12 +58,43 @@ public class FullScreenHelper {
|
||||
private final Window mWindow;
|
||||
private final View mDecorView;
|
||||
|
||||
private OnFullScreenBrokenListener mListener;
|
||||
|
||||
public interface OnFullScreenBrokenListener {
|
||||
/**
|
||||
* FullScreen state should be fullScreen or not,
|
||||
* but user or system broke it
|
||||
*
|
||||
* @param fullScreen support to be
|
||||
*/
|
||||
public void onFullScreenBroken(boolean fullScreen);
|
||||
}
|
||||
|
||||
|
||||
public FullScreenHelper(Activity activity) {
|
||||
mFullScreen = false;
|
||||
mActivity = activity;
|
||||
mActionBar = mActivity.getActionBar();
|
||||
mWindow = mActivity.getWindow();
|
||||
mDecorView = mWindow.getDecorView();
|
||||
mDecorView.setOnSystemUiVisibilityChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
if ((mFullScreen && visibility != FULL_SCREEN_FLAG_JELLY_BEAN) ||
|
||||
(!mFullScreen && visibility != 0)) {
|
||||
// User or system change visibility
|
||||
if (mListener != null)
|
||||
mListener.onFullScreenBroken(mFullScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnFullScreenBrokenListener(OnFullScreenBrokenListener l) {
|
||||
mListener = l;
|
||||
}
|
||||
|
||||
public boolean getFullScreen() {
|
||||
@@ -62,21 +106,30 @@ public class FullScreenHelper {
|
||||
if (fullScreen) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
// Empty
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
mActionBar.hide();
|
||||
mWindow.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
mActionBar.hide();
|
||||
mDecorView.setSystemUiVisibility(FULL_SCREEN_JELLY_BEAN);
|
||||
|
||||
} else {
|
||||
mActionBar.hide();
|
||||
mDecorView.setSystemUiVisibility(FULL_SCREEN_KITKAT);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
// Empty
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
mActionBar.show();
|
||||
mWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
mActionBar.show();
|
||||
mDecorView.setSystemUiVisibility(NOT_FULL_SCREEN_JELLY_BEAN);
|
||||
|
||||
} else {
|
||||
mActionBar.show();
|
||||
mDecorView.setSystemUiVisibility(NOT_FULL_SCREEN_KITKAT);
|
||||
|
||||
Reference in new issue
Block a user