From 8bf0816f4987140b2b4e6da135eaddb1b63899f5 Mon Sep 17 00:00:00 2001 From: "https://gitee.com/zcl7/sanling.git" <2227039052@qq.com> Date: Mon, 19 Mar 2018 15:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=8F=98=E9=87=8F=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=EF=BC=8C=E4=BE=BF=E4=BA=8E=E7=BB=A7=E6=89=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- .../soft/robert/com/githubdemo/MainActivity.java | 11 ++++------- .../soft/robert/com/xlibrary/base/BaseActivity.java | 12 ++++++------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 86c73f0..af5b24e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ allprojects { ## Step2: Add the dependency at your moudle build.gradle ``` dependencies { - compile 'com.github.RobertCow:GithubDemo:1.1.4' + compile 'com.github.RobertCow:GithubDemo:1.1.5' } ``` diff --git a/app/src/main/java/soft/robert/com/githubdemo/MainActivity.java b/app/src/main/java/soft/robert/com/githubdemo/MainActivity.java index b9f680c..248b6e0 100644 --- a/app/src/main/java/soft/robert/com/githubdemo/MainActivity.java +++ b/app/src/main/java/soft/robert/com/githubdemo/MainActivity.java @@ -5,11 +5,8 @@ import android.os.Bundle; import android.view.Gravity; import android.view.View; -import android.widget.FrameLayout; import android.widget.TextView; - import butterknife.BindView; -import butterknife.ButterKnife; import soft.robert.com.xlibrary.base.BaseActivity; import soft.robert.com.xlibrary.dialog.UniversalDialog; import soft.robert.com.xlibrary.utils.ChangeUtil; @@ -28,8 +25,8 @@ public class MainActivity extends BaseActivity { TextView tvGetCode; @Override - public boolean isScale() { - return true; + public boolean noScale() { + return false; } @Override @@ -38,8 +35,8 @@ public boolean isImmersion() { } @Override - public boolean isScreenNormal() { - return true; + public boolean isLandscape() { + return false; } @Override diff --git a/utils/src/main/java/soft/robert/com/xlibrary/base/BaseActivity.java b/utils/src/main/java/soft/robert/com/xlibrary/base/BaseActivity.java index 96077ae..f9382a5 100644 --- a/utils/src/main/java/soft/robert/com/xlibrary/base/BaseActivity.java +++ b/utils/src/main/java/soft/robert/com/xlibrary/base/BaseActivity.java @@ -33,21 +33,21 @@ public abstract class BaseActivity extends Activity{ private View rootView; private ImmersionBar mImmersionBar; - public abstract boolean isScale();//是否缩放 + public abstract boolean noScale();//是否缩放 public abstract boolean isImmersion();//是否浸入式状态栏 - public abstract boolean isScreenNormal();//是否竖屏 + public abstract boolean isLandscape();//是否竖屏 public abstract int initView(Bundle savedInstanceState);//初始化View public abstract void initData(Bundle savedInstanceState);//初始化数据 @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if(isScreenNormal()) {//竖屏 + if(!isLandscape()) {//竖屏 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }else{//横屏 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } mImmersionBar = ImmersionBar.with(this); - if(isImmersion()){ + if(isImmersion()){//浸入式状态栏 mImmersionBar.init(); //所有子类都将继承这些相同的属性 } try { @@ -57,8 +57,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { //绑定到butterknife mUnbinder = ButterKnife.bind(this); rootView = findViewById(android.R.id.content); - if (null != rootView && isScale()) { - if(isScreenNormal()) {//竖屏 + if (null != rootView && !noScale()) {//缩放 + if(!isLandscape()) {//竖屏 SupportMultipleScreensUtil.init(Utils.getContext(),false); }else{//横屏 SupportMultipleScreensUtil.init(Utils.getContext(),true);