Selaa lähdekoodia

添加客服弹框

316044749 7 vuotta sitten
vanhempi
commit
9ba0946dd2

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

@@ -173,7 +173,7 @@
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />
-                <data android:scheme="tencent100424468" />
+                <data android:scheme="tencent1106743412" />
             </intent-filter>
 
         </activity>

+ 1 - 1
app/src/main/java/com/ynstkz/shitu/android/activity/HomeActivity.java

@@ -239,7 +239,7 @@ public class HomeActivity extends TitleBarActivity implements AMapLocationListen
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void onMessageEvent(RegisterSuccessEvent event) {
-        changleLayout(2);
+        changleLayout(0);
     }
 
     @Subscribe(threadMode = ThreadMode.MAIN)

+ 3 - 1
app/src/main/java/com/ynstkz/shitu/android/application/STApplication.java

@@ -4,6 +4,7 @@ import android.app.Application;
 import android.content.Context;
 
 import com.common.library.okhttp.OkHttpUtils;
+import com.umeng.socialize.Config;
 import com.umeng.socialize.PlatformConfig;
 import com.umeng.socialize.UMShareAPI;
 import com.ynstkz.shitu.android.common.Constants;
@@ -26,6 +27,7 @@ public class STApplication extends Application{
         UMShareAPI.get(this);
         registThreeLoginConfig();
         if(com.common.library.Constants.DEVELOP_MODE){
+            Config.DEBUG = true;
             OkHttpUtils.getInstance().debug("okhttp", true);
         }
     }
@@ -39,7 +41,7 @@ public class STApplication extends Application{
      */
     private void registThreeLoginConfig(){
         PlatformConfig.setWeixin(Constants.WX_KEY, Constants.WX_SECRET);
-        PlatformConfig.setSinaWeibo(Constants.SINA_KEY, Constants.SINA_SECRET,"http://www.baidu.com");
+        PlatformConfig.setSinaWeibo(Constants.SINA_KEY, Constants.SINA_SECRET,"http://www.ynstkz.com");
         PlatformConfig.setQQZone(Constants.QQ_KEY, Constants.QQ_SECRET);
     }
 }

+ 46 - 0
app/src/main/java/com/ynstkz/shitu/android/application/STSign.java

@@ -1,7 +1,19 @@
 package com.ynstkz.shitu.android.application;
 
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
 import com.common.library.cache.Cache;
 import com.common.library.okhttp.callback.Callback;
+import com.common.library.utils.PixelUtil;
+import com.ynstkz.shitu.android.R;
 import com.ynstkz.shitu.android.bean.UserInfoBean;
 import com.ynstkz.shitu.android.common.Constants;
 import com.ynstkz.shitu.android.data.RequestGroup;
@@ -97,4 +109,38 @@ public class STSign {
             }
         });
     }
+
+    /**
+     * 打开客服电话弹框
+     * @param context
+     */
+    public void openPhoneServer(final Activity context){
+        final Dialog dialog = new Dialog(context);
+        View view = LayoutInflater.from(context).inflate(R.layout.view_phone_server, null);
+        dialog.setContentView(view);
+        dialog.getWindow().setLayout((int)(PixelUtil.getScreenWidth(context) * 0.9), ViewGroup.LayoutParams.WRAP_CONTENT);
+        dialog.show();
+
+        TextView tvPnone = view.findViewById(R.id.tv_phone_number);
+        TextView tvCancle = view.findViewById(R.id.tv_cancle);
+        TextView tvCall = view.findViewById(R.id.tv_call);
+
+        tvPnone.setText("40012345678");
+        tvCancle.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                dialog.dismiss();
+            }
+        });
+        tvCall.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                Intent intent = new Intent(Intent.ACTION_DIAL);
+                Uri data = Uri.parse("tel:" + "40012345678");
+                intent.setData(data);
+                context.startActivity(intent);
+                dialog.dismiss();
+            }
+        });
+    }
 }

+ 16 - 3
app/src/main/java/com/ynstkz/shitu/android/fragment/HomeFragment.java

@@ -36,6 +36,7 @@ import com.ynstkz.shitu.android.activity.OrgDetailActivity;
 import com.ynstkz.shitu.android.activity.OrgListActivity;
 import com.ynstkz.shitu.android.adapter.HomeBannerAdapter;
 import com.ynstkz.shitu.android.adapter.OrgNavigationGridAdapter;
