Просмотр исходного кода

提交分类: 功能开发;
提交内容: 邀请注册上传
当前版本: 测试版本6.1.6
是否冲突: 否

raomeng 8 лет назад
Родитель
Сommit
d34fab566f
100 измененных файлов с 3108 добавлено и 5279 удалено
  1. 1 1
      WeiChat/build.gradle
  2. 2 0
      WeiChat/src/main/AndroidManifest.xml
  3. 1 1
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ApplySubscribeActivity.java
  4. 2 0
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/WebViewCommActivity.java
  5. 0 68
      WeiChat/src/main/java/com/xzjmyk/pm/activity/util/oa/CommonUtil.java
  6. 7 11
      WeiChat/src/main/java/com/xzjmyk/pm/activity/wxapi/WXEntryActivity.java
  7. 5 5
      WeiChat/version.properties
  8. 10 1
      app_core/common/src/main/assets/work_menu.json
  9. 9 0
      app_core/common/src/main/assets/work_menu_b2b.json
  10. 9 0
      app_core/common/src/main/assets/work_menu_personal.json
  11. 1 1
      app_core/common/src/main/java/com/common/config/BaseApplication.java
  12. 19 14
      app_core/common/src/main/java/com/common/system/ActivityUtils.java
  13. 4 0
      app_core/common/src/main/java/com/core/app/Constants.java
  14. 99 11
      app_core/common/src/main/java/com/core/app/MyApplication.java
  15. 19 1
      app_core/common/src/main/java/com/core/model/LoginEntity.java
  16. 11 5
      app_core/common/src/main/java/com/core/net/http/ViewUtil.java
  17. 10 9
      app_core/common/src/main/java/com/core/service/InitializeService.java
  18. 149 1
      app_core/common/src/main/java/com/core/utils/CommonUtil.java
  19. 1865 942
      app_core/common/src/main/res/values-en/strings.xml
  20. 4 2
      app_core/common/src/main/res/values-zh-rCN/strings.xml
  21. 44 42
      app_core/common/src/main/res/values-zh-rTW/strings.xml
  22. 4 2
      app_core/common/src/main/res/values/strings.xml
  23. 10 7
      app_core/network/src/main/java/com/me/network/app/base/BaseApplication.java
  24. 35 0
      app_core/network/src/main/java/com/me/network/app/http/HttpRequest.java
  25. 1 0
      app_core/network/src/main/res/values/strings.xml
  26. 1 1
      app_modular/applogin/src/main/java/com/modular/login/activity/AdminRegisterActivity.java
  27. 7 2
      app_modular/appmessages/src/main/java/com/modular/appmessages/activity/SubscribeDetailActivity.java
  28. 2 2
      app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/AllSubscriptionAdapter.java
  29. 2 2
      app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/AllSubscriptionNumbersAdapter.java
  30. 1 1
      app_modular/appmessages/src/main/java/com/modular/appmessages/fragment/SubscriptionAllFragment.java
  31. 1 1
      app_modular/appmessages/src/main/java/com/modular/appmessages/fragment/SubscriptionMyFragment.java
  32. 36 31
      app_modular/apputils/src/main/java/com/modular/apputils/IntentUrlActivity.java
  33. 12 10
      app_modular/apputils/src/main/java/com/modular/apputils/activity/SimpleWebActivity.java
  34. 1 1
      app_modular/appworks/build.gradle
  35. 16 5
      app_modular/appworks/src/main/AndroidManifest.xml
  36. 19 6
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/PurchaseDetailsActivity.java
  37. 25 47
      app_modular/appworks/src/main/java/com/uas/appworks/activity/B2BBusinessMainActivity.java
  38. 21 28
      app_modular/appworks/src/main/java/com/uas/appworks/activity/CustomerInquiryDetailActivity.java
  39. 1 1
      app_modular/appworks/src/main/java/com/uas/appworks/activity/CustomerInquiryListActivity.java
  40. 306 0
      app_modular/appworks/src/main/java/com/uas/appworks/activity/InviteRegisterActivity.java
  41. 7 10
      app_modular/appworks/src/main/java/com/uas/appworks/activity/PublicInquiryDetailActivity.java
  42. 1 1
      app_modular/appworks/src/main/java/com/uas/appworks/activity/PublicInquiryListActivity.java
  43. 1 1
      app_modular/appworks/src/main/java/com/uas/appworks/activity/PurchaseOrderListActivity.java
  44. 4 4
      app_modular/appworks/src/main/java/com/uas/appworks/datainquiry/PDFUtils.java
  45. 167 169
      app_modular/appworks/src/main/java/com/uas/appworks/datainquiry/activity/PDFDownloadActivity.java
  46. 33 9
      app_modular/appworks/src/main/java/com/uas/appworks/fragment/B2BBusinessListFragment.java
  47. BIN
      app_modular/appworks/src/main/res/drawable-hdpi/ic_trademark_b2b.png
  48. BIN
      app_modular/appworks/src/main/res/drawable-hdpi/ic_trademark_mall.png
  49. BIN
      app_modular/appworks/src/main/res/drawable-hdpi/ic_trademark_uu.png
  50. BIN
      app_modular/appworks/src/main/res/drawable-hdpi/ic_work_invite_register.png
  51. BIN
      app_modular/appworks/src/main/res/drawable-xhdpi/ic_trademark_b2b.png
  52. BIN
      app_modular/appworks/src/main/res/drawable-xhdpi/ic_trademark_mall.png
  53. BIN
      app_modular/appworks/src/main/res/drawable-xhdpi/ic_trademark_uu.png
  54. BIN
      app_modular/appworks/src/main/res/drawable-xhdpi/ic_work_invite_register.png
  55. BIN
      app_modular/appworks/src/main/res/drawable-xxhdpi/ic_trademark_b2b.png
  56. BIN
      app_modular/appworks/src/main/res/drawable-xxhdpi/ic_trademark_mall.png
  57. BIN
      app_modular/appworks/src/main/res/drawable-xxhdpi/ic_trademark_uu.png
  58. BIN
      app_modular/appworks/src/main/res/drawable-xxhdpi/ic_work_invite_register.png
  59. 70 0
      app_modular/appworks/src/main/res/layout/activity_invite_register.xml
  60. 1 5
      app_modular/appworks/src/main/res/layout/activity_pdf_download.xml
  61. 2 3
      app_modular/appworks/src/main/res/layout/layout_list_b2b_detail_text.xml
  62. 2 3
      app_modular/appworks/src/main/res/layout/layout_list_b2b_white_detail_text.xml
  63. 0 5
      app_modular/appworks/src/main/res/layout/layout_list_customer_inquiry.xml
  64. 4 11
      app_modular/appworks/src/main/res/layout/layout_list_public_inquiry.xml
  65. 0 3
      app_modular/appworks/src/main/res/layout/layout_list_purchase_order.xml
  66. 11 5
      app_modular/appworks/src/main/res/values-en/strings.xml
  67. 11 5
      app_modular/appworks/src/main/res/values-zh-rCN/strings.xml
  68. 11 5
      app_modular/appworks/src/main/res/values-zh-rTW/strings.xml
  69. 11 5
      app_modular/appworks/src/main/res/values/strings.xml
  70. 0 45
      app_third/android-pdf-viewer/build.gradle
  71. 0 5
      app_third/android-pdf-viewer/src/main/AndroidManifest.xml
  72. 0 169
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/AnimationManager.java
  73. 0 178
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/CacheManager.java
  74. 0 79
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DecodingAsyncTask.java
  75. 0 216
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DragPinchManager.java
  76. 0 1472
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/PDFView.java
  77. 0 275
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/PagesLoader.java
  78. 0 160
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/RenderingHandler.java
  79. 0 28
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/exception/FileNotFoundException.java
  80. 0 38
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnDrawListener.java
  81. 0 25
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnErrorListener.java
  82. 0 29
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnLoadCompleteListener.java
  83. 0 32
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnPageChangeListener.java
  84. 0 31
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnPageScrollListener.java
  85. 0 27
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnRenderListener.java
  86. 0 100
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/model/PagePart.java
  87. 0 236
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/DefaultScrollHandle.java
  88. 0 57
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/ScrollHandle.java
  89. 0 43
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/AssetSource.java
  90. 0 37
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/ByteArraySource.java
  91. 0 27
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/DocumentSource.java
  92. 0 40
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/FileSource.java
  93. 0 39
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/InputStreamSource.java
  94. 0 40
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/UriSource.java
  95. 0 74
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/ArrayUtils.java
  96. 0 51
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/Constants.java
  97. 0 62
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/FileUtils.java
  98. 0 105
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/MathUtils.java
  99. 0 41
      app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/Util.java
  100. 0 12
      app_third/android-pdf-viewer/src/main/res/drawable/default_scroll_handle_bottom.xml

+ 1 - 1
WeiChat/build.gradle

@@ -178,7 +178,7 @@ dependencies {
     compile project(':appme')
     compile project(':appworks')
     compile project(':appbooking')
-    compile project(':android-pdf-viewer')
+//    compile project(':android-pdf-viewer')
     compile project(':apputils')
 }
 

+ 2 - 0
WeiChat/src/main/AndroidManifest.xml

@@ -130,7 +130,9 @@
         <activity android:name=".ui.SplashActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
+                <action android:name="com.modular.main.SplashActivity" />
                 <category android:name="android.intent.category.LAUNCHER" />
+                <category android:name="android.intent.category.DEFAULT" />
                 <action android:name="cat.ereza.customactivityoncrash.RESTART" />
             </intent-filter>
 

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ApplySubscribeActivity.java

@@ -89,7 +89,7 @@ public class ApplySubscribeActivity extends BaseActivity {
                     String submitResult = msg.getData().getString("result");
                     Log.d("apply_subscrive_submit", submitResult);
                     Crouton.makeText(ApplySubscribeActivity.this, "申请提交成功", Style.CONFIRM).show();
-                    CommonUtil.imageToast(ApplySubscribeActivity.this, R.drawable.ic_apply_submit_success, "", 2000);
+                    com.core.utils.CommonUtil.imageToast(ApplySubscribeActivity.this, R.drawable.ic_apply_submit_success, "", 2000);
                     break;
                 case Constants.APP_SOCKETIMEOUTEXCEPTION:
                     progressDialog.dismiss();

+ 2 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/WebViewCommActivity.java

@@ -234,6 +234,7 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
                 super.onReceivedError(view, errorCode, description, failingUrl);
             }
 
