Browse Source

基本完成UU助手的开发工作

Bitliker 8 years ago
parent
commit
4dd14102a5
33 changed files with 185 additions and 520 deletions
  1. 0 474
      WeiChat/src/main/java/com/xzjmyk/pm/activity/MyApplication.java
  2. 14 11
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java
  3. 1 1
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/circle/PMsgDetailActivity.java
  4. 1 1
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/presenter/AddVisitReportPresenter.java
  5. 23 15
      app_core/common/src/main/java/com/common/system/SystemUtil.java
  6. 3 3
      app_core/common/src/main/java/com/core/dao/UUHelperDao.java
  7. 1 0
      app_core/common/src/main/java/com/core/model/OAConfig.java
  8. 1 0
      app_modular/appmessages/build.gradle
  9. 3 0
      app_modular/appmessages/src/main/AndroidManifest.xml
  10. 16 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/activity/UUHelperActivity.java
  11. 25 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/activity/UUHelperDetailsActivity.java
  12. 1 2
      app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/MessageAdapter.java
  13. 9 10
      app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/UUHelperAdapter.java
  14. 1 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java
  15. BIN
      app_modular/appmessages/src/main/res/drawable-hdpi/icon_me.png
  16. BIN
      app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper.png
  17. BIN
      app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper_header.png
  18. BIN
      app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper_takephoto_btn.png
  19. BIN
      app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper_takephoto_btn_pass.png
  20. BIN
      app_modular/appmessages/src/main/res/drawable-xhdpi/icon_me.png
  21. BIN
      app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper.png
  22. BIN
      app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper_header.png
  23. BIN
      app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper_takephoto_btn.png
  24. BIN
      app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper_takephoto_btn_pass.png
  25. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_me.png
  26. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper.png
  27. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper_header.png
  28. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper_takephoto_btn.png
  29. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper_takephoto_btn_pass.png
  30. 7 0
      app_modular/appmessages/src/main/res/drawable/uuhelper_btn_bg.xml
  31. 69 0
      app_modular/appmessages/src/main/res/layout/activity_uuhelper_details.xml
  32. 9 0
      app_modular/appmessages/src/main/res/menu/menu_uuhelper.xml
  33. 1 3
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/DetailTaskActivity.java

+ 0 - 474
WeiChat/src/main/java/com/xzjmyk/pm/activity/MyApplication.java

