相关
全部集成
似官方APP功能
步骤
- 下载
- 配置
- libs
- gradle(app)
apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "com.self.zsp.reportview" minSdkVersion 15 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { maven { url uri("libs") } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.android.support:recyclerview-v7:27.1.1' implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' /*ButterKnife*/ implementation fileTree(include: ['*.jar'], dir: 'libs') /*依赖部分jar包文件*/ implementation('com.fr.android:bi-sdk:+', { // 排或冲版 // exclude group: 'com.google.zxing', module: 'core' // exclude group: 'com.jiechic.library', module: 'xUtils' // exclude group: 'com.android.support', module: 'appcompat-v7' // exclude group: 'com.android.support', module: 'recyclerview-v7' }) /*BI模块*/ implementation('com.fr.android:report-sdk:+', { // 排或冲版 // exclude group: 'com.google.zxing', module: 'core' // exclude group: 'com.jiechic.library', module: 'xUtils' // exclude group: 'com.android.support', module: 'appcompat-v7' // exclude group: 'com.android.support', module: 'recyclerview-v7' }) /*报表模块*/ implementation 'com.fr.android:location:+' /*定位插件(获经纬度)*/ implementation 'com.fr.android:vpn:+' /*VPN插件(登Sangfor VPN服务器)*/ implementation 'com.fr.android:gis:+' /*GIS插件(显GIS地图图表)*/ implementation 'com.fr.android:push-xg:+' /*推送插件(集信鸽推送服务)*/ } 复制代码
- gradle(module)
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 复制代码
- Appication
FRSDK.initSDK(this); 复制代码
- libs
部分集成
- URL集成 直用URL访服务器,原生预览模板。
- 目录集成 相当将FineReport的App嵌入自己App。 进FineReport App时只需发服务器地址、服务器名称、用户名、密码验证即可登FineReport App。服务器设主页则登后跳主页;没设则直显目录页。
步骤
- 下载
- 配置
- libs
- 说明一 去除
armeabi
,com保留core
、platform
、report-sdk
,jar保留android-async-http-1.4.6-fr.jar
、js.jar
。 - 说明二 com依赖顺序
report-sdk
->platform
->core
。 - 说明三 jar无
android-async-http-1.4.6-fr.jar
则登录崩溃,无js.jar
则登录成功但查看报表崩溃。
- 说明一 去除
- gradle(app)
apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "com.self.zsp.reportview" minSdkVersion 15 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { maven { url uri("libs") } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.android.support:recyclerview-v7:27.1.1' implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' /*ButterKnife*/ implementation fileTree(include: ['*.jar'], dir: 'libs') /*依赖部分jar包文件*/ implementation('com.fr.android:bi-sdk:+', { // 排或冲版 exclude group: 'com.google.zxing', module: 'core' exclude group: 'com.jiechic.library', module: 'xUtils' exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'recyclerview-v7' }) /*BI模块*/ implementation('com.fr.android:report-sdk:+', { // 排或冲版 exclude group: 'com.google.zxing', module: 'core' exclude group: 'com.jiechic.library', module: 'xUtils' exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'recyclerview-v7' }) /*报表模块*/ } 复制代码
- gradle(module)
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 复制代码
- Appication
FRSDK.initSDK(this); 复制代码
- libs
方法
初始化
// 初始属性配置(调接口前调)
FRSDK.initSDK(getContext());
复制代码
设置
package util;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import com.fr.android.ifbase.IFFont;
import com.fr.android.platform.data.IFOEMConstants;
import com.fr.android.platform.oem.IFOEMUtils;
import com.fr.android.platform.utils.IFContextManager;
import com.self.zsp.dfs.R;
/**
* @decs: 帆软设置
* @date: 2018/9/1 10:40
* @version: v 1.0
*/
public class FrSetting {
public static void stepSettings(Context context) {
// 默显设置按钮
IFContextManager.setHideOptions(false);
// 默不显主Menu返按钮
IFOEMUtils.showMainMenuLeftBackButton(false);
// 显关于
IFContextManager.setShowAbout(true);
// 初始关于信息
IFOEMUtils.setAppName("");
IFOEMUtils.setAppIcon(R.mipmap.logo);
IFOEMUtils.setAppVersion("");
IFOEMUtils.setAppDate("");
IFOEMUtils.setCopyrightInfo("");
// 标题
IFFont font = new IFFont();
font.setColor(ContextCompat.getColor(context, R.color.fontInput));
font.setSize(16);
IFOEMUtils.setTitleFont(font.getColor(), (int) font.getSize(), font.getFont());
// 用默设界面
IFOEMUtils.useDefaultSettingView();
// 显FRExtraButton
IFContextManager.setHideExtraItems(false);
// 开版检测
IFOEMUtils.enableUpdate();
IFOEMUtils.setOEMCheckVersionUrl("http://www.finereporthelp.com:8889/app/AVServer?op=version");
// 关手机动画
IFOEMUtils.closePhoneAnimateChart();
// 关左侧目录保显
IFOEMConstants.setIsKeepFolderLeftOnPad(false);
// 首页不显于一级目录
IFOEMConstants.setHomePageOnFolder(false);
// 支持收藏
IFOEMUtils.supportFavorite(true);
// 清自定目录节点
IFOEMUtils.clearNodeOnFolder();
// 关H5登录
IFOEMUtils.setUseH5LoginUI(false);
// 用引导页
IFOEMUtils.setUseGuidePage(true);
}
}
复制代码
FrSetting.stepSettings(context);
...
复制代码
目录集成
法一
// 头次安装加载启引导页
Intent welcomeIntent = new Intent(getContext(), LoadAppFromWelcomeActivity.class);
// 地址(数据决策系统)
welcomeIntent.putExtra("serverIp", "http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer");
// 名称(数据决策系统)
welcomeIntent.putExtra("serverName", "数据分析");
// 用户名(数据决策系统)
welcomeIntent.putExtra("username", App.getInstance().userDataBean().getUsername());
// 密码(数据决策系统)
welcomeIntent.putExtra("password", Compile.decode(App.getInstance().userDataBean().getPassword()));
startActivity(welcomeIntent);
复制代码
法二
IFIntegrationUtils.loginWithoutWelcome(getContext(),
"http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer",
App.getInstance().userDataBean().getUsername(),
Compile.decode(App.getInstance().userDataBean().getPassword()),
"数据分析");
复制代码
对比
- 法一进目录页后可返上页
- 法二进目录页后返提退或取,退则退APP
URL集成
模板后缀名.cpt
需url参数keyreportlet
Intent intent = new Intent(getContext(), LoadAppFromURLActivity.class);
intent.putExtra("url", "http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer" + "?reportlet=" + "xxx.cpt");
intent.putExtra("title", "井下预警");
startActivity(intent);
复制代码
模板后缀名.frm
需url参数keyformlet
Intent intent = new Intent(getContext(), LoadAppFromURLActivity.class);
intent.putExtra("url", "http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer" + "?formlet=" + "xxx.cpt");
intent.putExtra("title", "井下预警");
startActivity(intent);
复制代码
扩展
"http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer" + "?formlet=" + "xxx.cpt" + "&op=view"
复制代码
添参
"http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer" + "?formlet=" + "xxx.cpt" + "&jh=xxx"
或
"http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer" + "?formlet=" + "xxx.cpt" + "&op=view" + "&jh=xxx"
复制代码
节点集成
// 登服务器
IFIntegrationUtils.logInto(getContext(),
"http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer",
App.getInstance().userDataBean().getUsername(),
Compile.decode(App.getInstance().userDataBean().getPassword()),
new CallbackWithCancel<JSONObject>() {
@Override
public void loadCancel() {
}
@Override
public void load(JSONObject jsonObject) {
// 加载目录树节点
IFIntegrationUtils.loadReportTree(getContext(), new CallbackWithCancel<List<IFEntryNode>>() {
@Override
public void loadCancel() {
}
@Override
public void load(List<IFEntryNode> ifEntryNodes) {
for (IFEntryNode ifEntryNode : ifEntryNodes) {
LogUtils.e(ifEntryNode.getText());
switch (ifEntryNode.getText()) {
case "钻井液汇报表":
IFIntegrationUtils.loadEntryView(getContext(), ifEntryNode.getChildNodes().get(3));
break;
default:
break;
}
}
}
@Override
public void loadFail() {
}
});
}
@Override
public void loadFail() {
}
});
复制代码
登服务器
IFIntegrationUtils.logInto(getContext(),
"http://aaaliuxinaaa.xicp.net:22754/zjyfx/ReportServer",
App.getInstance().userDataBean().getUsername(),
Compile.decode(App.getInstance().userDataBean().getPassword()),
new CallbackWithCancel<JSONObject>() {
@Override
public void loadCancel() {
}
@Override
public void load(JSONObject jsonObject) {
// 操作
}
@Override
public void loadFail() {
}
});
复制代码
加载目录树节点
IFIntegrationUtils.loadReportTree(getContext(), new CallbackWithCancel<List<IFEntryNode>>() {
@Override
public void loadCancel() {
}
@Override
public void load(List<IFEntryNode> ifEntryNodes) {
for (IFEntryNode ifEntryNode : ifEntryNodes) {
// 操作
}
}
@Override
public void loadFail() {
}
});
复制代码
加载收藏目录节点
IFIntegrationUtils.loadFavorites(new CallbackWithCancel<List<IFEntryNode>>() {
@Override
public void loadCancel() {
}
@Override
public void load(List<IFEntryNode> ifEntryNodes) {
}
@Override
public void loadFail() {
}
});
复制代码
问题
- 目录集成后目录页下方动作栏背景色透明,官方Demo白色。
- 登录超时不可用
/** * 登录超时(可自定回调) * TimeoutCallBack之onLoginTimeOut返true消费,false不消费 * @param timeoutCallback 自定回调 */ IFOEMUtils.loginTimeout(new TimeoutCallBack() { @Override public boolean onLoginTimeOut(Context context) { return false; } }); 复制代码