Explorar o código

1.Me界面跳转逻辑
2.HelpCenter逻辑
3.常见问题逻辑

Administrator %!s(int64=2) %!d(string=hai) anos
pai
achega
ee55228cbd

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -6,6 +6,7 @@
 
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
+    <uses-permission android:name="android.permission.CALL_PHONE"/>
 
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

+ 11 - 0
config.gradle

@@ -20,4 +20,15 @@ ext {
     //极光正式环境key
     jpush_key_relese = '32dcfe077bda72c4f4c4a2d4'
 
+    //Help Center 测试环境
+    help_center_dev_url = 'http://dev-help-center.yycircle.com/helpCenter'
+    //Help Center 正式环境
+    help_center_relese_url = 'http://common.yycircle.com/helpCenter'
+
+    //Parttime-QA测试
+    parttime_qa_dev_url = "http://dev.yycircle.com/feedback-question/#/questions"
+    //Parttime-QA正式
+    parttime_qa_relese_url = "https://yycircle.com/feedback-question/#/Questions"
+
+
 }

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

@@ -28,6 +28,8 @@
 
         <activity android:name=".ui.AccountDeactivationActivity"/>
 
+        <activity android:name=".ui.HelpCenterProfileH5Activity" />
+
     </application>
 
 </manifest>

+ 503 - 0
cpt_main/src/main/java/com/hongyegroup/cpt_main/ui/HelpCenterProfileH5Activity.java

