Commit 4577285a by 霍志良

Merge remote-tracking branch 'origin/d/4.4.10' into feat/zl/consult_top_modify

# Conflicts:
#	app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
#	build.gradle
parents aa70d33b c2689a91
......@@ -4,11 +4,10 @@ package com.ydl.component.base;
import android.content.Context;
import com.ydl.component.BuildConfig;
import com.ydl.ydlcommon.base.config.GlobalConfig;
import com.ydl.ydlcommon.base.config.IConfigModule;
import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.base.delegate.IAppLifecycles;
import com.ydl.ydlcommon.base.config.GlobalConfig;
import com.ydl.ydlcommon.utils.YDLCacheUtils;
import org.jetbrains.annotations.NotNull;
......@@ -20,7 +19,7 @@ import java.util.List;
*/
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
......
......@@ -137,9 +137,9 @@ dependencies {
//====================云信基础库====================
implementation 'com.ydl:nim-base:1.1.1.2'
implementation 'com.netease.nimlib:basesdk:9.1.1'
implementation 'com.netease.nimlib:avchat:9.1.1'
implementation 'com.netease.nimlib:nrtc:9.1.1'
implementation 'com.netease.nimlib:basesdk:9.2.1'
implementation 'com.netease.nimlib:avchat:9.2.1'
implementation 'com.netease.nimlib:nrtc:9.2.1'
//OPPO推送需要单独引入
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'commons-codec:commons-codec:1.6'
......
......@@ -14,7 +14,7 @@ buildscript {
ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2'
componentVersion = "0.3.0.40-zl"
componentVersion = "0.3.0.44"
}
repositories {
mavenCentral()
......
......@@ -131,7 +131,7 @@ ext {
"flowlayout" : "cn.lankton:flowlayout:3.1.0",
"androidanimations" : "com.daimajia.androidanimations:library:2.3@aar",
//友盟统计
"umeng-common" : "com.umeng.umsdk:common:9.5.1",
"umeng-common" : "com.umeng.umsdk:common:9.5.2",
"umeng-asms" : "com.umeng.umsdk:asms:1.6.3",
//友盟社会化分享
"umeng-share-core" : "com.umeng.umsdk:share-core:7.1.4",
......@@ -164,7 +164,7 @@ ext {
"blankUtil" : "com.blankj:utilcode:1.25.9",
"ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
"ydl-device" : "com.ydl:device-id:0.0.31",
"ydl-device" : "com.ydl:device-id:0.0.35",
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.57@aar", //flutter aar
// "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
......
......@@ -17,5 +17,7 @@
android:launchMode="singleTask"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation="portrait" />
<service android:name=".AudioService"/>
</application>
</manifest>
......@@ -33,7 +33,6 @@ import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.listener.IntentConstants
import com.ydl.audioim.notification.FloatService
import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.router.AudioImIn
......@@ -234,7 +233,6 @@ class AudioHomeActivity :
private var canChangeRoute: Boolean = false
private var hasHandleRefused = false
private var mServiceIntent: Intent? = null
private val notificationCallback = object : IMRegisterObserverCustomNotificationCallBack {
override fun onObserverCustomNotification(fromUid: String, toUid: String, content: String) {
if (fromUid == listenerUid) {
......@@ -522,12 +520,6 @@ class AudioHomeActivity :
override fun initDataAndEvent() {
//状态栏颜色
setWindowStatusBarColor()
mServiceIntent = Intent(this@AudioHomeActivity, FloatService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(mServiceIntent)
} else {
startService(mServiceIntent)
}
//初始化传感器
initSensorManager()
//页面传递数据初始化
......@@ -1607,7 +1599,6 @@ class AudioHomeActivity :
override fun onDestroy() {
super.onDestroy()
stopService(mServiceIntent)
findRouteService(IImService::class.java).unregisterObserveCustomNotification(notificationCallback)
uploadLog()
phoneHandler?.removeCallbacksAndMessages(null)
......
package com.ydl.audioim
import android.app.*
import android.content.Context
import android.content.Intent
import android.os.Build
class AudioService : Service() {
override fun onCreate() {
val createNotification = createNotification(this)
startForeground(12001, createNotification)
}
override fun onBind(intent: Intent?) = null
private fun createNotification(context: Context): Notification = when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> {
// 创建消息渠道
val channel =
NotificationChannel("EasyFloat", "系统悬浮窗", NotificationManager.IMPORTANCE_MIN)
val manager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
manager.createNotificationChannel(channel)
Notification.Builder(context, "EasyFloat")
.setCategory(Notification.CATEGORY_SERVICE)
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ->
Notification.Builder(context)
.setCategory(Notification.CATEGORY_SERVICE)
.setPriority(Notification.PRIORITY_MIN)
else -> Notification.Builder(context)
}
// .setSmallIcon(R.drawable.audioim_audio_home_img_answer)
// .setContentText("正在通话中")
// .setContentIntent(PendingIntent.getActivity(context, 0, Intent(context, MainActivity::class.java), 0))
.setAutoCancel(true)
.setOngoing(true)
.build()
}
\ No newline at end of file
package com.ydl.audioim.notification
import android.app.*
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.IBinder
import com.ydl.audioim.R
class FloatService : Service() {
var notificationManager: NotificationManager? = null;
var notificationId = "audio_av";
var notificationName = "正在通话中";
override fun onBind(intent: Intent?): IBinder? {
return null
}
override fun onCreate() {
super.onCreate()
notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
//创建NotificationChannel
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
var channel = NotificationChannel(
notificationId,
notificationName,
NotificationManager.IMPORTANCE_HIGH
);
//不震动
channel.enableVibration(false);
//静音
channel.setSound(null, null);
notificationManager?.createNotificationChannel(channel);
}
//创建服务后,五秒内调用该方法
startForeground(1, getNotification());
}
/**
* 获取通知(Android8.0后需要)
* @return
*/
fun getNotification(): Notification {
var builder = Notification.Builder(this)
.setSmallIcon(R.drawable.dialog_list_bg)
.setContentTitle("壹点灵")
.setContentIntent(getIntent())
.setContentText("正在通话中");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setChannelId(notificationId);
}
return builder.build();
}
/**
* 点击后,直接打开app(之前的页面),不跳转特定activity
* @return
*/
fun getIntent(): PendingIntent {
var msgIntent =
applicationContext.packageManager.getLaunchIntentForPackage(packageName);//获取启动Activity
var pendingIntent = PendingIntent.getActivity(
applicationContext,
1,
msgIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
return pendingIntent;
}
}
\ No newline at end of file
......@@ -11,7 +11,6 @@ import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.net.Uri
import android.os.Build
import android.os.PowerManager
import android.provider.Settings
import android.text.TextUtils
......@@ -27,7 +26,6 @@ import com.ydl.audioim.R
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.notification.FloatService
import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.utils.AudioLogUtils
import com.ydl.audioim.utils.DateUtils
......@@ -120,7 +118,6 @@ class ConsultantAudioHomeActivity :
* 是否连接成功
*/
private var isConnectSuccess: Boolean = false
private var mServiceIntent: Intent? = null
companion object {
const val PARAM: String = "param"
......@@ -501,12 +498,6 @@ class ConsultantAudioHomeActivity :
override fun initDataAndEvent() {
EventBus.getDefault().register(this)
callEventSave("30", "进入接听界面")
mServiceIntent = Intent(this@ConsultantAudioHomeActivity, FloatService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(mServiceIntent)
} else {
startService(mServiceIntent)
}
//状态栏颜色
setWindowStatusBarColor()
//点亮屏幕 并解锁
......@@ -1123,7 +1114,6 @@ class ConsultantAudioHomeActivity :
}
override fun onDestroy() {
stopService(mServiceIntent)
LogUtil.e("http-------------onDestory")
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.AGORA, "咨询用户端:onDestroy channelId:${mAudioMessageBean?.channelId}")
......
package com.yidianling.consultant.adapter
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.graphics.Typeface
import android.text.SpannableStringBuilder
......@@ -19,10 +20,11 @@ import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.URLUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.consultant.IExpertSearchView
import com.yidianling.consultant.R
import com.yidianling.consultant.constants.ConsultBIConstants
......@@ -30,6 +32,7 @@ import com.yidianling.consultant.listener.OnExpertClickListener
import com.yidianling.consultant.model.bean.ExpertServiceItem
import com.yidianling.consultant.modular.utils.TempH5RouteUtils
import com.yidianling.consultant.router.ConsultantIn
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.main.consultant_expert_search_feedbackrate.view.*
import kotlinx.android.synthetic.main.consultant_expert_search_header_view.view.*
import kotlinx.android.synthetic.main.consultant_expert_search_item_view.view.*
......@@ -581,6 +584,18 @@ class ExpertSearchAdapter(
if (!TextUtils.isEmpty(doctor.uid)) {
val userService = findRouteService(IUserService::class.java)
if (!userService.isBindPhone() && context is Activity) {
CommonDialog(context)
.setMessage("为了及时接收消息通知,请立即绑定手机")
.setLeftOnclick("忍痛放弃") {}
.setRightClick("果断绑定") {
userService.wxBindToInputhonePage(context) // 跳转绑定手机号页面
}
.setCancelAble(false)
.show()
return@setOnClickListener
}
//跳转私聊
ConsultantIn.startP2PSession(context as AppCompatActivity, doctor.uid!!)
ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_PRIVATE_CHAT_CLICK)
......
package com.yidianling.consultant.ui.view.topView
import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.view.View
......@@ -21,8 +20,6 @@ import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import com.yidianling.consultant.model.bean.AllFilter
import com.yidianling.consultant.model.bean.ChildrenBean
import com.yidianling.consultant.model.bean.EightCategoryBean
import kotlinx.android.synthetic.main.consultant_expert_search_big_shot_one.view.*
import kotlinx.android.synthetic.main.consultant_layout_category_view.*
import kotlinx.android.synthetic.main.consultant_layout_category_view.view.*
class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklistener,
......@@ -145,7 +142,7 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
category_detail.layoutManager = leftmanager
category_detail.adapter = categoryRightAdapter
mutableList.forEachIndexed { index, mutable ->
if (mutable[0].isSelected) {
if (mutable.size > 0 && mutable[0].isSelected) {
eightCategoryListBean.get(index).hasData = true
return@forEachIndexed
}
......
......@@ -32,7 +32,7 @@ class CourseListDialog : BaseDialogFragment() {
private lateinit var recycler_list: RecyclerView
override fun getLayoutResourceId(): Int = R.layout.dialog_course_list
override fun getGravity(): Int = Gravity.BOTTOM
override fun setGravity(): Int = Gravity.BOTTOM
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
context?.let { ctx ->
......
......@@ -26,7 +26,7 @@ class CourseSpeedDialog : BaseDialogFragment() {
private lateinit var tv_cancel: TextView
override fun getLayoutResourceId(): Int = R.layout.dialog_course_speed
override fun getGravity(): Int = Gravity.BOTTOM
override fun setGravity(): Int = Gravity.BOTTOM
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
context?.let {
......
......@@ -20,11 +20,11 @@ public class MemberFragment extends DynamicFragment {
private View view;
private Context context;
private TextView member_age_tv,member_emotional_state_tv,member_job_tv,member_address_tv,member_introduction_tv;
private TextView member_age_tv,member_emotional_state_tv,member_job_tv,member_address_tv,member_introduction_tv,member_ip_tv;
String age,emotional_state,job,address,introduction;
String age,emotional_state,job,address,introduction,ipProvince;
public static MemberFragment newInstance(String age, String emotional_state, String job, String address, String introduction){
public static MemberFragment newInstance(String age, String emotional_state, String job, String address, String introduction, String ipProvince){
MemberFragment memberFragment=new MemberFragment();
Bundle args = new Bundle();
args.putString("age", age);
......@@ -32,6 +32,7 @@ public class MemberFragment extends DynamicFragment {
args.putString("job", job);
args.putString("address", address);
args.putString("introduction", introduction);
args.putString("ipProvince", ipProvince);
memberFragment.setArguments(args);
return memberFragment;
}
......@@ -46,18 +47,21 @@ public class MemberFragment extends DynamicFragment {
member_job_tv=(TextView)view.findViewById(R.id.member_job_tv);
member_address_tv=(TextView)view.findViewById(R.id.member_address_tv);
member_introduction_tv=(TextView)view.findViewById(R.id.member_introduction_tv);
member_ip_tv = view.findViewById(R.id.member_ip_tv);
age=getArguments().getString("age");
emotional_state=getArguments().getString("emotional_state");
job=getArguments().getString("job");
address=getArguments().getString("address");
introduction=getArguments().getString("introduction");
ipProvince=getArguments().getString("ipProvince");
member_age_tv.setText(age);
member_emotional_state_tv.setText(emotional_state);
member_job_tv.setText(job);
member_address_tv.setText(address);
member_introduction_tv.setText(introduction);
member_ip_tv.setText(ipProvince);
return view;
}
}
......@@ -24,7 +24,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.alibaba.android.arouter.launcher.ARouter;
import com.google.gson.internal.LinkedTreeMap;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.base.BaseActivity;
......@@ -83,7 +83,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
List<String> reportReasons;//举报内容列表
private FragmentManager fragmentManager;
String age, emotional_state, job, address, introduction;
String age, emotional_state, job, address, introduction, ipProvince;
String focus_state;//关注状态
boolean zan_state;
......@@ -239,6 +239,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
job = person.profession;
address = person.address;
introduction = person.description;
ipProvince = person.ipProvince;
String bg = person.bg;
GlideApp.with(MembersActivity.this)
.load(head)
......@@ -477,12 +478,13 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
private void RightSet() {
final List<String> dialog_datas = new ArrayList<String>();
if (shielding == false) {
if (!shielding) {
dialog_datas.add("屏蔽ta");
} else {
dialog_datas.add("解除屏蔽");
}
dialog_datas.add("举报");
dialog_datas.add("投诉与反馈");
int itemTextColor = getResources().getColor(R.color.dynamic_black);
ListDialog.Builder builder1 = new ListDialog.Builder(MembersActivity.this, dialog_datas, itemTextColor);
builder1.SetLastStr("取消");
......@@ -495,19 +497,20 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
builder1.SetOnItemClickLister(new ListDialog.Builder.OnItemClickLister() {
@Override
public void onItemClick(Dialog dialog, View view, int position) {
if (dialog_datas.size() == 2) {//不含取消关注
switch (position) {
case 0:
if (shielding == false) {
shieldHint();
} else {
RemoveShielding();
}
break;
case 1:
report();
break;
}
switch (position) {
case 0:
if (!shielding) {
shieldHint();
} else {
RemoveShielding();
}
break;
case 1:
report();
break;
case 2:
ARouter.getInstance().build("/mine/FeedBackActivity").navigation();
break;
}
dialog.dismiss();
}
......@@ -728,7 +731,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
members_information_tv.setTextColor(getResources().getColor(R.color.platform_main_theme));
members_information_hint_tv.setBackgroundColor(getResources().getColor(R.color.platform_main_theme));
if (memberfragment == null) {
memberfragment = MemberFragment.newInstance(age, emotional_state, job, address, introduction);
memberfragment = MemberFragment.newInstance(age, emotional_state, job, address, introduction, ipProvince);
transaction.add(R.id.members_content_frm, memberfragment);
} else {
transaction.show(memberfragment);
......
......@@ -35,6 +35,7 @@ public class CommentBean {
private ShareData share_data;
private int isAvailable; //是否空闲 0-否 1-是
private int isOpenListen; //是否开通倾诉 0-否 1-是
private String ipProvince;
private String listenLinkUrl; //统一路由url
......@@ -52,6 +53,14 @@ public class CommentBean {
return isOpenListen;
}
public String getIpProvince() {
return ipProvince;
}
public void setIpProvince(String ipProvince) {
this.ipProvince = ipProvince;
}
public ShareData getShare_data() {
return share_data;
}
......
......@@ -24,5 +24,7 @@ public class MemberInfoBean {
public String description;
public String address;
public String bg;
public String ipProvince;
}
}
......@@ -76,6 +76,7 @@ public class TrendsDetailInfoBean {
public String uid;
public String multitextType;//动态类型
public ExtAd ext;
public String ipProvince;
}
//图片
......
......@@ -948,6 +948,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
holder.setHeadImageWithUrl(R.id.item_recommend_trend_user_head_iv, data.getHeader()); //头像
holder.setText(R.id.text_userName, data.getName()); //用户名
holder.setText(R.id.text_time, data.getTime_str()); //发布时间
if (!TextUtils.isEmpty(data.getIpProvince())) holder.setText(R.id.tv_ip, "IP属地: " + data.getIpProvince()); // IP属地
holder.setImageResource(R.id.img_comment_sex, data.getGender() == 1 ? R.drawable.dynamic_male : R.drawable.dynamic_female);
holder.setImageResource(R.id.img_comment_zan, data.getIs_zan() == 1 ? R.drawable.dynamic_reply_zan_sel : R.drawable.dynamic_reply_zan);
showCommentItemContent(holder, data);
......@@ -1406,6 +1407,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
return commentCount > commentListAdapter.getDatas().size();
}
@SuppressLint("SetTextI18n")
private void fillContent() {
linComment.setVisibility(VISIBLE);
linContent.setVisibility(View.VISIBLE);
......@@ -1420,8 +1422,8 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
tvContent.setVisibility(View.GONE);
}
tvUserName.setText(mTrendBody.name);
tvTime.setText(mTrendBody.timeStr + "-"); //发布时间
tvFrom.setText(mTrendBody.from); //来源
tvTime.setText(mTrendBody.timeStr); //发布时间
if (!TextUtils.isEmpty(mTrendBody.ipProvince)) tvFrom.setText("IP属地: " + mTrendBody.ipProvince); // IP属地
if (TextUtils.isEmpty(mTrendBody.title)) {
tvTrendInfoTitle.setVisibility(GONE);
......
......@@ -335,6 +335,7 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
intent.putExtra("bundle", bundle);
startActivity(intent);
// PublishTrendActivityTrends.Companion.start(requireContext(),"44","今日打卡");
trendsAndQuestionDialog.dismiss();
}
@Override
......@@ -349,6 +350,7 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
bundle.putInt("dynamic_question", 2);
intent.putExtra("bundle", bundle);
startActivity(intent);
trendsAndQuestionDialog.dismiss();
}
});
trendsAndQuestionDialog.show();
......
......@@ -309,15 +309,15 @@
android:layout_weight="1">
<TextView
android:id="@+id/members_information_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="个人资料"
android:textColor="@color/dynamic_text_gray"
android:textSize="18sp" />
android:id="@+id/members_information_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="个人资料"
android:textColor="@color/dynamic_text_gray"
android:textSize="18sp" />
<TextView
android:id="@+id/members_information_hint_tv"
......
......@@ -61,6 +61,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:visibility="visible"
android:visibility="gone">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
......@@ -148,7 +149,6 @@
</RelativeLayout>
<TextView
android:id="@+id/text_time"
android:layout_width="wrap_content"
......@@ -166,11 +166,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text_userName_rel"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:layout_toRightOf="@id/text_time"
android:textColor="@color/dynamic_text_trend_defult"
android:textSize="12sp"
tools:text=" - 来自安卓客户端" />
tools:text="IP属地: XX" />
<TextView
android:id="@+id/text_guanzhu"
......@@ -498,6 +499,7 @@
<com.ydl.ydlcommon.ui.LogoLoadingView
android:id="@+id/v_loading"
tools:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
......
......@@ -114,4 +114,25 @@
android:text=""
android:textSize="18sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dynamic_black"
android:text="IP属地"
android:textSize="18sp"
android:layout_marginRight="15dp"/>
<TextView
android:id="@+id/member_ip_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dynamic_black"
android:textSize="18sp"/>
</LinearLayout>
</LinearLayout>
......@@ -112,6 +112,17 @@
tools:text="23分钟前" />
<TextView
android:id="@+id/tv_ip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_9d9ea7"
android:layout_toEndOf="@id/text_time"
android:layout_marginStart="10dp"
android:textSize="12sp"
android:layout_alignBaseline="@id/text_time"
tools:text="IP属地: XX"/>
<TextView
android:id="@+id/text_chat"
android:layout_width="60dp"
android:layout_height="30dp"
......
......@@ -23,7 +23,9 @@ import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.*
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.consultant.OnBottomWordListener
import com.yidianling.consultant.api.IConsultantService
......@@ -698,7 +700,11 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
}
textView.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
}
list?.get(tab.position)?.let { homeEvent?.getConfideData(it, tab.position) }
val minus = list?.size ?: -1
if (minus != -1 && tab.position < minus) {
list?.get(tab.position)?.let { homeEvent?.getConfideData(it, tab.position) }
}
}
}
......
......@@ -9,15 +9,18 @@ import android.widget.FrameLayout
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.URLUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeConsultBean
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_consult_item_view.view.*
/**
......@@ -72,7 +75,6 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
)*/
//补充点击事件埋点
ActionCountUtils.count(HomeBIConstants.YDL_USER_EXPERT_INTRODUCTION_CLICK, bean.uid.toString())
val url = URLUtils.appendParmas(bean.linkUrl,"cateId",cateId)
ModularServiceManager.provide(IConsultantService::class.java).dueToTypeJumpAutoOrGuide(
mContext as Activity,
11,
......@@ -134,6 +136,18 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
*/
private fun setConfideButton(bodyBean: HomeConsultBean.ListBean) {
tv_consult_chat.setOnClickListener {
val userService = findRouteService(IUserService::class.java)
if (!userService.isBindPhone() && context is Activity) {
CommonDialog(context)
.setMessage("为了及时接收消息通知,请立即绑定手机")
.setLeftOnclick("忍痛放弃") {}
.setRightClick("果断绑定") {
userService.wxBindToInputhonePage(context as Activity) // 跳转绑定手机号页面
}
.setCancelAble(false)
.show()
return@setOnClickListener
}
ModularServiceManager.provide(IConsultantService::class.java).dueToTypeJumpAutoOrGuide(
mContext as Activity,
11,
......
......@@ -17,8 +17,8 @@
android:id="@+id/tv_consult_chat"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/img_consult_head"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/platform_dp_13"
android:layout_marginEnd="@dimen/platform_dp_15"
android:background="@drawable/home_consult_chat_bg"
......
......@@ -118,6 +118,7 @@
<activity
android:name="com.yidianling.avchatkit.activity.AVChatActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="@style/FullScreenTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
......
package com.yidianling.avchatkit;
import android.app.NotificationManager;
import android.os.Build;
import android.os.Handler;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.netease.nimlib.app.AppForegroundWatcherCompat;
import com.netease.nimlib.sdk.avchat.model.AVChatData;
import com.yidianling.avchatkit.activity.AVChatActivity;
import com.yidianling.avchatkit.common.Handlers;
......@@ -21,6 +23,18 @@ public class AVChatProfile {
private boolean isAVChatting = false; // 是否正在音视频通话
private NotificationManager notificationManager;
public static AVChatProfile getInstance() {
return InstanceHolder.instance;
}
public boolean isAVChatting() {
return isAVChatting;
}
public void setAVChatting(boolean chating) {
isAVChatting = chating;
}
@Nullable
private AVChatData backgroundIncomingCallData;
@Nullable
......@@ -33,7 +47,12 @@ public class AVChatProfile {
return TextUtils.equals(backgroundIncomingCallData.getAccount(), account);
}
public void removeBackgroundIncomingCall(boolean activeMissCall) {
private static class InstanceHolder {
public final static AVChatProfile instance = new AVChatProfile();
}
public void removeBackgroundIncomingCall(boolean activeMissCall) {
backgroundIncomingCallData = null;
if (backgroundIncomingCallNotification != null) {
......@@ -50,32 +69,29 @@ public class AVChatProfile {
@Override
public void run() {
// 启动,如果 task正在启动,则稍等一下
if (AVChatKit.isMainTaskLaunching()) {
launchIncomingCall(data, displayName, source);
if (Build.VERSION.SDK_INT >= 29 && AppForegroundWatcherCompat.isBackground()) {
backgroundIncomingCallData = data;
backgroundIncomingCallNotification = new AVChatNotification(AVChatKit.getContext());
backgroundIncomingCallNotification.init(data.getAccount(), displayName);
backgroundIncomingCallNotification.activeIncomingCallNotification(true, backgroundIncomingCallData);
} else {
launchActivityTimeout();
AVChatActivity.incomingCall(AVChatKit.getContext(), data, displayName, source);
// 启动,如果 task正在启动,则稍等一下
if (AVChatKit.isMainTaskLaunching()) {
launchIncomingCall(data, displayName, source);
} else {
launchActivityTimeout();
AVChatActivity.incomingCall(AVChatKit.getContext(), data, displayName, source);
}
}
}
};
Handlers.sharedHandler(AVChatKit.getContext()).postDelayed(runnable, 200);
}
public static AVChatProfile getInstance() {
return InstanceHolder.instance;
}
public boolean isAVChatting() {
return isAVChatting;
}
public void setAVChatting(boolean chating) {
isAVChatting = chating;
}
private static class InstanceHolder {
public final static AVChatProfile instance = new AVChatProfile();
}
public void launchActivity(final AVChatData data, final String displayName, final int source) {
Runnable runnable = new Runnable() {
......
package com.yidianling.avchatkit.activity;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.LayoutInflater;
......@@ -118,13 +120,7 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
// 接听来电
public static void incomingCall(Context context, AVChatData config, String displayName, int source) {
needFinish = false;
Intent intent = new Intent();
intent.setClass(context, AVChatActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(KEY_CALL_CONFIG, config);
intent.putExtra(KEY_DISPLAY_NAME, displayName);
intent.putExtra(KEY_IN_CALLING, true);
intent.putExtra(KEY_SOURCE, source);
Intent intent = incomingCallIntent(context, config, displayName, source);
context.startActivity(intent);
}
@NonNull
......@@ -143,6 +139,10 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getIntent().hasExtra(KEY_NEED_FINISH)) {
needFinish = getIntent().getBooleanExtra(KEY_NEED_FINISH, false);
}
// 若来电或去电未接通时,点击home。另外一方挂断通话。从最近任务列表恢复,则finish
if (needFinish) {
finish();
......@@ -184,7 +184,6 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
protected void onPause() {
super.onPause();
hasOnPause = true;
}
@Override
......@@ -662,6 +661,7 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
avChatData != null ? avChatData.getAccount() : receiverId);
}
@SuppressLint("CheckResult")
@Override
public void onAudioToVideo() {
new RxPermissions(this)
......@@ -729,7 +729,11 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
@Override
public void finish() {
isUserFinish = true;
super.finish();
if (mIsInComingCall && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
super.finishAndRemoveTask();
} else {
super.finish();
}
}
......
package com.yidianling.avchatkit.ui;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
......@@ -10,13 +9,13 @@ import android.widget.Button;
import android.widget.Chronometer;
import android.widget.TextView;
import com.blankj.utilcode.constant.PermissionConstants;
import com.blankj.utilcode.util.PermissionUtils;
import com.netease.nimlib.sdk.avchat.AVChatCallback;
import com.netease.nimlib.sdk.avchat.AVChatManager;
import com.netease.nimlib.sdk.avchat.constant.AVChatControlCommand;
import com.netease.nimlib.sdk.avchat.constant.AVChatType;
import com.netease.nimlib.sdk.avchat.model.AVChatData;
import com.tbruyelle.rxpermissions2.Permission;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.utils.DeviceTool;
import com.yidianling.avchatkit.AVChatKit;
import com.yidianling.avchatkit.activity.AVChatActivity;
......@@ -34,7 +33,7 @@ import com.yidianling.avchatkit.module.AVSwitchListener;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import io.reactivex.functions.Consumer;
import java.util.List;
/**
* 音频界面显示变化以及点击事件
......@@ -383,22 +382,21 @@ public class AVChatAudioUI implements View.OnClickListener, ToggleListener {
@SuppressLint("CheckResult")
private void requestPermission() {
new RxPermissions((Activity) this.context)
.requestEach(Manifest.permission.RECORD_AUDIO,Manifest.permission.CAMERA)
.subscribe(new Consumer<Permission>() {
PermissionUtils
.permission(PermissionConstants.MICROPHONE, PermissionConstants.CAMERA)
.callback(new PermissionUtils.FullCallback() {
@Override
public void accept(Permission permission) throws Exception {
if (permission.granted) {
doReceiveCall();
} else if (permission.shouldShowRequestPermissionRationale){
requestPermission();
}else {
ToastUtil.toastLong(context,"请开启相机和麦克风权限后重试");
DeviceTool.openPersisonSetting((Activity) AVChatAudioUI.this.context);
((Activity) AVChatAudioUI.this.context).finish();
}
public void onGranted(List<String> permissionsGranted) {
doReceiveCall();
}
} );
@Override
public void onDenied(List<String> permissionsDeniedForever, List<String> permissionsDenied) {
ToastUtil.toastLong(context, "请开启相机和麦克风权限后重试");
DeviceTool.openPersisonSetting((Activity) AVChatAudioUI.this.context);
((Activity) AVChatAudioUI.this.context).finish();
}
}).request();
}
// 接听来电
......
......@@ -15,7 +15,6 @@ import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.ListNoCancelDialog
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.param.RmHistoryParam
import com.yidianling.im.api.param.RmTalkParam
import com.yidianling.im.api.param.TopMessageParam
......@@ -24,15 +23,11 @@ import com.yidianling.im.event.UpdateTabUnreadNumEvent
import com.yidianling.im.helper.IMChatUtil
import com.yidianling.im.helper.MsgReceiveHelper
import com.yidianling.im.http.ImHttpImpl
import com.yidianling.im.router.ImIn
import com.yidianling.im.session.SessionHelper
import com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import com.yidianling.im.ui.page.fragment.bean.ChatModelBean
import com.yidianling.im.ui.page.fragment.view.ChatItemView
import com.yidianling.im.ui.page.fragment.view.ChatTimeItemView
import com.yidianling.im.ui.param.ChatParam
import de.greenrobot.event.EventBus
import kotlinx.android.synthetic.main.im_chat_fragment_layout.*
/**
* 互动列表适配器
......@@ -94,7 +89,7 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
name.add("标记为已读")
}
val builder = ListNoCancelDialog.Builder(context, name, 0)
builder.SetOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
builder.setOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
override fun onItemClick(dialog: Dialog, view: View, position1: Int) {
val tag = name[position1]
when (tag) {
......
package com.ydl.js
import android.app.Activity
import android.content.Context
import android.webkit.JavascriptInterface
import androidx.fragment.app.FragmentActivity
import com.google.gson.Gson
......@@ -18,6 +20,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil
import com.yidianling.user.api.service.IUserService
......@@ -56,14 +59,15 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
wvEnventPro?.jumpLogin(jsData.cmd?.params)
return
}
val userService = findRouteService(IUserService::class.java)
if (jsData.url.equals("http")) {
if (jsData.cmd?.params?.toUid != 0) {
wvEnventPro?.chat(
findRouteService(IUserService::class.java).getUserInfo()?.uid?.toInt() ?: 0,
userService.getUserInfo()?.uid?.toInt() ?: 0,
jsData.cmd?.params?.toUid ?: 0,
0,
findRouteService(IUserService::class.java).getUserInfo()?.accessToken,
userService.getUserInfo()?.accessToken,
jsData.cmd?.params?.isFromQingShu ?: 0,
jsData.cmd?.params?.closeReplaceChat ?: false
)
......@@ -72,11 +76,11 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
}
} else if (jsData.url.equals("ydl_app")) {
wvEnventPro?.ydlNative(jsData.cmd)
jumpAction(jsData)
jumpAction(jsData, userService)
}
}
fun jumpAction(jsData: H5JsBean) {
private fun jumpAction(jsData: H5JsBean, userService: IUserService) {
LogUtil.d("jumpAction")
when (jsData.cmd!!.action_name) {
"fm" -> if (jsData.cmd!!.params!!.id > 0) {
......@@ -126,23 +130,24 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
"chat" ->
//私聊
if (wvEnventPro != null) {
wvEnventPro?.chat(findRouteService(IUserService::class.java).getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid, 0,
JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu,
jsData.cmd!!.params!!.closeReplaceChat
wvEnventPro.chat(userService.getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid, 0,
JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu,
jsData.cmd!!.params!!.closeReplaceChat
)
// 埋点
ActionCountUtils.count("ydl_user_main_page|private_chat_click")
}
"chat_send_message" ->
"chat_send_message" -> {
//跳转私聊:并发送消息
if (wvEnventPro != null) {
wvEnventPro!!.chatSendMessage(findRouteService(IUserService::class.java).getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid,
0, JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu)
}
wvEnventPro?.chatSendMessage(
userService.getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid,
0, JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu
)
}
"chat_team" ->
//群聊
if (wvEnventPro != null) {
......@@ -169,7 +174,7 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
"set_time_warn" ->
//提醒专家设置时间
if (wvEnventPro != null) {
wvEnventPro!!.sendSubscriptionTimeMessage("" + jsData.cmd?.params?.toUid)
wvEnventPro.sendSubscriptionTimeMessage("" + jsData.cmd?.params?.toUid)
}
"user_home" -> if (wvEnventPro != null) {
wvEnventPro!!.openMember("" + jsData.cmd?.params?.uid)
......@@ -507,4 +512,5 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
}
}
}
......@@ -39,6 +39,8 @@ import io.reactivex.disposables.Disposable
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_play_meditation.*
import kotlinx.android.synthetic.main.activity_play_meditation.iv_close
import kotlinx.android.synthetic.main.activity_play_meditation.tv_title
import kotlinx.android.synthetic.main.player_control_view.*
import java.util.*
import java.util.concurrent.TimeUnit
......
......@@ -32,10 +32,6 @@
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".ui.FillInfoActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".safePrivate.CheckPasswordActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
......@@ -126,19 +122,19 @@
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".mine.PersonalDesActivity"
android:name=".mine.PersonalInfoActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".mine.PersonalInfoActivity"
android:name=".mine.RechargeActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".mine.RechargeActivity"
android:name=".mine.ModifyInfoActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".mine.SetInfoActivity"
android:name=".mine.ModifyAvatarActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
......
......@@ -7,9 +7,11 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.CollectFocusItemBean
import com.yidianling.user.http.LoginApiRequestUtil.Companion.LOGIN_USER_PORT
import com.yidianling.user.http.request.UserModifyAuditRespDto
import com.yidianling.user.http.response.*
import com.yidianling.user.mine.bean.RedPacketId
import io.reactivex.Observable
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.*
......@@ -67,16 +69,6 @@ interface UserApi {
@POST("user/set-info")
fun setUserInfo(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>
//上传头像
@Multipart
@POST("user/set-info")
fun uploadHeadImg(@PartMap params: MutableMap<String, RequestBody>): Observable<BaseResponse<Any>>
//上传头像
@Multipart
@POST("user/set-info")
fun uploadHeadImg(@Part("type") param: RequestBody): Observable<BaseResponse<Any>>
//验证账号密码
@FormUrlEncoded
@POST("user/chkin-pass")
......@@ -251,4 +243,27 @@ interface UserApi {
@POST("login/v2/is_need_strong_bind")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
fun isNeedForceBindPhone(@Body map: Map<String,String>): Observable<BaseAPIResponse<Boolean>>
/**
* 修改昵称、头像、简介等基本信息
*/
@POST("user/v1/baseInfo/modify")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun modifyUserBaseInfo(@Body map: Map<String,String>): Observable<BaseAPIResponse<Boolean>>
/**
* 获取用户审核信息
*/
@POST("user/v1/getUserAuditInfo")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getUserAuditInfo(@Body map: Map<String,String>): Observable<BaseAPIResponse<UserModifyAuditRespDto>>
/**
* 上传图片
*/
@Multipart
@POST("file/upload")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun uploadFile(@Part file: MultipartBody.Part): Observable<BaseAPIResponse<String>>
}
\ No newline at end of file
......@@ -9,15 +9,11 @@ import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.CheckPhonePassBean
import com.yidianling.user.bean.CollectFocusItemBean
import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword
import com.yidianling.user.http.response.CountryResponse
import com.yidianling.user.http.response.ExistResponse
import com.yidianling.user.http.response.SecretResponse
import com.yidianling.user.mine.bean.RedPackDataForRegister
import com.yidianling.user.http.response.*
import com.yidianling.user.mine.bean.RedPacketId
import com.yidianling.user.mine.bean.RedPacketIdCmd
import com.yidianling.user.http.response.*
import io.reactivex.Observable
import java.io.File
/**
* author : Zhangwenchao
......@@ -46,8 +42,6 @@ interface UserHttp {
fun setUserInfo(param: UserInfoParam): Observable<BaseResponse<Any>>
fun uploadHead(param: HeadParam): Observable<BaseResponse<Any>>
fun checkPhonePass(cmd: CheckPhonePassBean): Observable<BaseResponse<CheckPassword>>
fun bindQQ(param: BindQQ): Observable<BaseResponse<Any>>
......@@ -84,4 +78,10 @@ interface UserHttp {
/**用户注销账号*/
fun accountLogOff(param: UserForbidLoginParam):Observable<BaseAPIResponse<Boolean>>
fun modifyUserBaseInfo(param: ModifyBaseInfo): Observable<BaseAPIResponse<Boolean>>
fun getUserAuditInfo(type: BaseInfo): Observable<BaseAPIResponse<UserModifyAuditRespDto>>
fun uploadFile(file: File): Observable<BaseAPIResponse<Boolean>>
}
\ No newline at end of file
......@@ -4,16 +4,11 @@ import android.app.Activity
import com.google.gson.Gson
import com.google.gson.internal.LinkedTreeMap
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseCommand
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.CheckPhonePassBean
import com.yidianling.user.bean.CollectFocusItemBean
......@@ -21,14 +16,14 @@ import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword
import com.yidianling.user.http.response.CountryResponse
import com.yidianling.user.http.response.ExistResponse
import com.yidianling.user.http.response.SecretResponse
import com.yidianling.user.mine.bean.RedPacketId
import com.yidianling.user.mine.bean.RedPacketIdCmd
import com.yidianling.user.rxlogin.LoginObservable
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
/**
* author : Zhangwenchao
......@@ -117,49 +112,40 @@ class UserHttpImpl private constructor() : UserHttp {
.flatMap { getUserApi().setUserInfo(it) }
}
//验证账号密码
override fun checkPhonePass(cmd: CheckPhonePassBean): Observable<BaseResponse<CheckPassword>> {
return RxUtils.mapObservable(cmd)
.flatMap { getUserApi().checkPhonePass(it) }
override fun modifyUserBaseInfo(param: ModifyBaseInfo): Observable<BaseAPIResponse<Boolean>> {
return RxUtils.mapObservable(param)
.flatMap { getUserApi().modifyUserBaseInfo(it) }
}
override fun getUserAuditInfo(type: BaseInfo): Observable<BaseAPIResponse<UserModifyAuditRespDto>> {
return RxUtils.mapObservable(type)
.flatMap { getUserApi().getUserAuditInfo(it) }
}
override fun uploadHead(param: HeadParam): Observable<BaseResponse<Any>> {
return Observable.just(param)
override fun uploadFile(file: File): Observable<BaseAPIResponse<Boolean>> {
return Observable.just(true)
.compose(RxUtils.netCheck())
.subscribeOn(Schedulers.io())
.map {
val map = HashMap<String, RequestBody>()
val mediaType = MediaType.parse("text/plain")
map["type"] = RequestBody.create(mediaType, it.type)
map["value"] = RequestBody.create(mediaType, it.value)
map["ffrom"] = RequestBody.create(mediaType, YdlCommonOut.getChannelName())
map["isFromApp"] = RequestBody.create(mediaType, "1")
map["osBuild"] = RequestBody.create(
mediaType,
"""${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()},${
RxAppTool.getAppVersionName(
BaseApp.getApp()
)
}"""
)
map["ts"] =
RequestBody.create(mediaType, (System.currentTimeMillis() / 1000).toString())
map["version"] =
RequestBody.create(mediaType, RxAppTool.getAppVersionName(BaseApp.getApp()))
val userInfo = UserHelper.getUserInfo()
if (userInfo != null) {
map["uid"] = RequestBody.create(mediaType, userInfo.uid)
map["accessToken"] = RequestBody.create(mediaType, userInfo.accessToken)
}
val fileBody = RequestBody.create(MediaType.parse("multipart/form-data"), it.file)
map.put("""head"; filename="${it.file.name}""", fileBody)
map
}
.flatMap {
getUserApi().uploadHeadImg(it)
getUserApi().uploadFile(
MultipartBody.Part.createFormData(
"file", file.name,
RequestBody.create(MediaType.parse("multipart/form-data"), file)
)
)
}.flatMap {
if (it.code == "200")
modifyUserBaseInfo(ModifyBaseInfo(it.data, 102))
else
Observable.just(BaseAPIResponse())
}
}
//验证账号密码
override fun checkPhonePass(cmd: CheckPhonePassBean): Observable<BaseResponse<CheckPassword>> {
return RxUtils.mapObservable(cmd)
.flatMap { getUserApi().checkPhonePass(it) }
}
override fun bindQQ(param: BindQQ): Observable<BaseResponse<Any>> {
return RxUtils.mapObservable(param)
.flatMap { getUserApi().bindQQ(it) }
......
package com.yidianling.user.http.request
data class ModifyBaseInfo(val modifyValue: String?,
val type: Int // 101:用户昵称 102:用户头像 103:用户简介
)
data class BaseInfo(val type: Int)
\ No newline at end of file
package com.yidianling.user.http.request
import com.ydl.ydlcommon.data.http.BaseCommand
data class UserModifyAuditRespDto(
val auditReason: String?, // 审核原因
val auditStatus: Int, // 审核状态 1:审核中,2:审核失败,3:已审核 || 提交审核
val auditTime: String?, // 审核时间
val auditor: String?, // 审核人
val auditorId: String?, // 审核人id
val createTime: String?, // 申请时间
val id: Int,
val last7Day: Boolean, // 最近7天申请修改
val modifyAfter: String?, // 变更后
val modifyBefore: String?, // 变更前
val modifyField: String? // 变更字段
) : BaseCommand()
\ No newline at end of file
package com.yidianling.user.mine
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.widget.TextView
import androidx.fragment.app.DialogFragment
import com.ydl.ydlcommon.base.BaseDialogFragment
import com.yidianling.user.R
/**
* 修改头像dialog
*/
class AvaterDialog : BaseDialogFragment() {
override fun getLayoutResourceId(): Int = R.layout.dialog_album_photo
override fun setGravity(): Int = Gravity.BOTTOM
lateinit var listener: (Int, DialogFragment) -> Unit
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val tv_album = view.findViewById<TextView>(R.id.tv_album)
tv_album.setOnClickListener {
listener.invoke(0, this)
}
val tv_photo = view.findViewById<TextView>(R.id.tv_photo)
tv_photo.setOnClickListener {
listener.invoke(1, this)
}
val tv_cancel = view.findViewById<TextView>(R.id.tv_cancel)
tv_cancel.setOnClickListener {
listener.invoke(2, this)
}
}
}
\ No newline at end of file
......@@ -63,7 +63,7 @@ class ChooseAccountActivity : BaseActivity() {
list.add("编辑")
list.add("删除")
val builder = ListNoCancelDialog.Builder(this, list, 0)
builder.SetOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
builder.setOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
override fun onItemClick(dialog: Dialog?, view: View?, index: Int) {
val name = list[index]
when (name) {
......
......@@ -59,8 +59,8 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener {
private var isPhoneNull = true
private var imgFiles: MutableList<File>? = null
internal var work_time = if (PlatformDataManager.getRam().getGlobalInfo() == null) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time
internal var tel = if (PlatformDataManager.getRam().getGlobalInfo() == null) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel
private var work_time = if (PlatformDataManager.getRam().getGlobalInfo() == null) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time
private var tel = if (PlatformDataManager.getRam().getGlobalInfo() == null) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel
override fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions(true, true)
}
......
......@@ -29,7 +29,6 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils.Companion.count
import com.ydl.ydlcommon.view.dialog.YDLShareDialog
import com.ydl.ydlcommon.view.dialog.YDLShareDialog.Companion.style4
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.im.api.service.IImService
import com.yidianling.im.message.param.MsgListParam
import com.yidianling.user.BuildConfig
import com.yidianling.user.R
......@@ -324,7 +323,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
.compose(resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { response: UserResponseBean ->
.subscribe({ response: UserResponseBean ->
swipe_refresh_layout.isRefreshing = false
try {
//此处后端返回信息,只有userinfo,其它数据为空,切勿整体赋值
......@@ -625,30 +624,14 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
mShareDialog?.show(activity?.fragmentManager, "lose")
}
/**
* 收到照片选取事件
*/
fun onEventBackgroundThread(event: UserResponseBean?) {
if (event?.userInfo != null) {
userInfoData = event.userInfo
}
}
fun onEvent(event: RefreshRecentContactListEvent?) {
refreshCouponData()
}
fun onEvent(event: UserChangeEvent) {
val changeFlag = event.isChange_flag
if (changeFlag) {
if (event.isChange_flag) {
initdata()
refreshCouponData()
try {
provide(
IImService::class.java
).updateUserHead(getUserInfo()?.userInfo?.head)
} catch (e: Exception) {
}
}
}
}
\ No newline at end of file
package com.yidianling.user.mine;
import android.annotation.SuppressLint;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.bean.StatusBarOptions;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.data.http.ThrowableConsumer;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.utils.remind.ToastHelper;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.api.service.IImService;
import com.yidianling.user.R;
import com.yidianling.user.UserHelper;
import com.yidianling.user.http.UserHttp;
import com.yidianling.user.http.UserHttpImpl;
import com.yidianling.user.http.request.UserInfoParam;
import org.jetbrains.annotations.NotNull;
import io.reactivex.android.schedulers.AndroidSchedulers;
/**
* 个人资料--个人简介
* Created by hgw on 2017/3/24.
*/
public class PersonalDesActivity extends BaseActivity {
ImageView imageBack;
TextView tvCenterTitle;
TextView textSave;
RelativeLayout relaToolBar;
EditText editDes;
@NotNull
@Override
public StatusBarOptions getStatusViewOptions() {
return new StatusBarOptions(true,true);
}
@Override
protected int layoutResId() {
return R.layout.user_mine_activity_personal_des;
}
@Override
protected void initDataAndEvent() {
imageBack = findViewById(R.id.image_back);
tvCenterTitle = findViewById(R.id.tv_center_title);
editDes = findViewById(R.id.edit_des);
textSave = findViewById(R.id.text_save);
imageBack.setOnClickListener(v -> {
finish();
});
textSave.setOnClickListener(v -> {
updateInfo("home_desc", editDes.getText().toString());
});
init();
}
private void init() {
String desc = "";
try {
desc = ModularServiceManager.INSTANCE.provide(IImService.class).getUserInfoDescription();
} catch (Exception e) {}
editDes.setText(desc);
}
@SuppressLint("CheckResult")
private void updateInfo(final String changType, final String value) {
showProgressDialog("保存中");
UserHttp userHttp = UserHttpImpl.Companion.getInstance();
userHttp.setUserInfo(new UserInfoParam(changType, value))
.filter(objectBaseResponse -> changType.equals("home_desc"))
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(o -> {
dismissProgressDialog();
UserHelper.INSTANCE.getUserInfo().getUserInfo().setDescription(value);
ToastUtil.toastShort("保存成功");
finish();
}, new ThrowableConsumer() {
@Override
public void accept(@NotNull String msg) {
dismissProgressDialog();
ToastHelper.Companion.show(msg);
}
});
}
}
package com.yidianling.user.mine;
import android.content.Intent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.bean.StatusBarOptions;
import com.ydl.ydlcommon.view.DeleteEditTextView;
import com.ydl.ydlcommon.view.TitleBar;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.user.R;
import org.jetbrains.annotations.NotNull;
/**
* 短信息填写
* Created by softrice on 15/9/29.
*/
public class SetInfoActivity extends BaseActivity {
public static final String INPUT = "INPUT";
@NotNull
@Override
public StatusBarOptions getStatusViewOptions() {
return new StatusBarOptions(true,true);
}
public static Intent getIntent(String input) {
Intent intent = new Intent();
intent.putExtra(INPUT, input);
return intent;
}
public static String getInput(Intent intent) {
if (intent == null) {
return null;
}
return intent.getStringExtra(INPUT);
}
String mTitle;
String mOldString;
DeleteEditTextView det_set_info;
TitleBar tb_title_bar;
Animation shake;
@Override
protected int layoutResId() {
return R.layout.user_mine_activity_set_info;
}
@Override
protected void initDataAndEvent() {
det_set_info = findViewById(R.id.det_set_info);
tb_title_bar = findViewById(R.id.tb_title_bar);
mTitle = getIntent().getStringExtra("mTitle");
mOldString = getIntent().getStringExtra("mOldString");
init();
}
void init() {
shake = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.user_mine_shake);
tb_title_bar.setTitle(mTitle);
det_set_info.setText(mOldString);
tb_title_bar.setOnRightTextClick(new TitleBar.OnTitleBarTextClick() {
@Override
public void onClick(View view, boolean isActive) {
if (checkInput()) {
ToastUtil.toastShort("保存成功");
setResult(RESULT_OK, getIntent(det_set_info.getText().toString()));
finish();
}
}
});
}
boolean checkInput() {
if (det_set_info.getText().length() == 0) {
ToastUtil.toastShort("请输入昵称");
det_set_info.startAnimation(shake);
return false;
}
if (det_set_info.getText().length() > 6) {
ToastUtil.toastShort("昵称最多6个字哦");
det_set_info.startAnimation(shake);
return false;
}
return true;
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp"/>
<solid android:color="@color/color_1DA1F2"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp"/>
<solid android:color="@color/color_C3C4CA"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp"/>
<solid android:color="@android:color/white"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="8dp"
android:topRightRadius="8dp"/>
<solid android:color="@android:color/white"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E6000000">
<com.ydl.ydlcommon.view.TitleBar
android:id="@+id/tip_bar"
android:layout_width="match_parent"
android:layout_height="44dp"
app:layout_constraintTop_toTopOf="parent"
app:pa_divide_visibility="false"
app:pa_left_start_icon="@drawable/platform_common_back_un"
app:pa_title_bar_text_color="@android:color/white"
app:pa_title_text="头像" />
<TextView
android:id="@id/tv_tip1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:gravity="center"
android:textColor="@color/color_62636F"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@id/iv_avatar"
tools:text="抱歉,七天内只能修改一次头像" />
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center_horizontal"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
app:layout_constraintTop_toBottomOf="@id/iv_avatar">
<ImageView
android:id="@+id/iv_warn"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginTop="2.5dp"
android:layout_marginEnd="3dp"
android:src="@drawable/modify_warn"
android:visibility="gone"
tools:visibility="visible" />
<TextView
android:id="@+id/tv_tip2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/iv_warn"
android:gravity="center_horizontal"
android:textColor="@color/color_C3C4CA"
android:lineSpacingExtra="5dp"
android:textSize="12sp"
tools:text="审核失败,XXX先休息休息寻寻寻寻小地方付付付付。如有疑问联系客服小壹" />
</RelativeLayout>
<TextView
android:id="@+id/tv_modify"
android:layout_width="333dp"
android:layout_height="54dp"
android:layout_marginBottom="50dp"
android:background="@drawable/bg_1da1f2_corner_8"
android:gravity="center"
android:text="修改头像"
android:textColor="@android:color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F7F7FA"
android:orientation="vertical">
<com.ydl.ydlcommon.view.TitleBar
android:id="@+id/tb_title_bar"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@color/platform_white"
app:pa_left_start_icon="@drawable/platform_common_back"
android:layout_marginBottom="16dp"
app:pa_right_text="保存"
app:pa_title_text="修改昵称" />
<TextView
android:id="@+id/tv_tip1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="26dp"
android:layout_marginBottom="12dp"
android:textColor="@color/color_C3C4CA"
android:textSize="14sp"
android:visibility="gone"
tools:text="七天内可修改一次昵称"
tools:visibility="visible"/>
<com.ydl.ydlcommon.view.DeleteEditTextView
android:id="@+id/det_set_info"
android:layout_width="match_parent"
android:layout_height="55dp"
android:textColorHint="@color/color_C3C4CA"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_corner_8_white"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:paddingTop="12dp"
android:gravity="center_vertical"
android:textSize="18sp"
android:textColor="@color/color_1C1F28"
android:paddingBottom="15dp" />
<LinearLayout
android:layout_marginTop="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="26dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_warn"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="12dp"
android:layout_marginTop="2dp"
android:layout_height="12dp"
android:layout_marginEnd="4dp"
android:src="@drawable/modify_warn"/>
<TextView
android:id="@+id/tv_tip2"
android:layout_marginEnd="26dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="5dp"
android:textColor="@color/color_9d9ea7"
android:textSize="12sp"
android:visibility="gone"
tools:text="审核失败,简介有风险词。如有疑问联系客服小壹"
tools:visibility="visible" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:background="@drawable/bg_top_corner_8_white">
<TextView
android:id="@+id/tv_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="相册"
android:textColor="@color/color_1C1F28"
android:textSize="16sp"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/divide_1"
android:layout_width="match_parent"
android:layout_height="0.5dp"
app:layout_constraintTop_toBottomOf="@id/tv_album"
android:background="@color/color_EFEFF1"/>
<TextView
android:id="@+id/tv_photo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="拍照"
android:textColor="@color/color_1C1F28"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/divide_1" />
<View
android:id="@+id/divide_2"
android:layout_width="match_parent"
android:layout_height="0.5dp"
app:layout_constraintTop_toBottomOf="@id/tv_photo"
android:background="@color/color_EFEFF1"/>
<TextView
android:id="@+id/tv_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="取消"
android:textColor="@color/color_1C1F28"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/divide_2" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.ydl.ydlcommon.view.TitleBar
android:id="@+id/tb_title"
android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height"
app:pa_left_text="退出"
android:background="@color/platform_white"
app:pa_title_text="完善资料" />
<com.ydl.ydlcommon.view.CircleImageView
android:id="@+id/sdv_head"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="30dp"
android:src="@drawable/user_regist_photo" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/user_divide_line_stroke_width"
android:layout_marginTop="36dp"
android:background="@color/platform_divide_color" />
<TextView
android:id="@+id/tv_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/platform_white"
android:gravity="center"
android:hint="@string/platform_please_select_gender"
android:padding="@dimen/platform_default_dis_size_huge"
android:textColorHint="#777777" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/user_divide_line_stroke_width"
android:background="@color/platform_divide_color" />
<EditText
android:id="@+id/et_nick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/platform_white"
android:gravity="center"
android:hint="@string/platform_nickname_hint"
android:maxLength="10"
android:padding="@dimen/platform_default_dis_size_huge"
android:singleLine="true"
android:textColorHint="#777777" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/user_divide_line_stroke_width"
android:background="@color/platform_divide_color" />
<com.ydl.ydlcommon.view.RoundCornerButton
android:id="@+id/rcb_submit"
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/platform_default_dis_size_big"
android:layout_marginRight="@dimen/platform_default_dis_size_big"
android:layout_marginTop="@dimen/platform_default_dis_size_huge"
android:text="@string/platform_finish"
android:textColor="@color/platform_white"
android:textSize="@dimen/platform_default_text_size_big"
app:pa_round_btn_active_bg="@color/platform_white"
app:pa_round_btn_bg="@color/platform_main_theme"
app:pa_round_btn_radio_size="5dp" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#f5f5f5"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rela_toolBar"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="45dp">
<ImageView
android:id="@+id/image_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="15dp"
android:paddingRight="20dp"
android:gravity="center_vertical"
android:src="@drawable/platform_common_back" />
<TextView
android:id="@+id/tv_center_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:ellipsize="end"
android:gravity="center"
android:maxEms="12"
android:maxLines="1"
android:text="简介"
android:textColor="#555555"
android:textSize="16sp" />
<TextView
android:id="@+id/text_save"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_alignParentRight="true"
android:paddingRight="20dp"
android:text="保存"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:layout_alignParentBottom="true"
android:background="#EDEDED" />
</RelativeLayout>
<EditText
android:id="@+id/edit_des"
android:layout_width="match_parent"
android:layout_height="300dp"
android:gravity="start"
android:maxLength="150"
android:padding="10dp"
android:background="@color/white"
android:textColorHint="#cbd0d8"
android:hint="一句话介绍下自己"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical">
<com.ydl.ydlcommon.view.TitleBar
android:id="@+id/tb_title_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height"
app:pa_left_text="取消"
app:pa_right_text="保存"
android:background="@color/platform_white"
app:pa_title_text="title" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:layout_marginTop="14dp"
android:background="#EDEDED" />
<com.ydl.ydlcommon.view.DeleteEditTextView
android:id="@+id/det_set_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="@dimen/platform_default_dis_size"
android:singleLine="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:background="#EDEDED" />
</LinearLayout>
......@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.app.Application
import android.os.Build
import com.alibaba.android.arouter.launcher.ARouter
import com.bun.miitmdid.core.JLibrary
import com.tencent.mmkv.MMKV
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.UpLoadLogUtils
......@@ -28,7 +27,7 @@ object YdlRepository {
// 需要在主 module 的 application 的 onCreate 方法中调用此方法
fun initApp(app: Application,isDebug:Boolean) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
JLibrary.InitEntry(app)
System.loadLibrary("msaoaidsec")
}
MMKV.initialize(app);
LogHelper.getInstance().deleteExpireLogSync()
......
......@@ -20,6 +20,7 @@ import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.AndroidSystemHelper
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.statusBar.StatusBarUtil
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject
import kotlin.properties.Delegates
......@@ -37,6 +38,9 @@ abstract class BaseActivity : AppCompatActivity(), IActivityLifecycleable {
var statusView: View? = null
private var loadingDialogFragment: LoadingDialogFragment? = null
@JvmField
val mDisposables = CompositeDisposable()
override fun provideLifecycleSubject(): Subject<ActivityEvent> {
return mLifecycleSubject;
}
......@@ -157,6 +161,7 @@ abstract class BaseActivity : AppCompatActivity(), IActivityLifecycleable {
override fun onDestroy() {
super.onDestroy()
mDisposables.takeIf { !it.isDisposed }?.dispose()
ActivityManager.getInstance().removeStack(this)
AndroidSystemHelper.fixInputMethodManagerLeak(this)
}
......
......@@ -8,6 +8,7 @@ import android.view.ViewDebug.ExportedProperty
import android.view.ViewDebug.IntToString
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.annotation.StyleRes
import androidx.fragment.app.DialogFragment
import com.ydl.ydlcommon.R
......@@ -18,7 +19,7 @@ abstract class BaseDialogFragment : DialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_TITLE, R.style.bottomUpDialog)
setStyle(STYLE_NO_TITLE, setTheme())
}
override fun onCreateView(
......@@ -33,7 +34,7 @@ abstract class BaseDialogFragment : DialogFragment() {
super.onStart()
dialog?.window?.run {
attributes = attributes?.apply {
gravity = getGravity()
gravity = setGravity()
width = getWidth()
height = getHeight()
}
......@@ -42,7 +43,9 @@ abstract class BaseDialogFragment : DialogFragment() {
@LayoutRes
abstract fun getLayoutResourceId(): Int
open fun getGravity(): Int = Gravity.NO_GRAVITY
open fun setGravity(): Int = Gravity.NO_GRAVITY
@StyleRes
open fun setTheme(): Int = R.style.bottomUpDialog
@ExportedProperty(
category = "layout",
......
......@@ -2,8 +2,11 @@ package com.ydl.ydlcommon.base.config
import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.devicesidlib.DeviceIDHelper
import com.ydl.devicesidlib.Utils
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.bean.AuthBean
......@@ -15,6 +18,7 @@ import com.ydl.ydlcommon.data.http.GsonProvider
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.api.ApiRequestUtil
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.DeviceTool
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
......@@ -53,6 +57,7 @@ class HttpConfig {
private const val YDL = "Ydl"
private const val UID = "uid"
private const val FFROM = "ffrom"
private const val FID = "fid"
private const val IS_FROM_APP = "isFromApp"
private const val OS_BUILD = "osBuild"
private const val TS = "ts"
......@@ -470,6 +475,17 @@ class HttpConfig {
builder.addHeader(TOKEN, loginBean.token)
.addHeader(UID, loginBean.userId)
}
// 请求头添加fid参数
if (DeviceTool.checkHasAgreeSecret()) {
val deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
//获取imei
Utils.getIMEI(BaseApp.getApp())
} else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
builder.addHeader(FID, deviceId)
}
it.proceed(builder.build())
}
}
......
......@@ -2,7 +2,6 @@ package com.ydl.ydlcommon.utils;
import static com.umeng.socialize.utils.ContextUtil.getPackageName;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentName;
......@@ -21,7 +20,6 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.BuildConfig;
import com.yidianling.common.tools.RxTool;
......@@ -108,41 +106,6 @@ public class DeviceTool {
}
/**
* 获取手机IMEI
*
* @return
*/
@SuppressLint("MissingPermission")
public static final String getIMEI() {
Activity topTaskActivity = ActivityManager.Companion.getInstance().getTopTaskActivity();
if (checkHasAgreeSecret()) {
try {
String imei = "";
RxPermissions rxPermissions = new RxPermissions(topTaskActivity);
if (rxPermissions.isGranted(Manifest.permission.READ_PHONE_STATE)) {
//实例化TelephonyManager对象
TelephonyManager telephonyManager = (TelephonyManager) topTaskActivity.getSystemService(Context.TELEPHONY_SERVICE);
if (null == telephonyManager) {
return "";
}
//获取IMEI号
imei = telephonyManager.getDeviceId();
if (imei == null) {
return "";
}
}
return RxTool.Md5(imei);
} catch (Exception e) {
e.printStackTrace();
return "";
}
} else {
return "";
}
}
/**
* 检查是否同意隐私协议
* */
public static boolean checkHasAgreeSecret() {
......
......@@ -13,7 +13,6 @@ import android.net.Uri
import android.os.Build
import android.os.Environment
import android.os.PowerManager
import android.telephony.TelephonyManager
import android.text.TextUtils
import android.util.DisplayMetrics
import android.util.Log
......@@ -22,10 +21,10 @@ import android.view.View
import android.view.ViewConfiguration
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import java.io.File
import java.lang.reflect.Field
import java.text.NumberFormat
/**
* Created by haorui on 2019-08-22 .
* Des: 设备信息工具类
......@@ -567,10 +566,6 @@ class DeviceUtils private constructor() {
context.startActivity(intent)
}
fun getIMEI(context: Context): String {
val tel = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
return tel.deviceId
}
val phoneType: String
get() = Build.MODEL
......
......@@ -38,7 +38,7 @@ public class FileUtils {
/**
* sd卡的根目录
*/
private static String mSdRootPath = Environment.getExternalStorageDirectory().getPath();
private static final String mSdRootPath = Environment.getExternalStorageDirectory().getPath();
/**
* 手机的缓存根目录
*/
......@@ -48,12 +48,8 @@ public class FileUtils {
*/
private final static String FOLDER_NAME = "/yidianling";
private static Context mContext;
public FileUtils(Context context) {
mDataRootPath = context.getCacheDir().getPath();
mContext = context;
}
......@@ -77,9 +73,9 @@ public class FileUtils {
mSdRootPath : mDataRootPath;
}
public File SaveBitmap(Bitmap mBitmap, String path) throws IOException {
public static File saveBitmap(Bitmap mBitmap, String path) throws IOException {
File file;
isFilleExit(path);
isFileExit(path);
File f = new File(path);
try {
f.createNewFile();
......@@ -100,7 +96,7 @@ public class FileUtils {
}
public void SaveBitmap(Bitmap mBitmap, String path, String filen_name) throws IOException {
isFilleExit(path);
isFileExit(path);
File f = new File(path + filen_name);
try {
f.createNewFile();
......@@ -174,13 +170,12 @@ public class FileUtils {
* @param path
* @return
*/
public static boolean isFilleExit(String path) {
Boolean isexit = false;
public static boolean isFileExit(String path) {
boolean isexit = false;
File f = new File(path);
if (f.exists()) {
isexit = true;
} else {
isexit = false;
if (!f.exists()) {
try {
f.mkdirs();
......@@ -196,7 +191,7 @@ public class FileUtils {
* 删除该目录下所有文件
* @param root
*/
public void deleteAllFiles(File root) {
public static void deleteAllFiles(File root) {
File files[] = root.listFiles();
if (files != null)
for (File f : files) {
......@@ -224,7 +219,7 @@ public class FileUtils {
* @param imageFile
* @return
*/
public Uri getImageContentUri(Context context, File imageFile) {
public static Uri getImageContentUri(Context context, File imageFile) {
String filePath = imageFile.getAbsolutePath();
Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
......@@ -235,9 +230,11 @@ public class FileUtils {
if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor
.getColumnIndex(MediaStore.MediaColumns._ID));
cursor.close();
Uri baseUri = Uri.parse("content://media/external/images/media");
return Uri.withAppendedPath(baseUri, "" + id);
} else {
if (cursor != null) cursor.close();
if (imageFile.exists()) {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, filePath);
......
......@@ -11,14 +11,12 @@ import android.text.TextUtils
import android.util.Log
import com.google.gson.Gson
import com.ydl.devicesidlib.DeviceIDHelper
import com.ydl.devicesidlib.Utils
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.api.ApiRequestUtil
import com.ydl.ydlcommon.data.http.params.ActionDataBean
import com.ydl.ydlcommon.data.http.params.BaiduActionDataBean
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.DeviceTool
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxDeviceTool
......@@ -145,21 +143,8 @@ class ActionCountUtils {
actionDataParams.osVersion(Build.VERSION.RELEASE)
actionDataParams.wifi(if (isWifi()) 0 else 1)
var deviceId = ""
/*
* 因为DeviceIDHelper.getInstance().deviceId对于imei
* 序列号对于小米手机Utils.getIMEI(context)
* 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */
if (DeviceTool.checkHasAgreeSecret()){
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
//获取imei
Utils.getIMEI(topTaskActivity)
} else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
if (DeviceTool.checkHasAgreeSecret()) {
deviceId = DeviceIDHelper.getInstance().deviceId
}
actionDataParams.deviceId(deviceId)
......@@ -263,22 +248,8 @@ class ActionCountUtils {
baiduActionDataParams.pkname = packageName
baiduActionDataParams.deviceType = 2
var deviceId = ""
/*
* 因为DeviceIDHelper.getInstance().deviceId对于imei
* 序列号对于小米手机Utils.getIMEI(context)
* 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */
if (DeviceTool.checkHasAgreeSecret()) {
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
//获取imei
Utils.getIMEI(topTaskActivity)
} else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
deviceId = DeviceIDHelper.getInstance().deviceId
}
//外部参数添加deviceid
actionDataParams.deviceId(deviceId)
......@@ -355,18 +326,11 @@ class ActionCountUtils {
actionDataParams.api = api
actionDataParams.appVersion(RxDeviceTool.getAppVersionName(BaseApp.getApp()))
var deviceId = ""
if (DeviceTool.checkHasAgreeSecret()){
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
//获取imei
Utils.getIMEI(topTaskActivity)
} else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
if (DeviceTool.checkHasAgreeSecret()) {
deviceId = DeviceIDHelper.getInstance().deviceId
}
actionDataParams.deviceId=deviceId
actionDataParams.deviceId = deviceId
actionDataParams.time(System.currentTimeMillis())
actionDataParams.appId(appId)
......@@ -406,14 +370,7 @@ class ActionCountUtils {
actionDataParams.appVersion(RxDeviceTool.getAppVersionName(BaseApp.getApp()))
var deviceId = ""
if (DeviceTool.checkHasAgreeSecret()) {
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
//获取imei
Utils.getIMEI(topTaskActivity)
} else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
deviceId = DeviceIDHelper.getInstance().deviceId
}
actionDataParams.deviceId = deviceId
......
......@@ -21,6 +21,7 @@ import com.ydl.ydlcommon.R;
public class DeleteEditTextView extends EditText {
int mCloseAreaSize;
private boolean mShowDelete = true;
public DeleteEditTextView(Context context) {
super(context);
......@@ -43,6 +44,10 @@ public class DeleteEditTextView extends EditText {
setSelection(text.length());
}
public void setShowDelete(boolean showDelete) {
this.mShowDelete = showDelete;
}
/**
* 初始化视图
*/
......@@ -77,6 +82,7 @@ public class DeleteEditTextView extends EditText {
}
void setEditTextDrawable() {
if (!mShowDelete) return;
if (getText().length() == 0 || !isFocused()) {
setCompoundDrawablesWithIntrinsicBounds(getCompoundDrawables()[0], null, null, null);
} else {
......@@ -87,7 +93,7 @@ public class DeleteEditTextView extends EditText {
@Override
public boolean onTouchEvent(MotionEvent event) {
if ((event.getAction() == 1) && isFocused()) {
if (mShowDelete && (event.getAction() == 1) && isFocused()) {
int i = (int) event.getRawX();
if (i > getRight() - mCloseAreaSize) {
setText("");
......
......@@ -63,15 +63,11 @@ public class ListNoCancelDialog extends Dialog {
return this;
}
public ListNoCancelDialog.Builder SetOnItemClickLister(ListNoCancelDialog.Builder.OnItemClickLister lister) {
public ListNoCancelDialog.Builder setOnItemClickLister(ListNoCancelDialog.Builder.OnItemClickLister lister) {
this.mOnItemClickLister = lister;
return this;
}
public ListNoCancelDialog create() {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
......
......@@ -38,6 +38,8 @@ public class TitleBar extends RelativeLayout {
int buttom_color;
//左侧图标颜色
int mLeftStartIconColor ;
//下划线是否可见
private boolean mDividerVisibility;
//文字内容
String mLeftText, mTitle, mRightText;
......@@ -196,26 +198,27 @@ public class TitleBar extends RelativeLayout {
void initRoot(AttributeSet attrs, int defStyleAttr) {
final TypedArray a = getContext().obtainStyledAttributes(
attrs, R.styleable.Platform_TitleBar, defStyleAttr, 0);
attrs, R.styleable.TitleBar, defStyleAttr, 0);
mLeftText = a.getString(R.styleable.Platform_TitleBar_pa_left_text);
mLeftStartIcon = a.getDrawable(R.styleable.Platform_TitleBar_pa_left_start_icon);
mLeftEndIcon = a.getDrawable(R.styleable.Platform_TitleBar_pa_left_end_icon);
mRight = a.getDrawable(R.styleable.Platform_TitleBar_pa_right_iv);
mLeftText = a.getString(R.styleable.TitleBar_pa_left_text);
mLeftStartIcon = a.getDrawable(R.styleable.TitleBar_pa_left_start_icon);
mLeftEndIcon = a.getDrawable(R.styleable.TitleBar_pa_left_end_icon);
mRight = a.getDrawable(R.styleable.TitleBar_pa_right_iv);
mTitle = a.getString(R.styleable.Platform_TitleBar_pa_title_text);
mTitle = a.getString(R.styleable.TitleBar_pa_title_text);
mRightText = a.getString(R.styleable.Platform_TitleBar_pa_right_text);
mRightStartIcon = a.getDrawable(R.styleable.Platform_TitleBar_pa_right_start_icon);
mRightEndIcon = a.getDrawable(R.styleable.Platform_TitleBar_pa_right_end_icon);
mRightText = a.getString(R.styleable.TitleBar_pa_right_text);
mRightStartIcon = a.getDrawable(R.styleable.TitleBar_pa_right_start_icon);
mRightEndIcon = a.getDrawable(R.styleable.TitleBar_pa_right_end_icon);
mTextColor = a.getColor(R.styleable.Platform_TitleBar_pa_title_bar_text_color, 0xff3c3c3c);
mSideTextColor = a.getColor(R.styleable.Platform_TitleBar_pa_side_text_color, 0xff3c3c3c);
mTextColor = a.getColor(R.styleable.TitleBar_pa_title_bar_text_color, 0xff3c3c3c);
mSideTextColor = a.getColor(R.styleable.TitleBar_pa_side_text_color, 0xff3c3c3c);
//底部线颜色
buttom_color = a.getColor(R.styleable.Platform_TitleBar_pa_bm_line_color, getResources().getColor(R.color.platform_divide_color));
buttom_color = a.getColor(R.styleable.TitleBar_pa_bm_line_color, getResources().getColor(R.color.platform_divide_color));
//左侧图标颜色
mLeftStartIconColor = a.getColor(R.styleable.Platform_TitleBar_pa_left_start_icon_color, 0xffffff);
mLeftStartIconColor = a.getColor(R.styleable.TitleBar_pa_left_start_icon_color, 0xffffff);
mDividerVisibility = a.getBoolean(R.styleable.TitleBar_pa_divide_visibility, true);
a.recycle();
setGravity(Gravity.CENTER_VERTICAL);
......@@ -256,6 +259,7 @@ public class TitleBar extends RelativeLayout {
//底部线
iv_title_divide.setBackgroundColor(buttom_color);
iv_title_divide.setVisibility(mDividerVisibility ? View.VISIBLE : View.GONE);
//设置点击事件
setupTextClick();
......
......@@ -2,7 +2,7 @@
<resources>
<!--头部bar-->
<declare-styleable name="Platform_TitleBar">
<declare-styleable name="TitleBar">
<attr name="pa_left_text" />
<attr name="pa_left_start_icon" format="reference" />
<attr name="pa_left_end_icon" format="reference" />
......@@ -15,6 +15,7 @@
<attr name="pa_bm_line_color" format="color" />
<attr name="pa_right_iv" format="reference" />
<attr name="pa_left_start_icon_color" format="color" />
<attr name="pa_divide_visibility" format="boolean" />
</declare-styleable>
<attr name="pa_left_text" format="string" />
<attr name="pa_right_text" format="string" />
......
......@@ -127,9 +127,14 @@
<color name="color_1C1F28">#1C1F28</color>
<color name="color_1DA1F2">#1DA1F2</color>
<color name="color_EB892C">#EB892C</color>
<color name="color_9D9EA7">#9D9EA7</color>
<color name="color_EFEFF1">#EFEFF1</color>
<color name="color_FAFAFF">#FAFAFF</color>
<color name="color_242424">#242424</color>
<color name="color_9d9ea7">#9D9EA7</color>
<color name="color_C3C4CA">#C3C4CA</color>
<color name="color_2E2E30">#2E2E30</color>
<color name="color_191919">#191919</color>
<color name="color_E5E5E5">#E5E5E5</color>
<color name="color_F7F7FA">#F7F7FA</color>
<color name="color_62636F">#62636F</color>
</resources>
package com.ydl.utils;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import com.ydl.view.MoreClickView;
import com.ydl.webview.IJavascriptHandler;
/**
* Created by Wi1ls on 2016/10/17;
*/
public class PopUtils {
public static PopupWindow showMoreItem(Context context, View view, IJavascriptHandler jtoJHandle){
MoreClickView v= new MoreClickView(context,jtoJHandle);
WindowManager windowManager= (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
final PopupWindow popupWindow=new PopupWindow(v, windowManager.getDefaultDisplay().getWidth(),
windowManager.getDefaultDisplay().getHeight());
v.setPopupWindow(popupWindow);
popupWindow.setFocusable(false);
popupWindow.setOutsideTouchable(true);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.showAtLocation(view, Gravity.CENTER,0,0);
return popupWindow;
}
}
......@@ -7,6 +7,7 @@ import android.text.TextUtils
import android.view.View
import android.widget.PopupWindow
import android.widget.RelativeLayout
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.webview.IJavascriptHandler
import com.ydl.webview.R
import com.ydl.ydlcommon.base.config.ChannelConfig
......@@ -20,12 +21,17 @@ import kotlinx.android.synthetic.main.web_ui_new_more.view.*
/**
* Created by Wi1ls on 2016/10/17;
*/
class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : RelativeLayout(context), View.OnClickListener {
private var mJtoJHandle: IJavascriptHandler?= jtoJHandle
class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : RelativeLayout(context),
View.OnClickListener {
private var mJtoJHandle: IJavascriptHandler? = jtoJHandle
private var mPopupWindow: PopupWindow? = null
private val work_time = if (PlatformDataManager.getRam().getGlobalInfo() == null) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time
private val tel = if (PlatformDataManager.getRam().getGlobalInfo() == null) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel
private val work_time = if (PlatformDataManager.getRam()
.getGlobalInfo() == null
) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time
private val tel = if (PlatformDataManager.getRam()
.getGlobalInfo() == null
) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel
init {
View.inflate(context, R.layout.web_ui_new_more, this)
......@@ -33,38 +39,37 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
}
internal fun init() {
fl_main.setOnClickListener(this)
if(mJtoJHandle?.setMoreMsg()!=null){
if (mJtoJHandle?.setMoreMsg() != null) {
more_msg.setOnClickListener(mJtoJHandle?.setMoreMsg())
}else{
} else {
more_msg.setOnClickListener(this)
}
if(mJtoJHandle?.setMoreHomePage()!=null){
if (mJtoJHandle?.setMoreHomePage() != null) {
more_homepage.setOnClickListener(mJtoJHandle?.setMoreHomePage())
}else{
} else {
more_homepage.setOnClickListener(this)
}
if(mJtoJHandle?.setMoreService()!=null){
if (mJtoJHandle?.setMoreService() != null) {
more_service.setOnClickListener(mJtoJHandle?.setMoreService())
}else{
} else {
more_service.setOnClickListener(this)
}
if(mJtoJHandle?.setMoreCall()!=null){
if (mJtoJHandle?.setMoreCall() != null) {
more_ray.setOnClickListener(mJtoJHandle?.setMoreCall())
}else{
} else {
more_ray.setOnClickListener(this)
}
more_feed.setOnClickListener(this)
/* if (YdlCommonRouterManager.getYdlCommonRoute().isHasUnread()) {
msg_new.setVisibility(View.VISIBLE)
} else {
msg_new.setVisibility(View.INVISIBLE)
}*/
var unreadNum = ModularServiceManager.provide(IImService::class.java).getAllUnReadNum()
val unreadNum = ModularServiceManager.provide(IImService::class.java).getAllUnReadNum()
if (unreadNum <= 0) {
un_read_num.visibility = View.GONE
}
else {
} else {
if (unreadNum > 99) {
un_read_num.text = "${unreadNum}+"
} else {
......@@ -80,8 +85,6 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
mPopupWindow!!.dismiss()
}
when (view.id) {
R.id.fl_main -> {
}
R.id.more_msg -> {
setMoreMsg()
}
......@@ -92,7 +95,10 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
setMoreService()
}
R.id.more_ray -> {
setMoreRay()
setMoreRay()
}
R.id.more_feed -> {
ARouter.getInstance().build("/mine/FeedBackActivity").navigation()
}
}
......@@ -116,24 +122,14 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
private fun setMoreRay() {
CommonDialog(context)
.setMessage("欢迎致电壹点灵客服热线\n$tel\n服务时间:$work_time")
.setLeftOnclick("取消", null)
.setRightClick("拨打") {
if (null != tel && !TextUtils.isEmpty(tel)) {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$tel"))
context.startActivity(phoneIntent)
}
}.show()
}
private var callBack: CallPhoneCallBack? = null
fun setCallPhoneCallBack(callBack: CallPhoneCallBack) {
this.callBack = callBack
}
interface CallPhoneCallBack {
fun call(tel: String, action: String)
.setMessage("欢迎致电壹点灵客服热线\n$tel\n服务时间:$work_time")
.setLeftOnclick("取消", null)
.setRightClick("拨打") {
if (null != tel && !TextUtils.isEmpty(tel)) {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$tel"))
context.startActivity(phoneIntent)
}
}.show()
}
fun setPopupWindow(popupWindow: PopupWindow) {
......
......@@ -18,8 +18,10 @@ import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
......@@ -37,10 +39,10 @@ import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.ydl.utils.PopUtils;
import com.ydl.utils.ProxyCheckUtils;
import com.ydl.utils.WebUrlParamsUtils;
import com.ydl.view.ArticleDialogFragment;
import com.ydl.view.MoreClickView;
import com.ydl.view.ShareMeditationDialog;
import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydlcommon.base.BaseActivity;
......@@ -131,8 +133,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private ShareMeditationDialog shareMeditationDialog;
private ArticleDialogFragment commentArticleDialog;
protected PopupWindow popupWindow;
protected ValueCallback<Uri> uploadMessage;
protected ValueCallback<Uri[]> uploadMessageAboveL;
private boolean shouldClearHistory = false;
......@@ -536,8 +536,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
public void openRightTopMenu() {
popupWindow = PopUtils.showMoreItem(this,
tb_title.getRootView(), jtoJHandle);
MoreClickView moreView = new MoreClickView(this, jtoJHandle);
PopupWindow popupWindow = new PopupWindow(moreView, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
moreView.setPopupWindow(popupWindow);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true); // 防止外部点击事件穿透
popupWindow.showAtLocation(tb_title, Gravity.TOP | Gravity.END, 0, 0);
}
public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
......@@ -641,8 +645,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
purl = intent.getStringExtra("purl");
//要加"more"按钮
if (h5Params.isShowMenu()) {
tb_title.setRightImageListener(v -> popupWindow = PopUtils.showMoreItem(this,
tb_title.getRootView(), jtoJHandle));
tb_title.setRightImageListener(v -> openRightTopMenu());
tb_title.setRightImageIfShouldSee();
} else {
tb_title.setRightImageIfNoSee();
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp"/>
<solid android:color="@android:color/white"/>
</shape>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment