Android源代码。packagecom.byt.framlib.base;importandroid.app.AlertDialog;importandroid.content.Context;importandroid.content.DialogInterface;importandroid.content.Intent;importandroid.content.pm.ActivityInfo;importandroid.graphics.Color;importandroid.os.Bundle;importandroid.support.annotation.NonNull;importandroid.support.v4.content.ContextCompat;importandroid.text.TextUtils;importandroid.view.LayoutInflater;importandroid.view.View;importandroid.view.Window;importcom.byt.framlib.BuildConfig;importcom.byt.framlib.R;importcom.byt.framlib.baseapp.AppManager;importcom.byt.framlib.commonutils.PermissionReq;importcom.byt.framlib.commonutils.ToastUitl;importcom.byt.framlib.commonutils.rx.RxBus;importcom.byt.framlib.commonwidget.LoadingDialog;importcom.byt.framlib.commonwidget.StatusBarCompat;importcom.trello.rxlifecycle.components.support.RxAppCompatActivity;importcom.umeng.analytics.MobclickAgent;importbutterknife.ButterKnife;importbutterknife.Unbinder;importrx.Subscription;importrx.subscriptions.CompositeSubscription;/***基类Actvity*/publicabstractclassBaseActivityextendsRxAppCompatActivity{protectedintexpertsColorInt=Color.parseColor(#79d6db);protectedintuserColorInt=Color.parseColor(#fe6f95);protectedinttransparentColorInt=Color.parseColor(#00000000);privateUnbindermBinder;publicContextmContext;protectedBundlemSavedInstanceState;privateCompositeSubscriptionsCompositeSubscription;protectedSubscriptionsubscribe=null;protectedViewconentView;@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);if(sCompositeSubscription==null||sCompositeSubscription.isUnsubscribed()){sCompositeSubscription=newCompositeSubscription();}doBeforeSetcontentView();setContentView(getLayoutId());LayoutInflaterinflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);conentView=inflater.inflate(getLayoutId(),null);mBinder=ButterKnife.bind(this);MobclickAgent.setScenarioType(mContext,MobclickAgent.EScenarioType.E_DUM_NORMAL);mContext=this;this.mSavedInstanceState=savedInstanceState;this.initPreData();this.initView();}@OverridepublicvoidonStart(){super.onStart();}@OverridepublicvoidonStop(){super.onStop();}/***设置layout前配置*/privatevoiddoBeforeSetcontentView(){//把actvity放到application栈中管理AppManager.getAppManager().addActivity(this);//无标题requestWindowFeature(Window.FEATURE_NO_TITLE);//设置竖屏setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//默认着色状态栏SetStatusBarColor();//SetStatusBarColor(Color.parseColor(#00000000));}/***添加Subscription**@paramsubscription*/publicvoidaddSubscription(Subscriptionsubscription){sCompositeSubscription.add(subscription);}/*********************子类实现*****************************///获取布局文件publicabstractintgetLayoutId();//实例化前端的数据publicabstractvoidinitPreData();//初始化viewpublicabstractvoidinitView();/***着色状态栏(4.4以上系统有效)*/protectedvoidSetStatusBarColor(){StatusBarCompat.setStatusBarColor(this,ContextCompat.getColor(this,R.color.common_tabbar_color));}/***着色状态栏(4.4以上系统有效)*/protectedvoidSetStatusBarColor(intcolor){StatusBarCompat.setStatusBarColor(this,color);}/***沉浸状态栏(4.4以上系统有效)*/protectedvoidSetTranslanteBar(){StatusBarCompat.translucentStatusBar(this);}/***显示单选对话框**@paramtitle标题*@parammessage提示信息*@paramcheckedItem默认选中*@paramstrings选项数组*@paramonClickListener点击事件的监听*/publicvoidshowRadioButtonDialog(Stringtitle,Stringmessage,String[]strings,intcheckedItem,DialogInterface.OnClickListeneronClickListener){AlertDialog.Builderbuilder=newAlertDialog.Builder(this);builder.setTitle(title);if(!TextUtils.isEmpty(message)){builder.setMessage(message);}builder.setSingleChoiceItems(strings,checkedItem,onClickListener);builder.create();builder.show();}/***通过Class跳转界面**/publicvoidopenActivity(Class?cls){openActivity(cls,null);}/***通过Class跳转界面**/publicvoidstartActivityForResult(Class?cls,intrequestCode){startActivityForResult(cls,null,requestCode);}/***含有Bundle通过Class跳转界面**/publicvoidstartActivityForResult(Class?cls,Bundlebundle,intrequestCode){Intentintent=newIntent();intent.setClass(this,cls);if(bundle!=null){intent.putExtras(bundle);}startActivityForResult(intent,requestCode);//this.overridePendingTransition(R.anim.fade_in,//R.anim.fade_out);}/***含有Bundle通过Class跳转界面**/publicvoidopenActivity(Class?cls,Bundlebundle){Intentintent=newIntent();intent.setClass(this,cls);if(bundle!=null){intent.putExtras(bundle);}startActivity(intent);//this.overridePendingTransition(R.anim.fade_in,//R.anim.fade_out);}/***含有Bundle通过Class跳转界面**/publicvoidopensActivity(Class?cls,Bundlebundle){Intentintent=newIntent();intent.setClass(this,cls);if(bundle!=null){intent.putExtras(bundle);}startActivity(intent);}/***回调**@parambundle*/publicvoidsetResultOk(Bundlebundle){Intentintent=newIntent();if(bundle!=null);intent.putExtras(bundle);setResult(RESULT_OK,intent);finish();this.overridePendingTransition(R.anim.fade_in,R.anim.fade_out);}/***开启浮动加载进度条*/publicvoidstartProgressDialog(){LoadingDialog.showDialogForLoading(this);}/***开启浮动加载进度条**@parammsg*/publicvoidstartProgressDialog(Stringmsg){LoadingDialog.