@@ -0,0 +1,503 @@
+package com.hongyegroup.cpt_main.ui;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.app.Instrumentation;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.GeolocationPermissions;
+import android.webkit.JavascriptInterface;
+import android.webkit.ValueCallback;
+import android.webkit.WebChromeClient;
+import android.webkit.WebView;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.guadou.cs_cptservices.YYConstants;
+import com.guadou.cs_cptservices.widget.PickPhotoDialog;
+import com.guadou.lib_baselib.base.activity.BaseVMActivity;
+import com.guadou.lib_baselib.base.vm.BaseViewModel;
+import com.guadou.lib_baselib.engine.PermissionExtKt;
+import com.guadou.lib_baselib.engine.image_select.ImageSelectExtKt;
+import com.guadou.lib_baselib.provider.PermissionFileProvider;
+import com.guadou.lib_baselib.utils.CheckUtil;
+import com.guadou.lib_baselib.utils.CommUtils;
+import com.guadou.lib_baselib.utils.SPUtils;
+import com.guadou.lib_baselib.utils.ThreadPoolUtils;
+import com.guadou.lib_baselib.utils.log.YYLogUtils;
+import com.guadou.lib_baselib.view.MyWebView;
+import com.guadou.lib_baselib.view.WebViewProgressBar;
+import com.hongyegroup.cpt_main.R;
+import com.luck.picture.lib.entity.LocalMedia;
+import com.luck.picture.lib.listener.OnResultCallbackListener;
+import com.luck.picture.lib.tools.ToastUtils;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import kotlin.Unit;
+import kotlin.jvm.functions.Function0;
+
+/**
+ * V11 Me页面的帮助中心
+ * 内部处理
+ */
+public class HelpCenterProfileH5Activity extends BaseVMActivity<BaseViewModel> {
+
+    private String mWebtitle;
+    private String mWeburl;
+    private WebViewProgressBar mPbWebView;
+    private FrameLayout mFlContent;
+    private MyWebView mWebView;
+    private TextView mTvTitle;
+    private ImageView mIvBack;
+    private ImageView mIvFinish;
+    private ImageView mIvSearch;
+
+    private String mHelpCenterUrl = "";
+
+    public static void startInstance(String helpCenterUrl) {
+        Context context = CommUtils.getContext();
+        Intent intent = new Intent(context, HelpCenterProfileH5Activity.class);
+        intent.putExtra("helpCenterUrl", helpCenterUrl);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        context.startActivity(intent);
+    }
+
+    @Override
+    protected void getDataFromIntent(Intent intent) {
+        super.getDataFromIntent(intent);
+        mHelpCenterUrl = intent.getStringExtra("helpCenterUrl");
+    }
+
+    @Override
+    public void init(@Nullable Bundle savedInstanceState) {
+
+        mWebtitle = "Help Center";
+
+        mWeburl = mHelpCenterUrl + "?token=" + SPUtils.getInstance(CommUtils.getContext()).getString(YYConstants.USER_TOKEN, "");
+
+        initView();
+        initTitles();
+        initWeb();
+        initListener();
+
+    }
+
+    @Override
+    public int getLayoutIdRes() {
+
+        return R.layout.activity_help_center;
+
+    }
+
+    @Override
+    public void startObserve() {
+
+    }
+
+    private void initListener() {
+        mIvBack.setOnClickListener(v -> {
+            //走底部系统返回键
+            webgoBack();
+        });
+
+        mIvFinish.setOnClickListener(v -> {
+            finish();
+        });
+
+        mIvSearch.setOnClickListener(v -> {
+            if (mWebView != null) {
+                mWebView.loadUrl(mHelpCenterUrl + "/search");
+            }
+        });
+    }
+
+    private void webgoBack() {
+        if (ThreadPoolUtils.getCachedThreadPool() != null) {
+            ThreadPoolUtils.getCachedThreadPool().execute(() -> {
+                try {
+                    Instrumentation inst = new Instrumentation();
+                    inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            });
+        }
+    }
+
+    private void initTitles() {
+        if (!CheckUtil.isEmpty(mWebtitle) && mTvTitle != null) {
+            mTvTitle.setText(mWebtitle);
+        }
+    }
+
+    @SuppressLint("AddJavascriptInterface")
+    private void initWeb() {
+        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
+        mWebView = new MyWebView(getApplicationContext());
+        mWebView.setLayoutParams(params);
+
+        //允许访问多媒体
+        mWebView.getSettings().setAllowFileAccess(true);
+        mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
+        mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
+
+        mWebView.addJavascriptInterface(new H5CallBackAndroid(), "webkit");
+
+        mWebView.setWebChromeClient(new WebChromeClient() {
+            //获取html的title标签
+            @Override
+            public void onReceivedTitle(WebView view, String title) {
+                YYLogUtils.e("title" + title);
+
+                if (!CheckUtil.isEmpty(title) && mTvTitle != null && !title.equals("common_html")) {
+                    mTvTitle.setText(title);
+
+                    if (title.equals("Help Center")) {
+
+                        mIvSearch.setVisibility(View.VISIBLE);
+
+                    } else {
+
+                        mIvSearch.setVisibility(View.GONE);
+
+                    }
+                }
+                super.onReceivedTitle(view, title);
+            }
+
+            //获取页面加载的进度
+            @Override
+            public void onProgressChanged(WebView view, int newProgress) {
+
+                if (newProgress == 100) {
+                    mPbWebView.setProgress(100);
+                    CommUtils.getHandler().postDelayed(() -> mPbWebView.setVisibility(View.GONE), 200);//0.2秒后隐藏进度条
+                } else if (mPbWebView.getVisibility() == View.GONE) {
+                    mPbWebView.setVisibility(View.VISIBLE);
+                }
+                //设置初始进度10,这样会显得效果真一点,总不能从1开始吧
+                if (newProgress < 10) {
+                    newProgress = 10;
+                }
+                //不断更新进度
+                mPbWebView.setProgress(newProgress);
+
+            }
+
+            // 指定源的网页内容在没有设置权限状态下尝试使用地理位置API。
+            @Override
+            public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
+                boolean allow = true;   // 是否允许origin使用定位API
+                boolean retain = false; // 内核是否记住这次制授权
+                callback.invoke(origin, true, false);
+            }
+
+            // 之前调用 onGeolocationPermissionsShowPrompt() 申请的授权被取消时,隐藏相关的UI。
+            @Override
+            public void onGeolocationPermissionsHidePrompt() {
+
+            }
+
+            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+            @Override
+            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
+                //启动系统相册
+//                Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
+//                startActivityForResult(intent, 99);
+                YYLogUtils.w("网页尝试调取Android相机相册");
+                filePathCallback1 = filePathCallback;
+                CommUtils.getHandler().post(() -> {
+                    showPickDialog();
+                });
+
+                return true;
+
+            }
+        });
+
+        mWebView.setOnWebChangeListener(new MyWebView.OnWebChangeListener() {
+            @Override
+            public void titleChange(String title) {
+                YYLogUtils.e("titleChange-" + title);
+            }
+
+            @Override
+            public void progressChange(int newProgress) {
+            }
+
+            @Override
+            public void onInnerLinkChecked() {
+                mIvFinish.setVisibility(View.VISIBLE);
+                YYLogUtils.e("onInnerLinkChecked" + mWebView.canGoBack());
+            }
+
+            @Override
+            public void onWebLoadError() {
+                ToastUtils.s(mActivity, "Load Error!");
+            }
+        });
+
+
+        YYLogUtils.e("mWeburl:" + mWeburl);
+        if (!TextUtils.isEmpty(mWeburl))
+            mWebView.loadUrl(mWeburl);
+
+        mFlContent.addView(mWebView);
+    }
+
+    private boolean isCancel = true;
+
+    /**
+     * 相机相册的选择
+     */
+    private void showPickDialog() {
+
+        PickPhotoDialog photoDialog = new PickPhotoDialog(mActivity);
+        photoDialog.SetOnChooseClickListener(new PickPhotoDialog.OnChooseClickListener() {
+            @Override
+            public void chooseCamera() {
+                isCancel = false;
+                startCamera();
+            }
+
+            @Override
+            public void chooseAlbum() {
+                isCancel = false;
+                startAlbum();
+            }
+        });
+        photoDialog.setCancelable(false);
+        photoDialog.show();
+        photoDialog.setOnDismissListener(dialog -> {
+            cancelFilePick();
+        });
+    }
+
+    //选择相册
+    private void startAlbum() {
+
+        ImageSelectExtKt.extOpenImageSelect(mActivity, new ArrayList<LocalMedia>(), new OnResultCallbackListener<LocalMedia>() {
+
+            @Override
+            public void onResult(List<LocalMedia> result) {
+
+                handlePath(result);
+
+            }
+
+            @Override
+            public void onCancel() {
+
+                cancelFilePick();
+
+            }
+        }, 1, false, false, true, 1, 1, false);
+//        ImageSelectEngine.get().openImageSelect(mActivity, null, 1, false, false, false, true, 1, 1, new OnResultCallbackListener<LocalMedia>() {
+//            @Override
+//            public void onResult(List<LocalMedia> result) {
+//                handlePath(result);
+//            }
+//
+//            @Override
+//            public void onCancel() {
+//                cancelFilePick();
+//            }
+//        });
+    }
+
+    //选择相机
+    private void startCamera() {
+
+        ImageSelectExtKt.extOpenCamera(mActivity, new ArrayList<LocalMedia>(), new OnResultCallbackListener<LocalMedia>() {
+            @Override
+            public void onResult(List<LocalMedia> result) {
+
+                handlePath(result);
+
+            }
+
+            @Override
+            public void onCancel() {
+
+                cancelFilePick();
+
+            }
+        }, false, true, 1, 1);
+
+//        ImageSelectEngine.get().openCamera(mActivity, null, false, true, 1, 1, new OnResultCallbackListener<LocalMedia>() {
+//            @Override
+//            public void onResult(List<LocalMedia> result) {
+//                handlePath(result);
+//            }
+//
+//            @Override
+//            public void onCancel() {
+//                cancelFilePick();
+//            }
+//        });
+    }
+
+    /**
+     * 处理图片-转换图片-返回给Web
+     */
+    private void handlePath(List<LocalMedia> result) {
+        YYLogUtils.w("处理图片-转换图片-返回给Web");
+
+        if (!CheckUtil.isEmpty(result)) {
+
+            String path = result.get(0).getCompressPath();
+
+//            Uri fileUri = PermissionFileProvider.getUriForFile(mActivity,"",new File(path));
+            Uri fileUri = Uri.fromFile(new File(path));
+//            Uri fileUri = AndPermission.getFileUri(mActivity, new File(path));
+
+            if (filePathCallback1 != null) {
+                filePathCallback1.onReceiveValue(new Uri[]{fileUri});
+                filePathCallback1 = null;
+            }
+        }
+
+        isCancel = true;
+    }
+
+    //取消图片的选择
+    private void cancelFilePick() {
+        if (isCancel && filePathCallback1 != null) {
+            YYLogUtils.w("取消图片的选择");
+            filePathCallback1.onReceiveValue(null);
+            filePathCallback1 = null;
+        }
+        isCancel = true;
+    }
+
+
+    //JS Java Call 用一个类包装起来方便忽略混淆
+    private class H5CallBackAndroid {
+
+        @JavascriptInterface
+        public void callPhone(String phoneNum) {
+//            YYCallPhoneManager.getInstance().callPhone(mActivity, phoneNum);
+
+            PermissionExtKt.extRequestPermission(mActivity, new String[]{Manifest.permission.CALL_PHONE}, new Function0<Unit>() {
+                @Override
+                public Unit invoke() {
+
+                    call();
+
+                    return null;
+                }
+            });
+
+        }
+
+        private void call(){
+
+            Intent intent = new Intent();
+            intent.setAction(Intent.ACTION_CALL);
+            Uri uri = Uri.parse("tel:" + "+65 66046919");
+            intent.setData(uri);
+            startActivity(intent);
+
+        }
+
+        @JavascriptInterface
+        public void EmailUsSuccess(Object obj) {
+            YYLogUtils.e("回调EmailUsSuccess");
+            webgoBack();
+        }
+    }
+
+    private void initView() {
+        mPbWebView = findViewById(R.id.pb_web_view);
+        mFlContent = findViewById(R.id.fl_content);
+        mTvTitle = findViewById(R.id.tv_title);
+        mIvBack = findViewById(R.id.iv_back);
+        mIvFinish = findViewById(R.id.iv_finish);
+        mIvSearch = findViewById(R.id.iv_search);
+    }
+
+    /**
+     * 回调的图片选择
+     */
+    private ValueCallback<Uri[]> filePathCallback1;
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        //99为之前设置中的标识
+        if (requestCode == 99) {
+            if (resultCode == RESULT_OK && null != data) {
+                Uri selectedImage = data.getData();
+                filePathCallback1.onReceiveValue(new Uri[]{selectedImage});
+            } else {
+                //没有选择图片,返回空,不返回的话,点击过一次以后,无法再启动相册
+                filePathCallback1.onReceiveValue(new Uri[]{});
+            }
+        }
+    }
+
+    /**
+     * 集成了系统的回退和网页的回退
+     */
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
+            mWebView.goBack();
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        if (mWebView != null) {
+            mWebView.onPause();
+        }
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (mWebView != null) {
+            mWebView.onResume();
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        if (mWebView != null) {
+            mWebView.clearCache(true); //清空缓存
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                if (mFlContent != null) {
+                    mFlContent.removeView(mWebView);
+                }
+                mWebView.removeAllViews();
+                mWebView.destroy();
+            } else {
+                mWebView.removeAllViews();
+                mWebView.destroy();
+                if (mFlContent != null) {
+                    mFlContent.removeView(mWebView);
+                }
+            }
+            mWebView = null;
+        }
+
+        //退出当前web进程
+//        System.exit(0);
+    }
+}