+            @Override
             public boolean shouldOverrideUrlLoading(WebView view, String url) {
                 Log.d("loadurl", url);
                 if (!url.equals("http://www.ubtob.com/signin#")) {
@@ -268,6 +269,7 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
                 handler.proceed();
             }
 
+            @Override
             public void onPageFinished(WebView view, String url) {
                 CookieManager cookieManager = CookieManager.getInstance();
                 String CookieStr = cookieManager.getCookie(url);

+ 0 - 68
WeiChat/src/main/java/com/xzjmyk/pm/activity/util/oa/CommonUtil.java

@@ -33,14 +33,10 @@ import android.text.Spannable;
 import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
 import android.text.style.ForegroundColorSpan;
-import android.text.style.UnderlineSpan;
 import android.util.Log;
 import android.util.Patterns;
-import android.view.Gravity;
 import android.view.View;
 import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -74,7 +70,6 @@ import com.nostra13.universalimageloader.core.DisplayImageOptions;
 import com.nostra13.universalimageloader.core.assist.ImageScaleType;
 import com.umeng.socialize.UMShareListener;
 import com.umeng.socialize.bean.SHARE_MEDIA;
-import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.erp.activity.WebViewCommActivity;
 import com.xzjmyk.pm.activity.ui.erp.activity.WebViewLoadActivity;
 import com.xzjmyk.pm.activity.ui.erp.view.DateTimePickerDialog;
@@ -948,32 +943,6 @@ public class CommonUtil {
         view.setText(style);
     }
 
-
-    /**
-     * @desc:修改textView样式(添加下划线)
-     * @author:Arison on 2016/8/3
-     */
-    public static void textUnderlineForStyle(
-            TextView view,
-            String input,
-            String match) {
-        SpannableStringBuilder style = new SpannableStringBuilder(input);
-        Pattern highlight = Pattern.compile(match);
-        Matcher m = highlight.matcher(style.toString());
-        while (m.find()) {
-//            style.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), m.start(), m.end(),
-//                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-//            style.setSpan(new ForegroundColorSpan(color), m.start(), m.end(),
-//                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-//            style.setSpan(new StrikethroughSpan(), m.start(), m.end(),
-//                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-            style.setSpan(new UnderlineSpan(), m.start(), m.end(),
-                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-        }
-        view.setText(style);
-    }
-
-
     private static long mLastClickTime;
     private static final long SPACE_TIME = 1000;//重复点击间隔时间
 
@@ -1071,43 +1040,6 @@ public class CommonUtil {
         return StringUtil.toHttpString(temp);
     }
 
-    /**
-     * 添加图片的toast
-     *
-     * @param context
-     * @param imageId  图片id
-     * @param content  文字内容
-     * @param duration 显示时长
-     */
-    public static void imageToast(Context context, int imageId, String content, int duration) {
-        Toast toast = new Toast(context);
-        //显示的时间
-        toast.setDuration(duration);
-        //显示的位置
-        toast.setGravity(Gravity.BOTTOM, 0, 300);
-
-        //自定义toast布局
-        LinearLayout toastLayout = new LinearLayout(context);
-        toastLayout.setGravity(Gravity.CENTER_VERTICAL);
-        toastLayout.setOrientation(LinearLayout.HORIZONTAL);
-
-        //添加ImageView
-        ImageView toastImage = new ImageView(context);
-        toastImage.setImageResource(imageId);
-        toastLayout.addView(toastImage);
-
-        //添加TextView
-        TextView toastText = new TextView(context);
-        toastText.setBackgroundColor(context.getResources().getColor(R.color.toast_bg));
-        toastText.setText(content);
-        toastLayout.addView(toastText);
-
-        toastLayout.setBackgroundColor(context.getResources().getColor(R.color.toast_bg));
-        toast.setView(toastLayout);
-        toast.show();
-    }
-
-
     /**
      * 打开一个文件
      *

+ 7 - 11
WeiChat/src/main/java/com/xzjmyk/pm/activity/wxapi/WXEntryActivity.java

@@ -1,23 +1,19 @@
 package com.xzjmyk.pm.activity.wxapi;
 
-import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
+import android.widget.Toast;
 
 import com.tencent.mm.sdk.modelbase.BaseReq;
 import com.tencent.mm.sdk.modelbase.BaseResp;
-import com.tencent.mm.sdk.modelmsg.SendAuth;
-import com.tencent.mm.sdk.openapi.IWXAPI;
 import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
+import com.umeng.socialize.weixin.view.WXCallbackActivity;
 
-public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
-    private IWXAPI api;
+public class WXEntryActivity extends WXCallbackActivity implements IWXAPIEventHandler {
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-//        api = WXAPIFactory.createWXAPI(this, Constants.WXPAY_APPID);
-//        api.handleIntent(getIntent(), this);
     }
 
     @Override
@@ -35,11 +31,11 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
         try {
             switch (resp.errCode) {
                 case BaseResp.ErrCode.ERR_OK: {
-                    if (resp != null && resp instanceof SendAuth.Resp) {
-
-                    }
+                    Toast.makeText(this, "分享成功", Toast.LENGTH_SHORT).show();
+                    break;
                 }
-                break;
+                default:
+                    break;
             }
         } catch (Exception e) {
             e.printStackTrace();

+ 5 - 5
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Thu Jan 25 17:30:57 CST 2018
-debugName=162
-versionName=617
-debugCode=162
-versionCode=156
+#Fri Feb 02 15:32:32 CST 2018
+debugName=268
+versionName=618
+debugCode=268
+versionCode=157

+ 10 - 1
app_core/common/src/main/assets/work_menu.json

@@ -23,6 +23,15 @@
         "menuUrl": "",
         "caller": "",
         "isHide": false
+      },
+      {
+        "isLocalMenu": true,
+        "menuName": "str_work_invite_register",
+        "menuIcon": "ic_work_invite_register",
+        "menuActivity": "com.modular.work.InviteRegisterActivity",
+        "menuUrl": "",
+        "caller": "",
+        "isHide": false
       }
     ]
   },
@@ -152,7 +161,7 @@
       },
       {
         "isLocalMenu": true,
-        "menuName": "title_device_manage",
+        "menuName": "str_work_device_manage",
         "menuIcon": "ic_device_manage",
         "menuActivity": "com.modular.work.DeviceManageActivity",
         "menuUrl": "",

+ 9 - 0
app_core/common/src/main/assets/work_menu_b2b.json

@@ -23,6 +23,15 @@
         "menuUrl": "",
         "caller": "",
         "isHide": false
+      },
+      {
+        "isLocalMenu": true,
+        "menuName": "str_work_invite_register",
+        "menuIcon": "ic_work_invite_register",
+        "menuActivity": "com.modular.work.InviteRegisterActivity",
+        "menuUrl": "",
+        "caller": "",
+        "isHide": false
       }
     ]
   },

+ 9 - 0
app_core/common/src/main/assets/work_menu_personal.json

@@ -23,6 +23,15 @@
         "menuUrl": "",
         "caller": "",
         "isHide": false
+      },
+      {
+        "isLocalMenu": true,
+        "menuName": "str_work_invite_register",
+        "menuIcon": "ic_work_invite_register",
+        "menuActivity": "com.modular.work.InviteRegisterActivity",
+        "menuUrl": "",
+        "caller": "",
+        "isHide": false
       }
     ]
   }

+ 1 - 1
app_core/common/src/main/java/com/common/config/BaseApplication.java

@@ -6,7 +6,7 @@ import android.app.Application;
 /**
  * Created by Bitliker on 2017/6/19.
  */
-public abstract class BaseApplication extends Application {
+public abstract class BaseApplication extends com.me.network.app.base.BaseApplication {
     private static Application api = null;
 
     @Override

+ 19 - 14
app_core/common/src/main/java/com/common/system/ActivityUtils.java

@@ -21,36 +21,41 @@ import java.util.List;
  */
 public class ActivityUtils {
 
-        /**
-         * 判断程序是否打开
-         * @return
-         */
-        public static boolean isRunningInForeground() {
-            boolean isActivityFound = false;
-            ActivityManager activityManager = (ActivityManager) MyApplication.getInstance().getSystemService(Context.ACTIVITY_SERVICE);
-            List<ActivityManager.RunningTaskInfo> services = activityManager
-                    .getRunningTasks(1);
-            if (services.get(0).topActivity.getPackageName().toString()
+    /**
+     * 判断程序是否打开
+     *
+     * @return
+     */
+    public static boolean isRunningInForeground() {
+        boolean isActivityFound = false;
+        ActivityManager activityManager = (ActivityManager) MyApplication.getInstance().getSystemService(Context.ACTIVITY_SERVICE);
+        List<ActivityManager.RunningTaskInfo> services = activityManager
+                .getRunningTasks(1);
+        if (services != null && !services.isEmpty()) {
+            ComponentName topActivity = services.get(0).topActivity;
+            if (topActivity != null && topActivity.getPackageName().toString()
                     .equalsIgnoreCase(MyApplication.getInstance().getPackageName().toString())) {
                 isActivityFound = true;
             }
-            return isActivityFound;
         }
+        return isActivityFound;
+    }
 
     private ActivityUtils() {
         throw new UnsupportedOperationException("u can't instantiate me...");
     }
 
     /**
-     * 判断某一个类是否存在任务栈里面 
+     * 判断某一个类是否存在任务栈里面
+     *
      * @return
      */
-    public  static boolean isExsitMianActivity(Context ct,Class<?> cls){
+    public static boolean isExsitMianActivity(Context ct, Class<?> cls) {
         Intent intent = new Intent(ct, cls);
         ComponentName cmpName = intent.resolveActivity(ct.getPackageManager());
         boolean flag = false;
         if (cmpName != null) { // 说明系统中存在这个activity    
-            ActivityManager am = (ActivityManager)ct. getSystemService(ct.ACTIVITY_SERVICE);
+            ActivityManager am = (ActivityManager) ct.getSystemService(ct.ACTIVITY_SERVICE);
             List<ActivityManager.RunningTaskInfo> taskInfoList = am.getRunningTasks(15);
             for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
                 if (taskInfo.baseActivity.equals(cmpName)) { // 说明它已经启动了    

+ 4 - 0
app_core/common/src/main/java/com/core/app/Constants.java

@@ -12,6 +12,9 @@ public class Constants {
     public static final String IM_BASE_URL = "http://113.105.74.140:8092/";
     //IM测试地址
     public static final String IM_BASE_URL_TEST = "http://113.105.74.135:8092/";
+    //询价服务正式地址
+    public static final String API_INQUIRY = "https://api-inquiry.usoftmall.com/";
+//    public static final String API_INQUIRY = "http://192.168.253.192:8080/";
 
     public static String IM_BASE_URL() {
         String url = "";
@@ -516,5 +519,6 @@ public class Constants {
 
     public interface CACHE {
         String B2B_BUSINESS_ENUU = "b2b_business_enuu";
+        String EN_BUSINESS_CODE = "en_business_code";
     }
 }

+ 99 - 11
app_core/common/src/main/java/com/core/app/MyApplication.java

@@ -6,14 +6,22 @@ import android.graphics.Bitmap;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Environment;
+import android.os.Handler;
+import android.os.StrictMode;
 import android.support.multidex.MultiDex;
 import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.volley.RequestQueue;
 import com.android.volley.toolbox.Volley;
+import com.baidu.mapapi.SDKInitializer;
 import com.common.config.BaseApplication;
 import com.common.config.BaseConfig;
+import com.common.preferences.PreferenceUtils;
+import com.common.preferences.SharedUtil;
+import com.core.db.DBOpenHelper;
+import com.core.db.DatabaseManager;
+import com.core.db.SQLiteHelper;
 import com.core.model.ConfigBean;
 import com.core.model.User;
 import com.core.net.NetWorkObservable;
@@ -21,7 +29,10 @@ import com.core.net.location.BdLocationHelper;
 import com.core.net.ssl.AuthImageDownloader;
 import com.core.net.utils.NetUtils;
 import com.core.net.volley.FastVolley;
-import com.core.service.InitializeService;
+import com.core.utils.CommonUtil;
+import com.facebook.stetho.Stetho;
+import com.iflytek.cloud.SpeechConstant;
+import com.iflytek.cloud.SpeechUtility;
 import com.lidroid.xutils.HttpUtils;
 import com.me.network.app.http.ssl.TrustAllCerts;
 import com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache;
@@ -33,12 +44,20 @@ import com.nostra13.universalimageloader.core.DisplayImageOptions;
 import com.nostra13.universalimageloader.core.ImageLoader;
 import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
 import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
+import com.tencent.mm.opensdk.openapi.IWXAPI;
+import com.tencent.mm.opensdk.openapi.WXAPIFactory;
 import com.tencent.smtt.sdk.QbSdk;
+import com.umeng.analytics.MobclickAgent;
+import com.umeng.socialize.Config;
+import com.umeng.socialize.PlatformConfig;
+import com.uuzuche.lib_zxing.activity.ZXingLibrary;
 
 import org.apache.http.cookie.Cookie;
 
 import java.io.File;
 
+import cat.ereza.customactivityoncrash.CustomActivityOnCrash;
+
 /**
  * Created by Arison on 2017/8/25.
  */
@@ -102,7 +121,19 @@ public class MyApplication extends BaseApplication {
     @Override
     public void initConfig() throws Exception {
         //后台服务初始化application
-        InitializeService.initApplication(this);
+//        InitializeService.initApplication(this);
+        Stetho.initializeWithDefaults(this);
+        SpeechUtility.createUtility(this, SpeechConstant.APPID + "=5876dc99");
+        //自定义闪退页面初始化
+        CustomActivityOnCrash.install(this);
+        //设置ErrorActivity在后台启动,默认为true
+        CustomActivityOnCrash.setLaunchErrorActivityWhenInBackground(true);
+        //设置展示详细错误信息,默认为true
+        CustomActivityOnCrash.setShowErrorDetails(true);
+        //启用APP Restart,默认为true
+        CustomActivityOnCrash.setEnableAppRestart(true);
+        //设置重新启动的activity
+        //  CustomActivityOnCrash.setRestartActivityClass(SplashActivity.class);
 
         INSTANCE = this;
         TrustAllCerts.allowAllSSL();//信任所有证书
@@ -110,14 +141,38 @@ public class MyApplication extends BaseApplication {
 
         mHttpUtils = new HttpUtils();
         configHttpUtils();
-        // 初始化定位
-        getBdLocationHelper();
-        // 初始化App目录
-        initAppDir();
-        // 初始化图片加载
-        initImageLoader();
-        //搜集本地tbs内核信息并上报服务器,服务器返回结果决定使用哪个内核。
 
+        Config.REDIRECT_URL = "http://sns.whalecloud.com/sina2/callback";
+        ZXingLibrary.initDisplayOpinion(this);
+        SharedUtil.init(this);
+
+        initShareAPI();
+
+        initWxPay(this);
+        //  CrashReport.initCrashReport(getApplicationContext(), "900050585", false);
+        PreferenceUtils.putBoolean(this, Constants.IS_NOTIFICATION, false);//不进行通知
+
+        new Handler().postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                //定位场景设置
+                MobclickAgent.setScenarioType(MyApplication.this, MobclickAgent.EScenarioType.E_UM_NORMAL);
+                initUmengStatistics();
+
+                SDKInitializer.initialize(getApplicationContext());
+                // 初始化数据库
+                SQLiteHelper.copyDatabaseFile(getApplicationContext());
+
+                // 初始化定位
+                getBdLocationHelper();
+                // 初始化App目录
+                initAppDir();
+                // 初始化图片加载
+                initImageLoader();
+            }
+        }, 1);
+
+        //搜集本地tbs内核信息并上报服务器,服务器返回结果决定使用哪个内核。
         QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
 
             @Override
@@ -133,8 +188,16 @@ public class MyApplication extends BaseApplication {
             }
         };
         //x5内核初始化接口
-        QbSdk.initX5Environment(getApplicationContext(),  cb);
-  
+        QbSdk.initX5Environment(getApplicationContext(), cb);
+
+        if (AppConfig.DEBUG) {
+            Log.d(AppConfig.TAG, "MyApplication onCreate");
+        }
+        if (AppConfig.DEBUG) {
+            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
+            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
+        }
+        initErpDB();
         // 初始化网络监听
         mNetWorkObservable = new NetWorkObservable(this);
 
@@ -188,6 +251,31 @@ public class MyApplication extends BaseApplication {
         android.os.Process.killProcess(android.os.Process.myPid());
     }
 
+    public void initShareAPI() {
+        PlatformConfig.setWeixin("wx2539cc96bf158e00", "b057aa3e807ba7c505a2f03cc541bbf6");
+        PlatformConfig.setSinaWeibo("493318722", "7def652c3683603b08bab87d34b1f944");
+        PlatformConfig.setQQZone("1104894295", "Nk8zMIz5YSqwRQ1F");
+        Config.IsToastTip = false;
+    }
+
+    public void initWxPay(Context context) {
+        IWXAPI wxApi = WXAPIFactory.createWXAPI(context, Constants.WXPAY_APPID, false);
+        wxApi.registerApp(Constants.WXPAY_APPID);
+    }
+
+    private void initErpDB() {
+        DatabaseManager.initializeInstance(DBOpenHelper.getInstance(this));
+    }
+
+    private void initUmengStatistics() {
+        MobclickAgent.UMAnalyticsConfig config = new MobclickAgent.UMAnalyticsConfig(this, "57ea27bb67e58e088c003bbf",
+                "baidu", MobclickAgent.EScenarioType.E_UM_NORMAL);
+        MobclickAgent.startWithConfigure(config);
+        if (!CommonUtil.isReleaseVersion()) {//当前为开发版本时候不需要上传友盟
+            MobclickAgent.setCatchUncaughtExceptions(false);
+        }
+    }
+
     private void configHttpUtils() {
         mHttpUtils.configRequestThreadPoolSize(4);
         mHttpUtils.configRequestRetryCount(3);

+ 19 - 1
app_core/common/src/main/java/com/core/model/LoginEntity.java

@@ -13,15 +13,17 @@ public class LoginEntity {
     private String website;
     private String name;
     private Integer masterId;
+    private String businessCode;
     //b2b
     private Integer spaceId;
     private String userName;
     private List<Spaces> spaces = new ArrayList<>();
-	
+
     public class Spaces {
         private Integer id;
         private String enuu;
         private String name;
+        private String businessCode;
 
         public String getEnuu() {
             return enuu;
@@ -46,6 +48,14 @@ public class LoginEntity {
         public void setId(Integer id) {
             this.id = id;
         }
+
+        public String getBusinessCode() {
+            return businessCode;
+        }
+
+        public void setBusinessCode(String businessCode) {
+            this.businessCode = businessCode;
+        }
     }
 
     public Integer getMasterId() {
@@ -112,6 +122,14 @@ public class LoginEntity {
         this.userName = userName;
     }
 
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode;
+    }
+
     public List<Spaces> getSpaces() {
         return spaces;
     }

+ 11 - 5
app_core/common/src/main/java/com/core/net/http/ViewUtil.java

@@ -58,6 +58,7 @@ public class ViewUtil {
     public static String erp_uu;//推送切公司
     public static String erp_masterId;//推送切公司
     public static String erp_company;
+    public static String mBusinessCode;//公司营业执照
     public static MaterialDialog mdProcessDialog;
     private static MaterialDialog loginERPDialog;
     private static List<LoginEntity> erpEntities;
@@ -359,6 +360,9 @@ public class ViewUtil {
                     break;
                 case Constants.SUCCESS_ERP:
                     String result = msg.getData().getString("result");
+                    //B2B商务以及邀请注册等功能需要用到B2B的个人uu号
+                    CommonUtil.setSharedPreferences(ct, "b2b_uu", b2b_uu);
+                    CommonUtil.setSharedPreferences(ct, Constants.CACHE.EN_BUSINESS_CODE, mBusinessCode);
                     try {
                         if (JSONUtil.validate(result) && result != null) {
                             //登录ERP成功,清除B2B缓存
@@ -610,7 +614,7 @@ public class ViewUtil {
                     loginEntities.add(model);
                 } else if (model.getPlatform().equals("B2B")) {
                     List<LoginEntity.Spaces> sModel = model.getSpaces();
-                    b2b_uu= model.getAccount();
+                    b2b_uu = model.getAccount();
                     if (!ListUtils.isEmpty(sModel)) {
                         for (int j = 0; j < sModel.size(); j++) {
                             //去重逻辑
@@ -628,6 +632,7 @@ public class ViewUtil {
                                 bModel.setSpaceId(sModel.get(j).getId());
                                 bModel.setPlatform("B2B");
                                 bModel.setUserName(model.getUserName());
+                                bModel.setBusinessCode(sModel.get(j).getBusinessCode());
                                 loginEntities.add(bModel);
                             }
                         }
@@ -650,7 +655,7 @@ public class ViewUtil {
             if (ListUtils.isEmpty(loginEntities)) return;
             erpEntities = loginEntities;
             String[] items = new String[loginEntities.size()];
-            int select =0;
+            int select = 0;
             for (int j = 0; j < loginEntities.size(); j++) {
                 items[j] = loginEntities.get(j).getName();
             }
@@ -658,10 +663,10 @@ public class ViewUtil {
                 if (loginERPDialog != null) {
                     select = loginERPDialog.getSelectedIndex();
                 }
-                if (select>items.length){
-                    select=0;
+                if (select > items.length) {
+                    select = 0;
                 }
-                LogUtil.d("AppLogs","select:"+select+"");
+                LogUtil.d("AppLogs", "select:" + select + "");
                 loginERPDialog = new MaterialDialog.Builder(ct)
                         .title(ct.getString(R.string.user_dialog_company))
                         .items(items)
@@ -674,6 +679,7 @@ public class ViewUtil {
                                             LoginEntity entity = erpEntities.get(which);
                                             erp_phone = phone;
                                             erp_password = password;
+                                            mBusinessCode = entity.getBusinessCode();
                                             if ("ERP".equals(entity.getPlatform())) {
                                                 erp_username = entity.getAccount();
                                                 erp_master = entity.getMaster();

+ 10 - 9
app_core/common/src/main/java/com/core/service/InitializeService.java

@@ -62,10 +62,10 @@ public class InitializeService extends IntentService {
     }
 
     private void initApplication() {
-        Stetho.initializeWithDefaults(this);
-        SpeechUtility.createUtility(this, SpeechConstant.APPID + "=5876dc99");
+        Stetho.initializeWithDefaults(mContext);
+        SpeechUtility.createUtility(mContext, SpeechConstant.APPID + "=5876dc99");
         //自定义闪退页面初始化
-        CustomActivityOnCrash.install(this);
+        CustomActivityOnCrash.install(mContext);
         //设置ErrorActivity在后台启动,默认为true
         CustomActivityOnCrash.setLaunchErrorActivityWhenInBackground(true);
         //设置展示详细错误信息,默认为true
@@ -75,14 +75,14 @@ public class InitializeService extends IntentService {
         //设置重新启动的activity
         //  CustomActivityOnCrash.setRestartActivityClass(SplashActivity.class);
         Config.REDIRECT_URL = "http://sns.whalecloud.com/sina2/callback";
-        ZXingLibrary.initDisplayOpinion(this);
-        SharedUtil.init(this);
+        ZXingLibrary.initDisplayOpinion(mContext);
+        SharedUtil.init(mContext);
 
         initShareAPI();
 
-        initWxPay(this);
+        initWxPay(mContext);
         //  CrashReport.initCrashReport(getApplicationContext(), "900050585", false);
-        PreferenceUtils.putBoolean(this, Constants.IS_NOTIFICATION, false);//不进行通知
+        PreferenceUtils.putBoolean(mContext, Constants.IS_NOTIFICATION, false);//不进行通知
 
         if (AppConfig.DEBUG) {
             Log.d(AppConfig.TAG, "MyApplication onCreate");
@@ -96,9 +96,10 @@ public class InitializeService extends IntentService {
         //定位场景设置
         MobclickAgent.setScenarioType(mContext, MobclickAgent.EScenarioType.E_UM_NORMAL);
         initUmengStatistics();
-        SDKInitializer.initialize(getApplicationContext());
+
+        SDKInitializer.initialize(this);
         // 初始化数据库
-        SQLiteHelper.copyDatabaseFile(getApplicationContext());
+        SQLiteHelper.copyDatabaseFile(mContext);
         /*try {
             com.core.app.Constants.cleanRed(this);
         } catch (PackageManager.NameNotFoundException e) {

+ 149 - 1
app_core/common/src/main/java/com/core/utils/CommonUtil.java

@@ -25,11 +25,15 @@ import android.text.Spannable;
 import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
 import android.text.style.ForegroundColorSpan;
+import android.text.style.UnderlineSpan;
 import android.util.Base64;
 import android.util.Log;
+import android.view.Gravity;
 import android.view.View;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -69,6 +73,7 @@ import java.io.InputStreamReader;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
 import java.net.URI;
 import java.net.URLEncoder;
 import java.text.DecimalFormat;
@@ -120,7 +125,19 @@ public class CommonUtil {
         }
 //        return "https://admin-city.ubtob.com/";
         return "https://city-service.ubtob.com/city/thxz/";
-//        return "http://192.168.253.31:8687/city/thxz/";
+    }
+
+    /**
+     * 询价服务的根路径
+     *
+     * @param ct
+     * @return
+     */
+    public static String getInquiryBaseUrl(Context ct) {
+        if (ct == null) {
+            return "";
+        }
+        return "https://api-inquiry.usoftmall.com/";
     }
 
     /**
@@ -1204,6 +1221,75 @@ public class CommonUtil {
     }
 
 
+    /**
+     * double 相减
+     *
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static double doublesubtract(double d1, double d2) {
+        BigDecimal bd1 = new BigDecimal(Double.toString(d1));
+        BigDecimal bd2 = new BigDecimal(Double.toString(d2));
+        return bd1.subtract(bd2).doubleValue();
+    }
+
+    /**
+     * double 相加
+     *
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static double doubleAddition(double d1, double d2) {
+        BigDecimal bigDecimal1 = new BigDecimal(Double.toString(d1));
+        BigDecimal bigDecimal2 = new BigDecimal(Double.toString(d2));
+        return bigDecimal1.add(bigDecimal2).doubleValue();
+    }
+
+    /**
+     * double 乘法
+     *
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static double doubleMul(double d1, double d2) {
+        BigDecimal bd1 = new BigDecimal(Double.toString(d1));
+        BigDecimal bd2 = new BigDecimal(Double.toString(d2));
+        return bd1.multiply(bd2).doubleValue();
+    }
+
+    /**
+     * double 除法
+     *
+     * @param d1
+     * @param d2
+     * @param scale 四舍五入 小数点位数
+     * @return
+     */
+    public static double doubleDiv(double d1, double d2, int scale) {
+        //  当然在此之前,你要判断分母是否为0,
+        //  为0你可以根据实际需求做相应的处理
+
+        BigDecimal bd1 = new BigDecimal(Double.toString(d1));
+        BigDecimal bd2 = new BigDecimal(Double.toString(d2));
+        return bd1.divide(bd2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
+
+    /**
+     * double 相比较大小
+     *
+     * @param d1
+     * @param d2
+     * @return 小于:-1;等于:0;大于:1
+     */
+    public static int doubleCompare(double d1, double d2) {
+        BigDecimal data1 = new BigDecimal(Double.toString(d1));
+        BigDecimal data2 = new BigDecimal(Double.toString(d2));
+        return data1.compareTo(data2);
+    }
+
     /**
      * double值小数点后为0则不显示,保留四位小数
      *
@@ -1214,4 +1300,66 @@ public class CommonUtil {
         DecimalFormat decimalFormat = new DecimalFormat("###.####");
         return decimalFormat.format(v);
     }
+
+
+    /**
+     * 添加图片的toast
+     *
+     * @param context
+     * @param imageId  图片id
+     * @param content  文字内容
+     * @param duration 显示时长
+     */
+    public static void imageToast(Context context, int imageId, String content, int duration) {
+        Toast toast = new Toast(context);
+        //显示的时间
+        toast.setDuration(duration);
+        //显示的位置
+        toast.setGravity(Gravity.BOTTOM, 0, 300);
+
+        //自定义toast布局
+        LinearLayout toastLayout = new LinearLayout(context);
+        toastLayout.setGravity(Gravity.CENTER_VERTICAL);
+        toastLayout.setOrientation(LinearLayout.HORIZONTAL);
+
+        //添加ImageView
+        ImageView toastImage = new ImageView(context);
+        toastImage.setImageResource(imageId);
+        toastLayout.addView(toastImage);
+
+        //添加TextView
+        TextView toastText = new TextView(context);
+        toastText.setBackgroundColor(context.getResources().getColor(R.color.toast_bg));
+        toastText.setText(content);
+        toastLayout.addView(toastText);
+
+        toastLayout.setBackgroundColor(context.getResources().getColor(R.color.toast_bg));
+        toast.setView(toastLayout);
+        toast.show();
+    }
+
+    /**
+     * @desc:修改textView样式(添加下划线)
+     * @author:Arison on 2016/8/3
+     */
+    public static void textUnderlineForStyle(
+            TextView view,
+            String input,
+            String match) {
+        SpannableStringBuilder style = new SpannableStringBuilder(input);
+        Pattern highlight = Pattern.compile(match);
+        Matcher m = highlight.matcher(style.toString());
+        while (m.find()) {
+//            style.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), m.start(), m.end(),
+//                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+//            style.setSpan(new ForegroundColorSpan(color), m.start(), m.end(),
+//                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+//            style.setSpan(new StrikethroughSpan(), m.start(), m.end(),
+//                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+            style.setSpan(new UnderlineSpan(), m.start(), m.end(),
+                    Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+        }
+        view.setText(style);
+    }
+
 }

Разница между файлами не показана из-за своего большого размера
+ 1865 - 942
app_core/common/src/main/res/values-en/strings.xml


+ 4 - 2
app_core/common/src/main/res/values-zh-rCN/strings.xml

@@ -1553,6 +1553,7 @@
     <string name="str_uu_application">UU应用</string>
     <string name="str_work_subscribe_secretary">预约小秘书</string>
     <string name="str_work_uu_sports">UU运动</string>
+    <string name="str_work_invite_register">邀请注册</string>
 
     <string name="str_administrative_office">行政办公</string>
     <string name="str_work_work_approval">我的审批</string>
@@ -1568,6 +1569,7 @@
     <string name="str_work_expense_account">费用报销</string>
     <string name="str_work_meeting_manage">会议管理</string>
     <string name="str_work_special_attendance">特殊考勤</string>
+    <string name="str_work_device_manage">设备管理</string>
 
     <string name="str_customer_relationship">客户关系管理</string>
     <string name="str_work_business_manage">商机管理</string>
@@ -1587,9 +1589,9 @@
     <string name="str_work_b2b_commerce">B2B商务</string>
     <string name="str_work_usoft_mall">优软商城</string>
     <string name="str_work_charitable_donations">一元捐</string>
+    <!--工作台菜单-->
+
     <string name="str_search_history">搜索历史</string>
     <string name="str_clear">清空</string>
     <string name="str_company_salary">工资条</string>
-    <!--工作台菜单-->
-
 </resources>

+ 44 - 42
app_core/common/src/main/res/values-zh-rTW/strings.xml

@@ -1525,58 +1525,60 @@
     <string name="input_phone_number">請輸入手機號</string>
     <string name="input_name">請輸入姓名</string>
 
-    <string name="give_up">放</string>
-    <string name="app_time_selecting">选择时间</string>
-    <string name="qzone_edit_weekly">编写周报</string>
-    <string name="qzone_edit_monthly">编写月报</string>
-    <string name="business_statistics">商家统计</string>
-    <string name="usoft_science">优软科技</string>
-    <string name="work_plat_setting">工作面板置</string>
+    <string name="give_up">放</string>
+    <string name="app_time_selecting">選擇時間</string>
+    <string name="qzone_edit_weekly">編寫週報</string>
+    <string name="qzone_edit_monthly">編寫月報</string>
+    <string name="business_statistics">商家統計</string>
+    <string name="usoft_science">優軟科技</string>
+    <string name="work_plat_setting">工作面板置</string>
     <string name="complete">完成</string>
 
     <!--工作台菜单-->
-    <string name="str_work_add_func">添加用</string>
+    <string name="str_work_add_func">添加用</string>
 
-    <string name="str_uu_application">UU应用</string>
-    <string name="str_work_subscribe_secretary">预约小秘书</string>
-    <string name="str_work_uu_sports">UU运动</string>
+    <string name="str_uu_application">UU應用</string>
+    <string name="str_work_subscribe_secretary">預約小秘書</string>
+    <string name="str_work_uu_sports">UU運動</string>
+    <string name="str_work_invite_register">邀請註冊</string>
 
-    <string name="str_administrative_office">行政公</string>
-    <string name="str_work_work_approval">我的批</string>
-    <string name="str_work_backlog">待工作</string>
-    <string name="str_work_work_calendar">工作日</string>
-    <string name="str_work_work_report">工作汇报</string>
-    <string name="str_work_punch_clock">打卡到</string>
-    <string name="str_work_outwork_sign">外勤到</string>
-    <string name="str_work_attendance_statistics">考勤统计</string>
-    <string name="str_work_overtime_request">加班申</string>
-    <string name="str_work_leave_request">请假申请</string>
-    <string name="str_work_travel_request">出差申</string>
-    <string name="str_work_expense_account">费用报销</string>
-    <string name="str_work_meeting_manage">会议管理</string>
+    <string name="str_administrative_office">行政公</string>
+    <string name="str_work_work_approval">我的批</string>
+    <string name="str_work_backlog">待工作</string>
+    <string name="str_work_work_calendar">工作日</string>
+    <string name="str_work_work_report">工作匯報</string>
+    <string name="str_work_punch_clock">打卡到</string>
+    <string name="str_work_outwork_sign">外勤到</string>
+    <string name="str_work_attendance_statistics">考勤統計</string>
+    <string name="str_work_overtime_request">加班申</string>
+    <string name="str_work_leave_request">請假申請</string>
+    <string name="str_work_travel_request">出差申</string>
+    <string name="str_work_expense_account">費用報銷</string>
+    <string name="str_work_meeting_manage">會議管理</string>
     <string name="str_work_special_attendance">特殊考勤</string>
+    <string name="str_work_device_manage">設備管理</string>
 
-    <string name="str_customer_relationship">客户关系管理</string>
-    <string name="str_work_business_manage">商管理</string>
-    <string name="str_work_customer_manage">客管理</string>
-    <string name="str_work_customer_visit">客户拜访</string>
-    <string name="str_work_sales_data">售看板</string>
-    <string name="str_work_honor_rank">荣誉墙</string>
+    <string name="str_customer_relationship">客戶關係管理</string>
+    <string name="str_work_business_manage">商管理</string>
+    <string name="str_work_customer_manage">客管理</string>
+    <string name="str_work_customer_visit">客戶拜訪</string>
+    <string name="str_work_sales_data">售看板</string>
+    <string name="str_work_honor_rank">榮譽墻</string>
 
-    <string name="str_enterprise_application">企业应用</string>
-    <string name="str_work_data_inquiry">数据查询</string>
-    <string name="str_work_report_statistics">报表统计</string>
-    <string name="str_work_real_time_subs">实时看板</string>
-    <string name="str_work_subs_manage">订阅号管理</string>
-    <string name="str_work_salary_bill">企业工资条</string>
+    <string name="str_enterprise_application">企業應用</string>
+    <string name="str_work_data_inquiry">數據查詢</string>
+    <string name="str_work_report_statistics">報表統計</string>
+    <string name="str_work_real_time_subs">實時看板</string>
+    <string name="str_work_subs_manage">訂閱號管理</string>
+    <string name="str_work_salary_bill">企業工資條</string>
 
-    <string name="str_usoft_cloud_platform">优软云平台</string>
-    <string name="str_work_b2b_commerce">B2B商</string>
-    <string name="str_work_usoft_mall">优软商城</string>
+    <string name="str_usoft_cloud_platform">優軟雲平台</string>
+    <string name="str_work_b2b_commerce">B2B商</string>
+    <string name="str_work_usoft_mall">優軟商城</string>
     <string name="str_work_charitable_donations">一元捐</string>
-    <string name="str_search_history">搜索历史</string>
-    <string name="str_clear">清空</string>
-    <string name="str_company_salary">工資條</string>
     <!--工作台菜单-->
 
+    <string name="str_search_history">搜索歷史</string>
+    <string name="str_clear">清空</string>
+    <string name="str_company_salary">工資條</string>
 </resources>

+ 4 - 2
app_core/common/src/main/res/values/strings.xml

@@ -1891,6 +1891,7 @@
     <string name="str_uu_application">UU应用</string>
     <string name="str_work_subscribe_secretary">预约小秘书</string>
     <string name="str_work_uu_sports">UU运动</string>
+    <string name="str_work_invite_register">邀请注册</string>
 
     <string name="str_administrative_office">行政办公</string>
     <string name="str_work_work_approval">我的审批</string>
@@ -1906,6 +1907,7 @@
     <string name="str_work_expense_account">费用报销</string>
     <string name="str_work_meeting_manage">会议管理</string>
     <string name="str_work_special_attendance">特殊考勤</string>
+    <string name="str_work_device_manage">设备管理</string>
 
     <string name="str_customer_relationship">客户关系管理</string>
     <string name="str_work_business_manage">商机管理</string>
@@ -1925,9 +1927,9 @@
     <string name="str_work_b2b_commerce">B2B商务</string>
     <string name="str_work_usoft_mall">优软商城</string>
     <string name="str_work_charitable_donations">一元捐</string>
+    <!--工作台菜单-->
+
     <string name="str_search_history">搜索历史</string>
     <string name="str_clear">清空</string>
     <string name="str_company_salary">工资条</string>
-    <!--工作台菜单-->
-
 </resources>

+ 10 - 7
app_core/network/src/main/java/com/me/network/app/base/BaseApplication.java

@@ -6,12 +6,13 @@ import android.app.Application;
  * Created by Arison on 2017/5/15.
  */
 public abstract class BaseApplication extends Application {
-    private static Application mApplication=null;
+    private static Application mApplication = null;
+
     @Override
     public void onCreate() {
         super.onCreate();
-      
-        mApplication=this;
+
+        mApplication = this;
         init();
         //初始化网络库
         initHttpClient();
@@ -23,7 +24,7 @@ public abstract class BaseApplication extends Application {
         initNotifyHelper();
         //初始化日志打印
         initLogHelper();
-      
+
     }
 
     public void initLogHelper() {
@@ -33,7 +34,9 @@ public abstract class BaseApplication extends Application {
     }
 
 
-    public abstract void init();
+    public void init() {
+
+    }
 
     public void initHttpClient() {
 
@@ -51,7 +54,7 @@ public abstract class BaseApplication extends Application {
 
     }
 
-    public static Application getInstance(){
-        return  mApplication;
+    public static Application getInstance() {
+        return mApplication;
     }
 }

+ 35 - 0
app_core/network/src/main/java/com/me/network/app/http/HttpRequest.java

@@ -1,15 +1,22 @@
 package com.me.network.app.http;
 
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
 import android.text.TextUtils;
 import android.util.Log;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.me.network.app.base.BaseApplication;
 import com.me.network.app.base.HttpCallback;
 import com.me.network.app.base.HttpParams;
 import com.me.network.app.http.rx.Result2Listener;
 import com.me.network.app.http.rx.ResultSubscriber;
 
+import base.android.com.network.R;
+
 /**
  * @author RaoMeng
  * @describe 发起网络请求
@@ -59,6 +66,15 @@ public class HttpRequest {
             throw new IllegalArgumentException("requestUrl can not be NULL");
         }
 
+        if (!isNetWorkConnected(BaseApplication.getInstance())) {
+            try {
+                callback.onFail(httpParams.getFlag(), BaseApplication.getInstance().getString(R.string.networks_out));
+                return;
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
         mHttpClient = new HttpClient.Builder(requestHost).build();
 
         mHttpClient.Api().send(new HttpClient.Builder()
@@ -103,4 +119,23 @@ public class HttpRequest {
         }));
     }
 
+    /**
+     * 检测网络是否可用
+     *
+     * @param context
+     * @return
+     */
+    private boolean isNetWorkConnected(Context context) {
+        if (context != null) {
+            ConnectivityManager mConnectivityManager = (ConnectivityManager) context
+                    .getSystemService(Context.CONNECTIVITY_SERVICE);
+            @SuppressLint("MissingPermission")
+            NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
+            if (mNetworkInfo != null) {
+                return mNetworkInfo.isAvailable();
+            }
+        }
+        return false;
+    }
+
 }

+ 1 - 0
app_core/network/src/main/res/values/strings.xml

@@ -1,3 +1,4 @@
 <resources>
     <string name="app_name">network</string>
+    <string name="networks_out">当前网络不可用,请稍后重试!</string>
 </resources>

+ 1 - 1
app_modular/applogin/src/main/java/com/modular/login/activity/AdminRegisterActivity.java

@@ -372,7 +372,7 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
     }
 
     private void uploadMsg(String enUU, String imid) {
-        String url = "http://113.105.74.140:8092/user/appSaveCompany";
+        String url = Constants.IM_BASE_URL() + "user/appSaveCompany";
 //        String url = "http://192.168.253.136:8092/user/appSaveCompany";
 
         Map<String, String> map = new HashMap<>();

+ 7 - 2
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/SubscribeDetailActivity.java

@@ -10,6 +10,7 @@ import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.text.TextUtils;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.Menu;
@@ -81,7 +82,7 @@ public class SubscribeDetailActivity extends BaseActivity {
                 case APPLY_DETAIL_SUBSCRIPTION:
                     progressDialog.dismiss();
                     Log.d("applysubscription", msg.getData().getString("result"));
-//                    CommonUtil.imageToast(mContext, R.drawable.ic_apply_submit_success, "", 2000);
+                    CommonUtil.imageToast(mContext, R.drawable.ic_apply_submit_success, "", 2000);
                     mSubStatus = 2;
                     mApplyButton.setText(getString(R.string.subscribe_requested));
                     mApplyButton.setEnabled(false);
@@ -111,7 +112,6 @@ public class SubscribeDetailActivity extends BaseActivity {
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_subscribe_detail);
-        getSupportActionBar().setTitle(getString(R.string.subscribe_detail_title));
         intent = getIntent();
         if (intent != null) {
             mSubId = intent.getIntExtra("subId", 0);
@@ -127,6 +127,11 @@ public class SubscribeDetailActivity extends BaseActivity {
 //        if (((System.currentTimeMillis() - oldtime) / (1000 * 60)) > 20) {
 //            login(this);
 //        }
+        if (TextUtils.isEmpty(mSubName)) {
+            getSupportActionBar().setTitle(getString(R.string.subscribe_detail_title));
+        } else {
+            getSupportActionBar().setTitle(mSubName);
+        }
         initViews();
         initEvents();
         initDatas();

+ 2 - 2
app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/AllSubscriptionAdapter.java

@@ -104,7 +104,7 @@ public class AllSubscriptionAdapter extends BaseAdapter {
             viewHolder.applyTextView.setTextColor(Color.GRAY);
             viewHolder.applyTextView.setEnabled(false);
         } else if (mSubscriptionNumbers.get(position).getStatus() == 3) {
-//            CommonUtil.textUnderlineForStyle(viewHolder.applyTextView,"申请","申请");
+            CommonUtil.textUnderlineForStyle(viewHolder.applyTextView,"申请","申请");
             viewHolder.applyTextView.setText(R.string.subscribe_detail_commit);
             viewHolder.applyTextView.setTextColor(Color.BLUE);
             viewHolder.applyTextView.setEnabled(true);
@@ -149,7 +149,7 @@ public class AllSubscriptionAdapter extends BaseAdapter {
                 case APPLY_SUBSCRIPTION:
                     progressDialog.dismiss();
                     Log.d("applysubscription", msg.getData().getString("result"));
-//                    CommonUtil.imageToast(mContext, R.drawable.ic_apply_submit_success, "", 2000);
+                    CommonUtil.imageToast(mContext, R.drawable.ic_apply_submit_success, "", 2000);
                     mSubscriptionNumbers.get(clickPosition).setStatus(2);
                     mDbManager.updateAllSubs(mSubscriptionNumbers.get(clickPosition));
                     notifyDataSetChanged();

+ 2 - 2
app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/AllSubscriptionNumbersAdapter.java

@@ -82,7 +82,7 @@ public class AllSubscriptionNumbersAdapter extends BaseAdapter {
         }else if (status == 3){
             viewHolder.nameTextView.setTextColor(mContext.getResources().getColor(R.color.white));
             viewHolder.nameTextView.setBackground(mContext.getResources().getDrawable(R.drawable.shape_subscribe_bg));
-//            CommonUtil.textUnderlineForStyle(viewHolder.applyTextView,"申请","申请");
+            CommonUtil.textUnderlineForStyle(viewHolder.applyTextView,"申请","申请");
             viewHolder.applyTextView.setText("申请");
             viewHolder.applyTextView.setEnabled(true);
         }else if (status == 2){
@@ -136,7 +136,7 @@ public class AllSubscriptionNumbersAdapter extends BaseAdapter {
                 case APPLY_SUBSCRIPTION:
                     progressDialog.dismiss();
                     Log.d("applysubscription", msg.getData().getString("result"));
-//                    CommonUtil.imageToast(mContext,R.drawable.ic_apply_submit_success,"",2000);
+                    CommonUtil.imageToast(mContext,R.drawable.ic_apply_submit_success,"",2000);
                     mSubscriptionNumbers.get(clickPosition).setStatus(2);
                     notifyDataSetChanged();
                     break;

+ 1 - 1
app_modular/appmessages/src/main/java/com/modular/appmessages/fragment/SubscriptionAllFragment.java

@@ -285,6 +285,7 @@ public class SubscriptionAllFragment extends BaseFragment {
     protected void initDatas() {
         if (CommonUtil.isNetWorkConnected(getActivity().getApplicationContext())) {
             //每次初始化页面都需要访问网络数据用来更新本地缓存
+            progressDialog.show();
             sendAllSubscriptionRequest();
         } else {
             //没有网络时,取本地数据库数据
@@ -388,7 +389,6 @@ public class SubscriptionAllFragment extends BaseFragment {
     public void sendAllSubscriptionRequest() {
         //取出本地缓存数据
         mDbSubscriptionNumbers = mDbManager.queryFromAllSubs(new String[]{currentMaster, currentUser}, "subs_master=? and subs_username=? ");
-        progressDialog.show();
         String allSubsUrl = CommonUtil.getAppBaseUrl(getActivity()) + "common/charts/getApplySubs.action";
         Map<String, Object> params = new HashMap<>();
         params.put("em_code", CommonUtil.getSharedPreferences(getActivity(), "erp_username"));

+ 1 - 1
app_modular/appmessages/src/main/java/com/modular/appmessages/fragment/SubscriptionMyFragment.java

@@ -114,6 +114,7 @@ public class SubscriptionMyFragment extends BaseFragment {
     @Override
     protected void initDatas() {
         if (CommonUtil.isNetWorkConnected(getActivity().getApplicationContext())) {
+            progressDialog.show();
             sendSubscriptionRequest();
         } else {
             List<PersonalSubscriptionBean> dbPersonalSubscriptionBeans = mDbManager.queryFromMySubs(new String[]{currentMaster, currentUser}, "subs_master=? and subs_username=? ");
@@ -135,7 +136,6 @@ public class SubscriptionMyFragment extends BaseFragment {
      * 获取当前用户的订阅号
      */
     private void sendSubscriptionRequest() {
-        progressDialog.show();
         String subsUrl = CommonUtil.getAppBaseUrl(getActivity()) + "common/charts/getPersonalSubs.action";
         Map<String, Object> params = new HashMap<>();
         params.put("em_code", CommonUtil.getSharedPreferences(getActivity(), "erp_username"));

+ 36 - 31
app_modular/apputils/src/main/java/com/modular/apputils/IntentUrlActivity.java

@@ -5,70 +5,75 @@ import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
+import android.text.TextUtils;
 
 import com.common.LogUtil;
 import com.common.system.ActivityUtils;
 import com.core.app.Constants;
 
 /**
-  * @desc:负责分发外部URL链接的中转界面
-  * @author:Arison on 2018/1/9
-  */
+ * @desc:负责分发外部URL链接的中转界面
+ * @author:Arison on 2018/1/9
+ */
 public class IntentUrlActivity extends Activity {
     private static final String TAG = "IntentUrlActivity";
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_intent_url);
         final Intent i_getvalue = getIntent();
         final String action = i_getvalue.getAction();
-        final boolean isOpenApp=   ActivityUtils.isRunningInForeground();
-        LogUtil.d(TAG,"isOpenApp:"+isOpenApp);
-        if (isOpenApp){
+        final boolean isOpenApp = ActivityUtils.isRunningInForeground();
+        LogUtil.d(TAG, "isOpenApp:" + isOpenApp);
+        if (isOpenApp) {
             openIntentUrl(action, i_getvalue);
-        }else{
-            startActivity(new Intent("com.modular.main.MainActivity"));
+        } else {
+            startActivity(new Intent("com.modular.main.SplashActivity"));
             new Handler().postDelayed(new Runnable() {
                 @Override
                 public void run() {
                     openIntentUrl(action, i_getvalue);
                 }
-            },200);
+            }, 200);
         }
     }
 
     private void openIntentUrl(String action, Intent i_getvalue) {
         try {
-            if(Intent.ACTION_VIEW.equals(action)){
+            if (Intent.ACTION_VIEW.equals(action)) {
                 Uri uri = i_getvalue.getData();
-                if(uri != null){
+                if (uri != null) {
                     String pagekind = uri.getQueryParameter("pagekind");
-                    String id= uri.getQueryParameter("id");
-                    String enuu= uri.getQueryParameter("uu"); 
-                    LogUtil.d(TAG,"pagekind:"+pagekind+" id:"+id+" enuu:"+enuu);
-                    if ("A".equals(pagekind)){
-                        Intent intent=new Intent("com.modular.work.platform.activity.CustomerInquiryDetailActivity");
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID ,id);
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE,"todo");
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ENUU,enuu);
+                    String id = uri.getQueryParameter("id");
+                    String enuu = uri.getQueryParameter("uu");
+                    LogUtil.d(TAG, "pagekind:" + pagekind + " id:" + id + " enuu:" + enuu);
+                    if ("A".equals(pagekind)) {
+                        Intent intent = new Intent("com.modular.work.platform.activity.CustomerInquiryDetailActivity");
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID, id);
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, "todo");
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ENUU, enuu);
                         startActivity(intent);
                     }
-                    if ("B".equals(pagekind)){//公共询价单
-                        Intent intent=new Intent("com.modular.work.platform.activity.CustomerInquiryDetailActivity");
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID ,id);
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE,"public_todo");
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ENUU,enuu);
+                    if ("B".equals(pagekind)) {//公共询价单
+                        Intent intent = new Intent("com.modular.work.platform.activity.CustomerInquiryDetailActivity");
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID, id);
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, "public_todo");
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ENUU, enuu);
                         startActivity(intent);
-    
+
                     }
-                    if ("C".equals(pagekind)){
-                        Intent intent=new Intent("com.modular.work.platform.activity.PurchaseDetailsActivity");
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID ,id);
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE,"todo");
-                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ENUU,enuu);
+                    if ("C".equals(pagekind)) {
+                        Intent intent = new Intent("com.modular.work.platform.activity.PurchaseDetailsActivity");
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID, id);
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, "todo");
+                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ENUU, enuu);
                         startActivity(intent);
                     }
-                    overridePendingTransition(0,0);
+                    if (TextUtils.isEmpty(pagekind) || "null".equals(pagekind)) {
+                        startActivity(new Intent("com.modular.main.SplashActivity"));
+                    }
+                    overridePendingTransition(0, 0);
                     finish();
                 }
             }

+ 12 - 10
app_modular/apputils/src/main/java/com/modular/apputils/activity/SimpleWebActivity.java

@@ -41,10 +41,10 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_simple_web);
-      
+
         webView = findViewById(R.id.mSimpleWebView);
         mTbsReaderView = new TbsReaderView(this, this);
-        RelativeLayout rootRl =  findViewById(R.id.rl_root);
+        RelativeLayout rootRl = findViewById(R.id.rl_root);
         rootRl.addView(mTbsReaderView, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
         webView.getSettings().setJavaScriptEnabled(true);
         webView.getSettings().setAllowFileAccess(true);
@@ -71,8 +71,9 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
 
         setThirdPartyCookiesEnabled(true);
         webView.setWebViewClient(new WebViewClient() {
+            @Override
             public boolean shouldOverrideUrlLoading(WebView view, String url) {
-                LogUtil.d(TAG,"url="+url);
+                LogUtil.d(TAG, "url=" + url);
                 if (url.startsWith(WebView.SCHEME_TEL) || url.startsWith("sms:") || url.startsWith(WebView.SCHEME_MAILTO)) {
                     try {
                         Intent intent = new Intent(Intent.ACTION_VIEW);
@@ -81,15 +82,16 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
                     } catch (ActivityNotFoundException ignored) {
                     }
                     return true;
-                }else if(url.contains("jsps/oa/persontask/workDaily/addWorkDaily.jsp")){
-                    LogUtil.d(TAG,"event url="+url);
-                    ToastUtil.showToast(mContext,"调转日报界面");
+                } else if (url.contains("jsps/oa/persontask/workDaily/addWorkDaily.jsp")) {
+                    LogUtil.d(TAG, "event url=" + url);
+                    ToastUtil.showToast(mContext, "调转日报界面");
                     return true;
                 }
                 webView.loadUrl(url);
                 return true;
             }
 
+            @Override
             public void onPageFinished(WebView view, String url) {
                 super.onPageFinished(view, url);
             }
@@ -105,7 +107,7 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
     private File getLocalFile() {
         return new File(filepath);
     }
-    
+
     private void openFileByTBS() {
         String fileName = parseFormat(filepath);
         Bundle bundle = new Bundle();
@@ -115,7 +117,7 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
         if (result) {
             mTbsReaderView.openFile(bundle);
         }
-        
+
     }
 
     private String parseFormat(String fileName) {
@@ -188,7 +190,7 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
         mTbsReaderView.onStop();
     }
 
-        @Override
+    @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) {
             webView.goBack();// 返回前一个页面
@@ -200,6 +202,6 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
 
     @Override
     public void onCallBackAction(Integer integer, Object o, Object o1) {
-        
+
     }
 }

+ 1 - 1
app_modular/appworks/build.gradle

@@ -23,5 +23,5 @@ dependencies {
     compile project(':apputils')
     compile project(path: ':imageload')
     compile 'com.android.support.constraint:constraint-layout:1.0.2'
-    compile project(':android-pdf-viewer')
+//    compile project(':android-pdf-viewer')
 }

+ 16 - 5
app_modular/appworks/src/main/AndroidManifest.xml

@@ -260,7 +260,9 @@
             android:name=".datainquiry.activity.ReportQueryCriteriaActivity"
             android:windowSoftInputMode="adjustPan" />
         <activity android:name=".datainquiry.activity.ReportStatisticsMoreMenuActivity" />
-        <activity android:name=".datainquiry.activity.PDFDownloadActivity" />
+        <activity
+            android:name=".datainquiry.activity.PDFDownloadActivity"
+            android:configChanges="screenSize|keyboardHidden|orientation" />
         <activity android:name=".datainquiry.activity.DataInquirySearchActivity" />
         <activity android:name=".datainquiry.activity.ReportQuerySearchActivity" />
 
@@ -401,22 +403,31 @@
             android:theme="@style/StyledBlueIndicators"
             android:windowSoftInputMode="adjustPan|stateHidden" />
         <activity android:name=".activity.PublicInquiryDetailActivity" />
-        
-        <activity android:name=".activity.CustomerInquiryDetailActivity"
+
+        <activity
+            android:name=".activity.CustomerInquiryDetailActivity"
             android:launchMode="singleTask">
             <intent-filter>
                 <action android:name="com.modular.work.platform.activity.CustomerInquiryDetailActivity" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
-        
-        <activity android:name=".OA.platform.activity.PurchaseDetailsActivity"
+        <activity
+            android:name=".OA.platform.activity.PurchaseDetailsActivity"
             android:launchMode="singleTask">
             <intent-filter>
                 <action android:name="com.modular.work.platform.activity.PurchaseDetailsActivity" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
+        <!--B2B商务end-->
+
+        <activity android:name=".activity.InviteRegisterActivity">
+            <intent-filter>
+                <action android:name="com.modular.work.InviteRegisterActivity" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
     </application>
 
 </manifest>

+ 19 - 6
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/PurchaseDetailsActivity.java

@@ -48,6 +48,7 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
     private String varId;
     private String varStatus;
     private String enUU;
+    private String mJson;
 
     private RecyclerView mRecyclerView;
     private PurchaseDetailsAdapter mAdapter;
@@ -61,7 +62,6 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
 
     @Override
     protected String getBaseUrl() {
-//        return "http://uas.ubtob.com/";
         return new ApiPlatform().getBaseUrl();
     }
 
@@ -71,6 +71,7 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
         if (intent != null) {
             varId = intent.getStringExtra(Constants.FLAG.EXTRA_B2B_LIST_ID);
             varStatus = intent.getStringExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE);
+            mJson = intent.getStringExtra(Constants.FLAG.EXTRA_B2B_LIST_JSON);
             enUU = intent.getStringExtra(Constants.FLAG.EXTRA_B2B_LIST_ENUU);
             if (TextUtils.isEmpty(enUU)) {
                 enUU = CommonUtil.getSharedPreferences(mContext, Constants.CACHE.B2B_BUSINESS_ENUU);
@@ -89,13 +90,13 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
         String title = "";
         switch (varStatus) {
             case Constants.FLAG.STATE_PURCHASE_ORDER_END:
-                title = "已结案";
+                title = getString(R.string.str_case_closed);
                 break;
             case Constants.FLAG.STATE_PURCHASE_ORDER_DONE:
-                title = "已回复";
-                break;
+                title = getString(R.string.str_have_replied);
+                 break;
             case Constants.FLAG.STATE_PURCHASE_ORDER_TODO:
-                title = "待回复";
+                title = getString(R.string.str_wait_for_reply);
                 break;
         }
         getSupportActionBar().setTitle(title);
@@ -109,7 +110,19 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
     }
 
     private void initData() {
-        loadData();
+        if (mJson != null && JSONUtil.validate(mJson)) {
+            try {
+                handleMessage(mJson);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            if (CommonUtil.isNetWorkConnected(mContext)) {
+                loadData();
+            } else {
+                ToastUtil.showToast(mContext, R.string.networks_out);
+            }
+        }
     }
 
 

+ 25 - 47
app_modular/appworks/src/main/java/com/uas/appworks/activity/B2BBusinessMainActivity.java

@@ -208,49 +208,11 @@ public class B2BBusinessMainActivity extends BaseMVPActivity<WorkPlatPresenter>
                     intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_JSON, mPublicInquiryBeans.get(position).getJsonData());
                     startActivity(intent);
                 } else if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(billState)) {
-                    showLoading(null);
-
-                    Map<String, Object> params = new HashMap<>();
-                    params.put("en_uu", mB2BCompanyBean.getEnuu());
-                    params.put("user_tel", MyApplication.getInstance().mLoginUser.getTelephone());
-                    params.put("id", mPublicInquiryBeans.get(position).getId());
-
-                    HttpRequest.getInstance().sendRequest("http://218.17.158.219:24000/",
-                            new HttpParams.Builder()
-                                    .url("inquiry/sale/quote")
-                                    .method(Method.GET)
-                                    .setHeaders(new HashMap<String, Object>())
-                                    .setParams(params)
-                                    .build(), new HttpCallback() {
-                                @Override
-                                public void onSuccess(int flag, Object o) throws Exception {
-                                    hideLoading();
-                                    Intent intent = null;
-                                    String inquiryJson = o.toString();
-                                    if (TextUtils.isEmpty(inquiryJson)) {
-//                                        mSelectPosition = position;
-                                        intent = new Intent();
-                                        intent.setClass(mContext, CustomerInquiryDetailActivity.class);
-                                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID, mPublicInquiryBeans.get(position).getId());
-                                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, mPublicInquiryBeans.get(position).getBillState());
-                                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_JSON, mPublicInquiryBeans.get(position).getJsonData());
-                                        startActivityForResult(intent, REQUEST_PUBLIC_DETAIL);
-                                    } else {
-                                        intent = new Intent();
-                                        intent.setClass(mContext, PublicInquiryDetailActivity.class);
-                                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID, mPublicInquiryBeans.get(position).getId());
-                                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, mPublicInquiryBeans.get(position).getBillState());
-                                        intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_JSON, inquiryJson);
-                                        startActivity(intent);
-                                    }
-                                }
-
-                                @Override
-                                public void onFail(int flag, String failStr) throws Exception {
-                                    hideLoading();
-                                    toast(failStr);
-                                }
-                            });
+                    intent.setClass(mContext, CustomerInquiryDetailActivity.class);
+                    intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID, mPublicInquiryBeans.get(position).getId());
+                    intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, mPublicInquiryBeans.get(position).getBillState());
+                    intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_JSON, mPublicInquiryBeans.get(position).getJsonData());
+                    startActivityForResult(intent, REQUEST_PUBLIC_DETAIL);
                 }
             }
         });
@@ -288,7 +250,7 @@ public class B2BBusinessMainActivity extends BaseMVPActivity<WorkPlatPresenter>
                 url = "mobile/sale/inquiry/info/search";
                 break;
             case OBTAIN_PUBLIC_INQUIRY_LIST:
-                host = "http://218.17.158.219:24000/";
+                host = Constants.API_INQUIRY;
                 url = "inquiry/public/mobile";
                 break;
         }
@@ -414,9 +376,19 @@ public class B2BBusinessMainActivity extends BaseMVPActivity<WorkPlatPresenter>
             JSONObject contentObject = contentArray.getJSONObject(i);
             if (contentObject != null) {
                 B2BBusinessListBean b2BBusinessListBean = new B2BBusinessListBean();
-                b2BBusinessListBean.setJsonData(contentObject.toString());
                 b2BBusinessListBean.setItemType(B2BBusinessListBean.PUBLIC_INQUIRY_LIST);
-                b2BBusinessListBean.setId(JSONUtil.getText(contentObject, "id"));
+
+                int quoted = JSONUtil.getInt(contentObject, "quoted");
+                if (TextUtils.isEmpty(contentObject.getString("quoted"))) {
+                    b2BBusinessListBean.setJsonData(contentObject.toString());
+                    quoted = 1;
+                }
+
+                if (TextUtils.isEmpty(contentObject.getString("quteId"))) {
+                    b2BBusinessListBean.setId(JSONUtil.getText(contentObject, "id"));
+                } else {
+                    b2BBusinessListBean.setId(JSONUtil.getText(contentObject, "quteId"));
+                }
 
                 long date = contentObject.getLongValue("date");
                 if (date != 0) {
@@ -445,11 +417,17 @@ public class B2BBusinessMainActivity extends BaseMVPActivity<WorkPlatPresenter>
                 String invalid = JSONUtil.getText(contentObject, "invalid");
                 String overdue = JSONUtil.getText(contentObject, "overdue");
                 String status = JSONUtil.getText(contentObject, "status");
-                if ("1".equals(invalid) || "1".equals(overdue) || "201".equals(status)) {
+                if (quoted == 1) {
                     b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_DONE);
                 } else {
+                    b2BBusinessListBean.setJsonData(contentObject.toString());
                     b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO);
                 }
+                /*if ("1".equals(invalid) || "1".equals(overdue) || "201".equals(status)) {
+                    b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_DONE);
+                } else {
+                    b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO);
+                }*/
                 mPublicInquiryBeans.add(b2BBusinessListBean);
             }
         }

+ 21 - 28
app_modular/appworks/src/main/java/com/uas/appworks/activity/CustomerInquiryDetailActivity.java

@@ -191,7 +191,7 @@ public class CustomerInquiryDetailActivity extends BaseMVPActivity<WorkPlatPrese
             String url = "mobile/sale/inquiry/" + mId + "/info";
             int flag = CUSTOMER_INQUIRY_DETAIL;
             if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(mState)) {
-                host = "http://218.17.158.219:24000/";
+                host = Constants.API_INQUIRY;
                 url = "inquiry/sale/publicInquiry/detail";
                 flag = PUBLIC_INQUIRY_DETAIL;
             }
@@ -345,7 +345,8 @@ public class CustomerInquiryDetailActivity extends BaseMVPActivity<WorkPlatPrese
                 }
             }
             List<Reply> replies = new ArrayList<>();
-            for (B2BQuotePriceBean b2BQuotePriceBean : b2BQuotePriceBeans) {
+            for (int j = 0; j < b2BQuotePriceBeans.size(); j++) {
+                B2BQuotePriceBean b2BQuotePriceBean = b2BQuotePriceBeans.get(j);
                 Reply reply = new Reply();
                 String amount = b2BQuotePriceBean.getAmount();
                 String price = b2BQuotePriceBean.getPrice();
@@ -354,6 +355,22 @@ public class CustomerInquiryDetailActivity extends BaseMVPActivity<WorkPlatPrese
                     toast(getString(R.string.unfilled_items_in_subsection_quotation));
                     return;
                 }
+
+                if (j >= 1) {
+                    try {
+                        double amountN = Double.parseDouble(amount);
+
+                        B2BQuotePriceBean lastB2BQuotePriceBean = b2BQuotePriceBeans.get(j - 1);
+                        String lastAmount = lastB2BQuotePriceBean.getAmount();
+                        double amountB = Double.parseDouble(lastAmount);
+                        if (CommonUtil.doubleCompare(amountN, amountB) <= 0) {
+                            toast(getString(R.string.number_of_segments_please_keep_increasing));
+                            return;
+                        }
+                    } catch (Exception e) {
+
+                    }
+                }
                 reply.setLapQty(amount);
                 reply.setPrice(price);
 
@@ -371,15 +388,14 @@ public class CustomerInquiryDetailActivity extends BaseMVPActivity<WorkPlatPrese
             params.put("minPackQty", minPackQty);
             params.put("minOrderQty", minOrderQty);
 
-            params.put("useruu", "1000002503");
-
+            params.put("useruu", CommonUtil.getSharedPreferences(mContext, "b2b_uu"));
 
             showLoading(null);
             String url = "mobile/sale/inquiry/items/" + mId + "/reply";
             String host = new ApiPlatform().getBaseUrl();
             if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(mState)) {
                 url = "inquiry/sale/mobile/quote";
-                host = "http://218.17.158.219:24000/";
+                host = Constants.API_INQUIRY;
             }
             HttpRequest.getInstance().sendRequest(host
                     , new HttpParams.Builder()
@@ -418,29 +434,6 @@ public class CustomerInquiryDetailActivity extends BaseMVPActivity<WorkPlatPrese
                     finish();
                 }
             }, 1000);
-
-            /*Map<String, Object> params = new HashMap<>();
-            params.put("en_uu", mEnuu);
-            params.put("user_tel", MyApplication.getInstance().mLoginUser.getTelephone());
-            if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(mState)) {
-                params.put("itemId", publicId);
-            } else {
-                params.put("itemId", mId);
-            }
-
-            String url = "mobile/sale/inquiry/" + mId + "/info";
-            String host = new ApiPlatform().getBaseUrl();
-            if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(mState)) {
-                url = "inquiry/sale/inquiry/detail";
-                host = "http://218.17.158.219:24000/";
-            }
-            HttpRequest.getInstance().sendRequest(host
-                    , new HttpParams.Builder()
-                            .url(url)
-                            .method(Method.GET)
-                            .flag(CUSTOMER_INQUIRY_DETAIL)
-                            .setHeaders(new HashMap<String, Object>())
-                            .setParams(params).build(), this);*/
         } else if (flag == CUSTOMER_INQUIRY_DETAIL) {
 
             if (result != null && JSONUtil.validate(result)

+ 1 - 1
app_modular/appworks/src/main/java/com/uas/appworks/activity/CustomerInquiryListActivity.java

@@ -51,7 +51,7 @@ public class CustomerInquiryListActivity extends BaseMVPActivity<WorkPlatPresent
         ActionBar bar = this.getSupportActionBar();
         bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
         bar.setCustomView(mSearchActionView);
-        mSearchActionView.setSearchHint(R.string.str_customer_inquiry_list);
+        mSearchActionView.setSearchHint(getString(R.string.customer_inquiry_search_hint));
 
         mTabPageIndicator = (TabPageIndicator) findViewById(R.id.tab_viewpager_tab);
         mUnderlinePageIndicator = (UnderlinePageIndicator) findViewById(R.id.tab_viewpager_undertab);

+ 306 - 0
app_modular/appworks/src/main/java/com/uas/appworks/activity/InviteRegisterActivity.java

@@ -0,0 +1,306 @@
+package com.uas.appworks.activity;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.ClipData;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Build;
+import android.support.annotation.NonNull;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.Toast;
+
+import com.afollestad.materialdialogs.DialogAction;
+import com.afollestad.materialdialogs.MaterialDialog;
+import com.core.app.Constants;
+import com.core.base.activity.BaseMVPActivity;
+import com.core.base.presenter.BasePresenter;
+import com.core.utils.CommonUtil;
+import com.tencent.smtt.sdk.CookieManager;
+import com.tencent.smtt.sdk.ValueCallback;
+import com.tencent.smtt.sdk.WebChromeClient;
+import com.tencent.smtt.sdk.WebSettings;
+import com.tencent.smtt.sdk.WebView;
+import com.tencent.smtt.sdk.WebViewClient;
+import com.uas.appworks.R;
+import com.umeng.socialize.ShareAction;
+import com.umeng.socialize.bean.SHARE_MEDIA;
+import com.umeng.socialize.media.UMImage;
+import com.umeng.socialize.shareboard.SnsPlatform;
+import com.umeng.socialize.utils.ShareBoardlistener;
+
+import java.util.List;
+
+/**
+ * @author RaoMeng
+ * @describe 邀请注册
+ * @date 2018/1/31 16:04
+ */
+
+public class InviteRegisterActivity extends BaseMVPActivity {
+    private static final int RESULT_FILE_CHOOSER = 0x11;
+    private WebView mWebView;
+    private String mRegisterUrl;
+    private LinearLayout mSuccessLinearLayout;
+    private android.webkit.ValueCallback<Uri> mUploadMessage;
+    private android.webkit.ValueCallback<Uri[]> uploadMessageAboveL;
+
+    @Override
+    protected int getLayout() {
+        return R.layout.activity_invite_register;
+    }
+
+    @Override
+    protected void initView() {
+        getSupportActionBar().setTitle(R.string.str_work_invite_register);
+
+        mWebView = $(R.id.invite_register_wv);
+        mSuccessLinearLayout = $(R.id.invite_register_success);
+
+        mWebView.getSettings().setJavaScriptEnabled(true);
+        mWebView.getSettings().setAllowFileAccess(true);
+        mWebView.getSettings().setDomStorageEnabled(true);
+        mWebView.getSettings().setDatabaseEnabled(true);
+        mWebView.getSettings().setAppCacheEnabled(true);
+        mWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
+
+        if (Build.VERSION.SDK_INT >= 21) {
+            CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true);
+        } else {
+            CookieManager.getInstance().setAcceptCookie(true);
+        }
+    }
+
+    @Override
+    protected BasePresenter initPresenter() {
+        return null;
+    }
+
+    @Override
+    protected void initEvent() {
+        mWebView.setWebViewClient(new WebViewClient() {
+            @Override
+            public boolean shouldOverrideUrlLoading(WebView webView, String url) {
+                if (url.contains("https://mobile.ubtob.com:8443/openapp/")) {
+                    mSuccessLinearLayout.setVisibility(View.VISIBLE);
+                    return true;
+                }
+                return super.shouldOverrideUrlLoading(webView, url);
+            }
+        });
+
+        mWebView.setWebChromeClient(new WebChromeClient() {
+
+            @Override
+            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, FileChooserParams fileChooserParams) {
+                uploadMessageAboveL = valueCallback;
+                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
+                i.addCategory(Intent.CATEGORY_OPENABLE);
+                i.setType("image/*");
+                InviteRegisterActivity.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), RESULT_FILE_CHOOSER);
+                return true;
+            }
+
+            @Override
+            public void openFileChooser(ValueCallback<Uri> valueCallback, String acceptType, String capture) {
+                openFileChooser(valueCallback);
+            }
+
+            public void openFileChooser(ValueCallback uploadMsg) {
+                mUploadMessage = uploadMsg;
+                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
+                i.addCategory(Intent.CATEGORY_OPENABLE);
+                i.setType("image/*");
+                InviteRegisterActivity.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), RESULT_FILE_CHOOSER);
+            }
+
+            public void openFileChooser(ValueCallback uploadMsg, String acceptType) {
+                openFileChooser(uploadMsg);
+            }
+
+        });
+    }
+
+    @Override
+    protected void initData() {
+        mRegisterUrl = "http://192.168.253.66:8080/sso/register?inviteUserCode="
+                + CommonUtil.getSharedPreferences(mContext, "b2b_uu")
+                + "&inviteuid=" + CommonUtil.getSharedPreferences(mContext, Constants.CACHE.EN_BUSINESS_CODE);
+        mWebView.loadUrl(mRegisterUrl);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == RESULT_FILE_CHOOSER) {
+            if (null == mUploadMessage && null == uploadMessageAboveL) {
+                return;
+            }
+            Uri result = data == null || resultCode != RESULT_OK ? null : data.getData();
+            if (uploadMessageAboveL != null) {
+                onActivityResultAboveL(requestCode, resultCode, data);
+            } else if (mUploadMessage != null) {
+                mUploadMessage.onReceiveValue(result);
+                mUploadMessage = null;
+            }
+        }
+    }
+
+    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+    protected void onActivityResultAboveL(int requestCode, int resultCode, Intent intent) {
+        if (requestCode != RESULT_FILE_CHOOSER || uploadMessageAboveL == null) {
+            return;
+        }
+        Uri[] results = null;
+        if (resultCode == Activity.RESULT_OK) {
+            if (intent != null) {
+                String dataString = intent.getDataString();
+                ClipData clipData = intent.getClipData();
+                if (clipData != null) {
+                    results = new Uri[clipData.getItemCount()];
+                    for (int i = 0; i < clipData.getItemCount(); i++) {
+                        ClipData.Item item = clipData.getItemAt(i);
+                        results[i] = item.getUri();
+                    }
+                }
+                if (dataString != null) {
+                    results = new Uri[]{Uri.parse(dataString)};
+                }
+            }
+        }
+        uploadMessageAboveL.onReceiveValue(results);
+        uploadMessageAboveL = null;
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        int visibility = mSuccessLinearLayout.getVisibility();
+        if (keyCode == KeyEvent.KEYCODE_BACK && visibility == View.GONE) {
+            new MaterialDialog.Builder(this).title(R.string.common_notice)
+                    .content(R.string.register_unsuccessed_sure_to_exit)
+                    .negativeText(R.string.cancel)
+                    .onNegative(new MaterialDialog.SingleButtonCallback() {
+                        @Override
+                        public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
+                            materialDialog.dismiss();
+                        }
+                    })
+                    .positiveText(R.string.sure)
+                    .onPositive(new MaterialDialog.SingleButtonCallback() {
+                        @Override
+                        public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
+                            InviteRegisterActivity.this.finish();
+                        }
+                    }).build().show();
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.menu_about, menu);
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.app_about) {
+            new ShareAction(activity).setDisplayList(
+                    SHARE_MEDIA.SINA,
+                    SHARE_MEDIA.QQ,
+                    SHARE_MEDIA.QZONE,
+                    SHARE_MEDIA.WEIXIN,
+                    SHARE_MEDIA.WEIXIN_CIRCLE,
+                    SHARE_MEDIA.WEIXIN_FAVORITE)
+                    .setShareboardclickCallback(new ShareBoardlistener() {
+                        @Override
+                        public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
+                            if (share_media.name().equals("WEIXIN")
+                                    || share_media.name().equals("WEIXIN_CIRCLE")
+                                    || share_media.name().equals("WEIXIN_FAVORITE")) {
+                                if (!isWeixinAvilible(InviteRegisterActivity.this)) {
+                                    Toast.makeText(InviteRegisterActivity.this, "您未安装微信", Toast.LENGTH_SHORT).show();
+                                    return;
+                                }
+                            }
+
+                            if (share_media.name().equals("QQ")
+                                    || share_media.name().equals("QZONE")) {
+                                if (!isQQClientAvailable(InviteRegisterActivity.this)) {
+                                    Toast.makeText(InviteRegisterActivity.this, "您未安装QQ", Toast.LENGTH_SHORT).show();
+                                    return;
+                                }
+                            }
+
+                            new ShareAction(activity)
+                                    .setPlatform(share_media)
+                                    .withTitle("UU互联企业注册")
+                                    .withText("发现一款超好用的办公助手,邀请您注册使用!")
+                                    .withMedia(new UMImage(activity, "http://img.my.csdn.net/uploads/201609/30/1475204542_1365.png"))
+                                    .withTargetUrl(mRegisterUrl)
+                                    .setCallback(CommonUtil.umShareListener)
+                                    .share();
+                        }
+                    })
+                    .open();
+        } else if (android.R.id.home == item.getItemId()) {
+            onBackPressed();
+        }
+        return true;
+    }
+
+
+    public boolean isWeixinAvilible(Context context) {
+        final PackageManager packageManager = context.getPackageManager();// 获取packagemanager
+        List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息
+        if (pinfo != null) {
+            for (int i = 0; i < pinfo.size(); i++) {
+                String pn = pinfo.get(i).packageName;
+                if (pn.equals("com.tencent.mm")) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * 判断qq是否可用
+     *
+     * @param context
+     * @return
+     */
+    public boolean isQQClientAvailable(Context context) {
+        final PackageManager packageManager = context.getPackageManager();
+        List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
+        if (pinfo != null) {
+            for (int i = 0; i < pinfo.size(); i++) {
+                String pn = pinfo.get(i).packageName;
+                if (pn.equals("com.tencent.mobileqq")) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public void showLoading(String loadStr) {
+
+    }
+
+    @Override
+    public void hideLoading() {
+
+    }
+
+}

+ 7 - 10
app_modular/appworks/src/main/java/com/uas/appworks/activity/PublicInquiryDetailActivity.java

@@ -129,10 +129,11 @@ public class PublicInquiryDetailActivity extends BaseMVPActivity<WorkPlatPresent
             params.put("en_uu", mEnuu);
             params.put("user_tel", MyApplication.getInstance().mLoginUser.getTelephone());
             params.put("id", mId);
+            params.put("itemId", mId);
 
-            HttpRequest.getInstance().sendRequest("http://218.17.158.219:24000/",
+            HttpRequest.getInstance().sendRequest(Constants.API_INQUIRY,
                     new HttpParams.Builder()
-                            .url("inquiry/sale/publicInquiry/detail")
+                            .url("inquiry/sale/inquiry/detail")
                             .flag(PUBLIC_INQUIRY_DETAIL)
                             .method(Method.GET)
                             .setHeaders(new HashMap<String, Object>())
@@ -286,14 +287,10 @@ public class PublicInquiryDetailActivity extends BaseMVPActivity<WorkPlatPresent
         LogUtil.prinlnLongMsg("publicdetailsuccess", result);
         if (flag == PUBLIC_INQUIRY_DETAIL) {
             if (JSONUtil.validate(result)) {
-                JSONObject resultObject = JSON.parseObject(result);
-                JSONObject inquiryItem = resultObject.getJSONObject("inquiryItem");
-                if (inquiryItem != null) {
-                    initDetailData(inquiryItem.toString());
-                } else {
-                    initDetailData("");
-                    toast("数据获取为空");
-                }
+                initDetailData(result);
+            } else {
+                initDetailData("");
+                toast("报价信息为空");
             }
         }
     }

+ 1 - 1
app_modular/appworks/src/main/java/com/uas/appworks/activity/PublicInquiryListActivity.java

@@ -49,7 +49,7 @@ public class PublicInquiryListActivity extends BaseMVPActivity<WorkPlatPresenter
         ActionBar bar = this.getSupportActionBar();
         bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
         bar.setCustomView(mSearchActionView);
-        mSearchActionView.setSearchHint(R.string.str_public_inquiry_list);
+        mSearchActionView.setSearchHint(getString(R.string.public_inquiry_search_hint));
 
         mTabPageIndicator = (TabPageIndicator) findViewById(R.id.tab_viewpager_tab);
         mUnderlinePageIndicator = (UnderlinePageIndicator) findViewById(R.id.tab_viewpager_undertab);

+ 1 - 1
app_modular/appworks/src/main/java/com/uas/appworks/activity/PurchaseOrderListActivity.java

@@ -50,7 +50,7 @@ public class PurchaseOrderListActivity extends BaseMVPActivity {
         ActionBar bar = this.getSupportActionBar();
         bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
         bar.setCustomView(mSearchActionView);
-        mSearchActionView.setSearchHint(R.string.str_purchase_order_list);
+        mSearchActionView.setSearchHint(getString(R.string.purchase_order_search_hint));
 
         mTabPageIndicator = (TabPageIndicator) findViewById(R.id.tab_viewpager_tab);
         mUnderlinePageIndicator = (UnderlinePageIndicator) findViewById(R.id.tab_viewpager_undertab);

+ 4 - 4
app_modular/appworks/src/main/java/com/uas/appworks/datainquiry/PDFUtils.java

@@ -74,7 +74,6 @@ public class PDFUtils {
                 try {
                     if (response.body() != null) {
                         String responseStr = response.body().string();
-//                        LogUtil.prinlnLongMsg("pdfresponse", responseStr);
                         JSONObject responseObject = new JSONObject(responseStr);
                         if (!responseObject.isNull("success") && !responseObject.optBoolean("success")) {
                             Message message = Message.obtain();
@@ -139,10 +138,12 @@ public class PDFUtils {
                     mHandler.sendEmptyMessage(Constants.CONSTANT.DOWNLOAD_FAILED);
                     e.printStackTrace();
                 } finally {
-                    if (inputStream != null)
+                    if (inputStream != null) {
                         inputStream.close();
-                    if (fileOutputStream != null)
+                    }
+                    if (fileOutputStream != null) {
                         fileOutputStream.close();
+                    }
                 }
             }
         });
@@ -217,7 +218,6 @@ public class PDFUtils {
         return ssfFactory;
     }
 
-    //http://blog.csdn.net/u013686019/article/details/52856389  信任所有证书
     public static class TrustAllCerts implements X509TrustManager {
         @Override
         public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {

+ 167 - 169
app_modular/appworks/src/main/java/com/uas/appworks/datainquiry/activity/PDFDownloadActivity.java

@@ -1,13 +1,17 @@
 package com.uas.appworks.datainquiry.activity;
 
+import android.app.Activity;
 import android.content.Intent;
-import android.graphics.Canvas;
+import android.content.pm.ActivityInfo;
+import android.content.res.Configuration;
 import android.os.Bundle;
+import android.os.Environment;
 import android.os.Handler;
 import android.os.Message;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
+import android.view.WindowManager;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.RelativeLayout;
@@ -21,13 +25,9 @@ import com.core.net.ProgressResponseBody;
 import com.core.net.http.ViewUtil;
 import com.core.utils.CommonUtil;
 import com.core.utils.ToastUtil;
-import com.github.barteksc.pdfviewer.PDFView;
-import com.github.barteksc.pdfviewer.listener.OnDrawListener;
-import com.github.barteksc.pdfviewer.listener.OnErrorListener;
-import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
-import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
-import com.github.barteksc.pdfviewer.listener.OnPageScrollListener;
-import com.github.barteksc.pdfviewer.listener.OnRenderListener;
+import com.core.widget.crouton.Crouton;
+import com.core.widget.crouton.Style;
+import com.tencent.smtt.sdk.TbsReaderView;
 import com.uas.appworks.R;
 import com.uas.appworks.datainquiry.Constants;
 
@@ -48,14 +48,16 @@ import static com.uas.appworks.datainquiry.Constants.CONSTANT.PDF_FILE_PATH;
  * Created by RaoMeng on 2017/8/17.
  * 报表统计PDF文件下载并展示页面
  */
-public class PDFDownloadActivity extends BaseActivity implements View.OnClickListener, OnDrawListener, OnLoadCompleteListener, OnPageChangeListener, OnPageScrollListener, OnErrorListener, OnRenderListener, ProgressResponseBody.ProgressListener {
+public class PDFDownloadActivity extends BaseActivity implements View.OnClickListener, ProgressResponseBody.ProgressListener, TbsReaderView.ReaderCallback {
     private final int OBATIN_PDF_PATH = 100;
 
-    private PDFView mPDFView;
+    private RelativeLayout mRootLayout;
     private TextView mStateTextView, mRemainTextView, mRedownloadTextView, mExitTextView, mPauseTextView, mLoadTextView;
     private ProgressBar mDownloadProgressBar;
     private RelativeLayout mDownloadRelativeLayout;
     private LinearLayout mErrorLinearLayout;
+    private TbsReaderView mTbsReaderView;
+
     private String downloadUrl = "", mReportName = "";
     private String mCondition, mTitle;
     private ProgressDownloader mDownloader;
@@ -64,7 +66,6 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
     private long contentLength;
     private long totalBytes;
     private String replace;
-    private int mRetryTimes = 0;
 
     private Handler mHandler = new Handler() {
         @Override
@@ -76,14 +77,18 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
                         Log.d("progress", progress + ":" + contentLength);
                         mStateTextView.setText(R.string.str_downloading);
                         mDownloadProgressBar.setProgress(progress);
-                        mRemainTextView.setText((100 - (((progress * 1024 * 100) / contentLength))) + "");
+                        long remain = 100 - (((progress * 1024 * 100) / contentLength));
+                        if (remain < 0) {
+                            remain = 0;
+                        }
+                        mRemainTextView.setText(remain + "");
                     } catch (Exception e) {
 
                     }
                     break;
                 case Constants.CONSTANT.DOWNLOAD_SUCCESS:
                     mPauseTextView.setVisibility(View.GONE);
-                    mStateTextView.setText("报表文件下载成功!\n正在加载....");
+                    mStateTextView.setText("报表文件生成预览成功!");
                     mRemainTextView.setText("0");
                     displayFromFile(new File(PDF_FILE_PATH, PDF_FILE_NAME));
                     break;
@@ -105,7 +110,7 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
                     if (msg.obj != null) {
                         info = "\n" + (String) msg.obj;
                     }
-                    mStateTextView.setText("报表文件下载失败" + info);
+                    mStateTextView.setText("报表文件预览失败" + info);
                     mDownloadProgressBar.setProgress(0);
                     mRemainTextView.setText(100 + "");
                     break;
@@ -127,10 +132,107 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
                         mRemainTextView.setText(100 + "");
                     }
                     break;
+                default:
+                    break;
             }
         }
     };
 
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_pdf_download);
+
+        initViews();
+        initEvents();
+        obtainPdfPath();
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+
+        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
+            if (getSupportActionBar() != null) {
+                getSupportActionBar().hide();
+            }
+            //设置全屏
+            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
+            if (getSupportActionBar() != null) {
+                getSupportActionBar().show();
+                //取消全屏
+                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+            }
+        }
+    }
+
+    private void obtainPdfPath() {
+        mStateTextView.setText(R.string.obtain_pdf_path);
+        mDownloadProgressBar.setProgress(0);
+        mRemainTextView.setText(100 + "");
+
+        String url = replace + "report/pdf/path";
+        Map<String, Object> params = new HashMap<>();
+        params.put("u", CommonUtil.getSharedPreferences(ct, "erp_master"));
+        params.put("pf", "phone");
+        params.put("r", mReportName);
+        params.put("w", "where " + mCondition);
+        LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+        ViewUtil.httpSendRequest(this, url, params, mHandler, headers, OBATIN_PDF_PATH, null, null, "get");
+    }
+
+    private void initViews() {
+        Intent intent = getIntent();
+        if (intent != null) {
+            mCondition = intent.getStringExtra("condition");
+            mReportName = intent.getStringExtra("reportName");
+            mTitle = intent.getStringExtra("title");
+        }
+
+        if (mTitle != null && getSupportActionBar() != null) {
+            getSupportActionBar().setTitle(mTitle);
+        }
+
+        try {
+            replace = CommonUtil.getIP(URI.create(CommonUtil.getAppBaseUrl(this))).toString() + "/";
+//            replace = "http://print.ubtob.com/";
+        } catch (Exception e) {
+            try {
+                String appBaseUrl = CommonUtil.getAppBaseUrl(this);
+                replace = appBaseUrl.substring(0, appBaseUrl.length() - 1);
+                replace = replace.substring(0, replace.lastIndexOf("/") + 1);
+            } catch (Exception exception) {
+
+            }
+        }
+        Log.d("pdfurl", replace == null ? "" : replace);
+
+        mStateTextView = (TextView) findViewById(R.id.pdf_download_state_tv);
+        mRemainTextView = (TextView) findViewById(R.id.pdf_download_remain_tv);
+        mDownloadProgressBar = (ProgressBar) findViewById(R.id.pdf_download_progress_pb);
+        mDownloadRelativeLayout = (RelativeLayout) findViewById(R.id.pdf_download_progress_rl);
+        mRedownloadTextView = (TextView) findViewById(R.id.pdf_download_redownload_tv);
+        mExitTextView = (TextView) findViewById(R.id.pdf_download_exit_tv);
+        mErrorLinearLayout = (LinearLayout) findViewById(R.id.pdf_download_error_menu_ll);
+        mPauseTextView = (TextView) findViewById(R.id.pdf_download_pause_tv);
+        mLoadTextView = (TextView) findViewById(R.id.pdf_download_load_tv);
+        mRootLayout = (RelativeLayout) findViewById(R.id.pdf_download_rl);
+        mTbsReaderView = new TbsReaderView(this, this);
+        mRootLayout.addView(mTbsReaderView, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
+    }
+
+    private void initEvents() {
+        mExitTextView.setOnClickListener(this);
+        mRedownloadTextView.setOnClickListener(this);
+        mDownloadRelativeLayout.setOnClickListener(this);
+        mPauseTextView.setOnClickListener(this);
+        mLoadTextView.setOnClickListener(this);
+    }
+
+
     private void analysisPdfPath(String result) {
         if (result != null) {
             try {
@@ -190,117 +292,54 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
 
     private void displayFromFile(File fileName) {
         try {
-            mPDFView.fromFile(fileName)
-//                .pages(0, 2, 1, 3, 3, 3) // all pages are displayed by default
-                    .enableSwipe(true) // allows to block changing pages using swipe
-//                .swipeHorizontal(true)
-                    .enableDoubletap(true)
-                    .defaultPage(0)
-                    // allows to draw something on the current page, usually visible in the middle of the screen
-                    .onDraw(this)
-                    // allows to draw something on all pages, separately for every page. Called only for visible pages
-                    .onDrawAll(this)
-                    .onLoad(this) // called after document is loaded and starts to be rendered
-                    .onPageChange(this)
-                    .onPageScroll(this)
-                    .onError(this)
-                    .onRender(this) // called after document is rendered for the first time
-                    .enableAnnotationRendering(false) // render annotations (such as comments, colors or forms)
-                    .password(null)
-                    .scrollHandle(null)
-                    .enableAntialiasing(true) // improve rendering a little bit on low-res screens
-                    // spacing between pages in dp. To define spacing color, set view background
-                    .spacing(10)
-                    .load();
+            new Handler().postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    Bundle bundle = new Bundle();
+                    bundle.putString("filePath", PDF_FILE_PATH + "/" + PDF_FILE_NAME);
+                    bundle.putString("tempPath", Environment.getExternalStorageDirectory().getPath());
+
+                    readPdf(bundle, 3);
+                }
+            }, 400);
         } catch (Exception e) {
-            if (mRetryTimes <= 2) {
-                mRetryTimes++;
-                displayFromFile(new File(PDF_FILE_PATH, PDF_FILE_NAME));
-            } else {
-                mPauseTextView.setVisibility(View.GONE);
-                mErrorLinearLayout.setVisibility(View.VISIBLE);
-                mLoadTextView.setVisibility(View.VISIBLE);
-                mStateTextView.setText("报表文件加载失败!");
-                mDownloadProgressBar.setProgress(0);
-                mRemainTextView.setText(100 + "");
-            }
-        }
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_pdf_download);
+            Bundle bundle = new Bundle();
+            bundle.putString("filePath", PDF_FILE_PATH + "/" + PDF_FILE_NAME);
+            bundle.putString("tempPath", Environment.getExternalStorageDirectory().getPath());
 
-        initViews();
-        initEvents();
-        obtainPdfPath();
-    }
-
-    private void obtainPdfPath() {
-        mStateTextView.setText(R.string.obtain_pdf_path);
-        mDownloadProgressBar.setProgress(0);
-        mRemainTextView.setText(100 + "");
-
-        String url = replace + "report/pdf/path";
-        Map<String, Object> params = new HashMap<>();
-        params.put("u", CommonUtil.getSharedPreferences(ct, "erp_master"));
-        params.put("pf", "phone");
-        params.put("r", mReportName);
-        params.put("w", "where " + mCondition);
-        LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
-        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
-        ViewUtil.httpSendRequest(this, url, params, mHandler, headers, OBATIN_PDF_PATH, null, null, "get");
-//        PDFUtils.downloadPDF(downloadUrl, mHandler);
-    }
-
-    private void initViews() {
-        Intent intent = getIntent();
-        if (intent != null) {
-            mCondition = intent.getStringExtra("condition");
-            mReportName = intent.getStringExtra("reportName");
-            mTitle = intent.getStringExtra("title");
+            readPdf(bundle, 3);
         }
+    }
 
-        if (mTitle != null)
-            getSupportActionBar().setTitle(mTitle);
-
-//        downloadUrl = "http://print.ubtob.com/report/pdf/data?u=" + CommonUtil.getSharedPreferences(ct, "erp_master")
-//                + "&pf=phone&r=" + mReportName + "&w=where " + mCondition;
-
+    private void readPdf(Bundle bundle, int repeat) {
         try {
-            replace = CommonUtil.getIP(URI.create(CommonUtil.getAppBaseUrl(this))).toString() + "/";
-        } catch (Exception e) {
-            try {
-                String appBaseUrl = CommonUtil.getAppBaseUrl(this);
-                replace = appBaseUrl.substring(0, appBaseUrl.length() - 1);
-                replace = replace.substring(0, replace.lastIndexOf("/") + 1);
-            } catch (Exception exception) {
+            boolean result = mTbsReaderView.preOpen("pdf", false);
+            if (result) {
+                mDownloadRelativeLayout.setVisibility(View.GONE);
+                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
+                Crouton.makeText((Activity) mContext, getString(R.string.revolving_mobile_phone_full_screen_browsing), Style.holoGreenLight, 1500).show();
 
+                mTbsReaderView.openFile(bundle);
+            } else {
+                repeat--;
+                if (repeat >= 0) {
+                    readPdf(bundle, repeat);
+                } else {
+                    displayfail();
+                }
             }
+        } catch (Exception e) {
+            displayfail();
         }
-
-        Log.d("pdfurl", replace == null ? "" : replace);
-        mPDFView = (PDFView) findViewById(R.id.pdf_download_pdfview);
-        mPDFView.useBestQuality(true);
-
-        mStateTextView = (TextView) findViewById(R.id.pdf_download_state_tv);
-        mRemainTextView = (TextView) findViewById(R.id.pdf_download_remain_tv);
-        mDownloadProgressBar = (ProgressBar) findViewById(R.id.pdf_download_progress_pb);
-        mDownloadRelativeLayout = (RelativeLayout) findViewById(R.id.pdf_download_progress_rl);
-        mRedownloadTextView = (TextView) findViewById(R.id.pdf_download_redownload_tv);
-        mExitTextView = (TextView) findViewById(R.id.pdf_download_exit_tv);
-        mErrorLinearLayout = (LinearLayout) findViewById(R.id.pdf_download_error_menu_ll);
-        mPauseTextView = (TextView) findViewById(R.id.pdf_download_pause_tv);
-        mLoadTextView = (TextView) findViewById(R.id.pdf_download_load_tv);
     }
 
-    private void initEvents() {
-        mExitTextView.setOnClickListener(this);
-        mRedownloadTextView.setOnClickListener(this);
-        mDownloadRelativeLayout.setOnClickListener(this);
-        mPauseTextView.setOnClickListener(this);
-        mLoadTextView.setOnClickListener(this);
+    private void displayfail() {
+        mPauseTextView.setVisibility(View.GONE);
+        mErrorLinearLayout.setVisibility(View.VISIBLE);
+        mLoadTextView.setVisibility(View.VISIBLE);
+        mStateTextView.setText("报表文件加载失败!");
+        mDownloadProgressBar.setProgress(0);
+        mRemainTextView.setText(100 + "");
     }
 
     @Override
@@ -308,92 +347,40 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
         int i = v.getId();
         if (i == R.id.pdf_download_exit_tv) {
             onBackPressed();
-
         } else if (i == R.id.pdf_download_redownload_tv) {
             mStateTextView.setText(R.string.str_downloading);
             mErrorLinearLayout.setVisibility(View.GONE);
             mDownloadProgressBar.setProgress(0);
             mRemainTextView.setText(100 + "");
-//                PDFUtils.downloadPDF(downloadUrl, mHandler);
             if (TextUtils.isEmpty(downloadUrl)) {
                 obtainPdfPath();
             } else {
                 downloadPdf();
             }
-
         } else if (i == R.id.pdf_download_pause_tv) {
             if (getString(R.string.pause_download).equals(mPauseTextView.getText().toString())) {
                 mPauseTextView.setText(R.string.continue_download);
                 mStateTextView.setText(R.string.download_paused);
                 mDownloader.pause();
-                ToastUtil.showToast(this, "下载暂停");
+                ToastUtil.showToast(this, "预览暂停");
                 // 存储此时的totalBytes,即断点位置。
                 breakPoints = totalBytes;
             } else if (getString(R.string.continue_download).equals(mPauseTextView.getText().toString())) {
                 mPauseTextView.setText(R.string.pause_download);
                 mStateTextView.setText(R.string.str_downloading);
-                ToastUtil.showToast(this, "下载继续");
+                ToastUtil.showToast(this, "预览继续");
                 mDownloader.download(breakPoints);
             }
-
         } else if (i == R.id.pdf_download_load_tv) {
-            mRetryTimes = 0;
             mErrorLinearLayout.setVisibility(View.GONE);
             mLoadTextView.setVisibility(View.GONE);
             mStateTextView.setText(R.string.str_reloading);
             mDownloadProgressBar.setProgress((int) (contentLength / 1024));
             mRemainTextView.setText(0 + "");
             displayFromFile(new File(PDF_FILE_PATH, PDF_FILE_NAME));
-
         }
     }
 
-    @Override
-    public void onLayerDrawn(Canvas canvas, float pageWidth, float pageHeight, int displayedPage) {
-
-    }
-
-    @Override
-    public void loadComplete(int nbPages) {
-        mStateTextView.setText("报表文件加载成功");
-        mDownloadRelativeLayout.postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                mDownloadRelativeLayout.setVisibility(View.GONE);
-            }
-        }, 1000);
-    }
-
-    @Override
-    public void onPageChanged(int page, int pageCount) {
-
-    }
-
-    @Override
-    public void onPageScrolled(int page, float positionOffset) {
-
-    }
-
-    @Override
-    public void onError(Throwable t) {
-        if (mRetryTimes <= 2) {
-            mRetryTimes++;
-            displayFromFile(new File(PDF_FILE_PATH, PDF_FILE_NAME));
-        } else {
-            mPauseTextView.setVisibility(View.GONE);
-            mErrorLinearLayout.setVisibility(View.VISIBLE);
-            mLoadTextView.setVisibility(View.VISIBLE);
-            mStateTextView.setText("报表文件加载失败!");
-            mDownloadProgressBar.setProgress(0);
-            mRemainTextView.setText(100 + "");
-        }
-    }
-
-    @Override
-    public void onInitiallyRendered(int nbPages, float pageWidth, float pageHeight) {
-        mPDFView.fitToWidth();
-    }
-
     @Override
     public void onPreExecute(long contentLength) {
         // 文件总长只需记录一次,要注意断点续传后的contentLength只是剩余部分的长度
@@ -416,4 +403,15 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
             mHandler.sendEmptyMessage(Constants.CONSTANT.DOWNLOAD_SUCCESS);
         }
     }
+
+    @Override
+    public void onCallBackAction(Integer integer, Object o, Object o1) {
+        Log.e("tbscallback", "-->" + integer + "-->" + o.toString() + "-->" + o1.toString());
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        mTbsReaderView.onStop();
+    }
 }

+ 33 - 9
app_modular/appworks/src/main/java/com/uas/appworks/fragment/B2BBusinessListFragment.java

@@ -4,7 +4,6 @@ import android.content.Intent;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
-import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
@@ -110,7 +109,7 @@ public class B2BBusinessListFragment extends BaseMVPFragment<WorkPlatPresenter>
         mEnuu = CommonUtil.getSharedPreferences(mContext, Constants.CACHE.B2B_BUSINESS_ENUU);
         mRecyclerView = $(R.id.b2b_list_rv);
         mRefreshLayout = $(R.id.b2b_list_refreshlayout);
-        mRefreshLayout.setEnableAutoLoadmore(false);
+        mRefreshLayout.setEnableAutoLoadmore(true);
         mRefreshLayout.setEnableLoadmoreWhenContentNotFull(true);
 
         mB2BBusinessListBeans = new ArrayList<>();
@@ -158,14 +157,19 @@ public class B2BBusinessListFragment extends BaseMVPFragment<WorkPlatPresenter>
                             intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_JSON, mB2BBusinessListBeans.get(position).getJsonData());
                             startActivity(intent);
                         } else if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(billState)) {
-                            showLoading(null);
+                            intent.setClass(mContext, CustomerInquiryDetailActivity.class);
+                            intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_ID, mB2BBusinessListBeans.get(position).getId());
+                            intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, mB2BBusinessListBeans.get(position).getBillState());
+                            intent.putExtra(Constants.FLAG.EXTRA_B2B_LIST_JSON, mB2BBusinessListBeans.get(position).getJsonData());
+                            startActivityForResult(intent, REQUEST_PUBLIC_DETAIL);
+                            /*showLoading(null);
 
                             Map<String, Object> params = new HashMap<>();
                             params.put("en_uu", mEnuu);
                             params.put("user_tel", MyApplication.getInstance().mLoginUser.getTelephone());
                             params.put("id", data.get(position).getId());
 
-                            HttpRequest.getInstance().sendRequest("http://218.17.158.219:24000/",
+                            HttpRequest.getInstance().sendRequest(Constants.API_INQUIRY,
                                     new HttpParams.Builder()
                                             .url("inquiry/sale/quote")
                                             .flag(INQUIRY_SALE_QUOTE)
@@ -201,9 +205,11 @@ public class B2BBusinessListFragment extends BaseMVPFragment<WorkPlatPresenter>
                                             hideLoading();
                                             toast(failStr);
                                         }
-                                    });
+                                    });*/
                         }
                         break;
+                    default:
+                        break;
                 }
             }
         });
@@ -263,7 +269,7 @@ public class B2BBusinessListFragment extends BaseMVPFragment<WorkPlatPresenter>
 
         String host = new ApiPlatform().getBaseUrl();
         if (mListType == B2BBusinessListBean.PUBLIC_INQUIRY_LIST) {
-            host = "http://218.17.158.219:24000/";
+            host = Constants.API_INQUIRY;
         }
         HttpRequest.getInstance().sendRequest(host,
                 new HttpParams.Builder()
@@ -368,6 +374,8 @@ public class B2BBusinessListFragment extends BaseMVPFragment<WorkPlatPresenter>
                         case B2BBusinessListBean.PUBLIC_INQUIRY_LIST:
                             analisisPublicInquiry(contentArray);
                             break;
+                        default:
+                            break;
                     }
                     break;
                 default:
@@ -383,9 +391,19 @@ public class B2BBusinessListFragment extends BaseMVPFragment<WorkPlatPresenter>
             JSONObject contentObject = contentArray.getJSONObject(i);
             if (contentObject != null) {
                 B2BBusinessListBean b2BBusinessListBean = new B2BBusinessListBean();
-                b2BBusinessListBean.setJsonData(contentObject.toString());
                 b2BBusinessListBean.setItemType(B2BBusinessListBean.PUBLIC_INQUIRY_LIST);
-                b2BBusinessListBean.setId(JSONUtil.getText(contentObject, "id"));
+
+                int quoted = JSONUtil.getInt(contentObject, "quoted");
+                if (TextUtils.isEmpty(contentObject.getString("quoted"))) {
+                    b2BBusinessListBean.setJsonData(contentObject.toString());
+                    quoted = 1;
+                }
+
+                if (TextUtils.isEmpty(contentObject.getString("quteId"))) {
+                    b2BBusinessListBean.setId(JSONUtil.getText(contentObject, "id"));
+                } else {
+                    b2BBusinessListBean.setId(JSONUtil.getText(contentObject, "quteId"));
+                }
 
                 long date = contentObject.getLongValue("date");
                 if (date != 0) {
@@ -414,11 +432,17 @@ public class B2BBusinessListFragment extends BaseMVPFragment<WorkPlatPresenter>
                 String invalid = JSONUtil.getText(contentObject, "invalid");
                 String overdue = JSONUtil.getText(contentObject, "overdue");
                 String status = JSONUtil.getText(contentObject, "status");
-                if ("1".equals(invalid) || "1".equals(overdue) || "201".equals(status)) {
+                if (quoted == 1) {
                     b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_DONE);
                 } else {
+                    b2BBusinessListBean.setJsonData(contentObject.toString());
                     b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO);
                 }
+                /*if ("1".equals(invalid) || "1".equals(overdue) || "201".equals(status)) {
+                    b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_DONE);
+                } else {
+                    b2BBusinessListBean.setBillState(Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO);
+                }*/
                 mB2BBusinessListBeans.add(b2BBusinessListBean);
             }
         }

BIN
app_modular/appworks/src/main/res/drawable-hdpi/ic_trademark_b2b.png


BIN
app_modular/appworks/src/main/res/drawable-hdpi/ic_trademark_mall.png


BIN
app_modular/appworks/src/main/res/drawable-hdpi/ic_trademark_uu.png


BIN
app_modular/appworks/src/main/res/drawable-hdpi/ic_work_invite_register.png


BIN
app_modular/appworks/src/main/res/drawable-xhdpi/ic_trademark_b2b.png


BIN
app_modular/appworks/src/main/res/drawable-xhdpi/ic_trademark_mall.png


BIN
app_modular/appworks/src/main/res/drawable-xhdpi/ic_trademark_uu.png


BIN
app_modular/appworks/src/main/res/drawable-xhdpi/ic_work_invite_register.png


BIN
app_modular/appworks/src/main/res/drawable-xxhdpi/ic_trademark_b2b.png


BIN
app_modular/appworks/src/main/res/drawable-xxhdpi/ic_trademark_mall.png


BIN
app_modular/appworks/src/main/res/drawable-xxhdpi/ic_trademark_uu.png


BIN
app_modular/appworks/src/main/res/drawable-xxhdpi/ic_work_invite_register.png


+ 70 - 0
app_modular/appworks/src/main/res/layout/activity_invite_register.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.scwang.smartrefresh.layout.SmartRefreshLayout
+    android:id="@+id/refreshLayout"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    app:srlHeaderHeight="140dp"
+    app:srlHeaderMaxDragRate="1">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#555"
+        android:gravity="center_horizontal"
+        android:lineSpacingExtra="5dp"
+        android:padding="20dp"
+        android:text="网页由 www.ubtob.com 提供"
+        android:textColor="#aaa"
+        android:textSize="16sp"
+        app:layout_srlBackgroundColor="#555"
+        app:layout_srlSpinnerStyle="FixedBehind" />
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+        <com.tencent.smtt.sdk.WebView
+            android:id="@+id/invite_register_wv"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+
+        <LinearLayout
+            android:id="@+id/invite_register_success"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="@color/white"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:visibility="gone">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="45dp"
+                android:text="恭喜您注册成功,我们已为您开通以下服务:"
+                android:textColor="#2F95DD"
+                android:textSize="14sp" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="36dp"
+                android:src="@drawable/ic_trademark_b2b" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="36dp"
+                android:src="@drawable/ic_trademark_mall" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="36dp"
+                android:src="@drawable/ic_trademark_uu" />
+        </LinearLayout>
+    </FrameLayout>
+
+</com.scwang.smartrefresh.layout.SmartRefreshLayout>

+ 1 - 5
app_modular/appworks/src/main/res/layout/activity_pdf_download.xml

@@ -1,16 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout
+    android:id="@+id/pdf_download_rl"
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:fitsSystemWindows="true">
 
-    <com.github.barteksc.pdfviewer.PDFView
-        android:id="@+id/pdf_download_pdfview"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-
     <RelativeLayout
         android:id="@+id/pdf_download_progress_rl"
         android:layout_width="match_parent"

+ 2 - 3
app_modular/appworks/src/main/res/layout/layout_list_b2b_detail_text.xml

@@ -5,18 +5,17 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background="@color/b2b_tab_bg"
-    android:gravity="center_vertical"
     android:orientation="horizontal"
     android:padding="4dp">
 
     <TextView
         android:id="@+id/list_b2b_detail_text_caption_tv"
         android:layout_width="0dp"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:layout_marginLeft="8dp"
         android:layout_weight="1"
         android:textSize="14sp"
-        android:text="@string/str_product_name"/>
+        tools:text="@string/str_product_name"/>
 
     <TextView
         android:id="@+id/list_b2b_detail_text_value_tv"

+ 2 - 3
app_modular/appworks/src/main/res/layout/layout_list_b2b_white_detail_text.xml

@@ -5,7 +5,6 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background="@color/white"
-    android:gravity="center_vertical"
     android:orientation="horizontal"
     android:padding="4dp">
 
@@ -15,8 +14,8 @@
         android:layout_height="wrap_content"
         android:layout_marginLeft="8dp"
         android:layout_weight="1"
-        android:text="@string/str_product_name"
-        android:textSize="14sp" />
+        android:textSize="14sp"
+        tools:text="@string/str_product_name" />
 
     <TextView
         android:id="@+id/list_b2b_detail_white_text_value_tv"

+ 0 - 5
app_modular/appworks/src/main/res/layout/layout_list_customer_inquiry.xml

@@ -41,7 +41,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -66,7 +65,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -91,7 +89,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -116,7 +113,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -141,7 +137,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView

+ 4 - 11
app_modular/appworks/src/main/res/layout/layout_list_public_inquiry.xml

@@ -41,7 +41,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -66,7 +65,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -92,7 +90,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -113,23 +110,21 @@
                 tools:text="2018-01-21" />
         </LinearLayout>
 
-
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
-                android:text="@string/str_product_amount"
+                android:text="@string/str_product_brand"
                 android:textSize="14sp" />
 
             <TextView
-                android:id="@+id/list_public_inquiry_product_amount_tv"
+                android:id="@+id/list_public_inquiry_product_brand_tv"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="4dp"
@@ -144,18 +139,17 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
-                android:text="@string/str_product_brand"
+                android:text="@string/str_product_amount"
                 android:textSize="14sp" />
 
             <TextView
-                android:id="@+id/list_public_inquiry_product_brand_tv"
+                android:id="@+id/list_public_inquiry_product_amount_tv"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="4dp"
@@ -169,7 +163,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView

+ 0 - 3
app_modular/appworks/src/main/res/layout/layout_list_purchase_order.xml

@@ -40,7 +40,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -65,7 +64,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView
@@ -90,7 +88,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
-            android:gravity="center_vertical"
             android:orientation="horizontal">
 
             <TextView

+ 11 - 5
app_modular/appworks/src/main/res/values-en/strings.xml

@@ -46,14 +46,14 @@
     <string name="select_query_service">选择查询业务</string>
     <string name="report_query">报表查询</string>
     <string name="report_query_prompt">报表查询结果是PDF文件,\n需要耗费您一些流量....</string>
-    <string name="str_downloading">正在下载...</string>
-    <string name="re_download">重新下载</string>
+    <string name="str_downloading">正在预览...</string>
+    <string name="re_download">重新预览</string>
     <string name="search_history">搜索历史</string>
     <string name="str_clear">清空</string>
-    <string name="pause_download">暂停下载</string>
-    <string name="continue_download">继续下载</string>
+    <string name="pause_download">暂停预览</string>
+    <string name="continue_download">继续预览</string>
     <string name="obtain_pdf_path">正在获取报表文件资源,请稍候...</string>
-    <string name="download_paused">下载已暂停</string>
+    <string name="download_paused">预览已暂停</string>
     <string name="str_reloading">正在加载....</string>
 
     <!--B2B商务-->
@@ -125,4 +125,10 @@
     <string name="modify_quote_price">修改报价</string>
     <string name="str_currency">币别:</string>
     <string name="str_quote_information">报价信息</string>
+    <string name="revolving_mobile_phone_full_screen_browsing">旋转手机可全屏浏览</string>
+    <string name="number_of_segments_please_keep_increasing">分段数量请保持递增!</string>
+    <string name="purchase_order_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="customer_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="public_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="register_unsuccessed_sure_to_exit">注册未完成,确定退出?</string>
 </resources>

+ 11 - 5
app_modular/appworks/src/main/res/values-zh-rCN/strings.xml

@@ -45,14 +45,14 @@
     <string name="select_query_service">选择查询业务</string>
     <string name="report_query">报表查询</string>
     <string name="report_query_prompt">报表查询结果是PDF文件,\n需要耗费您一些流量....</string>
-    <string name="str_downloading">正在下载...</string>
-    <string name="re_download">重新下载</string>
+    <string name="str_downloading">正在预览...</string>
+    <string name="re_download">重新预览</string>
     <string name="search_history">搜索历史</string>
     <string name="str_clear">清空</string>
-    <string name="pause_download">暂停下载</string>
-    <string name="continue_download">继续下载</string>
+    <string name="pause_download">暂停预览</string>
+    <string name="continue_download">继续预览</string>
     <string name="obtain_pdf_path">正在获取报表文件资源,请稍候...</string>
-    <string name="download_paused">下载已暂停</string>
+    <string name="download_paused">预览已暂停</string>
     <string name="str_reloading">正在加载....</string>
 
     <!--B2B商务-->
@@ -124,4 +124,10 @@
     <string name="modify_quote_price">修改报价</string>
     <string name="str_currency">币别:</string>
     <string name="str_quote_information">报价信息</string>
+    <string name="revolving_mobile_phone_full_screen_browsing">旋转手机可全屏浏览</string>
+    <string name="number_of_segments_please_keep_increasing">分段数量请保持递增!</string>
+    <string name="purchase_order_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="customer_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="public_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="register_unsuccessed_sure_to_exit">注册未完成,确定退出?</string>
 </resources>

+ 11 - 5
app_modular/appworks/src/main/res/values-zh-rTW/strings.xml

@@ -45,14 +45,14 @@
     <string name="select_query_service">选择查询业务</string>
     <string name="report_query">报表查询</string>
     <string name="report_query_prompt">报表查询结果是PDF文件,\n需要耗费您一些流量....</string>
-    <string name="str_downloading">正在下载...</string>
-    <string name="re_download">重新下载</string>
+    <string name="str_downloading">正在预览...</string>
+    <string name="re_download">重新预览</string>
     <string name="search_history">搜索历史</string>
     <string name="str_clear">清空</string>
-    <string name="pause_download">暂停下载</string>
-    <string name="continue_download">继续下载</string>
+    <string name="pause_download">暂停预览</string>
+    <string name="continue_download">继续预览</string>
     <string name="obtain_pdf_path">正在获取报表文件资源,请稍候...</string>
-    <string name="download_paused">下载已暂停</string>
+    <string name="download_paused">预览已暂停</string>
     <string name="str_reloading">正在加载....</string>
 
     <!--B2B商务-->
@@ -124,4 +124,10 @@
     <string name="modify_quote_price">修改报价</string>
     <string name="str_currency">币别:</string>
     <string name="str_quote_information">报价信息</string>
+    <string name="revolving_mobile_phone_full_screen_browsing">旋转手机可全屏浏览</string>
+    <string name="number_of_segments_please_keep_increasing">分段数量请保持递增!</string>
+    <string name="purchase_order_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="customer_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="public_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="register_unsuccessed_sure_to_exit">注册未完成,确定退出?</string>
 </resources>

+ 11 - 5
app_modular/appworks/src/main/res/values/strings.xml

@@ -53,14 +53,14 @@
     <string name="select_query_service">选择查询业务</string>
     <string name="report_query">报表查询</string>
     <string name="report_query_prompt">报表查询结果是PDF文件,\n需要耗费您一些流量....</string>
-    <string name="str_downloading">正在下载...</string>
-    <string name="re_download">重新下载</string>
+    <string name="str_downloading">正在预览...</string>
+    <string name="re_download">重新预览</string>
     <string name="search_history">搜索历史</string>
     <string name="str_clear">清空</string>
-    <string name="pause_download">暂停下载</string>
-    <string name="continue_download">继续下载</string>
+    <string name="pause_download">暂停预览</string>
+    <string name="continue_download">继续预览</string>
     <string name="obtain_pdf_path">正在获取报表文件资源,请稍候...</string>
-    <string name="download_paused">下载已暂停</string>
+    <string name="download_paused">预览已暂停</string>
     <string name="str_reloading">正在加载....</string>
 
     <!--一元捐项目新-->
@@ -156,6 +156,12 @@
     <string name="modify_quote_price">修改报价</string>
     <string name="str_currency">币别:</string>
     <string name="str_quote_information">报价信息</string>
+    <string name="revolving_mobile_phone_full_screen_browsing">旋转手机可全屏浏览</string>
+    <string name="number_of_segments_please_keep_increasing">分段数量请保持递增!</string>
+    <string name="purchase_order_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="customer_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="public_inquiry_search_hint">单据编号/客户名称/物料名称</string>
+    <string name="register_unsuccessed_sure_to_exit">注册未完成,确定退出?</string>
 
 
 </resources>

+ 0 - 45
app_third/android-pdf-viewer/build.gradle

@@ -1,45 +0,0 @@
-apply plugin: 'com.android.library'
-
-ext {
-    bintrayRepo = 'maven'
-    bintrayName = 'android-pdf-viewer'
-
-    publishedGroupId = 'com.github.barteksc'
-    libraryName = 'AndroidPdfViewer'
-    artifact = 'android-pdf-viewer'
-
-    libraryDescription = 'Android view for displaying PDFs rendered with PdfiumAndroid'
-
-    siteUrl = 'https://github.com/barteksc/AndroidPdfViewer'
-    gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git'
-
-    libraryVersion = '2.7.0-beta.1'
-
-    developerId = 'barteksc'
-    developerName = 'Bartosz Schiller'
-    developerEmail = 'barteksch@boo.pl'
-
-    licenseName = 'The Apache Software License, Version 2.0'
-    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
-    allLicenses = ["Apache-2.0"]
-}
-
-android {
-    compileSdkVersion rootProject.ext.android.compileSdkVersion
-    buildToolsVersion rootProject.ext.android.buildToolsVersion
-
-    defaultConfig {
-        minSdkVersion rootProject.ext.android.minSdkVersion
-        targetSdkVersion rootProject.ext.android.targetSdkVersion
-        versionCode 1
-        versionName "2.7.0-beta.1"
-    }
-
-}
-
-dependencies {
-    compile 'com.github.barteksc:pdfium-android:1.7.0'
-}
-
-//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
-//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

+ 0 - 5
app_third/android-pdf-viewer/src/main/AndroidManifest.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.github.barteksc.pdfviewer">
-              
-</manifest>

+ 0 - 169
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/AnimationManager.java

@@ -1,169 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer;
-
-import android.animation.Animator;
-import android.animation.Animator.AnimatorListener;
-import android.animation.ValueAnimator;
-import android.animation.ValueAnimator.AnimatorUpdateListener;
-import android.graphics.PointF;
-import android.view.animation.DecelerateInterpolator;
-import android.widget.OverScroller;
-
-
-/**
- * This manager is used by the PDFView to launch animations.
- * It uses the ValueAnimator appeared in API 11 to start
- * an animation, and call moveTo() on the PDFView as a result
- * of each animation update.
- */
-class AnimationManager {
-
-    private PDFView pdfView;
-
-    private ValueAnimator animation;
-
-    private OverScroller scroller;
-
-    private boolean flinging = false;
-
-    public AnimationManager(PDFView pdfView) {
-        this.pdfView = pdfView;
-        scroller = new OverScroller(pdfView.getContext());
-    }
-
-    public void startXAnimation(float xFrom, float xTo) {
-        stopAll();
-        animation = ValueAnimator.ofFloat(xFrom, xTo);
-        animation.setInterpolator(new DecelerateInterpolator());
-        animation.addUpdateListener(new XAnimation());
-        animation.setDuration(400);
-        animation.start();
-    }
-
-    public void startYAnimation(float yFrom, float yTo) {
-        stopAll();
-        animation = ValueAnimator.ofFloat(yFrom, yTo);
-        animation.setInterpolator(new DecelerateInterpolator());
-        animation.addUpdateListener(new YAnimation());
-        animation.setDuration(400);
-        animation.start();
-    }
-
-    public void startZoomAnimation(float centerX, float centerY, float zoomFrom, float zoomTo) {
-        stopAll();
-        animation = ValueAnimator.ofFloat(zoomFrom, zoomTo);
-        animation.setInterpolator(new DecelerateInterpolator());
-        ZoomAnimation zoomAnim = new ZoomAnimation(centerX, centerY);
-        animation.addUpdateListener(zoomAnim);
-        animation.addListener(zoomAnim);
-        animation.setDuration(400);
-        animation.start();
-    }
-
-    public void startFlingAnimation(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY) {
-        stopAll();
-        flinging = true;
-        scroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
-    }
-
-    void computeFling() {
-        if (scroller.computeScrollOffset()) {
-            pdfView.moveTo(scroller.getCurrX(), scroller.getCurrY());
-            pdfView.loadPageByOffset();
-        } else if(flinging) { // fling finished
-            flinging = false;
-            pdfView.loadPages();
-            hideHandle();
-        }
-    }
-
-    public void stopAll() {
-        if (animation != null) {
-            animation.cancel();
-            animation = null;
-        }
-        stopFling();
-    }
-
-    public void stopFling() {
-        flinging = false;
-        scroller.forceFinished(true);
-    }
-
-    class XAnimation implements AnimatorUpdateListener {
-
-        @Override
-        public void onAnimationUpdate(ValueAnimator animation) {
-            float offset = (Float) animation.getAnimatedValue();
-            pdfView.moveTo(offset, pdfView.getCurrentYOffset());
-        }
-
-    }
-
-    class YAnimation implements AnimatorUpdateListener {
-
-        @Override
-        public void onAnimationUpdate(ValueAnimator animation) {
-            float offset = (Float) animation.getAnimatedValue();
-            pdfView.moveTo(pdfView.getCurrentXOffset(), offset);
-        }
-
-    }
-
-    class ZoomAnimation implements AnimatorUpdateListener, AnimatorListener {
-
-        private final float centerX;
-        private final float centerY;
-
-        public ZoomAnimation(float centerX, float centerY) {
-            this.centerX = centerX;
-            this.centerY = centerY;
-        }
-
-        @Override
-        public void onAnimationUpdate(ValueAnimator animation) {
-            float zoom = (Float) animation.getAnimatedValue();
-            pdfView.zoomCenteredTo(zoom, new PointF(centerX, centerY));
-        }
-
-        @Override
-        public void onAnimationCancel(Animator animation) {
-        }
-
-        @Override
-        public void onAnimationEnd(Animator animation) {
-            pdfView.loadPages();
-            hideHandle();
-        }
-
-        @Override
-        public void onAnimationRepeat(Animator animation) {
-        }
-
-        @Override
-        public void onAnimationStart(Animator animation) {
-        }
-
-    }
-
-    private void hideHandle() {
-        if (pdfView.getScrollHandle() != null) {
-            pdfView.getScrollHandle().hideDelayed();
-        }
-    }
-
-}

+ 0 - 178
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/CacheManager.java

@@ -1,178 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer;
-
-import android.graphics.RectF;
-import android.support.annotation.Nullable;
-
-import com.github.barteksc.pdfviewer.model.PagePart;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.PriorityQueue;
-
-import static com.github.barteksc.pdfviewer.util.Constants.Cache.CACHE_SIZE;
-import static com.github.barteksc.pdfviewer.util.Constants.Cache.THUMBNAILS_CACHE_SIZE;
-
-class CacheManager {
-
-    private final PriorityQueue<PagePart> passiveCache;
-
-    private final PriorityQueue<PagePart> activeCache;
-
-    private final List<PagePart> thumbnails;
-
-    private final Object passiveActiveLock = new Object();
-
-    private final PagePartComparator comparator = new PagePartComparator();
-
-    public CacheManager() {
-        activeCache = new PriorityQueue<>(CACHE_SIZE, comparator);
-        passiveCache = new PriorityQueue<>(CACHE_SIZE, comparator);
-        thumbnails = new ArrayList<>();
-    }
-
-    public void cachePart(PagePart part) {
-        synchronized (passiveActiveLock) {
-            // If cache too big, remove and recycle
-            makeAFreeSpace();
-
-            // Then add part
-            activeCache.offer(part);
-        }
-    }
-
-    public void makeANewSet() {
-        synchronized (passiveActiveLock) {
-            passiveCache.addAll(activeCache);
-            activeCache.clear();
-        }
-    }
-
-    private void makeAFreeSpace() {
-        synchronized (passiveActiveLock) {
-            while ((activeCache.size() + passiveCache.size()) >= CACHE_SIZE &&
-                    !passiveCache.isEmpty()) {
-                PagePart part = passiveCache.poll();
-                part.getRenderedBitmap().recycle();
-            }
-
-            while ((activeCache.size() + passiveCache.size()) >= CACHE_SIZE &&
-                    !activeCache.isEmpty()) {
-                activeCache.poll().getRenderedBitmap().recycle();
-            }
-        }
-    }
-
-    public void cacheThumbnail(PagePart part) {
-        synchronized (thumbnails) {
-            // If cache too big, remove and recycle
-            if (thumbnails.size() >= THUMBNAILS_CACHE_SIZE) {
-                thumbnails.remove(0).getRenderedBitmap().recycle();
-            }
-
-            // Then add thumbnail
-            thumbnails.add(part);
-        }
-
-    }
-
-    public boolean upPartIfContained(int userPage, int page, float width, float height, RectF pageRelativeBounds, int toOrder) {
-        PagePart fakePart = new PagePart(userPage, page, null, width, height, pageRelativeBounds, false, 0);
-
-        PagePart found;
-        synchronized (passiveActiveLock) {
-            if ((found = find(passiveCache, fakePart)) != null) {
-                passiveCache.remove(found);
-                found.setCacheOrder(toOrder);
-                activeCache.offer(found);
-                return true;
-            }
-
-            return find(activeCache, fakePart) != null;
-        }
-    }
-
-    /**
-     * Return true if already contains the described PagePart
-     */
-    public boolean containsThumbnail(int userPage, int page, float width, float height, RectF pageRelativeBounds) {
-        PagePart fakePart = new PagePart(userPage, page, null, width, height, pageRelativeBounds, true, 0);
-        synchronized (thumbnails) {
-            for (PagePart part : thumbnails) {
-                if (part.equals(fakePart)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    @Nullable
-    private static PagePart find(PriorityQueue<PagePart> vector, PagePart fakePart) {
-        for (PagePart part : vector) {
-            if (part.equals(fakePart)) {
-                return part;
-            }
-        }
-        return null;
-    }
-
-    public List<PagePart> getPageParts() {
-        synchronized (passiveActiveLock) {
-            List<PagePart> parts = new ArrayList<>(passiveCache);
-            parts.addAll(activeCache);
-            return parts;
-        }
-    }
-
-    public List<PagePart> getThumbnails() {
-        synchronized (thumbnails) {
-            return thumbnails;
-        }
-    }
-
-    public void recycle() {
-        synchronized (passiveActiveLock) {
-            for (PagePart part : passiveCache) {
-                part.getRenderedBitmap().recycle();
-            }
-            passiveCache.clear();
-            for (PagePart part : activeCache) {
-                part.getRenderedBitmap().recycle();
-            }
-            activeCache.clear();
-        }
-        synchronized (thumbnails) {
-            for (PagePart part : thumbnails) {
-                part.getRenderedBitmap().recycle();
-            }
-            thumbnails.clear();
-        }
-    }
-
-    class PagePartComparator implements Comparator<PagePart> {
-        @Override
-        public int compare(PagePart part1, PagePart part2) {
-            if (part1.getCacheOrder() == part2.getCacheOrder()) {
-                return 0;
-            }
-            return part1.getCacheOrder() > part2.getCacheOrder() ? 1 : -1;
-        }
-    }
-
-}

+ 0 - 79
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DecodingAsyncTask.java

@@ -1,79 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer;
-
-import android.content.Context;
-import android.os.AsyncTask;
-
-import com.github.barteksc.pdfviewer.source.DocumentSource;
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-class DecodingAsyncTask extends AsyncTask<Void, Void, Throwable> {
-
-    private boolean cancelled;
-
-    private PDFView pdfView;
-
-    private Context context;
-    private PdfiumCore pdfiumCore;
-    private PdfDocument pdfDocument;
-    private String password;
-    private DocumentSource docSource;
-    private int firstPageIdx;
-    private int pageWidth;
-    private int pageHeight;
-
-    DecodingAsyncTask(DocumentSource docSource, String password, PDFView pdfView, PdfiumCore pdfiumCore, int firstPageIdx) {
-        this.docSource = docSource;
-        this.firstPageIdx = firstPageIdx;
-        this.cancelled = false;
-        this.pdfView = pdfView;
-        this.password = password;
-        this.pdfiumCore = pdfiumCore;
-        context = pdfView.getContext();
-    }
-
-    @Override
-    protected Throwable doInBackground(Void... params) {
-        try {
-            pdfDocument = docSource.createDocument(context, pdfiumCore, password);
-            // We assume all the pages are the same size
-            pdfiumCore.openPage(pdfDocument, firstPageIdx);
-            pageWidth = pdfiumCore.getPageWidth(pdfDocument, firstPageIdx);
-            pageHeight = pdfiumCore.getPageHeight(pdfDocument, firstPageIdx);
-            return null;
-        } catch (Throwable t) {
-            return t;
-        }
-    }
-
-    @Override
-    protected void onPostExecute(Throwable t) {
-        if (t != null) {
-            pdfView.loadError(t);
-            return;
-        }
-        if (!cancelled) {
-            pdfView.loadComplete(pdfDocument, pageWidth, pageHeight);
-        }
-    }
-
-    @Override
-    protected void onCancelled() {
-        cancelled = true;
-    }
-}

+ 0 - 216
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DragPinchManager.java

@@ -1,216 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer;
-
-import android.graphics.PointF;
-import android.view.GestureDetector;
-import android.view.MotionEvent;
-import android.view.ScaleGestureDetector;
-import android.view.View;
-
-import com.github.barteksc.pdfviewer.scroll.ScrollHandle;
-
-import static com.github.barteksc.pdfviewer.util.Constants.Pinch.MAXIMUM_ZOOM;
-import static com.github.barteksc.pdfviewer.util.Constants.Pinch.MINIMUM_ZOOM;
-
-/**
- * This Manager takes care of moving the PDFView,
- * set its zoom track user actions.
- */
-class DragPinchManager implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener, ScaleGestureDetector.OnScaleGestureListener, View.OnTouchListener {
-
-    private PDFView pdfView;
-    private AnimationManager animationManager;
-
-    private GestureDetector gestureDetector;
-    private ScaleGestureDetector scaleGestureDetector;
-
-    private boolean isSwipeEnabled;
-
-    private boolean swipeVertical;
-
-    private boolean scrolling = false;
-    private boolean scaling = false;
-
-    public DragPinchManager(PDFView pdfView, AnimationManager animationManager) {
-        this.pdfView = pdfView;
-        this.animationManager = animationManager;
-        this.isSwipeEnabled = false;
-        this.swipeVertical = pdfView.isSwipeVertical();
-        gestureDetector = new GestureDetector(pdfView.getContext(), this);
-        scaleGestureDetector = new ScaleGestureDetector(pdfView.getContext(), this);
-        pdfView.setOnTouchListener(this);
-    }
-
-    public void enableDoubletap(boolean enableDoubletap) {
-        if (enableDoubletap) {
-            gestureDetector.setOnDoubleTapListener(this);
-        } else {
-            gestureDetector.setOnDoubleTapListener(null);
-        }
-    }
-
-    public boolean isZooming() {
-        return pdfView.isZooming();
-    }
-
-    private boolean isPageChange(float distance) {
-        return Math.abs(distance) > Math.abs(pdfView.toCurrentScale(swipeVertical ? pdfView.getOptimalPageHeight() : pdfView.getOptimalPageWidth()) / 2);
-    }
-
-    public void setSwipeEnabled(boolean isSwipeEnabled) {
-        this.isSwipeEnabled = isSwipeEnabled;
-    }
-
-    public void setSwipeVertical(boolean swipeVertical) {
-        this.swipeVertical = swipeVertical;
-    }
-
-    @Override
-    public boolean onSingleTapConfirmed(MotionEvent e) {
-        ScrollHandle ps = pdfView.getScrollHandle();
-        if (ps != null && !pdfView.documentFitsView()) {
-            if (!ps.shown()) {
-                ps.show();
-            } else {
-                ps.hide();
-            }
-        }
-        pdfView.performClick();
-        return true;
-    }
-
-    @Override
-    public boolean onDoubleTap(MotionEvent e) {
-        if (pdfView.getZoom() < pdfView.getMidZoom()) {
-            pdfView.zoomWithAnimation(e.getX(), e.getY(), pdfView.getMidZoom());
-        } else if (pdfView.getZoom() < pdfView.getMaxZoom()) {
-            pdfView.zoomWithAnimation(e.getX(), e.getY(), pdfView.getMaxZoom());
-        } else {
-            pdfView.resetZoomWithAnimation();
-        }
-        return true;
-    }
-
-    @Override
-    public boolean onDoubleTapEvent(MotionEvent e) {
-        return false;
-    }
-
-    @Override
-    public boolean onDown(MotionEvent e) {
-        animationManager.stopFling();
-        return true;
-    }
-
-    @Override
-    public void onShowPress(MotionEvent e) {
-
-    }
-
-    @Override
-    public boolean onSingleTapUp(MotionEvent e) {
-        return false;
-    }
-
-    @Override
-    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
-        scrolling = true;
-        if (isZooming() || isSwipeEnabled) {
-            pdfView.moveRelativeTo(-distanceX, -distanceY);
-        }
-        if (!scaling || pdfView.doRenderDuringScale()) {
-            pdfView.loadPageByOffset();
-        }
-        return true;
-    }
-
-    public void onScrollEnd(MotionEvent event) {
-        pdfView.loadPages();
-        hideHandle();
-    }
-
-    @Override
-    public void onLongPress(MotionEvent e) {
-
-    }
-
-    @Override
-    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
-        int xOffset = (int) pdfView.getCurrentXOffset();
-        int yOffset = (int) pdfView.getCurrentYOffset();
-
-        float minX, minY;
-        if (pdfView.isSwipeVertical()) {
-            minX = -(pdfView.toCurrentScale(pdfView.getOptimalPageWidth()) - pdfView.getWidth());
-            minY = -(pdfView.calculateDocLength() - pdfView.getHeight());
-        } else {
-            minX = -(pdfView.calculateDocLength() - pdfView.getWidth());
-            minY = -(pdfView.toCurrentScale(pdfView.getOptimalPageHeight()) - pdfView.getHeight());
-        }
-
-        animationManager.startFlingAnimation(xOffset, yOffset, (int) (velocityX), (int) (velocityY),
-                (int) minX, 0, (int) minY, 0);
-
-        return true;
-    }
-
-    @Override
-    public boolean onScale(ScaleGestureDetector detector) {
-        float dr = detector.getScaleFactor();
-        float wantedZoom = pdfView.getZoom() * dr;
-        if (wantedZoom < MINIMUM_ZOOM) {
-            dr = MINIMUM_ZOOM / pdfView.getZoom();
-        } else if (wantedZoom > MAXIMUM_ZOOM) {
-            dr = MAXIMUM_ZOOM / pdfView.getZoom();
-        }
-        pdfView.zoomCenteredRelativeTo(dr, new PointF(detector.getFocusX(), detector.getFocusY()));
-        return true;
-    }
-
-    @Override
-    public boolean onScaleBegin(ScaleGestureDetector detector) {
-        scaling = true;
-        return true;
-    }
-
-    @Override
-    public void onScaleEnd(ScaleGestureDetector detector) {
-        pdfView.loadPages();
-        hideHandle();
-        scaling = false;
-    }
-
-    @Override
-    public boolean onTouch(View v, MotionEvent event) {
-        boolean retVal = scaleGestureDetector.onTouchEvent(event);
-        retVal = gestureDetector.onTouchEvent(event) || retVal;
-
-        if (event.getAction() == MotionEvent.ACTION_UP) {
-            if (scrolling) {
-                scrolling = false;
-                onScrollEnd(event);
-            }
-        }
-        return retVal;
-    }
-
-    private void hideHandle() {
-        if (pdfView.getScrollHandle() != null && pdfView.getScrollHandle().shown()) {
-            pdfView.getScrollHandle().hideDelayed();
-        }
-    }
-}

+ 0 - 1472
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/PDFView.java

@@ -1,1472 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Paint.Style;
-import android.graphics.PaintFlagsDrawFilter;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.HandlerThread;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.widget.RelativeLayout;
-
-import com.github.barteksc.pdfviewer.listener.OnDrawListener;
-import com.github.barteksc.pdfviewer.listener.OnErrorListener;
-import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
-import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
-import com.github.barteksc.pdfviewer.listener.OnPageScrollListener;
-import com.github.barteksc.pdfviewer.listener.OnRenderListener;
-import com.github.barteksc.pdfviewer.model.PagePart;
-import com.github.barteksc.pdfviewer.scroll.ScrollHandle;
-import com.github.barteksc.pdfviewer.source.AssetSource;
-import com.github.barteksc.pdfviewer.source.ByteArraySource;
-import com.github.barteksc.pdfviewer.source.DocumentSource;
-import com.github.barteksc.pdfviewer.source.FileSource;
-import com.github.barteksc.pdfviewer.source.InputStreamSource;
-import com.github.barteksc.pdfviewer.source.UriSource;
-import com.github.barteksc.pdfviewer.util.ArrayUtils;
-import com.github.barteksc.pdfviewer.util.Constants;
-import com.github.barteksc.pdfviewer.util.MathUtils;
-import com.github.barteksc.pdfviewer.util.Util;
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * It supports animations, zoom, cache, and swipe.
- * <p>
- * To fully understand this class you must know its principles :
- * - The PDF document is seen as if we always want to draw all the pages.
- * - The thing is that we only draw the visible parts.
- * - All parts are the same size, this is because we can't interrupt a native page rendering,
- * so we need these renderings to be as fast as possible, and be able to interrupt them
- * as soon as we can.
- * - The parts are loaded when the current offset or the current zoom level changes
- * <p>
- * Important :
- * - DocumentPage = A page of the PDF document.
- * - UserPage = A page as defined by the user.
- * By default, they're the same. But the user can change the pages order
- * using {@link #load(DocumentSource, String, OnLoadCompleteListener, OnErrorListener, int[])}. In this
- * particular case, a userPage of 5 can refer to a documentPage of 17.
- */
-public class PDFView extends RelativeLayout {
-
-    private static final String TAG = PDFView.class.getSimpleName();
-
-    public static final float DEFAULT_MAX_SCALE = 3.0f;
-    public static final float DEFAULT_MID_SCALE = 1.75f;
-    public static final float DEFAULT_MIN_SCALE = 1.0f;
-
-    private float minZoom = DEFAULT_MIN_SCALE;
-    private float midZoom = DEFAULT_MID_SCALE;
-    private float maxZoom = DEFAULT_MAX_SCALE;
-
-    /**
-     * START - scrolling in first page direction
-     * END - scrolling in last page direction
-     * NONE - not scrolling
-     */
-    enum ScrollDir {
-        NONE, START, END
-    }
-
-    private ScrollDir scrollDir = ScrollDir.NONE;
-
-    /**
-     * Rendered parts go to the cache manager
-     */
-    CacheManager cacheManager;
-
-    /**
-     * Animation manager manage all offset and zoom animation
-     */
-    private AnimationManager animationManager;
-
-    /**
-     * Drag manager manage all touch events
-     */
-    private DragPinchManager dragPinchManager;
-
-    /**
-     * The pages the user want to display in order
-     * (ex: 0, 2, 2, 8, 8, 1, 1, 1)
-     */
-    private int[] originalUserPages;
-
-    /**
-     * The same pages but with a filter to avoid repetition
-     * (ex: 0, 2, 8, 1)
-     */
-    private int[] filteredUserPages;
-
-    /**
-     * The same pages but with a filter to avoid repetition
-     * (ex: 0, 1, 1, 2, 2, 3, 3, 3)
-     */
-    private int[] filteredUserPageIndexes;
-
-    /**
-     * Number of pages in the loaded PDF document
-     */
-    private int documentPageCount;
-
-    /**
-     * The index of the current sequence
-     */
-    private int currentPage;
-
-    /**
-     * The index of the current sequence
-     */
-    private int currentFilteredPage;
-
-    /**
-     * The actual width and height of the pages in the PDF document
-     */
-    private int pageWidth, pageHeight;
-
-    /**
-     * The optimal width and height of the pages to fit the component size
-     */
-    private float optimalPageWidth, optimalPageHeight;
-
-    /**
-     * If you picture all the pages side by side in their optimal width,
-     * and taking into account the zoom level, the current offset is the
-     * position of the left border of the screen in this big picture
-     */
-    private float currentXOffset = 0;
-
-    /**
-     * If you picture all the pages side by side in their optimal width,
-     * and taking into account the zoom level, the current offset is the
-     * position of the left border of the screen in this big picture
-     */
-    private float currentYOffset = 0;
-
-    /**
-     * The zoom level, always >= 1
-     */
-    private float zoom = 1f;
-
-    /**
-     * True if the PDFView has been recycled
-     */
-    private boolean recycled = true;
-
-    /**
-     * Current state of the view
-     */
-    private State state = State.DEFAULT;
-
-    /**
-     * Async task used during the loading phase to decode a PDF document
-     */
-    private DecodingAsyncTask decodingAsyncTask;
-
-    /**
-     * The thread {@link #renderingHandler} will run on
-     */
-    private final HandlerThread renderingHandlerThread;
-    /**
-     * Handler always waiting in the background and rendering tasks
-     */
-    RenderingHandler renderingHandler;
-
-    private PagesLoader pagesLoader;
-
-    /**
-     * Call back object to call when the PDF is loaded
-     */
-    private OnLoadCompleteListener onLoadCompleteListener;
-
-    private OnErrorListener onErrorListener;
-
-    /**
-     * Call back object to call when the page has changed
-     */
-    private OnPageChangeListener onPageChangeListener;
-
-    /**
-     * Call back object to call when the page is scrolled
-     */
-    private OnPageScrollListener onPageScrollListener;
-
-    /**
-     * Call back object to call when the above layer is to drawn
-     */
-    private OnDrawListener onDrawListener;
-
-    private OnDrawListener onDrawAllListener;
-
-    /**
-     * Call back object to call when the document is initially rendered
-     */
-    private OnRenderListener onRenderListener;
-
-    /**
-     * Paint object for drawing
-     */
-    private Paint paint;
-
-    /**
-     * Paint object for drawing debug stuff
-     */
-    private Paint debugPaint;
-
-    private int defaultPage = 0;
-
-    /**
-     * True if should scroll through pages vertically instead of horizontally
-     */
-    private boolean swipeVertical = true;
-
-    /**
-     * Pdfium core for loading and rendering PDFs
-     */
-    private PdfiumCore pdfiumCore;
-
-    private PdfDocument pdfDocument;
-
-    private ScrollHandle scrollHandle;
-
-    private boolean isScrollHandleInit = false;
-
-    ScrollHandle getScrollHandle() {
-        return scrollHandle;
-    }
-
-    /**
-     * True if bitmap should use ARGB_8888 format and take more memory
-     * False if bitmap should be compressed by using RGB_565 format and take less memory
-     */
-    private boolean bestQuality = false;
-
-    /**
-     * True if annotations should be rendered
-     * False otherwise
-     */
-    private boolean annotationRendering = false;
-
-    /**
-     * True if the view should render during scaling<br/>
-     * Can not be forced on older API versions (< Build.VERSION_CODES.KITKAT) as the GestureDetector does
-     * not detect scrolling while scaling.<br/>
-     * False otherwise
-     */
-    private boolean renderDuringScale = false;
-
-    /**
-     * Antialiasing and bitmap filtering
-     */
-    private boolean enableAntialiasing = true;
-    private PaintFlagsDrawFilter antialiasFilter =
-            new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
-
-    /**
-     * Spacing between pages, in DP
-     */
-    private int spacingPx = 0;
-
-    /**
-     * pages numbers used when calling onDrawAllListener
-     */
-    private List<Integer> onDrawPagesNums = new ArrayList<>(10);
-
-    /**
-     * Construct the initial view
-     */
-    public PDFView(Context context, AttributeSet set) {
-        super(context, set);
-
-        renderingHandlerThread = new HandlerThread("PDF renderer");
-
-        if (isInEditMode()) {
-            return;
-        }
-
-        cacheManager = new CacheManager();
-        animationManager = new AnimationManager(this);
-        dragPinchManager = new DragPinchManager(this, animationManager);
-
-        paint = new Paint();
-        debugPaint = new Paint();
-        debugPaint.setStyle(Style.STROKE);
-
-        pdfiumCore = new PdfiumCore(context);
-        setWillNotDraw(false);
-    }
-
-    private void load(DocumentSource docSource, String password, OnLoadCompleteListener listener, OnErrorListener onErrorListener) {
-        load(docSource, password, listener, onErrorListener, null);
-    }
-
-    private void load(DocumentSource docSource, String password, OnLoadCompleteListener onLoadCompleteListener, OnErrorListener onErrorListener, int[] userPages) {
-
-        if (!recycled) {
-            throw new IllegalStateException("Don't call load on a PDF View without recycling it first.");
-        }
-
-        // Manage UserPages if not null
-        if (userPages != null) {
-            this.originalUserPages = userPages;
-            this.filteredUserPages = ArrayUtils.deleteDuplicatedPages(originalUserPages);
-            this.filteredUserPageIndexes = ArrayUtils.calculateIndexesInDuplicateArray(originalUserPages);
-        }
-
-        this.onLoadCompleteListener = onLoadCompleteListener;
-        this.onErrorListener = onErrorListener;
-
-        int firstPageIdx = 0;
-        if (originalUserPages != null) {
-            firstPageIdx = originalUserPages[0];
-        }
-
-        recycled = false;
-        // Start decoding document
-        decodingAsyncTask = new DecodingAsyncTask(docSource, password, this, pdfiumCore, firstPageIdx);
-        decodingAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
-    }
-
-    /**
-     * Go to the given page.
-     *
-     * @param page Page index.
-     */
-    public void jumpTo(int page, boolean withAnimation) {
-        float offset = -calculatePageOffset(page);
-        if (swipeVertical) {
-            if (withAnimation) {
-                animationManager.startYAnimation(currentYOffset, offset);
-            } else {
-                moveTo(currentXOffset, offset);
-            }
-        } else {
-            if (withAnimation) {
-                animationManager.startXAnimation(currentXOffset, offset);
-            } else {
-                moveTo(offset, currentYOffset);
-            }
-        }
-        showPage(page);
-    }
-
-    public void jumpTo(int page) {
-        jumpTo(page, false);
-    }
-
-    void showPage(int pageNb) {
-        if (recycled) {
-            return;
-        }
-
-        // Check the page number and makes the
-        // difference between UserPages and DocumentPages
-        pageNb = determineValidPageNumberFrom(pageNb);
-        currentPage = pageNb;
-        currentFilteredPage = pageNb;
-        if (filteredUserPageIndexes != null) {
-            if (pageNb >= 0 && pageNb < filteredUserPageIndexes.length) {
-                pageNb = filteredUserPageIndexes[pageNb];
-                currentFilteredPage = pageNb;
-            }
-        }
-
-        loadPages();
-
-        if (scrollHandle != null && !documentFitsView()) {
-            scrollHandle.setPageNum(currentPage + 1);
-        }
-
-        if (onPageChangeListener != null) {
-            onPageChangeListener.onPageChanged(currentPage, getPageCount());
-        }
-    }
-
-    /**
-     * Get current position as ratio of document length to visible area.
-     * 0 means that document start is visible, 1 that document end is visible
-     *
-     * @return offset between 0 and 1
-     */
-    public float getPositionOffset() {
-        float offset;
-        if (swipeVertical) {
-            offset = -currentYOffset / (calculateDocLength() - getHeight());
-        } else {
-            offset = -currentXOffset / (calculateDocLength() - getWidth());
-        }
-        return MathUtils.limit(offset, 0, 1);
-    }
-
-    /**
-     * @param progress   must be between 0 and 1
-     * @param moveHandle whether to move scroll handle
-     * @see PDFView#getPositionOffset()
-     */
-    public void setPositionOffset(float progress, boolean moveHandle) {
-        if (swipeVertical) {
-            moveTo(currentXOffset, (-calculateDocLength() + getHeight()) * progress, moveHandle);
-        } else {
-            moveTo((-calculateDocLength() + getWidth()) * progress, currentYOffset, moveHandle);
-        }
-        loadPageByOffset();
-    }
-
-    public void setPositionOffset(float progress) {
-        setPositionOffset(progress, true);
-    }
-
-    private float calculatePageOffset(int page) {
-        if (swipeVertical) {
-            return toCurrentScale(page * optimalPageHeight + page * spacingPx);
-        } else {
-            return toCurrentScale(page * optimalPageWidth + page * spacingPx);
-        }
-    }
-
-    float calculateDocLength() {
-        int pageCount = getPageCount();
-        if (swipeVertical) {
-            return toCurrentScale(pageCount * optimalPageHeight + (pageCount - 1) * spacingPx);
-        } else {
-            return toCurrentScale(pageCount * optimalPageWidth + (pageCount - 1) * spacingPx);
-        }
-    }
-
-    public void stopFling() {
-        animationManager.stopFling();
-    }
-
-    public int getPageCount() {
-        if (originalUserPages != null) {
-            return originalUserPages.length;
-        }
-        return documentPageCount;
-    }
-
-    public void enableSwipe(boolean enableSwipe) {
-        dragPinchManager.setSwipeEnabled(enableSwipe);
-    }
-
-    public void enableDoubletap(boolean enableDoubletap) {
-        this.dragPinchManager.enableDoubletap(enableDoubletap);
-    }
-
-    private void setOnPageChangeListener(OnPageChangeListener onPageChangeListener) {
-        this.onPageChangeListener = onPageChangeListener;
-    }
-
-    OnPageChangeListener getOnPageChangeListener() {
-        return this.onPageChangeListener;
-    }
-
-    private void setOnPageScrollListener(OnPageScrollListener onPageScrollListener) {
-        this.onPageScrollListener = onPageScrollListener;
-    }
-
-    OnPageScrollListener getOnPageScrollListener() {
-        return this.onPageScrollListener;
-    }
-
-    private void setOnRenderListener(OnRenderListener onRenderListener) {
-        this.onRenderListener = onRenderListener;
-    }
-
-    OnRenderListener getOnRenderListener() {
-        return this.onRenderListener;
-    }
-
-    private void setOnDrawListener(OnDrawListener onDrawListener) {
-        this.onDrawListener = onDrawListener;
-    }
-
-    private void setOnDrawAllListener(OnDrawListener onDrawAllListener) {
-        this.onDrawAllListener = onDrawAllListener;
-    }
-
-    public void recycle() {
-
-        animationManager.stopAll();
-
-        // Stop tasks
-        if (renderingHandler != null) {
-            renderingHandler.stop();
-            renderingHandler.removeMessages(RenderingHandler.MSG_RENDER_TASK);
-        }
-        if (decodingAsyncTask != null) {
-            decodingAsyncTask.cancel(true);
-        }
-
-        // Clear caches
-        cacheManager.recycle();
-
-        if (scrollHandle != null && isScrollHandleInit) {
-            scrollHandle.destroyLayout();
-        }
-
-        if (pdfiumCore != null && pdfDocument != null) {
-            pdfiumCore.closeDocument(pdfDocument);
-        }
-
-        renderingHandler = null;
-        originalUserPages = null;
-        filteredUserPages = null;
-        filteredUserPageIndexes = null;
-        pdfDocument = null;
-        scrollHandle = null;
-        isScrollHandleInit = false;
-        currentXOffset = currentYOffset = 0;
-        zoom = 1f;
-        recycled = true;
-        state = State.DEFAULT;
-    }
-
-    public boolean isRecycled() {
-        return recycled;
-    }
-
-    /**
-     * Handle fling animation
-     */
-    @Override
-    public void computeScroll() {
-        super.computeScroll();
-        animationManager.computeFling();
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        recycle();
-        super.onDetachedFromWindow();
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        if (isInEditMode() || state != State.SHOWN) {
-            return;
-        }
-        animationManager.stopAll();
-        calculateOptimalWidthAndHeight();
-        if (swipeVertical) {
-            moveTo(currentXOffset, -calculatePageOffset(currentPage));
-        } else {
-            moveTo(-calculatePageOffset(currentPage), currentYOffset);
-        }
-        loadPageByOffset();
-    }
-
-    @Override
-    protected void onDraw(Canvas canvas) {
-        if (isInEditMode()) {
-            return;
-        }
-        // As I said in this class javadoc, we can think of this canvas as a huge
-        // strip on which we draw all the images. We actually only draw the rendered
-        // parts, of course, but we render them in the place they belong in this huge
-        // strip.
-
-        // That's where Canvas.translate(x, y) becomes very helpful.
-        // This is the situation :
-        //  _______________________________________________
-        // |   			 |					 			   |
-        // | the actual  |					The big strip  |
-        // |	canvas	 | 								   |
-        // |_____________|								   |
-        // |_______________________________________________|
-        //
-        // If the rendered part is on the bottom right corner of the strip
-        // we can draw it but we won't see it because the canvas is not big enough.
-
-        // But if we call translate(-X, -Y) on the canvas just before drawing the object :
-        //  _______________________________________________
-        // |   			  					  _____________|
-        // |   The big strip     			 |			   |
-        // |		    					 |	the actual |
-        // |								 |	canvas	   |
-        // |_________________________________|_____________|
-        //
-        // The object will be on the canvas.
-        // This technique is massively used in this method, and allows
-        // abstraction of the screen position when rendering the parts.
-
-        // Draws background
-
-        if (enableAntialiasing) {
-            canvas.setDrawFilter(antialiasFilter);
-        }
-
-        Drawable bg = getBackground();
-        if (bg == null) {
-            canvas.drawColor(Color.WHITE);
-        } else {
-            bg.draw(canvas);
-        }
-
-        if (recycled) {
-            return;
-        }
-
-        if (state != State.SHOWN) {
-            return;
-        }
-
-        // Moves the canvas before drawing any element
-        float currentXOffset = this.currentXOffset;
-        float currentYOffset = this.currentYOffset;
-        canvas.translate(currentXOffset, currentYOffset);
-
-        // Draws thumbnails
-        for (PagePart part : cacheManager.getThumbnails()) {
-            drawPart(canvas, part);
-
-        }
-
-        // Draws parts
-        for (PagePart part : cacheManager.getPageParts()) {
-            drawPart(canvas, part);
-            if (onDrawAllListener != null && !onDrawPagesNums.contains(part.getUserPage())) {
-                onDrawPagesNums.add(part.getUserPage());
-            }
-        }
-
-        for (Integer page : onDrawPagesNums) {
-            drawWithListener(canvas, page, onDrawAllListener);
-        }
-        onDrawPagesNums.clear();
-
-        drawWithListener(canvas, currentPage, onDrawListener);
-
-        // Restores the canvas position
-        canvas.translate(-currentXOffset, -currentYOffset);
-    }
-
-    private void drawWithListener(Canvas canvas, int page, OnDrawListener listener) {
-        if (listener != null) {
-            float translateX, translateY;
-            if (swipeVertical) {
-                translateX = 0;
-                translateY = calculatePageOffset(page);
-            } else {
-                translateY = 0;
-                translateX = calculatePageOffset(page);
-            }
-
-            canvas.translate(translateX, translateY);
-            listener.onLayerDrawn(canvas,
-                    toCurrentScale(optimalPageWidth),
-                    toCurrentScale(optimalPageHeight),
-                    page);
-
-            canvas.translate(-translateX, -translateY);
-        }
-    }
-
-    /**
-     * Draw a given PagePart on the canvas
-     */
-    private void drawPart(Canvas canvas, PagePart part) {
-        // Can seem strange, but avoid lot of calls
-        RectF pageRelativeBounds = part.getPageRelativeBounds();
-        Bitmap renderedBitmap = part.getRenderedBitmap();
-
-        if (renderedBitmap.isRecycled()) {
-            return;
-        }
-
-        // Move to the target page
-        float localTranslationX = 0;
-        float localTranslationY = 0;
-        if (swipeVertical) {
-            localTranslationY = calculatePageOffset(part.getUserPage());
-        } else {
-            localTranslationX = calculatePageOffset(part.getUserPage());
-        }
-        canvas.translate(localTranslationX, localTranslationY);
-
-        Rect srcRect = new Rect(0, 0, renderedBitmap.getWidth(),
-                renderedBitmap.getHeight());
-
-        float offsetX = toCurrentScale(pageRelativeBounds.left * optimalPageWidth);
-        float offsetY = toCurrentScale(pageRelativeBounds.top * optimalPageHeight);
-        float width = toCurrentScale(pageRelativeBounds.width() * optimalPageWidth);
-        float height = toCurrentScale(pageRelativeBounds.height() * optimalPageHeight);
-
-        // If we use float values for this rectangle, there will be
-        // a possible gap between page parts, especially when
-        // the zoom level is high.
-        RectF dstRect = new RectF((int) offsetX, (int) offsetY,
-                (int) (offsetX + width),
-                (int) (offsetY + height));
-
-        // Check if bitmap is in the screen
-        float translationX = currentXOffset + localTranslationX;
-        float translationY = currentYOffset + localTranslationY;
-        if (translationX + dstRect.left >= getWidth() || translationX + dstRect.right <= 0 ||
-                translationY + dstRect.top >= getHeight() || translationY + dstRect.bottom <= 0) {
-            canvas.translate(-localTranslationX, -localTranslationY);
-            return;
-        }
-
-        canvas.drawBitmap(renderedBitmap, srcRect, dstRect, paint);
-
-        if (Constants.DEBUG_MODE) {
-            debugPaint.setColor(part.getUserPage() % 2 == 0 ? Color.RED : Color.BLUE);
-            canvas.drawRect(dstRect, debugPaint);
-        }
-
-        // Restore the canvas position
-        canvas.translate(-localTranslationX, -localTranslationY);
-
-    }
-
-    /**
-     * Load all the parts around the center of the screen,
-     * taking into account X and Y offsets, zoom level, and
-     * the current page displayed
-     */
-    public void loadPages() {
-        if (optimalPageWidth == 0 || optimalPageHeight == 0 || renderingHandler == null) {
-            return;
-        }
-
-        // Cancel all current tasks
-        renderingHandler.removeMessages(RenderingHandler.MSG_RENDER_TASK);
-        cacheManager.makeANewSet();
-
-        pagesLoader.loadPages();
-        redraw();
-    }
-
-    /**
-     * Called when the PDF is loaded
-     */
-    void loadComplete(PdfDocument pdfDocument, int pageWidth, int pageHeight) {
-        state = State.LOADED;
-        this.documentPageCount = pdfiumCore.getPageCount(pdfDocument);
-
-        this.pdfDocument = pdfDocument;
-
-        this.pageWidth = pageWidth;
-        this.pageHeight = pageHeight;
-        calculateOptimalWidthAndHeight();
-
-        pagesLoader = new PagesLoader(this);
-
-        if (!renderingHandlerThread.isAlive()) {
-            renderingHandlerThread.start();
-        }
-        renderingHandler = new RenderingHandler(renderingHandlerThread.getLooper(),
-                this, pdfiumCore, pdfDocument);
-        renderingHandler.start();
-
-        if (scrollHandle != null) {
-            scrollHandle.setupLayout(this);
-            isScrollHandleInit = true;
-        }
-
-        if (onLoadCompleteListener != null) {
-            onLoadCompleteListener.loadComplete(documentPageCount);
-        }
-
-        jumpTo(defaultPage, false);
-    }
-
-    void loadError(Throwable t) {
-        state = State.ERROR;
-        recycle();
-        invalidate();
-        if (this.onErrorListener != null) {
-            this.onErrorListener.onError(t);
-        } else {
-            Log.e("PDFView", "load pdf error", t);
-        }
-    }
-
-    void redraw() {
-        invalidate();
-    }
-
-    /**
-     * Called when a rendering task is over and
-     * a PagePart has been freshly created.
-     *
-     * @param part The created PagePart.
-     */
-    public void onBitmapRendered(PagePart part) {
-        // when it is first rendered part
-        if (state == State.LOADED) {
-            state = State.SHOWN;
-            if (onRenderListener != null) {
-                onRenderListener.onInitiallyRendered(getPageCount(), optimalPageWidth, optimalPageHeight);
-            }
-        }
-
-        if (part.isThumbnail()) {
-            cacheManager.cacheThumbnail(part);
-        } else {
-            cacheManager.cachePart(part);
-        }
-        redraw();
-    }
-
-    /**
-     * Given the UserPage number, this method restrict it
-     * to be sure it's an existing page. It takes care of
-     * using the user defined pages if any.
-     *
-     * @param userPage A page number.
-     * @return A restricted valid page number (example : -2 => 0)
-     */
-    private int determineValidPageNumberFrom(int userPage) {
-        if (userPage <= 0) {
-            return 0;
-        }
-        if (originalUserPages != null) {
-            if (userPage >= originalUserPages.length) {
-                return originalUserPages.length - 1;
-            }
-        } else {
-            if (userPage >= documentPageCount) {
-                return documentPageCount - 1;
-            }
-        }
-        return userPage;
-    }
-
-    /**
-     * Calculate the x/y-offset needed to have the given
-     * page centered on the screen. It doesn't take into
-     * account the zoom level.
-     *
-     * @param pageNb The page number.
-     * @return The x/y-offset to use to have the pageNb centered.
-     */
-    private float calculateCenterOffsetForPage(int pageNb) {
-        if (swipeVertical) {
-            float imageY = -(pageNb * optimalPageHeight + pageNb * spacingPx);
-            imageY += getHeight() / 2 - optimalPageHeight / 2;
-            return imageY;
-        } else {
-            float imageX = -(pageNb * optimalPageWidth + pageNb * spacingPx);
-            imageX += getWidth() / 2 - optimalPageWidth / 2;
-            return imageX;
-        }
-    }
-
-    /**
-     * Calculate the optimal width and height of a page
-     * considering the area width and height
-     */
-    private void calculateOptimalWidthAndHeight() {
-        if (state == State.DEFAULT || getWidth() == 0) {
-            return;
-        }
-
-        float maxWidth = getWidth(), maxHeight = getHeight();
-        float w = pageWidth, h = pageHeight;
-        float ratio = w / h;
-        w = maxWidth;
-        h = (float) Math.floor(maxWidth / ratio);
-        if (h > maxHeight) {
-            h = maxHeight;
-            w = (float) Math.floor(maxHeight * ratio);
-        }
-
-        optimalPageWidth = w;
-        optimalPageHeight = h;
-
-    }
-
-    public void moveTo(float offsetX, float offsetY) {
-        moveTo(offsetX, offsetY, true);
-    }
-
-    /**
-     * Move to the given X and Y offsets, but check them ahead of time
-     * to be sure not to go outside the the big strip.
-     *
-     * @param offsetX    The big strip X offset to use as the left border of the screen.
-     * @param offsetY    The big strip Y offset to use as the right border of the screen.
-     * @param moveHandle whether to move scroll handle or not
-     */
-    public void moveTo(float offsetX, float offsetY, boolean moveHandle) {
-        if (swipeVertical) {
-            // Check X offset
-            float scaledPageWidth = toCurrentScale(optimalPageWidth);
-            if (scaledPageWidth < getWidth()) {
-                offsetX = getWidth() / 2 - scaledPageWidth / 2;
-            } else {
-                if (offsetX > 0) {
-                    offsetX = 0;
-                } else if (offsetX + scaledPageWidth < getWidth()) {
-                    offsetX = getWidth() - scaledPageWidth;
-                }
-            }
-
-            // Check Y offset
-            float contentHeight = calculateDocLength();
-            if (contentHeight < getHeight()) { // whole document height visible on screen
-                offsetY = (getHeight() - contentHeight) / 2;
-            } else {
-                if (offsetY > 0) { // top visible
-                    offsetY = 0;
-                } else if (offsetY + contentHeight < getHeight()) { // bottom visible
-                    offsetY = -contentHeight + getHeight();
-                }
-            }
-
-            if (offsetY < currentYOffset) {
-                scrollDir = ScrollDir.END;
-            } else if (offsetY > currentYOffset) {
-                scrollDir = ScrollDir.START;
-            } else {
-                scrollDir = ScrollDir.NONE;
-            }
-        } else {
-            // Check Y offset
-            float scaledPageHeight = toCurrentScale(optimalPageHeight);
-            if (scaledPageHeight < getHeight()) {
-                offsetY = getHeight() / 2 - scaledPageHeight / 2;
-            } else {
-                if (offsetY > 0) {
-                    offsetY = 0;
-                } else if (offsetY + scaledPageHeight < getHeight()) {
-                    offsetY = getHeight() - scaledPageHeight;
-                }
-            }
-
-            // Check X offset
-            float contentWidth = calculateDocLength();
-            if (contentWidth < getWidth()) { // whole document width visible on screen
-                offsetX = (getWidth() - contentWidth) / 2;
-            } else {
-                if (offsetX > 0) { // left visible
-                    offsetX = 0;
-                } else if (offsetX + contentWidth < getWidth()) { // right visible
-                    offsetX = -contentWidth + getWidth();
-                }
-            }
-
-            if (offsetX < currentXOffset) {
-                scrollDir = ScrollDir.END;
-            } else if (offsetX > currentXOffset) {
-                scrollDir = ScrollDir.START;
-            } else {
-                scrollDir = ScrollDir.NONE;
-            }
-        }
-
-        currentXOffset = offsetX;
-        currentYOffset = offsetY;
-        float positionOffset = getPositionOffset();
-
-        if (moveHandle && scrollHandle != null && !documentFitsView()) {
-            scrollHandle.setScroll(positionOffset);
-        }
-
-        if (onPageScrollListener != null) {
-            onPageScrollListener.onPageScrolled(getCurrentPage(), positionOffset);
-        }
-
-        redraw();
-    }
-
-    ScrollDir getScrollDir() {
-        return scrollDir;
-    }
-
-    void loadPageByOffset() {
-        float offset, optimal, screenCenter;
-        float spacingPerPage = spacingPx - (spacingPx / getPageCount());
-        if (swipeVertical) {
-            offset = currentYOffset;
-            optimal = optimalPageHeight + spacingPerPage;
-            screenCenter = ((float) getHeight()) / 2;
-        } else {
-            offset = currentXOffset;
-            optimal = optimalPageWidth + spacingPerPage;
-            screenCenter = ((float) getWidth()) / 2;
-        }
-
-        int page = (int) Math.floor((Math.abs(offset) + screenCenter) / toCurrentScale(optimal));
-
-        if (page >= 0 && page <= getPageCount() - 1 && page != getCurrentPage()) {
-            showPage(page);
-        } else {
-            loadPages();
-        }
-    }
-
-    int[] getFilteredUserPages() {
-        return filteredUserPages;
-    }
-
-    int[] getOriginalUserPages() {
-        return originalUserPages;
-    }
-
-    int[] getFilteredUserPageIndexes() {
-        return filteredUserPageIndexes;
-    }
-
-    int getDocumentPageCount() {
-        return documentPageCount;
-    }
-
-    /**
-     * Move relatively to the current position.
-     *
-     * @param dx The X difference you want to apply.
-     * @param dy The Y difference you want to apply.
-     * @see #moveTo(float, float)
-     */
-    public void moveRelativeTo(float dx, float dy) {
-        moveTo(currentXOffset + dx, currentYOffset + dy);
-    }
-
-    /**
-     * Change the zoom level
-     */
-    public void zoomTo(float zoom) {
-        this.zoom = zoom;
-    }
-
-    /**
-     * Change the zoom level, relatively to a pivot point.
-     * It will call moveTo() to make sure the given point stays
-     * in the middle of the screen.
-     *
-     * @param zoom  The zoom level.
-     * @param pivot The point on the screen that should stays.
-     */
-    public void zoomCenteredTo(float zoom, PointF pivot) {
-        float dzoom = zoom / this.zoom;
-        zoomTo(zoom);
-        float baseX = currentXOffset * dzoom;
-        float baseY = currentYOffset * dzoom;
-        baseX += (pivot.x - pivot.x * dzoom);
-        baseY += (pivot.y - pivot.y * dzoom);
-        moveTo(baseX, baseY);
-    }
-
-    /**
-     * @see #zoomCenteredTo(float, PointF)
-     */
-    public void zoomCenteredRelativeTo(float dzoom, PointF pivot) {
-        zoomCenteredTo(zoom * dzoom, pivot);
-    }
-
-    /**
-     * Checks if whole document can be displayed on screen, doesn't include zoom
-     *
-     * @return true if whole document can displayed at once, false otherwise
-     */
-    public boolean documentFitsView() {
-        int pageCount = getPageCount();
-        int spacing = (pageCount - 1) * spacingPx;
-        if (swipeVertical) {
-            return pageCount * optimalPageHeight + spacing < getHeight();
-        } else {
-            return pageCount * optimalPageWidth + spacing < getWidth();
-        }
-    }
-
-    public void fitToWidth(int page) {
-        if (state != State.SHOWN) {
-            Log.e(TAG, "Cannot fit, document not rendered yet");
-            return;
-        }
-        fitToWidth();
-        jumpTo(page);
-    }
-
-    public void fitToWidth() {
-        if (state != State.SHOWN) {
-            Log.e(TAG, "Cannot fit, document not rendered yet");
-            return;
-        }
-        zoomTo(getWidth() / optimalPageWidth);
-        setPositionOffset(0);
-    }
-
-    public int getCurrentPage() {
-        return currentPage;
-    }
-
-    public float getCurrentXOffset() {
-        return currentXOffset;
-    }
-
-    public float getCurrentYOffset() {
-        return currentYOffset;
-    }
-
-    public float toRealScale(float size) {
-        return size / zoom;
-    }
-
-    public float toCurrentScale(float size) {
-        return size * zoom;
-    }
-
-    public float getZoom() {
-        return zoom;
-    }
-
-    public boolean isZooming() {
-        return zoom != minZoom;
-    }
-
-    public float getOptimalPageWidth() {
-        return optimalPageWidth;
-    }
-
-    public float getOptimalPageHeight() {
-        return optimalPageHeight;
-    }
-
-    private void setDefaultPage(int defaultPage) {
-        this.defaultPage = defaultPage;
-    }
-
-    public void resetZoom() {
-        zoomTo(minZoom);
-    }
-
-    public void resetZoomWithAnimation() {
-        zoomWithAnimation(minZoom);
-    }
-
-    public void zoomWithAnimation(float centerX, float centerY, float scale) {
-        animationManager.startZoomAnimation(centerX, centerY, zoom, scale);
-    }
-
-    public void zoomWithAnimation(float scale) {
-        animationManager.startZoomAnimation(getWidth() / 2, getHeight() / 2, zoom, scale);
-    }
-
-    private void setScrollHandle(ScrollHandle scrollHandle) {
-        this.scrollHandle = scrollHandle;
-    }
-
-    /**
-     * Get page number at given offset
-     *
-     * @param positionOffset scroll offset between 0 and 1
-     * @return page number at given offset, starting from 0
-     */
-    public int getPageAtPositionOffset(float positionOffset) {
-        int page = (int) Math.floor(getPageCount() * positionOffset);
-        return page == getPageCount() ? page - 1 : page;
-    }
-
-    public float getMinZoom() {
-        return minZoom;
-    }
-
-    public void setMinZoom(float minZoom) {
-        this.minZoom = minZoom;
-    }
-
-    public float getMidZoom() {
-        return midZoom;
-    }
-
-    public void setMidZoom(float midZoom) {
-        this.midZoom = midZoom;
-    }
-
-    public float getMaxZoom() {
-        return maxZoom;
-    }
-
-    public void setMaxZoom(float maxZoom) {
-        this.maxZoom = maxZoom;
-    }
-
-    public void useBestQuality(boolean bestQuality) {
-        this.bestQuality = bestQuality;
-    }
-
-    public boolean isBestQuality() {
-        return bestQuality;
-    }
-
-    public boolean isSwipeVertical() {
-        return swipeVertical;
-    }
-
-    public void setSwipeVertical(boolean swipeVertical) {
-        this.swipeVertical = swipeVertical;
-    }
-
-    public void enableAnnotationRendering(boolean annotationRendering) {
-        this.annotationRendering = annotationRendering;
-    }
-
-    public boolean isAnnotationRendering() {
-        return annotationRendering;
-    }
-
-    public void enableRenderDuringScale(boolean renderDuringScale) {
-        this.renderDuringScale = renderDuringScale;
-    }
-
-    public boolean isAntialiasing() {
-        return enableAntialiasing;
-    }
-
-    public void enableAntialiasing(boolean enableAntialiasing) {
-        this.enableAntialiasing = enableAntialiasing;
-    }
-
-    int getSpacingPx() {
-        return spacingPx;
-    }
-
-    private void setSpacing(int spacing) {
-        this.spacingPx = Util.getDP(getContext(), spacing);
-    }
-
-    public boolean doRenderDuringScale() {
-        return renderDuringScale;
-    }
-
-    public PdfDocument.Meta getDocumentMeta() {
-        if (pdfDocument == null) {
-            return null;
-        }
-        return pdfiumCore.getDocumentMeta(pdfDocument);
-    }
-
-    public List<PdfDocument.Bookmark> getTableOfContents() {
-        if (pdfDocument == null) {
-            return new ArrayList<>();
-        }
-        return pdfiumCore.getTableOfContents(pdfDocument);
-    }
-
-    /**
-     * Use an asset file as the pdf source
-     */
-    public Configurator fromAsset(String assetName) {
-        return new Configurator(new AssetSource(assetName));
-    }
-
-    /**
-     * Use a file as the pdf source
-     */
-    public Configurator fromFile(File file) {
-        return new Configurator(new FileSource(file));
-    }
-
-    /**
-     * Use URI as the pdf source, for use with content providers
-     */
-    public Configurator fromUri(Uri uri) {
-        return new Configurator(new UriSource(uri));
-    }
-
-    /**
-     * Use bytearray as the pdf source, documents is not saved
-     *
-     * @param bytes
-     * @return
-     */
-    public Configurator fromBytes(byte[] bytes) {
-        return new Configurator(new ByteArraySource(bytes));
-    }
-
-    public Configurator fromStream(InputStream stream) {
-        return new Configurator(new InputStreamSource(stream));
-    }
-
-    /**
-     * Use custom source as pdf source
-     */
-    public Configurator fromSource(DocumentSource docSource) {
-        return new Configurator(docSource);
-    }
-
-    private enum State {DEFAULT, LOADED, SHOWN, ERROR}
-
-    public class Configurator {
-
-        private final DocumentSource documentSource;
-
-        private int[] pageNumbers = null;
-
-        private boolean enableSwipe = true;
-
-        private boolean enableDoubletap = true;
-
-        private OnDrawListener onDrawListener;
-
-        private OnDrawListener onDrawAllListener;
-
-        private OnLoadCompleteListener onLoadCompleteListener;
-
-        private OnErrorListener onErrorListener;
-
-        private OnPageChangeListener onPageChangeListener;
-
-        private OnPageScrollListener onPageScrollListener;
-
-        private OnRenderListener onRenderListener;
-
-        private int defaultPage = 0;
-
-        private boolean swipeHorizontal = false;
-
-        private boolean annotationRendering = false;
-
-        private String password = null;
-
-        private ScrollHandle scrollHandle = null;
-
-        private boolean antialiasing = true;
-
-        private int spacing = 0;
-
-        private Configurator(DocumentSource documentSource) {
-            this.documentSource = documentSource;
-        }
-
-        public Configurator pages(int... pageNumbers) {
-            this.pageNumbers = pageNumbers;
-            return this;
-        }
-
-        public Configurator enableSwipe(boolean enableSwipe) {
-            this.enableSwipe = enableSwipe;
-            return this;
-        }
-
-        public Configurator enableDoubletap(boolean enableDoubletap) {
-            this.enableDoubletap = enableDoubletap;
-            return this;
-        }
-
-        public Configurator enableAnnotationRendering(boolean annotationRendering) {
-            this.annotationRendering = annotationRendering;
-            return this;
-        }
-
-        public Configurator onDraw(OnDrawListener onDrawListener) {
-            this.onDrawListener = onDrawListener;
-            return this;
-        }
-
-        public Configurator onDrawAll(OnDrawListener onDrawAllListener) {
-            this.onDrawAllListener = onDrawAllListener;
-            return this;
-        }
-
-        public Configurator onLoad(OnLoadCompleteListener onLoadCompleteListener) {
-            this.onLoadCompleteListener = onLoadCompleteListener;
-            return this;
-        }
-
-        public Configurator onPageScroll(OnPageScrollListener onPageScrollListener) {
-            this.onPageScrollListener = onPageScrollListener;
-            return this;
-        }
-
-        public Configurator onError(OnErrorListener onErrorListener) {
-            this.onErrorListener = onErrorListener;
-            return this;
-        }
-
-        public Configurator onPageChange(OnPageChangeListener onPageChangeListener) {
-            this.onPageChangeListener = onPageChangeListener;
-            return this;
-        }
-
-        public Configurator onRender(OnRenderListener onRenderListener) {
-            this.onRenderListener = onRenderListener;
-            return this;
-        }
-
-        public Configurator defaultPage(int defaultPage) {
-            this.defaultPage = defaultPage;
-            return this;
-        }
-
-        public Configurator swipeHorizontal(boolean swipeHorizontal) {
-            this.swipeHorizontal = swipeHorizontal;
-            return this;
-        }
-
-        public Configurator password(String password) {
-            this.password = password;
-            return this;
-        }
-
-        public Configurator scrollHandle(ScrollHandle scrollHandle) {
-            this.scrollHandle = scrollHandle;
-            return this;
-        }
-
-        public Configurator enableAntialiasing(boolean antialiasing) {
-            this.antialiasing = antialiasing;
-            return this;
-        }
-
-        public Configurator spacing(int spacing) {
-            this.spacing = spacing;
-            return this;
-        }
-
-        public void load() {
-            PDFView.this.recycle();
-            PDFView.this.setOnDrawListener(onDrawListener);
-            PDFView.this.setOnDrawAllListener(onDrawAllListener);
-            PDFView.this.setOnPageChangeListener(onPageChangeListener);
-            PDFView.this.setOnPageScrollListener(onPageScrollListener);
-            PDFView.this.setOnRenderListener(onRenderListener);
-            PDFView.this.enableSwipe(enableSwipe);
-            PDFView.this.enableDoubletap(enableDoubletap);
-            PDFView.this.setDefaultPage(defaultPage);
-            PDFView.this.setSwipeVertical(!swipeHorizontal);
-            PDFView.this.enableAnnotationRendering(annotationRendering);
-            PDFView.this.setScrollHandle(scrollHandle);
-            PDFView.this.enableAntialiasing(antialiasing);
-            PDFView.this.setSpacing(spacing);
-            PDFView.this.dragPinchManager.setSwipeVertical(swipeVertical);
-            if (pageNumbers != null) {
-                PDFView.this.load(documentSource, password, onLoadCompleteListener, onErrorListener, pageNumbers);
-            } else {
-                PDFView.this.load(documentSource, password, onLoadCompleteListener, onErrorListener);
-            }
-        }
-    }
-}

+ 0 - 275
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/PagesLoader.java

@@ -1,275 +0,0 @@
-package com.github.barteksc.pdfviewer;
-
-
-import android.graphics.RectF;
-import android.util.Pair;
-
-import com.github.barteksc.pdfviewer.util.Constants;
-import com.github.barteksc.pdfviewer.util.MathUtils;
-
-import static com.github.barteksc.pdfviewer.util.Constants.Cache.CACHE_SIZE;
-
-class PagesLoader {
-
-    private PDFView pdfView;
-
-
-    // variables set on every call to loadPages()
-    private int cacheOrder;
-    private float scaledHeight;
-    private float scaledWidth;
-    private Pair<Integer, Integer> colsRows;
-    private float xOffset;
-    private float yOffset;
-    private float rowHeight;
-    private float colWidth;
-    private float pageRelativePartWidth;
-    private float pageRelativePartHeight;
-    private float partRenderWidth;
-    private float partRenderHeight;
-    private int thumbnailWidth;
-    private int thumbnailHeight;
-    private float scaledSpacingPx;
-    private final RectF thumbnailRect = new RectF(0, 0, 1, 1);
-
-    private class Holder {
-        int page;
-        int row;
-        int col;
-    }
-
-    PagesLoader(PDFView pdfView) {
-        this.pdfView = pdfView;
-    }
-
-    private Pair<Integer, Integer> getPageColsRows() {
-        float ratioX = 1f / pdfView.getOptimalPageWidth();
-        float ratioY = 1f / pdfView.getOptimalPageHeight();
-        final float partHeight = (Constants.PART_SIZE * ratioY) / pdfView.getZoom();
-        final float partWidth = (Constants.PART_SIZE * ratioX) / pdfView.getZoom();
-        final int nbRows = MathUtils.ceil(1f / partHeight);
-        final int nbCols = MathUtils.ceil(1f / partWidth);
-        return new Pair<>(nbCols, nbRows);
-    }
-
-    private int documentPage(int userPage) {
-        int documentPage = userPage;
-        if (pdfView.getOriginalUserPages() != null) {
-            if (userPage < 0 || userPage >= pdfView.getOriginalUserPages().length) {
-                return -1;
-            } else {
-                documentPage = pdfView.getOriginalUserPages()[userPage];
-            }
-        }
-
-        if (documentPage < 0 || userPage >= pdfView.getDocumentPageCount()) {
-            return -1;
-        }
-
-        return documentPage;
-    }
-
-    /**
-     * @param offset
-     * @param endOffset, if true, then rounding up, else rounding down
-     * @return
-     */
-    private Holder getPageAndCoordsByOffset(float offset, boolean endOffset) {
-        Holder holder = new Holder();
-        float fixOffset = -MathUtils.max(offset, 0);
-        float row, col;
-
-        if (pdfView.isSwipeVertical()) {
-            holder.page = MathUtils.floor(fixOffset / (scaledHeight + scaledSpacingPx));
-            row = Math.abs(fixOffset - (scaledHeight + scaledSpacingPx) * holder.page) / rowHeight;
-            col = xOffset / colWidth;
-        } else {
-            holder.page = MathUtils.floor(fixOffset / (scaledWidth + scaledSpacingPx));
-            col = Math.abs(fixOffset - (scaledWidth + scaledSpacingPx) * holder.page) / colWidth;
-            row = yOffset / rowHeight;
-        }
-
-        if (endOffset) {
-            holder.row = MathUtils.ceil(row);
-            holder.col = MathUtils.ceil(col);
-        } else {
-            holder.row = MathUtils.floor(row);
-            holder.col = MathUtils.floor(col);
-        }
-        return holder;
-    }
-
-    private void loadThumbnail(int userPage, int documentPage) {
-        if (!pdfView.cacheManager.containsThumbnail(userPage, documentPage,
-                thumbnailWidth, thumbnailHeight, thumbnailRect)) {
-            pdfView.renderingHandler.addRenderingTask(userPage, documentPage,
-                    thumbnailWidth, thumbnailHeight, thumbnailRect,
-                    true, 0, pdfView.isBestQuality(), pdfView.isAnnotationRendering());
-        }
-    }
-
-    /**
-     * @param number if < 0 then row (column) is above view, else row (column) is visible or below view
-     * @return
-     */
-    private int loadRelative(int number, int nbOfPartsLoadable, boolean belowView) {
-        int loaded = 0;
-        float newOffset;
-        if (pdfView.isSwipeVertical()) {
-            float rowsHeight = rowHeight * number + 1;
-            newOffset = pdfView.getCurrentYOffset() - (belowView ? pdfView.getHeight() : 0) - rowsHeight;
-        } else {
-            float colsWidth = colWidth * number;
-            newOffset = pdfView.getCurrentXOffset() - (belowView ? pdfView.getWidth() : 0) - colsWidth;
-        }
-
-        Holder holder = getPageAndCoordsByOffset(newOffset, false);
-        int documentPage = documentPage(holder.page);
-        if (documentPage < 0) {
-            return 0;
-        }
-        loadThumbnail(holder.page, documentPage);
-
-        if (pdfView.isSwipeVertical()) {
-            int firstCol = MathUtils.floor(xOffset / colWidth);
-            firstCol = MathUtils.min(firstCol - 1, 0);
-            int lastCol = MathUtils.ceil((xOffset + pdfView.getWidth()) / colWidth);
-            lastCol = MathUtils.max(lastCol + 1, colsRows.first);
-            for (int col = firstCol; col <= lastCol; col++) {
-                if (loadCell(holder.page, documentPage, holder.row, col, pageRelativePartWidth, pageRelativePartHeight)) {
-                    loaded++;
-                }
-                if (loaded >= nbOfPartsLoadable) {
-                    return loaded;
-                }
-            }
-        } else {
-            int firstRow = MathUtils.floor(yOffset / rowHeight);
-            firstRow = MathUtils.min(firstRow - 1, 0);
-            int lastRow = MathUtils.ceil((yOffset + pdfView.getHeight()) / rowHeight);
-            lastRow = MathUtils.max(lastRow + 1, colsRows.second);
-            for (int row = firstRow; row <= lastRow; row++) {
-                if (loadCell(holder.page, documentPage, row, holder.col, pageRelativePartWidth, pageRelativePartHeight)) {
-                    loaded++;
-                }
-                if (loaded >= nbOfPartsLoadable) {
-                    return loaded;
-                }
-            }
-        }
-
-        return loaded;
-    }
-
-    public int loadVisible() {
-        int parts = 0;
-        Holder firstHolder, lastHolder;
-        if (pdfView.isSwipeVertical()) {
-            firstHolder = getPageAndCoordsByOffset(pdfView.getCurrentYOffset(), false);
-            lastHolder = getPageAndCoordsByOffset(pdfView.getCurrentYOffset() - pdfView.getHeight() + 1, true);
-            int visibleRows = 0;
-            if (firstHolder.page == lastHolder.page) {
-                visibleRows = lastHolder.row - firstHolder.row + 1;
-            } else {
-                visibleRows += colsRows.second - firstHolder.row;
-                for (int page = firstHolder.page + 1; page < lastHolder.page; page++) {
-                    visibleRows += colsRows.second;
-                }
-                visibleRows += lastHolder.row + 1;
-            }
-
-            for (int i = 0; i < visibleRows && parts < CACHE_SIZE; i++) {
-                parts += loadRelative(i, CACHE_SIZE - parts, false);
-            }
-        } else {
-            firstHolder = getPageAndCoordsByOffset(pdfView.getCurrentXOffset(), false);
-            lastHolder = getPageAndCoordsByOffset(pdfView.getCurrentXOffset() - pdfView.getWidth() + 1, true);
-            int visibleCols = 0;
-            if (firstHolder.page == lastHolder.page) {
-                visibleCols = lastHolder.col - firstHolder.col + 1;
-            } else {
-                visibleCols += colsRows.first - firstHolder.col;
-                for (int page = firstHolder.page + 1; page < lastHolder.page; page++) {
-                    visibleCols += colsRows.first;
-                }
-                visibleCols += lastHolder.col + 1;
-            }
-
-            for (int i = 0; i < visibleCols && parts < CACHE_SIZE; i++) {
-                parts += loadRelative(i, CACHE_SIZE - parts, false);
-            }
-        }
-        int prevDocPage = documentPage(firstHolder.page - 1);
-        if (prevDocPage >= 0) {
-            loadThumbnail(firstHolder.page - 1, prevDocPage);
-        }
-        int nextDocPage = documentPage(firstHolder.page + 1);
-        if (nextDocPage >= 0) {
-            loadThumbnail(firstHolder.page + 1, nextDocPage);
-        }
-        return parts;
-    }
-
-    private boolean loadCell(int userPage, int documentPage, int row, int col, float pageRelativePartWidth, float pageRelativePartHeight) {
-
-        float relX = pageRelativePartWidth * col;
-        float relY = pageRelativePartHeight * row;
-        float relWidth = pageRelativePartWidth;
-        float relHeight = pageRelativePartHeight;
-
-        // Adjust width and height to
-        // avoid being outside the page
-        float renderWidth = partRenderWidth;
-        float renderHeight = partRenderHeight;
-        if (relX + relWidth > 1) {
-            relWidth = 1 - relX;
-        }
-        if (relY + relHeight > 1) {
-            relHeight = 1 - relY;
-        }
-        renderWidth *= relWidth;
-        renderHeight *= relHeight;
-        RectF pageRelativeBounds = new RectF(relX, relY, relX + relWidth, relY + relHeight);
-
-        if (renderWidth > 0 && renderHeight > 0) {
-            if (!pdfView.cacheManager.upPartIfContained(userPage, documentPage, renderWidth, renderHeight, pageRelativeBounds, cacheOrder)) {
-                pdfView.renderingHandler.addRenderingTask(userPage, documentPage,
-                        renderWidth, renderHeight, pageRelativeBounds, false, cacheOrder,
-                        pdfView.isBestQuality(), pdfView.isAnnotationRendering());
-            }
-
-            cacheOrder++;
-            return true;
-        }
-        return false;
-    }
-
-    public void loadPages() {
-        scaledHeight = pdfView.toCurrentScale(pdfView.getOptimalPageHeight());
-        scaledWidth = pdfView.toCurrentScale(pdfView.getOptimalPageWidth());
-        thumbnailWidth = (int) (pdfView.getOptimalPageWidth() * Constants.THUMBNAIL_RATIO);
-        thumbnailHeight = (int) (pdfView.getOptimalPageHeight() * Constants.THUMBNAIL_RATIO);
-        colsRows = getPageColsRows();
-        xOffset = -MathUtils.max(pdfView.getCurrentXOffset(), 0);
-        yOffset = -MathUtils.max(pdfView.getCurrentYOffset(), 0);
-        rowHeight = scaledHeight / colsRows.second;
-        colWidth = scaledWidth / colsRows.first;
-        pageRelativePartWidth = 1f / (float) colsRows.first;
-        pageRelativePartHeight = 1f / (float) colsRows.second;
-        partRenderWidth = Constants.PART_SIZE / pageRelativePartWidth;
-        partRenderHeight = Constants.PART_SIZE / pageRelativePartHeight;
-        cacheOrder = 1;
-        scaledSpacingPx = pdfView.toCurrentScale(pdfView.getSpacingPx());
-        scaledSpacingPx -= scaledSpacingPx / pdfView.getPageCount();
-        int loaded = loadVisible();
-        if (pdfView.getScrollDir().equals(PDFView.ScrollDir.END)) { // if scrolling to end, preload next view
-            for (int i = 0; i < Constants.PRELOAD_COUNT && loaded < CACHE_SIZE; i++) {
-                loaded += loadRelative(i, loaded, true);
-            }
-        } else { // if scrolling to start, preload previous view
-            for (int i = 0; i > -Constants.PRELOAD_COUNT && loaded < CACHE_SIZE; i--) {
-                loaded += loadRelative(i, loaded, false);
-            }
-        }
-    }
-}

+ 0 - 160
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/RenderingHandler.java

@@ -1,160 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer;
-
-import android.graphics.Bitmap;
-import android.graphics.Matrix;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-
-import com.github.barteksc.pdfviewer.model.PagePart;
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * A {@link Handler} that will process incoming {@link RenderingTask} messages
- * and alert {@link PDFView#onBitmapRendered(PagePart)} when the portion of the
- * PDF is ready to render.
- */
-class RenderingHandler extends Handler {
-    /**
-     * {@link Message#what} kind of message this handler processes.
-     */
-    static final int MSG_RENDER_TASK = 1;
-
-    private PdfiumCore pdfiumCore;
-    private PdfDocument pdfDocument;
-
-    private PDFView pdfView;
-
-    private RectF renderBounds = new RectF();
-    private Rect roundedRenderBounds = new Rect();
-    private Matrix renderMatrix = new Matrix();
-    private final Set<Integer> openedPages = new HashSet<>();
-    private boolean running = false;
-
-    RenderingHandler(Looper looper, PDFView pdfView, PdfiumCore pdfiumCore, PdfDocument pdfDocument) {
-        super(looper);
-        this.pdfView = pdfView;
-        this.pdfiumCore = pdfiumCore;
-        this.pdfDocument = pdfDocument;
-    }
-
-    void addRenderingTask(int userPage, int page, float width, float height, RectF bounds, boolean thumbnail, int cacheOrder, boolean bestQuality, boolean annotationRendering) {
-        RenderingTask task = new RenderingTask(width, height, bounds, userPage, page, thumbnail, cacheOrder, bestQuality, annotationRendering);
-        Message msg = obtainMessage(MSG_RENDER_TASK, task);
-        sendMessage(msg);
-    }
-
-    @Override
-    public void handleMessage(Message message) {
-        RenderingTask task = (RenderingTask) message.obj;
-        final PagePart part = proceed(task);
-        if (part != null) {
-            if (running) {
-                pdfView.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        pdfView.onBitmapRendered(part);
-                    }
-                });
-            } else {
-                part.getRenderedBitmap().recycle();
-            }
-        }
-    }
-
-    private PagePart proceed(RenderingTask renderingTask) {
-        if (!openedPages.contains(renderingTask.page)) {
-            openedPages.add(renderingTask.page);
-            pdfiumCore.openPage(pdfDocument, renderingTask.page);
-        }
-
-        int w = Math.round(renderingTask.width);
-        int h = Math.round(renderingTask.height);
-        Bitmap render;
-        try {
-            render = Bitmap.createBitmap(w, h, renderingTask.bestQuality ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
-        } catch (IllegalArgumentException e) {
-            e.printStackTrace();
-            return null;
-        }
-        calculateBounds(w, h, renderingTask.bounds);
-        pdfiumCore.renderPageBitmap(pdfDocument, render, renderingTask.page,
-                roundedRenderBounds.left, roundedRenderBounds.top,
-                roundedRenderBounds.width(), roundedRenderBounds.height(), renderingTask.annotationRendering);
-
-        return new PagePart(renderingTask.userPage, renderingTask.page, render,
-                renderingTask.width, renderingTask.height,
-                renderingTask.bounds, renderingTask.thumbnail,
-                renderingTask.cacheOrder);
-    }
-
-    private void calculateBounds(int width, int height, RectF pageSliceBounds) {
-        renderMatrix.reset();
-        renderMatrix.postTranslate(-pageSliceBounds.left * width, -pageSliceBounds.top * height);
-        renderMatrix.postScale(1 / pageSliceBounds.width(), 1 / pageSliceBounds.height());
-
-        renderBounds.set(0, 0, width, height);
-        renderMatrix.mapRect(renderBounds);
-        renderBounds.round(roundedRenderBounds);
-    }
-
-    void stop() {
-        running = false;
-    }
-
-    void start() {
-        running = true;
-    }
-
-    private class RenderingTask {
-
-        float width, height;
-
-        RectF bounds;
-
-        int page;
-
-        int userPage;
-
-        boolean thumbnail;
-
-        int cacheOrder;
-
-        boolean bestQuality;
-
-        boolean annotationRendering;
-
-        RenderingTask(float width, float height, RectF bounds, int userPage, int page, boolean thumbnail, int cacheOrder, boolean bestQuality, boolean annotationRendering) {
-            this.page = page;
-            this.width = width;
-            this.height = height;
-            this.bounds = bounds;
-            this.userPage = userPage;
-            this.thumbnail = thumbnail;
-            this.cacheOrder = cacheOrder;
-            this.bestQuality = bestQuality;
-            this.annotationRendering = annotationRendering;
-        }
-    }
-}

+ 0 - 28
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/exception/FileNotFoundException.java

@@ -1,28 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.exception;
-
-@Deprecated
-public class FileNotFoundException extends RuntimeException {
-
-    public FileNotFoundException(String detailMessage) {
-        super(detailMessage);
-    }
-
-    public FileNotFoundException(String detailMessage, Throwable throwable) {
-        super(detailMessage, throwable);
-    }
-}

+ 0 - 38
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnDrawListener.java

@@ -1,38 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.listener;
-
-import android.graphics.Canvas;
-
-/**
- * This interface allows an extern class to draw
- * something on the PDFView canvas, above all images.
- */
-public interface OnDrawListener {
-
-    /**
-     * This method is called when the PDFView is
-     * drawing its view.
-     * <p>
-     * The page is starting at (0,0)
-     *
-     * @param canvas        The canvas on which to draw things.
-     * @param pageWidth     The width of the current page.
-     * @param pageHeight    The height of the current page.
-     * @param displayedPage The current page index
-     */
-    void onLayerDrawn(Canvas canvas, float pageWidth, float pageHeight, int displayedPage);
-}

+ 0 - 25
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnErrorListener.java

@@ -1,25 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.listener;
-
-public interface OnErrorListener {
-
-    /**
-     * Called if error occurred while opening PDF
-     * @param t Throwable with error
-     */
-    void onError(Throwable t);
-}

+ 0 - 29
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnLoadCompleteListener.java

@@ -1,29 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.listener;
-
-/**
- * Implement this interface to receive events from PDFView
- * when loading is complete.
- */
-public interface OnLoadCompleteListener {
-
-    /**
-     * Called when the PDF is loaded
-     * @param nbPages the number of pages in this PDF file
-     */
-    void loadComplete(int nbPages);
-}

+ 0 - 32
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnPageChangeListener.java

@@ -1,32 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.listener;
-
-/**
- * Implements this interface to receive events from PDFView
- * when a page has changed through swipe
- */
-public interface OnPageChangeListener {
-
-    /**
-     * Called when the user use swipe to change page
-     *
-     * @param page      the new page displayed, starting from 0
-     * @param pageCount the total page count
-     */
-    void onPageChanged(int page, int pageCount);
-
-}

+ 0 - 31
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnPageScrollListener.java

@@ -1,31 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.listener;
-
-/**
- * Implements this interface to receive events from PDFView
- * when a page has been scrolled
- */
-public interface OnPageScrollListener {
-
-    /**
-     * Called on every move while scrolling
-     *
-     * @param page current page index
-     * @param positionOffset see {@link com.github.barteksc.pdfviewer.PDFView#getPositionOffset()}
-     */
-    void onPageScrolled(int page, float positionOffset);
-}

+ 0 - 27
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnRenderListener.java

@@ -1,27 +0,0 @@
-/**
- * Copyright 2017 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.listener;
-
-public interface OnRenderListener {
-
-    /**
-     * Called only once, when document is rendered
-     * @param nbPages number of pages
-     * @param pageWidth width of page
-     * @param pageHeight height of page
-     */
-    void onInitiallyRendered(int nbPages, float pageWidth, float pageHeight);
-}

+ 0 - 100
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/model/PagePart.java

@@ -1,100 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.model;
-
-import android.graphics.Bitmap;
-import android.graphics.RectF;
-
-public class PagePart {
-
-    private int userPage;
-
-    private int page;
-
-    private Bitmap renderedBitmap;
-
-    private float width, height;
-
-    private RectF pageRelativeBounds;
-
-    private boolean thumbnail;
-
-    private int cacheOrder;
-
-    public PagePart(int userPage, int page, Bitmap renderedBitmap, float width, float height, RectF pageRelativeBounds, boolean thumbnail, int cacheOrder) {
-        super();
-        this.userPage = userPage;
-        this.page = page;
-        this.renderedBitmap = renderedBitmap;
-        this.pageRelativeBounds = pageRelativeBounds;
-        this.thumbnail = thumbnail;
-        this.cacheOrder = cacheOrder;
-    }
-
-    public int getCacheOrder() {
-        return cacheOrder;
-    }
-
-    public int getPage() {
-        return page;
-    }
-
-    public int getUserPage() {
-        return userPage;
-    }
-
-    public Bitmap getRenderedBitmap() {
-        return renderedBitmap;
-    }
-
-    public RectF getPageRelativeBounds() {
-        return pageRelativeBounds;
-    }
-
-    public float getWidth() {
-        return width;
-    }
-
-    public float getHeight() {
-        return height;
-    }
-
-    public boolean isThumbnail() {
-        return thumbnail;
-    }
-
-    public void setCacheOrder(int cacheOrder) {
-        this.cacheOrder = cacheOrder;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof PagePart)) {
-            return false;
-        }
-
-        PagePart part = (PagePart) obj;
-        return part.getPage() == page
-                && part.getUserPage() == userPage
-                && part.getWidth() == width
-                && part.getHeight() == height
-                && part.getPageRelativeBounds().left == pageRelativeBounds.left
-                && part.getPageRelativeBounds().right == pageRelativeBounds.right
-                && part.getPageRelativeBounds().top == pageRelativeBounds.top
-                && part.getPageRelativeBounds().bottom == pageRelativeBounds.bottom;
-    }
-
-}

