Skip to content

Commit

Permalink
更改变量名称,便于继承
Browse files Browse the repository at this point in the history
  • Loading branch information
Cpf-666 committed Mar 19, 2018
1 parent 10f4c3b commit 8bf0816
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
```

Expand Down
11 changes: 4 additions & 7 deletions app/src/main/java/soft/robert/com/githubdemo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,8 +25,8 @@ public class MainActivity extends BaseActivity {
TextView tvGetCode;

@Override
public boolean isScale() {
return true;
public boolean noScale() {
return false;
}

@Override
Expand All @@ -38,8 +35,8 @@ public boolean isImmersion() {
}

@Override
public boolean isScreenNormal() {
return true;
public boolean isLandscape() {
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down

0 comments on commit 8bf0816

Please sign in to comment.