合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
#动态首页使用说明 基于RubikU的动态首页模块页面 ## Download Download grab via Maven: ```xml allprojects { repositories { maven { url "http://192.168.0.121:8081/repository/maven-releases/" } maven {url "https://clojars.org/repo/"} } } ``` ```xml dependencies { compile 'com.ucmed.monkey:userCenter:1.0.0' } ``` ## 使用 ### 1、AndroidManifest.xml配置 ```xml <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <activity android:name="com.ucmed.monkey.rubikhomepage.activity.HomePageMainActivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> ``` ### 2、Application配置 ```java public class AppPatientDemoContexts extends AppHttpContexts { @Override public void onCreate() { super.onCreate(); AppHttpContexts.setRequestFail(getAppRequestFail()); new HttpClient(this).url("http://192.168.0.12:8080/api/exec/b9610b09-8291-428b-9ff3-676eacb0f338.htm").debug(false).log(null); //3个参数,分别为url地址,是否开启调式模式,日志输出路径 new HomePageBarUtils().addHomeBar(R.string.ttf_homepage_home_unselct, R.string.ttf_homepage_home_selct, R.string.homepage_bar_home, new HomePageFragment()) .addHomeBar(R.string.ttf_homepage_history_unselct, R.string.ttf_homepage_history_selct, R.string.homepage_bar_history, new TestFragment()) .addHomeBar(R.string.ttf_homepage_user_unselct, R.string.ttf_homepage_user_selct, R.string.homepage_bar_user, new TestFragment(),true) //添加配置首页viewPage } public RequestFail getAppRequestFail() { return new RequestFail() { @Override public void fail(boolean isFinish, Activity activity, int code, String... messages) { Toaster.show(activity, messages[0]);//交互失败异常处理 } }; } } ``` ### 3、开放入口 ```java /**ttf 底部bar矢量图 * ttf_select 底部bar矢量图点击状态 * text 底部bar文字 * fragment 展现的页面fragment **/ public HomePageBarUtils addHomeBar(int ttf, int ttf_select, int text, Fragment fragment) { barMdoels.add(new HomePageBarModel(ttf, ttf_select, text, fragment)); return this; } /**ttf 底部bar矢量图 * ttf_select 底部bar矢量图点击状态 * text 底部bar文字 * fragment 展现的页面fragment * needLogin 是否需要登录状态 **/ public HomePageBarUtils addHomeBar(int ttf, int ttf_select, int text, Fragment fragment,Boolean needLogin) { barMdoels.add(new HomePageBarModel(ttf, ttf_select, text, fragment,needLogin)); return this; } /** *loginActivity 登录的Activity **/ public HomePageBarUtils setLoginActivity(Class<? extends Activity> loginActivity) { this.loginActivity = loginActivity; return this; } ``` ### 4、包重复 ```xml android { packagingOptions { exclude 'META-INF/services/javax.annotation.processing.Processor' pickFirst 'META-INF/services/javax.annotation.processing.Processor' } } ```