+ 0 - 236
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/DefaultScrollHandle.java

@@ -1,236 +0,0 @@
-package com.github.barteksc.pdfviewer.scroll;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.support.v4.content.ContextCompat;
-import android.util.TypedValue;
-import android.view.MotionEvent;
-import android.view.ViewGroup;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.github.barteksc.pdfviewer.PDFView;
-import com.github.barteksc.pdfviewer.R;
-import com.github.barteksc.pdfviewer.util.Util;
-
-public class DefaultScrollHandle extends RelativeLayout implements ScrollHandle {
-
-    private final static int HANDLE_LONG = 65;
-    private final static int HANDLE_SHORT = 40;
-    private final static int DEFAULT_TEXT_SIZE = 16;
-
-    private float relativeHandlerMiddle = 0f;
-
-    protected TextView textView;
-    protected Context context;
-    private boolean inverted;
-    private PDFView pdfView;
-    private float currentPos;
-
-    private Handler handler = new Handler();
-    private Runnable hidePageScrollerRunnable = new Runnable() {
-        @Override
-        public void run() {
-            hide();
-        }
-    };
-
-    public DefaultScrollHandle(Context context) {
-        this(context, false);
-    }
-
-    public DefaultScrollHandle(Context context, boolean inverted) {
-        super(context);
-        this.context = context;
-        this.inverted = inverted;
-        textView = new TextView(context);
-        setVisibility(INVISIBLE);
-        setTextColor(Color.BLACK);
-        setTextSize(DEFAULT_TEXT_SIZE);
-    }
-
-    @Override
-    public void setupLayout(PDFView pdfView) {
-        int align, width, height;
-        Drawable background;
-        // determine handler position, default is right (when scrolling vertically) or bottom (when scrolling horizontally)
-        if (pdfView.isSwipeVertical()) {
-            width = HANDLE_LONG;
-            height = HANDLE_SHORT;
-            if (inverted) { // left
-                align = ALIGN_PARENT_LEFT;
-                background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_left);
-            } else { // right
-                align = ALIGN_PARENT_RIGHT;
-                background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_right);
-            }
-        } else {
-            width = HANDLE_SHORT;
-            height = HANDLE_LONG;
-            if (inverted) { // top
-                align = ALIGN_PARENT_TOP;
-                background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_top);
-            } else { // bottom
-                align = ALIGN_PARENT_BOTTOM;
-                background = ContextCompat.getDrawable(context, R.drawable.default_scroll_handle_bottom);
-            }
-        }
-
-        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
-            setBackgroundDrawable(background);
-        } else {
-            setBackground(background);
-        }
-
-        LayoutParams lp = new LayoutParams(Util.getDP(context, width), Util.getDP(context, height));
-        lp.setMargins(0, 0, 0, 0);
-
-        LayoutParams tvlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-        tvlp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
-
-        addView(textView, tvlp);
-
-        lp.addRule(align);
-        pdfView.addView(this, lp);
-
-        this.pdfView = pdfView;
-    }
-
-    @Override
-    public void destroyLayout() {
-        pdfView.removeView(this);
-    }
-
-    @Override
-    public void setScroll(float position) {
-        if (!shown()) {
-            show();
-        } else {
-            handler.removeCallbacks(hidePageScrollerRunnable);
-        }
-        setPosition((pdfView.isSwipeVertical() ? pdfView.getHeight() : pdfView.getWidth()) * position);
-    }
-
-    private void setPosition(float pos) {
-        if (Float.isInfinite(pos) || Float.isNaN(pos)) {
-            return;
-        }
-        float pdfViewSize;
-        if (pdfView.isSwipeVertical()) {
-            pdfViewSize = pdfView.getHeight();
-        } else {
-            pdfViewSize = pdfView.getWidth();
-        }
-        pos -= relativeHandlerMiddle;
-
-        if (pos < 0) {
-            pos = 0;
-        } else if (pos > pdfViewSize - Util.getDP(context, HANDLE_SHORT)) {
-            pos = pdfViewSize - Util.getDP(context, HANDLE_SHORT);
-        }
-
-        if (pdfView.isSwipeVertical()) {
-            setY(pos);
-        } else {
-            setX(pos);
-        }
-
-        calculateMiddle();
-        invalidate();
-    }
-
-    private void calculateMiddle() {
-        float pos, viewSize, pdfViewSize;
-        if (pdfView.isSwipeVertical()) {
-            pos = getY();
-            viewSize = getHeight();
-            pdfViewSize = pdfView.getHeight();
-        } else {
-            pos = getX();
-            viewSize = getWidth();
-            pdfViewSize = pdfView.getWidth();
-        }
-        relativeHandlerMiddle = ((pos + relativeHandlerMiddle) / pdfViewSize) * viewSize;
-    }
-
-    @Override
-    public void hideDelayed() {
-        handler.postDelayed(hidePageScrollerRunnable, 1000);
-    }
-
-    @Override
-    public void setPageNum(int pageNum) {
-        String text = String.valueOf(pageNum);
-        if (!textView.getText().equals(text)) {
-            textView.setText(text);
-        }
-    }
-
-    @Override
-    public boolean shown() {
-        return getVisibility() == VISIBLE;
-    }
-
-    @Override
-    public void show() {
-        setVisibility(VISIBLE);
-    }
-
-    @Override
-    public void hide() {
-        setVisibility(INVISIBLE);
-    }
-
-    public void setTextColor(int color) {
-        textView.setTextColor(color);
-    }
-
-    /**
-     * @param size text size in dp
-     */
-    public void setTextSize(int size) {
-        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size);
-    }
-
-    private boolean isPDFViewReady() {
-        return pdfView != null && pdfView.getPageCount() > 0 && !pdfView.documentFitsView();
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent event) {
-
-        if (!isPDFViewReady()) {
-            return super.onTouchEvent(event);
-        }
-
-        switch (event.getAction()) {
-            case MotionEvent.ACTION_DOWN:
-            case MotionEvent.ACTION_POINTER_DOWN:
-                pdfView.stopFling();
-                handler.removeCallbacks(hidePageScrollerRunnable);
-                if (pdfView.isSwipeVertical()) {
-                    currentPos = event.getRawY() - getY();
-                } else {
-                    currentPos = event.getRawX() - getX();
-                }
-            case MotionEvent.ACTION_MOVE:
-                if (pdfView.isSwipeVertical()) {
-                    setPosition(event.getRawY() - currentPos + relativeHandlerMiddle);
-                    pdfView.setPositionOffset(relativeHandlerMiddle / (float) getHeight(), false);
-                } else {
-                    setPosition(event.getRawX() - currentPos + relativeHandlerMiddle);
-                    pdfView.setPositionOffset(relativeHandlerMiddle / (float) getWidth(), false);
-                }
-                return true;
-            case MotionEvent.ACTION_CANCEL:
-            case MotionEvent.ACTION_UP:
-            case MotionEvent.ACTION_POINTER_UP:
-                hideDelayed();
-                return true;
-        }
-
-        return super.onTouchEvent(event);
-    }
-}

+ 0 - 57
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/ScrollHandle.java

@@ -1,57 +0,0 @@
-package com.github.barteksc.pdfviewer.scroll;
-
-import com.github.barteksc.pdfviewer.PDFView;
-
-public interface ScrollHandle {
-
-    /**
-     * Used to move the handle, called internally by PDFView
-     *
-     * @param position current scroll ratio between 0 and 1
-     */
-    void setScroll(float position);
-
-    /**
-     * Method called by PDFView after setting scroll handle.
-     * Do not call this method manually.
-     * For usage sample see {@link DefaultScrollHandle}
-     *
-     * @param pdfView PDFView instance
-     */
-    void setupLayout(PDFView pdfView);
-
-    /**
-     * Method called by PDFView when handle should be removed from layout
-     * Do not call this method manually.
-     */
-    void destroyLayout();
-
-    /**
-     * Set page number displayed on handle
-     *
-     * @param pageNum page number
-     */
-    void setPageNum(int pageNum);
-
-    /**
-     * Get handle visibility
-     *
-     * @return true if handle is visible, false otherwise
-     */
-    boolean shown();
-
-    /**
-     * Show handle
-     */
-    void show();
-
-    /**
-     * Hide handle immediately
-     */
-    void hide();
-
-    /**
-     * Hide handle after some time (defined by implementation)
-     */
-    void hideDelayed();
-}

