SDK集成

**SDK集成** # 1. jar包以及aar文件接入 将wellsignsdk.aar拷贝到libs目录下。 # 2. build.gradle修改 请在gradle的dependencies项中加入以下依赖: ``` implementation 'com.android.support:support-vector-drawable:27.1.1' implementation 'com.mylhyl:acp:1.1.7' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34' implementation 'com.githang:status-bar-compat:0.7' implementation 'com.google.code.gson:gson:2.8.2' implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.android.support:multidex:1.0.+' //glide相关 implementation 'com.github.bumptech.glide:glide:4.7.1' annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1' // 阿里json implementation 'com.alibaba:fastjson:1.2.76' implementation 'com.squareup.okhttp3:okhttp:3.2.0' // 缩略图上拉刷新控件 implementation 'com.github.anzaizai:EasyRefreshLayout:1.3.1' implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0' //sqlite 数据库相关 implementation 'net.zetetic:android-database-sqlcipher:4.4.3@aar' implementation "androidx.sqlite:sqlite:2.0.1" ``` 备注:如果存在jar包冲突,请告知协商解决 # 3. Manifest.xml文件 ## 3.1 添加资源访问权限: ``` <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.CAMERA" /> ``` ## 3.2 添加FileProvider支持 将文件夹中xml目录拷贝到工程res文件夹下,并在AndroidManifest.xml文件中添加如下信息。 其中packagename为提供的包名。(如不设置,会影响拍照,相册等功能的使用) ``` <provider android:name="android.support.v4.content.FileProvider" android:authorities="{packagename}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> ``` 同时在代码中调用接口 ``` WellSign.setHQFileProvider({packagename}.fileprovider); ``` # 4. 布局文件引入插件 在界面的布局文件中引入好签的控件 **代码示例:** ``` <!--展示pdf的view--> <com.nj.wellsign.sdk.verticalScreen.hq.display.WSPDFView android:id="@+id/pdfview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@id/ll_edit" android:layout_below="@id/rl_title_hq"> //页码展示 <TextView android:id="@+id/tv_page_number_view" android:layout_width="wrap_content" android:layout_height="@dimen/dp_18" android:gravity="center" android:layout_centerHorizontal="true" android:layout_marginBottom="@dimen/dp_64" android:layout_alignParentBottom="true" android:textSize="@dimen/sp_13" android:visibility="visible" android:background="@mipmap/bg_page_number"/> </com.nj.wellsign.sdk.verticalScreen.hq.display.WSPDFView> ``` # 5. APP打包 用户在发布APP时,如果用到了proguard混淆工具,为保证sdk运行正常,需要在混淆配置中添加排除混淆 ``` -dontwarn com.nj.wellsign.sdk.** -keep class com.nj.wellsign.sdk.** {*;} ```