@@ -1,474 +0,0 @@
-package com.xzjmyk.pm.activity;
-
-import android.app.Activity;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.Config;
-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.preferences.PreferenceUtils;
-import com.common.preferences.SharedUtil;
-import com.core.app.AppConfig;
-import com.core.model.ConfigBean;
-import com.core.model.User;
-import com.core.net.NetWorkObservable;
-import com.core.net.location.BdLocationHelper;
-import com.core.net.ssl.AuthImageDownloader;
-import com.core.net.volley.FastVolley;
-import com.facebook.stetho.Stetho;
-import com.iflytek.cloud.SpeechConstant;
-import com.iflytek.cloud.SpeechUtility;
-import com.lidroid.xutils.HttpUtils;
-import com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache;
-import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
-import com.nostra13.universalimageloader.cache.memory.MemoryCacheAware;
-import com.nostra13.universalimageloader.cache.memory.impl.LRULimitedMemoryCache;
-import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;
-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.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
-import com.umeng.analytics.MobclickAgent;
-import com.umeng.socialize.PlatformConfig;
-import com.uuzuche.lib_zxing.activity.ZXingLibrary;
-import com.core.db.DatabaseManager;
-import com.core.db.SQLiteHelper;
-import com.xzjmyk.pm.activity.ui.SplashActivity;
-import com.core.db.DBOpenHelper;
-import com.xzjmyk.pm.activity.ui.me.TimeStatisticsActivity;
-import com.core.utils.TimeUtils;
-import com.xzjmyk.pm.activity.util.im.Constants;
-import com.core.app.MyActivityManager;
-
-import org.apache.http.cookie.Cookie;
-
-import java.io.File;
-
-import cat.ereza.customactivityoncrash.CustomActivityOnCrash;
-
-public class MyApplication extends BaseApplication {
-  
-    public String JSESSION_B2B;
-//    public static Cookie cookie;
-    public static Cookie cookieERP;
-
-    public static RequestQueue mRequestQueue;
-    public static HttpUtils mHttpUtils;
-   
-
-    private static MyApplication INSTANCE = null;
-
-    public static MyApplication getInstance() {
-        return INSTANCE;
-    }
-
-
-
-
-    @Override
-    public void initConfig() throws Exception {
-        //内存泄漏检测工具初始化
-        /*if (AppConfig.DEBUG){
-            if (LeakCanary.isInAnalyzerProcess(this)) {
-                // This process is dedicated to LeakCanary for heap analysis.
-                // You should not init your app in this process.
-                return;
-            }
-            LeakCanary.install(this);
-        }*/
-        //Stetho调试工具初始化
-        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;
-        ZXingLibrary.initDisplayOpinion(this);
-        mRequestQueue = Volley.newRequestQueue(this);
-
-        mHttpUtils = new HttpUtils();
-        configHttpUtils();
-
-        SharedUtil.init(this);
-        initShareAPI();
-        //  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);
-        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());
-        }
-        // 初始化网络监听
-        mNetWorkObservable = new NetWorkObservable(this);
-        initErpDB();
-    /*    try {
-            com.core.app.Constants.cleanRed(this);
-        } catch (PackageManager.NameNotFoundException e) {
-            e.printStackTrace();
-        }*/
-        registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
-            @Override
-            public void onActivityCreated(Activity activity, Bundle savedInstanceState) {}
-            @Override
-            public void onActivityStarted(Activity activity) {}
-            @Override
-            public void onActivityResumed(Activity activity) {
-                MyActivityManager.getInstance().setCurrentActivity(activity);
-            }
-            @Override
-            public void onActivityPaused(Activity activity) {}
-            @Override
-            public void onActivityStopped(Activity activity) {}
-            @Override
-            public void onActivitySaveInstanceState(Activity activity, Bundle outState) {}
-            @Override
-            public void onActivityDestroyed(Activity activity) {}
-        });
-    }
-
-
-    private void initErpDB() {
-        DatabaseManager.initializeInstance(DBOpenHelper.getInstance(this));
-    }
-
-    /**
-     * @desc:初始化分享组件
-     * @author:Arison on 2016/9/29
-     */
-    public void initShareAPI() {
-        PlatformConfig.setWeixin("wx2539cc96bf158e00", "b057aa3e807ba7c505a2f03cc541bbf6");
-        PlatformConfig.setSinaWeibo("493318722", "7def652c3683603b08bab87d34b1f944");
-        PlatformConfig.setQQZone("1104894295", "Nk8zMIz5YSqwRQ1F");
-    }
-
-    private void initUmengStatistics() {
-        MobclickAgent.UMAnalyticsConfig config = new MobclickAgent.UMAnalyticsConfig(this, "57ea27bb67e58e088c003bbf",
-                "baidu", MobclickAgent.EScenarioType.E_UM_NORMAL);
-        MobclickAgent.startWithConfigure(config);
-    }
-
-    /**
-     * 为HttpUtils配置参数
-     */
-    private void configHttpUtils() {
-        mHttpUtils.configRequestThreadPoolSize(4);
-        mHttpUtils.configRequestRetryCount(3);
-        mHttpUtils.configResponseTextCharset("utf-8");
-        mHttpUtils.configTimeout(10000);
-    }
-
-    /**
-     * 在程序内部关闭时,调用此方法
-     */
-    public void destory() {
-        if (AppConfig.DEBUG) {
-            Log.d(AppConfig.TAG, "MyApplication destory");
-        }
-        // 结束百度定位
-        if (mBdLocationHelper != null) {
-            mBdLocationHelper.release();
-        }
-        // 关闭网络状态的监听
-        if (mNetWorkObservable != null) {
-            mNetWorkObservable.release();
-        }
-        // 清除图片加载
-        ImageLoader.getInstance().destroy();
-        //
-        releaseFastVolley();
-        // 释放数据库
-        // SQLiteHelper.release();
-        android.os.Process.killProcess(android.os.Process.myPid());
-
-        //TODO 获取此刻精确时间并转换为yyyy-MM-dd HH:mm:ss
-        String nowtime = TimeUtils.f_long_2_str(System.currentTimeMillis());
-        String saved_time = PreferenceUtils.getString(MyApplication.getInstance(), TimeStatisticsActivity.Killed);
-
-        if (!TextUtils.isEmpty(saved_time)) {
-            PreferenceUtils.putString(TimeStatisticsActivity.Killed, saved_time + "," + nowtime);
-        } else {
-            PreferenceUtils.putString(TimeStatisticsActivity.Killed, nowtime);
-
-        }
-    }
-
-    /*********************
-     * 百度地图定位服务
-     ************************/
-    private BdLocationHelper mBdLocationHelper;
-
-    public BdLocationHelper getBdLocationHelper() {
-        if (mBdLocationHelper == null)
-            mBdLocationHelper = new BdLocationHelper(this);
-        mBdLocationHelper.requestLocation();
-        return mBdLocationHelper;
-    }
-
-    /*********************
-     * 提供网络全局监听
-     ************************/
-    private NetWorkObservable mNetWorkObservable;
-
-    public boolean isNetworkActive() {
-        if (mNetWorkObservable != null) {
-            return mNetWorkObservable.isNetworkActive();
-        }
-        return true;
-    }
-
-    public void registerNetWorkObserver(NetWorkObservable.NetWorkObserver observer) {
-        if (mNetWorkObservable != null) {
-            mNetWorkObservable.registerObserver(observer);
-        }
-    }
-
-    public void unregisterNetWorkObserver(NetWorkObservable.NetWorkObserver observer) {
-        if (mNetWorkObservable != null) {
-            mNetWorkObservable.unregisterObserver(observer);
-        }
-    }
-
-    /* 文件缓存的目录 */
-    public String mAppDir;
-    public String mPicturesDir;
-    public String mVoicesDir;
-    public String mVideosDir;
-    public String mFilesDir;
-
-    private void initAppDir() {
-        File file = getExternalFilesDir(null);
-        if (file != null) {
-            if (!file.exists()) {
-                file.mkdirs();
-            }
-            mAppDir = file.getAbsolutePath();
-        }
-
-        file = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
-        if (file != null) {
-            if (!file.exists()) {
-                file.mkdirs();
-            }
-            mPicturesDir = file.getAbsolutePath();
-        }
-
-        file = getExternalFilesDir(Environment.DIRECTORY_MUSIC);
-        if (file != null) {
-            if (!file.exists()) {
-                file.mkdirs();
-            }
-            mVoicesDir = file.getAbsolutePath();
-        }
-        file = getExternalFilesDir(Environment.DIRECTORY_MOVIES);
-        if (file != null) {
-            if (!file.exists()) {
-                file.mkdirs();
-            }
-            mVideosDir = file.getAbsolutePath();
-        }
-        file = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
-        if (file != null) {
-            if (!file.exists()) {
-                file.mkdirs();
-            }
-            mFilesDir = file.getAbsolutePath();
-        }
-    }
-
-    /*******************
-     * 初始化图片加载
-     **********************/
-    // 显示的设置
-    public static DisplayImageOptions mNormalImageOptions;
-    public static DisplayImageOptions mAvatarRoundImageOptions;
-    public static DisplayImageOptions mAvatarNormalImageOptions;
-
-    private void initImageLoader() {
-        int memoryCacheSize = (int) (Runtime.getRuntime().maxMemory() / 5);
-        MemoryCacheAware<String, Bitmap> memoryCache;
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
-            memoryCache = new LruMemoryCache(memoryCacheSize);
-        } else {
-            memoryCache = new LRULimitedMemoryCache(memoryCacheSize);
-        }
-
-        mNormalImageOptions = new DisplayImageOptions.Builder().bitmapConfig(Config.RGB_565).cacheInMemory(true).cacheOnDisc(true)
-                .resetViewBeforeLoading(false).showImageForEmptyUri(com.xzjmyk.pm.activity.R.drawable.image_download_fail_icon)
-                .showImageOnFail(com.xzjmyk.pm.activity.R.drawable.image_download_fail_icon).build();
-
-        mAvatarRoundImageOptions = new DisplayImageOptions.Builder().bitmapConfig(Config.RGB_565).
-                cacheInMemory(true).cacheOnDisc(true)
-                .displayer(new RoundedBitmapDisplayer(10)).
-                        resetViewBeforeLoading(true).
-                        showImageForEmptyUri(com.xzjmyk.pm.activity.R.drawable.avatar_normal)
-                .showImageOnFail(com.xzjmyk.pm.activity.R.drawable.avatar_normal).showImageOnLoading(com.xzjmyk.pm.activity.R.drawable.avatar_normal).build();
-
-        mAvatarNormalImageOptions = new DisplayImageOptions.Builder().bitmapConfig(Config.RGB_565).cacheInMemory(true).cacheOnDisc(true)
-                .resetViewBeforeLoading(true).showImageForEmptyUri(com.xzjmyk.pm.activity.R.drawable.avatar_normal).showImageOnFail(com.xzjmyk.pm.activity.R.drawable.avatar_normal)
-                .showImageOnLoading(com.xzjmyk.pm.activity.R.drawable.avatar_normal).build();
-
-        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).defaultDisplayImageOptions(mNormalImageOptions)
-                // .denyCacheImageMultipleSizesInMemory()
-                .discCache(new TotalSizeLimitedDiscCache(new File(mPicturesDir), 50 * 1024 * 1024))
-                // 最多缓存50M的图片
-                .discCacheFileNameGenerator(new Md5FileNameGenerator())
-                .memoryCache(memoryCache)
-                .tasksProcessingOrder(QueueProcessingType.LIFO)
-                .threadPriority(Thread.NORM_PRIORITY - 2)
-                .imageDownloader(new AuthImageDownloader(this))
-                .denyCacheImageMultipleSizesInMemory()
-                .threadPoolSize(4)
-                .build();
-        // Initialize ImageLoader with configuration.
-        ImageLoader.getInstance().init(config);
-    }
-
-    /*********************
-     * 提供全局配置
-     ************************/
-    private AppConfig mConfig;
-
-    public void setConfig(AppConfig config) {
-        mConfig = config;
-    }
-
-    public AppConfig getConfig() {
-        if (mConfig == null) {
-            mConfig = AppConfig.initConfig(getApplicationContext(), new ConfigBean());
-        }
-        return mConfig;
-    }
-
-    /*****************
-     * 提供全局的Volley
-     ***************************/
-
-    private FastVolley mFastVolley;
-
-    public FastVolley getFastVolley() {
-        if (mFastVolley == null) {
-            synchronized (MyApplication.class) {
-                if (mFastVolley == null) {
-                    mFastVolley = new FastVolley(this);
-                    mFastVolley.start();
-                }
-            }
-        }
-        return mFastVolley;
-    }
-
-    private void releaseFastVolley() {
-        if (mFastVolley != null) {
-            mFastVolley.stop();
-        }
-    }
-
-
-    @Override
-    protected void attachBaseContext(Context base) {
-        super.attachBaseContext(base);
-        MultiDex.install(this);
-    }
-
-    /***********************
-     * 保存当前登陆用户的全局信息
-     ***************/
-    public String roomName;
-    public String mAccessToken;
-    public long mExpiresIn;
-    public int mUserStatus;
-    public boolean mUserStatusChecked = false;
-    public User mLoginUser = new User();// 当前登陆的用户
-
-    /***********************
-     * 保存其他用户坐标信息
-     ***************/
-
-    public String getJSESSION_B2B() {
-        return JSESSION_B2B;
-    }
-
-    public void setJSESSION_B2B(String jSESSION_B2B) {
-        JSESSION_B2B = jSESSION_B2B;
-    }
-
-//    public static Cookie getCookie() {
-//        return cookie;
-//    }
-//
-//    public static void setCookie(Cookie cookie) {
-//        MyApplication.cookie = cookie;
-//    }
-
-/*    public void clearWebViewCache() {
-        Log.i("clearWebViewCache", "clearWebViewCache");
-        // 清理WebView缓存数据库
-        try {
-            deleteDatabase("webview.db");
-            deleteDatabase("webviewCache.db");
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        // WebView缓存文件
-        File appCacheDir = new File(getFilesDir().getAbsolutePath()
-                + SubscribeDetailActivity.APP_CACHE_DIRNAME);
-
-        File webviewCacheDir = new File(getCacheDir().getAbsolutePath()
-                + "/webviewCache");
-
-        // 删除webView缓存目录
-        if (webviewCacheDir.exists()) {
-            com.common.file.FileUtils.deleteFileOrDir(webviewCacheDir);
-        }
-        // 删除webView缓存,缓存目录
-        if (appCacheDir.exists()) {
-            com.common.file.FileUtils.deleteFileOrDir(appCacheDir);
-        }
-    }*/
-
-    public String getLoginUserId() {
-        return (mLoginUser!=null&&!TextUtils.isEmpty(mLoginUser.getUserId()))?mLoginUser.getUserId():"";
-    }
-}

+ 14 - 11
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java

@@ -59,6 +59,7 @@ import com.core.dao.SignAutoLogDao;
 import com.core.dao.UserDao;
 import com.core.model.CircleMessage;
 import com.core.model.NewFriendMessage;
+import com.core.model.OAConfig;
 import com.core.model.User;
 import com.core.model.WorkModel;
 import com.core.net.NetWorkObservable;
@@ -579,21 +580,23 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
     private void doHiTask() {
         int isUUStep = PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.UU_STEP);
         if (isUUStep != 0 && StepCountCheckUtil.isSupportStepCountSensor(this)) { // 开启UU运动
-            startService(new Intent(mContext, StepService.class));
-//            PreferenceUtils.putInt(NewStepActivity.UU_STEP_NOTICE, 1);
-            PreferenceUtils.putInt(MainActivity.UU_STEP, 1);
-            PushManager.resumeWork(MyApplication.getInstance());
+            if (!MyApplication.getInstance().getLoginUserId().equals("100366")) {
+                startService(new Intent(mContext, StepService.class));
+                PreferenceUtils.putInt(MainActivity.UU_STEP, 1);
+                PushManager.resumeWork(MyApplication.getInstance());
+            }
         }
         doSendSignAutoLog(); // 获取数据库中监控日志上传至服务器操作
         //TODO 桌面红点显示逻辑
-        if (handler == null) {
-            handler = new Handler();
-        }
-        if (runnable == null) {
-            runnable = new MyRunnable();
+        if (OAConfig.canShowRed) {
+            if (handler == null) {
+                handler = new Handler();
+            }
+            if (runnable == null) {
+                runnable = new MyRunnable();
+            }
+            handler.post(runnable);
         }
-        handler.post(runnable);
-
         hiQuickSearch();
     }
 

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/circle/PMsgDetailActivity.java

@@ -34,7 +34,7 @@ import com.core.utils.helper.AvatarHelper;
 import com.core.xmpp.dao.FriendDao;
 import com.handmark.pulltorefresh.library.PullToRefreshBase;
 import com.handmark.pulltorefresh.library.PullToRefreshListView;
-import com.xzjmyk.pm.activity.MyApplication;
+import com.core.app.MyApplication;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.bean.circle.Comment;
 import com.xzjmyk.pm.activity.bean.circle.PublicMessage;

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/presenter/AddVisitReportPresenter.java

@@ -262,7 +262,7 @@ public class AddVisitReportPresenter implements OnHttpResultListener {
         String vrCode = bundle.getString("vrCode");
         String remark = bundle.getString("remark");
         String detail = bundle.getString("detail");
-        if (detail==null)detail="";
+        if (detail == null) detail = "";
         String type = bundle.getString("type");
         String vr_recorddate = bundle.getString("recorddate");
         Map<String, Object> formStore = new HashMap<>();

+ 23 - 15
app_core/common/src/main/java/com/common/system/SystemUtil.java

@@ -2,6 +2,7 @@ package com.common.system;
 
 import android.Manifest;
 import android.annotation.TargetApi;
+import android.app.Activity;
 import android.app.ActivityManager;
 import android.content.ClipData;
 import android.content.Context;
@@ -279,6 +280,7 @@ public class SystemUtil {
         }
         return 0;
     }
+
     public static boolean isBackground(Context context) {
         ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
         List<ActivityManager.RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
@@ -293,6 +295,7 @@ public class SystemUtil {
         }
         return false;
     }
+
     public static boolean isNetWorkConnected(Context context) {
         if (context != null) {
             ConnectivityManager mConnectivityManager = (ConnectivityManager) context
@@ -306,23 +309,28 @@ public class SystemUtil {
     }
 
     public static void phoneAction(final Context mContext, final String phone) {
-        MaterialDialog dialog = new MaterialDialog.Builder(mContext).title(R.string.dialog_confim_phone).content(mContext.getString(R.string.dialog_phone) + phone)
-                .positiveText(R.string.dialog_phone_action).negativeText(R.string.common_cancel).autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
-                    @Override
-                    public void onPositive(MaterialDialog dialog) {
-                        // 用intent启动拨打电话
-                        Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone));
-                        mContext.startActivity(intent);
-                    }
+        if (!PermissionUtil.lacksPermissions(mContext, Manifest.permission.CALL_PHONE)) {
+            MaterialDialog dialog = new MaterialDialog.Builder(mContext).title(R.string.dialog_confim_phone).content(mContext.getString(R.string.dialog_phone) + phone)
+                    .positiveText(R.string.dialog_phone_action).negativeText(R.string.common_cancel).autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
+                        @Override
+                        public void onPositive(MaterialDialog dialog) {
+                            // 用intent启动拨打电话
+                            Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone));
+                            mContext.startActivity(intent);
+                            dialog.dismiss();
+                        }
 
-                    @Override
-                    public void onNegative(MaterialDialog dialog) {
-                        super.onNegative(dialog);
-                        dialog.dismiss();
-                    }
-                }).build();
+                        @Override
+                        public void onNegative(MaterialDialog dialog) {
+                            super.onNegative(dialog);
+                            dialog.dismiss();
+                        }
+                    }).build();
 
-        dialog.show();
+            dialog.show();
+        } else if (mContext instanceof Activity){
+            PermissionUtil.requestPermission((Activity)mContext,PermissionUtil.DEFAULT_REQUEST, Manifest.permission.CALL_PHONE);
+        }
     }
 
 }

+ 3 - 3
app_core/common/src/main/java/com/core/dao/UUHelperDao.java

@@ -92,7 +92,7 @@ public class UUHelperDao extends Dao<UUHelperModel.UUHelperItem> {
     public boolean updateRead(int id) {
         long i = 0;
         try {
-            String where = DatabaseTables.UUHelperTable.Cols.ID;
+            String where = DatabaseTables.UUHelperTable.Cols.ID+" =?";
             String[] whereArgs = {String.valueOf(id)};
             SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
             ContentValues values = new ContentValues();
@@ -107,8 +107,8 @@ public class UUHelperDao extends Dao<UUHelperModel.UUHelperItem> {
     public boolean updateRead() {
         long i = 0;
         try {
-            String where = DatabaseTables.UUHelperTable.Cols.READED;
-            String[] whereArgs = {String.valueOf(0)};
+            String where = null;
+            String[] whereArgs = null;
             SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
             ContentValues values = new ContentValues();
             values.put(DatabaseTables.UUHelperTable.Cols.READED, 1);

+ 1 - 0
app_core/common/src/main/java/com/core/model/OAConfig.java

@@ -31,6 +31,7 @@ public class OAConfig {
 
     /*是否显示Crm2.0功能*/
     public static boolean canShowCrm2_0 = true;
+    public static boolean canShowRed = false;
 
     public static boolean canShowCrm2_0() {
         if (!CommonUtil.getSharedPreferencesBoolean(MyApplication.getInstance(), "erp_login"))

+ 1 - 0
app_modular/appmessages/build.gradle

@@ -27,4 +27,5 @@ dependencies {
     compile project(':common')
     compile project(':network')
     compile project(':appworks')
+    compile 'com.android.support.constraint:constraint-layout:1.0.2'
 }

+ 3 - 0
app_modular/appmessages/src/main/AndroidManifest.xml

@@ -29,9 +29,12 @@
             android:launchMode="singleTask">
             <intent-filter>
                 <action android:name="com.modular.appmessage.UUHelperActivity" />
+
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
+        <activity android:name=".activity.UUHelperDetailsActivity"
+                  android:label="UU 助手"/>
     </application>
 
 </manifest>

+ 16 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/UUHelperActivity.java

@@ -9,6 +9,8 @@ import android.support.v4.content.LocalBroadcastManager;
 import android.support.v7.widget.DefaultItemAnimator;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.view.Menu;
+import android.view.MenuItem;
 import android.view.View;
 
 import com.core.app.AppConstant;
@@ -36,6 +38,20 @@ public class UUHelperActivity extends BaseActivity implements View.OnClickListen
         }
     };
 
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.menu_uuhelper,menu);
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId()==R.id.menuMe){
+            startActivity(new Intent(ct,UUHelperDetailsActivity.class));
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

+ 25 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/UUHelperDetailsActivity.java

@@ -0,0 +1,25 @@
+package com.modular.appmessages.activity;
+
+import android.os.Bundle;
+import android.view.View;
+
+import com.common.system.SystemUtil;
+import com.core.base.BaseActivity;
+import com.modular.appmessages.R;
+
+public class UUHelperDetailsActivity extends BaseActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_uuhelper_details);
+        findViewById(R.id.takePhotoBtn).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                SystemUtil.phoneAction(ct, "4008301818");
+            }
+        });
+    }
+
+
+}

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