+ 0 - 43
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/AssetSource.java

@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 Bartosz Schiller.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.source;
-
-
-import android.content.Context;
-import android.os.ParcelFileDescriptor;
-
-import com.github.barteksc.pdfviewer.util.FileUtils;
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.io.File;
-import java.io.IOException;
-
-public class AssetSource implements DocumentSource {
-
-    private final String assetName;
-
-    public AssetSource(String assetName) {
-        this.assetName = assetName;
-    }
-
-    @Override
-    public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
-        File f = FileUtils.fileFromAsset(context, assetName);
-        ParcelFileDescriptor pfd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
-        return core.newDocument(pfd, password);
-    }
-}

+ 0 - 37
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/ByteArraySource.java

@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2016 Bartosz Schiller.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.source;
-
-import android.content.Context;
-
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.io.IOException;
-
-public class ByteArraySource implements DocumentSource {
-
-    private byte[] data;
-
-    public ByteArraySource(byte[] data) {
-        this.data = data;
-    }
-
-    @Override
-    public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
-        return core.newDocument(data, password);
-    }
-}

+ 0 - 27
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/DocumentSource.java

@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2016 Bartosz Schiller.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.source;
-
-import android.content.Context;
-
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.io.IOException;
-
-public interface DocumentSource {
-    PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException;
-}