+ 15 - 0
cpt_main/src/main/java/com/hongyegroup/cpt_main/ui/ProfileFragment.kt

@@ -1,6 +1,7 @@
 package com.hongyegroup.cpt_main.ui
 
 import android.os.Bundle
+import com.guadou.cs_cptservices.YYConstants
 import com.guadou.cs_cptservices.base.fragment.YYBaseVDBFragment
 import com.guadou.cs_cptservices.interfaces.IFragmentRefresh
 import com.guadou.cs_router.YYRouterService
@@ -131,6 +132,20 @@ class ProfileFragment : YYBaseVDBFragment<ProfileViewModel, FragmentProfileBindi
 
         }
 
+        //跳转到News Feed
+        fun gotoNewsFeed(){
+
+            YYRouterService.newsfeedComponentServer?.startNewsFeedHomePage()
+
+        }
+
+        //跳转到Help Center
+        fun gotoHelpCenter(){
+
+            HelpCenterProfileH5Activity.startInstance(YYConstants.HELP_CENTER_URL)
+
+        }
+
     }
 
 

+ 12 - 0
cpt_main/src/main/java/com/hongyegroup/cpt_main/ui/SettingsActivity.kt

@@ -2,10 +2,13 @@ package com.hongyegroup.cpt_main.ui
 
 import android.content.Intent
 import android.os.Bundle