+import com.ynstkz.shitu.android.application.STSign;
 import com.ynstkz.shitu.android.base.BaseFragment;
 import com.ynstkz.shitu.android.bean.CourseItemBean;
 import com.ynstkz.shitu.android.bean.CourseNavigationBean;
@@ -85,6 +86,8 @@ public class HomeFragment extends BaseFragment implements PullToRefreshBase.OnRe
     TextView ivOrgMore;
     @Bind(R.id.rl_org_more)
     RelativeLayout rlOrgMore;
+    @Bind(R.id.ll_phone_server)
+    LinearLayout llPhoneServer;
 
 
     private List<HomeBannerBean.DataBean> listBanner;
@@ -184,6 +187,16 @@ public class HomeFragment extends BaseFragment implements PullToRefreshBase.OnRe
                 startActivity(intent);
             }
         });
+
+        /**
+         * 客服电话
+         */
+        llPhoneServer.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                STSign.getInstance().openPhoneServer(getActivity());
+            }
+        });
     }
 
     /**
@@ -323,10 +336,10 @@ public class HomeFragment extends BaseFragment implements PullToRefreshBase.OnRe
 
             //加载课程数据
             LinearLayout llCourseMain = view.findViewById(R.id.ll_course_main);
-            if(orgItemBean.getCourseList() != null && orgItemBean.getCourseList().size() > 0){
+            if (orgItemBean.getCourseList() != null && orgItemBean.getCourseList().size() > 0) {
                 llCourseMain.setVisibility(View.VISIBLE);
                 llCourseMain.removeAllViews();
-                for(int j=0; j<orgItemBean.getCourseList().size(); j++){
+                for (int j = 0; j < orgItemBean.getCourseList().size(); j++) {
                     View courseView = LayoutInflater.from(getActivity()).inflate(R.layout.item_org_course_list, null);
                     TextView tvCourseTitle = courseView.findViewById(R.id.tv_course_title);
                     TextView tvCoursePrice = courseView.findViewById(R.id.tv_course_price);
@@ -442,7 +455,7 @@ public class HomeFragment extends BaseFragment implements PullToRefreshBase.OnRe
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void onMessageEvent(LocationChangedEvent event) {
-        if(event.getAmapLocation() != null){
+        if (event.getAmapLocation() != null) {
             tvLocation.setText(event.getAmapLocation().getDistrict());
             //获取推荐机构列表
             pageNumber = 1;

+ 1 - 0
app/src/main/res/layout/view_home_title.xml

@@ -65,6 +65,7 @@
     </LinearLayout>
 
     <LinearLayout
+        android:id="@+id/ll_phone_server"
         android:layout_width="0dp"
         android:layout_weight="1"
         android:layout_height="match_parent"

+ 58 - 0
app/src/main/res/layout/view_phone_server.xml

@@ -0,0 +1,58 @@
+<?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="match_parent"
+    android:orientation="vertical">
+
+    <TextView
+        android:id="@+id/tv_phone_number"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginTop="@dimen/company_20dp"
+        android:textColor="@color/color_333"
+        android:textSize="@dimen/company_16sp"
+        android:text="拨打电话400123456"/>
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginTop="@dimen/company_20dp"
+        android:textSize="@dimen/company_15sp"
+        android:textColor="@color/color_666"
+        android:text="我们将为您提供更安心的服务"/>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:layout_marginTop="@dimen/company_40dp">
+
+        <TextView
+            android:id="@+id/tv_cancle"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:background="@color/main_color"
+            android:padding="@dimen/company_15dp"
+            android:gravity="center"
+            android:textSize="@dimen/company_16sp"
+            android:textColor="@color/white"
+            android:text="我再逛逛"/>
+
+        <TextView
+            android:id="@+id/tv_call"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:background="@color/white"
+            android:padding="@dimen/company_15dp"
+            android:gravity="center"
+            android:textSize="@dimen/company_16sp"
+            android:textColor="@color/black"
+            android:text="我再逛逛"/>
+
+    </LinearLayout>
+
+</LinearLayout>