+ 0 - 40
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/FileSource.java

@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2016 Bartosz Schiller.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.source;
-
-import android.content.Context;
-import android.os.ParcelFileDescriptor;
-
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.io.File;
-import java.io.IOException;
-
-public class FileSource implements DocumentSource {
-
-    private File file;
-
-    public FileSource(File file) {
-        this.file = file;
-    }
-
-    @Override
-    public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
-        ParcelFileDescriptor pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
-        return core.newDocument(pfd, password);
-    }
-}

+ 0 - 39
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/InputStreamSource.java

@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2016 Bartosz Schiller.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.source;
-
-import android.content.Context;
-
-import com.github.barteksc.pdfviewer.util.Util;
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class InputStreamSource implements DocumentSource {
-
-    private InputStream inputStream;
-
-    public InputStreamSource(InputStream inputStream) {
-        this.inputStream = inputStream;
-    }
-
-    @Override
-    public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
-        return core.newDocument(Util.toByteArray(inputStream), password);
-    }
-}

+ 0 - 40
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/source/UriSource.java

@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2016 Bartosz Schiller.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.source;
-
-import android.content.Context;
-import android.net.Uri;
-import android.os.ParcelFileDescriptor;
-
-import com.shockwave.pdfium.PdfDocument;
-import com.shockwave.pdfium.PdfiumCore;
-
-import java.io.IOException;
-
-public class UriSource implements DocumentSource {
-
-    private Uri uri;
-
-    public UriSource(Uri uri) {
-        this.uri = uri;
-    }
-
-    @Override
-    public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
-        ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, "r");
-        return core.newDocument(pfd, password);
-    }
-}

+ 0 - 74
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/ArrayUtils.java

@@ -1,74 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ArrayUtils {
-
-    private ArrayUtils() {
-        // Prevents instantiation
-    }
-
-    /** Transforms (0,1,2,2,3) to (0,1,2,3) */
-    public static int[] deleteDuplicatedPages(int[] pages) {
-        List<Integer> result = new ArrayList<>();
-        int lastInt = -1;
-        for (Integer currentInt : pages) {
-            if (lastInt != currentInt) {
-                result.add(currentInt);
-            }
-            lastInt = currentInt;
-        }
-        int[] arrayResult = new int[result.size()];
-        for (int i = 0; i < result.size(); i++) {
-            arrayResult[i] = result.get(i);
-        }
-        return arrayResult;
-    }
-
-    /** Transforms (0, 4, 4, 6, 6, 6, 3) into (0, 1, 1, 2, 2, 2, 3) */
-    public static int[] calculateIndexesInDuplicateArray(int[] originalUserPages) {
-        int[] result = new int[originalUserPages.length];
-        if (originalUserPages.length == 0) {
-            return result;
-        }
-
-        int index = 0;
-        result[0] = index;
-        for (int i = 1; i < originalUserPages.length; i++) {
-            if (originalUserPages[i] != originalUserPages[i - 1]) {
-                index++;
-            }
-            result[i] = index;
-        }
-
-        return result;
-    }
-
-    public static String arrayToString(int[] array) {
-        StringBuilder builder = new StringBuilder("[");
-        for (int i = 0; i < array.length; i++) {
-            builder.append(array[i]);
-            if (i != array.length - 1) {
-                builder.append(",");
-            }
-        }
-        builder.append("]");
-        return builder.toString();
-    }
-}