+import com.guadou.cs_cptservices.YYConstants
 import com.guadou.cs_cptservices.base.activity.YYBaseVDBActivity
+import com.guadou.cs_cptservices.ui.GlobalWebActivity
 import com.guadou.lib_baselib.base.vm.BaseViewModel
 import com.guadou.lib_baselib.bean.DataBindingConfig
 import com.guadou.lib_baselib.utils.CommUtils
+import com.guadou.lib_baselib.utils.SPUtils
 import com.hongyegroup.cpt_main.BR
 import com.hongyegroup.cpt_main.R
 import com.hongyegroup.cpt_main.databinding.ActivitySettingsBinding
@@ -51,6 +54,15 @@ class SettingsActivity : YYBaseVDBActivity<BaseViewModel, ActivitySettingsBindin
 
         }
 
+        //点击常见问题
+        fun gotoQAActivity() {
+
+            var tokenStr = SPUtils.getInstance(CommUtils.getContext()).getString(YYConstants.USER_TOKEN, "")
+            var webUrl = YYConstants.PART_TIME_QA_URL + "?token=" + tokenStr
+            GlobalWebActivity.startInstance("常见问题", webUrl)
+
+        }
+
     }
 
 }

BIN=BIN
cpt_main/src/main/res/drawable-xhdpi/title_black_delete.webp