@@ -88,8 +88,7 @@ public class MessageAdapter extends BaseAdapter {
             holder.time_tv.setText(TimeUtils.getFriendlyTimeDesc(MyApplication.getInstance(), friend.getTimeSend()));
         } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
             holder.time_tv.setText(TimeUtils.getFriendlyTimeDesc(MyApplication.getInstance(), friend.getTimeSend()));
-            //TODO 设置图片
-            holder.avatar_img.setImageResource( R.drawable.home_image_03_u);
+            holder.avatar_img.setImageResource( R.drawable.icon_uuhelper);
         } else {
             if (friend.getRoomFlag() == 0) {// 这是单个人
                 AvatarHelper.getInstance().display(friend.getUserId(), holder.avatar_img, false, false);//每次刷新都会去删除此人缓存

+ 9 - 10
app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/UUHelperAdapter.java

@@ -1,7 +1,6 @@
 package com.modular.appmessages.adapter;
 
 import android.content.Context;
-import android.content.Intent;
 import android.support.v7.widget.DefaultItemAnimator;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
@@ -16,8 +15,8 @@ import com.common.LogUtil;
 import com.common.data.ListUtils;
 import com.core.dao.UUHelperDao;
 import com.core.model.UUHelperModel;
+import com.core.utils.IntentUtils;
 import com.modular.appmessages.R;
-import com.modular.appmessages.activity.AppWebViewActivity;
 import com.nostra13.universalimageloader.core.ImageLoader;
 
 import java.util.List;
@@ -192,16 +191,16 @@ public class UUHelperAdapter extends RecyclerView.Adapter<UUHelperAdapter.ViewHo
     }
 
     private void onItemClick(UUHelperModel.UUHelperItem item) {
-//         Intent intent = new Intent("com.modular.main.WebViewActivity");
-        Intent intent = new Intent(ct, AppWebViewActivity.class);
         String title = item.getContent();
-        String url = item.getLinkUrl();
-        intent.putExtra("url", url);
-        intent.putExtra("p", title);
-        intent.putExtra("title", title);
-        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         UUHelperDao.getInstance().updateRead(item.getId());
-        ct.startActivity(intent);
+        String url = item.getLinkUrl();
+        IntentUtils.webLinks(ct, url, title);
+//        Intent intent = new Intent(ct, AppWebViewActivity.class);
+//        intent.putExtra("url", url);
+//        intent.putExtra("p", title);
+//        intent.putExtra("title", title);
+//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+//        ct.startActivity(intent);
     }
 
     private void onLongItemClick(final UUHelperModel.UUHelperItem item) {

+ 1 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java

@@ -692,6 +692,7 @@ public class MessagePresenter implements OnHttpResultListener {
             if (lastItem != null) {
                 friend.set_id(lastItem.getId());
                 friend.setTimeSend((int) (lastItem.getTimeSend() / 1000));
+                friend.setContent(lastItem.getContent());
             } else {
                 friend.setContent("");
             }

BIN
app_modular/appmessages/src/main/res/drawable-hdpi/icon_me.png


BIN
app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper.png


BIN
app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper_header.png


BIN
app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper_takephoto_btn.png


BIN
app_modular/appmessages/src/main/res/drawable-hdpi/icon_uuhelper_takephoto_btn_pass.png


BIN
app_modular/appmessages/src/main/res/drawable-xhdpi/icon_me.png


BIN
app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper.png


BIN
app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper_header.png


BIN
app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper_takephoto_btn.png


BIN
app_modular/appmessages/src/main/res/drawable-xhdpi/icon_uuhelper_takephoto_btn_pass.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_me.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper_header.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper_takephoto_btn.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/icon_uuhelper_takephoto_btn_pass.png


+ 7 - 0
app_modular/appmessages/src/main/res/drawable/uuhelper_btn_bg.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/icon_uuhelper_takephoto_btn_pass" android:state_enabled="false" />
+    <item android:drawable="@drawable/icon_uuhelper_takephoto_btn_pass" android:state_pressed="true" />
+    <item android:drawable="@drawable/icon_uuhelper_takephoto_btn" />
+</selector>

+ 69 - 0
app_modular/appmessages/src/main/res/layout/activity_uuhelper_details.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout 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:background="@color/base_bg"
+                tools:context="com.modular.appmessages.activity.UUHelperDetailsActivity">
+
+    <ImageView
+        android:id="@+id/headIMG"
+        android:layout_width="50dp"
+        android:layout_height="50dp"
+        android:layout_margin="10dp"
+        android:src="@drawable/icon_uuhelper_header" />
+
+    <TextView
+        android:id="@+id/title"
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginLeft="10dp"
+        android:layout_alignTop="@id/headIMG"
+        android:layout_toRightOf="@id/headIMG"
+        android:gravity="center_vertical"
+        android:text="UU 助手"
+        android:textColor="@color/black"
+        android:textSize="18sp" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="2px"
+        android:layout_below="@id/headIMG"
+        android:background="@color/item_line" />
+
+    <TextView
+        android:id="@+id/tagTV"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignLeft="@id/headIMG"
+        android:layout_below="@id/headIMG"
+        android:layout_marginTop="10dp"
+        android:gravity="center_vertical"
+        android:text="功能介绍"
+        android:textColor="@color/text_hine"
+        android:textSize="16sp" />
+
+    <TextView
+        android:id="@+id/contentTV"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/tagTV"
+        android:layout_marginLeft="10dp"
+        android:layout_toRightOf="@id/tagTV"
+        android:gravity="center_vertical"
+        android:text="UU 助手,您身边的移动办公小帮手。在这里,您可以查看CRM、OA等消息通知,还可以了解UU和互联的最新动态哦,我们还提供人工智能客户,UU助手随时等候主任的吩咐哦!"
+        android:textColor="@color/text_main"
+        android:textSize="16sp" />
+
+    <Button
+        android:id="@+id/takePhotoBtn"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/contentTV"
+    android:layout_marginTop="30dp"
+        android:layout_centerHorizontal="true"
+        android:background="@drawable/uuhelper_btn_bg"
+        android:padding="10dp"
+        android:textColor="@color/white"
+        android:textSize="@dimen/text_main" />
+</RelativeLayout>

+ 9 - 0
app_modular/appmessages/src/main/res/menu/menu_uuhelper.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+      xmlns:app="http://schemas.android.com/apk/res-auto">
+    <item
+        android:id="@+id/menuMe"
+        android:icon="@drawable/icon_me"
+        android:title="UU 助手"
+        app:showAsAction="always" />
+</menu>

+ 1 - 3
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/DetailTaskActivity.java

@@ -33,7 +33,6 @@ import com.core.utils.CommonUtil;
 import com.core.utils.TimeUtils;
 import com.core.widget.CustomerListView;
 import com.lidroid.xutils.HttpUtils;
-import com.lidroid.xutils.ViewUtils;
 import com.lidroid.xutils.exception.HttpException;
 import com.lidroid.xutils.http.ResponseInfo;
 import com.lidroid.xutils.http.callback.RequestCallBack;
@@ -147,6 +146,7 @@ public class DetailTaskActivity extends BaseActivity implements OnClickListener
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        setContentView(R.layout.act_task_detail);
         initIDs();
         initView();
         initData();
@@ -175,8 +175,6 @@ public class DetailTaskActivity extends BaseActivity implements OnClickListener
     }
 
     public void initView() {
-        setContentView(R.layout.act_task_detail);
-        ViewUtils.inject(this);
         ct = this;
         getSupportActionBar().setTitle(getString(R.string.taskdetail_title));
         TAG = "DetailTask";