+ 0 - 51
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/Constants.java

@@ -1,51 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.util;
-
-public class Constants {
-
-    public static boolean DEBUG_MODE = false;
-
-    /** Between 0 and 1, the thumbnails quality (default 0.3). Increasing this value may cause performance decrease */
-    public static float THUMBNAIL_RATIO = 0.3f;
-
-    /**
-     * The size of the rendered parts (default 256)
-     * Tinier : a little bit slower to have the whole page rendered but more reactive.
-     * Bigger : user will have to wait longer to have the first visual results
-     */
-    public static float PART_SIZE = 256;
-
-    /** Number of preloaded rows or columns */
-    public static int PRELOAD_COUNT = 7;
-
-    public static class Cache {
-
-        /** The size of the cache (number of bitmaps kept) */
-        public static int CACHE_SIZE = 120;
-
-        public static int THUMBNAILS_CACHE_SIZE = 6;
-    }
-
-    public static class Pinch {
-
-        public static float MAXIMUM_ZOOM = 10;
-
-        public static float MINIMUM_ZOOM = 1;
-
-    }
-
-}

+ 0 - 62
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/FileUtils.java

@@ -1,62 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.util;
-
-import android.content.Context;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class FileUtils {
-
-    private FileUtils() {
-        // Prevents instantiation
-    }
-
-    public static File fileFromAsset(Context context, String assetName) throws IOException {
-        File outFile = new File(context.getCacheDir(), assetName + "-pdfview.pdf");
-        if (assetName.contains("/")) {
-            outFile.getParentFile().mkdirs();
-        }
-        copy(context.getAssets().open(assetName), outFile);
-        return outFile;
-    }
-
-    public static void copy(InputStream inputStream, File output) throws IOException {
-        OutputStream outputStream = null;
-        try {
-            outputStream = new FileOutputStream(output);
-            int read = 0;
-            byte[] bytes = new byte[1024];
-            while ((read = inputStream.read(bytes)) != -1) {
-                outputStream.write(bytes, 0, read);
-            }
-        } finally {
-            try {
-                if (inputStream != null) {
-                    inputStream.close();
-                }
-            } finally {
-                if (outputStream != null) {
-                    outputStream.close();
-                }
-            }
-        }
-    }
-}

+ 0 - 105
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/MathUtils.java

@@ -1,105 +0,0 @@
-/**
- * Copyright 2016 Bartosz Schiller
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.util;
-
-public class MathUtils {
-
-    static private final int BIG_ENOUGH_INT = 16 * 1024;
-    static private final double BIG_ENOUGH_FLOOR = BIG_ENOUGH_INT;
-    static private final double BIG_ENOUGH_CEIL = 16384.999999999996;
-
-    private MathUtils() {
-        // Prevents instantiation
-    }
-
-    /**
-     * Limits the given <b>number</b> between the other values
-     * @param number  The number to limit.
-     * @param between The smallest value the number can take.
-     * @param and     The biggest value the number can take.
-     * @return The limited number.
-     */
-    public static int limit(int number, int between, int and) {
-        if (number <= between) {
-            return between;
-        }
-        if (number >= and) {
-            return and;
-        }
-        return number;
-    }
-
-    /**
-     * Limits the given <b>number</b> between the other values
-     * @param number  The number to limit.
-     * @param between The smallest value the number can take.
-     * @param and     The biggest value the number can take.
-     * @return The limited number.
-     */
-    public static float limit(float number, float between, float and) {
-        if (number <= between) {
-            return between;
-        }
-        if (number >= and) {
-            return and;
-        }
-        return number;
-    }
-
-    public static float max(float number, float max) {
-        if (number > max) {
-            return max;
-        }
-        return number;
-    }
-
-    public static float min(float number, float min) {
-        if (number < min) {
-            return min;
-        }
-        return number;
-    }
-
-    public static int max(int number, int max) {
-        if (number > max) {
-            return max;
-        }
-        return number;
-    }
-
-    public static int min(int number, int min) {
-        if (number < min) {
-            return min;
-        }
-        return number;
-    }
-
-    /**
-     * Methods from libGDX - https://github.com/libgdx/libgdx
-     */
-
-    /** Returns the largest integer less than or equal to the specified float. This method will only properly floor floats from
-     * -(2^14) to (Float.MAX_VALUE - 2^14). */
-    static public int floor(float value) {
-        return (int) (value + BIG_ENOUGH_FLOOR) - BIG_ENOUGH_INT;
-    }
-
-    /** Returns the smallest integer greater than or equal to the specified float. This method will only properly ceil floats from
-     * -(2^14) to (Float.MAX_VALUE - 2^14). */
-    static public int ceil(float value) {
-        return (int) (value + BIG_ENOUGH_CEIL) - BIG_ENOUGH_INT;
-    }
-}

+ 0 - 41
app_third/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/util/Util.java

@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2016 Bartosz Schiller.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.barteksc.pdfviewer.util;
-
-import android.content.Context;
-import android.util.TypedValue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class Util {
-    private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
-
-    public static int getDP(Context context, int dp) {
-        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
-    }
-
-    public static byte[] toByteArray(InputStream inputStream) throws IOException {
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
-        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
-        int n;
-        while (-1 != (n = inputStream.read(buffer))) {
-            os.write(buffer, 0, n);
-        }
-        return os.toByteArray();
-    }
-}

+ 0 - 12
app_third/android-pdf-viewer/src/main/res/drawable/default_scroll_handle_bottom.xml

@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="rectangle">
-    <stroke
-        android:color="#6C7A89"
-        android:width="1dp" />
-    <corners
-        android:topLeftRadius="10dp"
-        android:topRightRadius="10dp" />
-    <solid android:color="#DADFE1" />
-</shape>

Некоторые файлы не были показаны из-за большого количества измененных файлов