+ 72 - 0
cpt_main/src/main/res/layout/activity_help_center.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:background="@color/white"
+    android:orientation="vertical">
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_48dp">
+
+        <ImageView
+            android:id="@+id/iv_back"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:layout_marginLeft="@dimen/d_12dp"
+            android:layout_marginTop="@dimen/d_3dp"
+            android:src="@drawable/back_blue" />
+
+        <ImageView
+            android:id="@+id/iv_finish"
+            android:layout_width="@dimen/d_27dp"
+            android:layout_height="@dimen/d_27dp"
+            android:layout_gravity="center_vertical"
+            android:layout_marginLeft="@dimen/d_45dp"
+            android:layout_marginTop="@dimen/d_2dp"
+            android:src="@drawable/title_black_delete"
+            tools:tint="@color/colorPrimary"
+            app:tint="@color/colorPrimary"
+            android:visibility="gone" />
+
+        <TextView
+            android:id="@+id/tv_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:textColor="@color/black"
+            android:textSize="@dimen/d_18sp"
+            tools:text="Title" />
+
+        <ImageView
+            android:id="@+id/iv_search"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="right|center_vertical"
+            android:layout_marginRight="@dimen/d_13dp"
+            android:src="@drawable/search" />
+
+    </FrameLayout>
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="0.5dp"
+        android:src="@color/divider_color"/>
+
+    <com.guadou.lib_baselib.view.WebViewProgressBar
+        android:id="@+id/pb_web_view"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_1dp"
+        android:visibility="gone" />
+
+
+    <FrameLayout
+        android:id="@+id/fl_content"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+    </FrameLayout>
+</LinearLayout>

+ 1 - 0
cpt_main/src/main/res/layout/activity_settings.xml

@@ -65,6 +65,7 @@
             android:layout_height="wrap_content"
             android:orientation="horizontal"
             android:padding="@dimen/d_15dp"
+            binding:clicks="@{click.gotoQAActivity}"
             android:visibility="visible">
 
             <TextView

+ 2 - 0
cpt_main/src/main/res/layout/fragment_profile.xml

@@ -472,6 +472,7 @@
                                 android:clickable="true"
                                 android:orientation="horizontal"
                                 android:gravity="center_vertical"
+                                binding:clicks="@{click.gotoNewsFeed}"
                                 android:paddingLeft="@dimen/d_25dp"
                                 android:paddingTop="@dimen/d_15dp"
                                 android:paddingRight="@dimen/d_25dp"
@@ -660,6 +661,7 @@
                                 android:layout_height="wrap_content"
                                 android:background="@drawable/transparent_bg_selector"
                                 android:clickable="true"
+                                binding:clicks="@{click.gotoHelpCenter}"
                                 android:orientation="horizontal"
                                 android:paddingLeft="@dimen/d_25dp"
                                 android:paddingTop="@dimen/d_15dp"

+ 13 - 0
cs_cptServices/build.gradle

@@ -6,17 +6,30 @@ android {
     defaultConfig {
         //读取配置表的值
         boolean mIsReleaseUrl = rootProject.ext.isReleaseUrl
+
+        String helpCenterUrl
+        String qaWebUrl
+
         //判断是正式环境还是测试环境
         if (mIsReleaseUrl) {
             String baseUrlRelese = rootProject.ext.baseUrl_relese
             buildConfigField 'String', 'Base_Url', "\"${baseUrlRelese}\""
 
+            helpCenterUrl = rootProject.ext.help_center_relese_url
+            qaWebUrl = rootProject.ext.parttime_qa_relese_url
+
         } else {
             String baseUrlDev = rootProject.ext.baseUrl_dev
             buildConfigField 'String', 'Base_Url', "\"${baseUrlDev}\""
 
+            helpCenterUrl = rootProject.ext.help_center_dev_url
+            qaWebUrl = rootProject.ext.parttime_qa_dev_url
+
         }
 
+        buildConfigField 'String', 'Help_Center_URL', "\"${helpCenterUrl}\""
+        buildConfigField 'String', 'Part_Time_QA_Url', "\"${qaWebUrl}\""
+
     }
 
     buildFeatures {

+ 5 - 0
cs_cptServices/src/main/java/com/guadou/cs_cptservices/YYConstants.java

@@ -12,9 +12,14 @@ public class YYConstants {
     public static final int NEWS_FEED_TYPE_BALLOT = 2;
     public static final int NEWS_FEED_TYPE_NEWS = 3;
 
+    public static final String USER_TOKEN="user_token";
     public static final String CACHE_REWARDS_POINTS="cache_rewards_points";
     public static final String ENENT_PART_TIME_BACK = "enent_part_time_back";   //兼职首页回到第一个Tab
     public static final String CACHE_PROMOTION_REWARDS_LIST_SEARCH_HISTORY = "cache_promotion_rewards_list_search_history";   //Rewards缓存搜索结果
 
+    //Help Center Url
+    public static final String HELP_CENTER_URL = BuildConfig.Help_Center_URL;
+    //PartTime模块QA的Web
+    public static final String PART_TIME_QA_URL = BuildConfig.Part_Time_QA_Url;
 
 }

+ 111 - 0
cs_cptServices/src/main/java/com/guadou/cs_cptservices/widget/PickPhotoDialog.java

@@ -0,0 +1,111 @@
+package com.guadou.cs_cptservices.widget;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.Display;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import com.guadou.cs_cptservices.R;
+
+
+/**
+ * 选择相机相册对话框
+ */
+
+public class PickPhotoDialog extends Dialog implements View.OnClickListener {
+    /**
+     * 初始化此类,调用此构造方法。传递一个样式布局给两个参数的构造方法。由两个参数的构造方法
+     * 填充布局,实现逻辑
+     */
+    public PickPhotoDialog(Context context) {
+        this(context, R.style.quick_option_dialog);
+    }
+
+    protected PickPhotoDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
+        super(context, cancelable, cancelListener);
+    }
+
+    //两个参数的构造方法实现具体的逻辑
+    public PickPhotoDialog(Context context, int themeResId) {
+        super(context, themeResId);
+        View view = LayoutInflater.from(context).inflate(R.layout.dialog_quick_choose, null);
+        view.findViewById(R.id.choose_xiangji).setOnClickListener(this);
+        view.findViewById(R.id.choose_xianggce).setOnClickListener(this);
+        view.findViewById(R.id.cancel).setOnClickListener(this);
+        requestWindowFeature(Window.FEATURE_NO_TITLE);  //设置没有标题
+        //设置触摸一下整个View.让其可取消。触摸(不是点击)对话框任意地方取消对话框
+        view.setOnTouchListener(new View.OnTouchListener() {
+            @Override
+            public boolean onTouch(View view, MotionEvent motionEvent) {
+                dismiss();
+                return true;  //消费掉此次触摸事件
+            }
+        });
+
+        //View设置完成,赋值给dialog对话框
+        super.setContentView(view);
+    }
+
+    /**
+     * 对话框被创建调用的方法
+     */
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        //设置对话框显示的位置.在底部显示
+        getWindow().setGravity(Gravity.BOTTOM);
+        //设置对话框的宽度,填充屏幕
+        WindowManager wm = getWindow().getWindowManager();
+        Display display = wm.getDefaultDisplay();
+        int width = display.getWidth();
+        //获取对话框的属性
+        WindowManager.LayoutParams params = getWindow().getAttributes();
+        params.width = width; //和屏幕一样宽
+        getWindow().setAttributes(params);
+    }
+
+    /**
+     * 点击事件
+     */
+    @Override
+    public void onClick(View view) {
+        int i = view.getId();
+        if (i == R.id.cancel) {
+            dismiss();
+
+        } else if (i == R.id.choose_xiangji) {
+            dismiss();
+            if (mListener != null) {
+                mListener.chooseCamera();
+            }
+
+        } else if (i == R.id.choose_xianggce) {
+            dismiss();
+            if (mListener != null) {
+                mListener.chooseAlbum();
+            }
+
+        }
+    }
+
+
+    /* =========================== 回调 =====================================**/
+
+    private OnChooseClickListener mListener;
+
+    public void SetOnChooseClickListener(OnChooseClickListener listener) {
+        mListener = listener;
+    }
+
+    public interface OnChooseClickListener {
+        void chooseCamera();
+
+        void chooseAlbum();
+    }
+}

+ 20 - 0
cs_cptServices/src/main/res/drawable/botton_choose_selector.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_pressed="true">
+        <shape android:shape="rectangle">
+            <corners android:radius="10dp"/>
+            <solid android:color="#FFE6EBEC"/>
+        </shape>
+    </item>
+
+    <item android:state_pressed="false">
+        <shape android:shape="rectangle">
+            <corners android:radius="10dp"/>
+            <solid android:color="#F1F6F7"/>
+        </shape>
+
+
+    </item>
+
+</selector>

+ 20 - 0
cs_cptServices/src/main/res/drawable/botton_choose_selector_b.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_pressed="true">
+        <shape android:shape="rectangle">
+            <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp"/>
+            <solid android:color="#FFE6EBEC"/>
+        </shape>
+    </item>
+
+    <item android:state_pressed="false">
+        <shape android:shape="rectangle">
+            <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp"/>
+            <solid android:color="#F1F6F7"/>
+        </shape>
+
+
+    </item>
+
+</selector>

+ 18 - 0
cs_cptServices/src/main/res/drawable/botton_choose_selector_c.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_pressed="true">
+        <shape android:shape="rectangle">
+            <solid android:color="#FFE6EBEC"/>
+        </shape>
+    </item>
+
+    <item android:state_pressed="false">
+        <shape android:shape="rectangle">
+            <solid android:color="#F1F6F7"/>
+        </shape>
+
+
+    </item>
+
+</selector>

+ 10 - 0
cs_cptServices/src/main/res/drawable/shape_quick_dialog_bg.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <!-- 填充颜色 -->
+    <solid android:color="#F1F6F7" />
+
+    <!-- 圆角半径 -->
+    <corners android:radius="10dp" />
+
+</shape>

+ 78 - 0
cs_cptServices/src/main/res/layout/dialog_quick_choose.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@android:color/transparent"
+    android:orientation="vertical">
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="10dp"
+        android:layout_marginLeft="20dp"
+        android:layout_marginRight="20dp"
+        android:layout_marginTop="10dp"
+        android:background="@drawable/shape_quick_dialog_bg"
+        android:orientation="vertical">
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:padding="8dp"
+            android:text="上传图片"
+            android:textColor="#3e3e3e"
+            android:textSize="12sp" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0.3dp"
+            android:background="#D2D2D2" />
+
+        <TextView
+            android:id="@+id/choose_xiangji"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/botton_choose_selector_c"
+            android:gravity="center"
+            android:padding="13dp"
+            android:text="相机"
+            android:textColor="#1E88E5"
+            android:textSize="16sp" />
+
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0.3dp"
+            android:background="#D2D2D2" />
+
+        <TextView
+            android:id="@+id/choose_xianggce"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/botton_choose_selector_b"
+            android:gravity="center"
+            android:padding="13dp"
+            android:text="相册"
+            android:textColor="#1E88E5"
+            android:textSize="16dp" />
+
+
+    </LinearLayout>
+
+    <TextView
+        android:id="@+id/cancel"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="10dp"
+        android:layout_marginLeft="20dp"
+        android:layout_marginRight="20dp"
+        android:background="@drawable/botton_choose_selector"
+        android:gravity="center"
+        android:padding="13dp"
+        android:text="取消"
+        android:textColor="#1E88E5"
+        android:textSize="16sp" />
+
+</LinearLayout>