Commit 0052a112 by konghaorui

User 模块删除dynamic依赖、修复隐私弹出框bug、补充H5页面url参数加签

parent 16d481a6
......@@ -45,13 +45,13 @@ ext {
"m-confide" : "0.0.48.8",
"m-consultant" : "0.0.58.3",
"m-fm" : "0.0.29.2",
"m-user" : "0.0.59.8",
"m-user" : "0.0.59.17",
"m-home" : "0.0.20.3",
"m-im" : "0.0.15.9",
"m-im" : "0.0.16.1",
"m-dynamic" : "0.0.7.4",
"m-muse" : "0.0.28.8",
"m-tests" : "0.0.23.9",
"m-tests" : "0.0.23.10",
"m-course" : "0.0.41.10",
//-------------- 业务模块 API 层 --------------
......@@ -69,14 +69,14 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.8",
"ydl-platform" : "0.0.39.10",
//第二步 若干
"ydl-webview" : "0.0.38.8",
"ydl-webview" : "0.0.38.11",
"ydl-media" : "0.0.21.3",
"ydl-pay" : "0.0.18.4",
"ydl-pay" : "0.0.18.5",
"m-audioim" : "0.0.48.0",
"ydl-flutter-base": "0.0.10.8",
"ydl-flutter-base": "0.0.14.2",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -115,10 +115,10 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.7",
"ydl-platform" : "0.0.39.9",
//第二步 若干
"ydl-webview" : "0.0.38.4",
"ydl-webview" : "0.0.38.11",
"ydl-media" : "0.0.21.3",
"ydl-pay" : "0.0.18.4",
"m-audioim" : "0.0.48.0",
......@@ -270,7 +270,7 @@ ext {
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.17.8@aar", //flutter aar
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.17.10@aar", //flutter aar
"ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号
......
......@@ -5,7 +5,6 @@ import android.support.v4.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.yidianling.home.api.service.IHomeService
import com.yidianling.home.ui.fragment.YdlHomeFragment
import com.yidianling.home.ui.utils.Double11ActivityManagerUtils
@Route(path = "/home/HomeService")
class HomeServiceImpl : IHomeService {
......@@ -15,7 +14,6 @@ class HomeServiceImpl : IHomeService {
}
override fun setDouble11ShowType(mBool: Boolean) {
Double11ActivityManagerUtils.notShowDouble11Activity = mBool
}
override fun getYDLHomeFragment(): Fragment {
......
package com.yidianling.home.ui.utils;
/**
* 双十一活动管理类
*/
public class Double11ActivityManagerUtils {
/**
* 不显示双11活动,仅用于2019年双11活动使用
*/
public static boolean notShowDouble11Activity = false;
}
......@@ -32,7 +32,6 @@ import com.yidianling.home.event.HomeImpl
import com.yidianling.home.listener.HomeConfideRecyleSuspendListener
import com.yidianling.home.model.bean.*
import com.yidianling.home.presenter.HomePresenterImpl
import com.yidianling.home.ui.utils.Double11ActivityManagerUtils
import com.yidianling.home.ui.view.CouponDialog
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.xlzx.home_fragment_home_module.*
......@@ -226,14 +225,12 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
return
}
}
if (!ModularServiceManager.provide(IUserService::class.java).isLogin()) {
//未登录不显示
return
}
//如果是首次注册,会有新手礼包弹窗,则不显示此弹窗
if (Double11ActivityManagerUtils.notShowDouble11Activity) {
if (!ModularServiceManager.provide(IUserService::class.java).isLogin()||!ModularServiceManager.provide(IUserService::class.java).isFirstLogin()) {
//未登录/首次登录 不显示
return
}
if (!TextUtils.isEmpty(act.imageBanner)) {
//展示弹窗
if (aa == null) {
......@@ -255,7 +252,6 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
}
}
}
Double11ActivityManagerUtils.notShowDouble11Activity = false
}
//仅展示一次,以后不再展示
SharedPreferencesEditor.putString(act.imageBanner, "yes")
......
......@@ -155,7 +155,7 @@ object ImIn {
}
fun sendRedPacketIntent(activity: Activity, toUid: String,code:Int){
ARouter.getInstance().build("/main/sendRedPacket").withString("to_uid",toUid).navigation(activity,code)
ARouter.getInstance().build("/user/sendRedPacket").withString("to_uid",toUid).navigation(activity,code)
}
fun testResultH5(testResultId: Int){
......
......@@ -250,7 +250,7 @@ class NewMultiMessageFragment : BaseFragment() {
}
override fun onChatSettingClick() {
ARouter.getInstance().build("/main/notifysetting").navigation()
ARouter.getInstance().build("/user/notifysetting").navigation()
}
override fun onSafeInfoSetting() {
......
......@@ -4,6 +4,9 @@ import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.im.R
import kotlinx.android.synthetic.main.im_chat_unusual_view.view.*
......@@ -77,8 +80,16 @@ class ChatUnusualView constructor(private val mContext: Context, attrs: Attribut
}
// 没有互动数据
TYPE_INTERACT_NO_DATA -> {
unusual_txt.text = "这里好安静,先逛逛社区和大家互动一下吧"
unusual_btn.text = "去「问答」逛逛"
var unusualTxtStr = "这里好安静,先逛逛社区和大家互动一下吧"
var unusualBtnStr = "去「问答」逛逛"
if (!ModularServiceManager.isDependByClz(IDynamicService::class.java)){
if (ModularServiceManager.isDependByClz(IConsultantService::class.java)){
unusualTxtStr = "这里好安静,先找咨询师聊一下吧"
unusualBtnStr = "去「咨询」逛逛"
}
}
unusual_txt.text = unusualTxtStr
unusual_btn.text = unusualBtnStr
unusual_btn.visibility = View.VISIBLE
unusual_img.setImageResource(R.mipmap.im_default_hudong)
}
......
......@@ -87,7 +87,6 @@ dependencies {
api project(':ydl-platform')
api project(":ydl-pay")
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-home-api')
implementation modularPublication('com.ydl:m-course-api')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-fm-api')
......@@ -95,7 +94,6 @@ dependencies {
}else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies['ydl-m-home-api']
compileOnly rootProject.ext.dependencies['ydl-m-course-api']
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
......
......@@ -187,6 +187,12 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:theme="@style/platform_NoTitleTheme"/>
<activity
android:name=".mine.ReceiveRedPacketActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:theme="@style/platform_NoTitleTheme"/>
</application>
</manifest>
\ No newline at end of file
......@@ -16,19 +16,19 @@ import android.widget.Toast
import com.alibaba.android.arouter.facade.annotation.Route
import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.listener.OnResultCallbackListener
import com.ydl.ydlcommon.actions.imagepicker.BrowsePicturesActivity
import com.ydl.ydlcommon.actions.imagepicker.ImageCompress
import com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker
import com.ydl.ydlcommon.adapter.custom.PublishImageAdapter
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.ui.ParcelableImage
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.user.R
import com.yidianling.user.UserHelper
import com.yidianling.user.mine.data.AppDataManager
......@@ -46,6 +46,7 @@ import kotlin.properties.Delegates
*/
@Route(path = "/mine/FeedBackActivity")
class FeedBackActivity : BaseActivity(), View.OnClickListener {
private val PUBLISH_PIC_BROW = 21009
private var adapter: PublishImageAdapter? = null
private var imags: ArrayList<ParcelableImage>? = ArrayList()
......@@ -133,13 +134,17 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener {
override fun onItemClick(view: View, position: Int) {
if (imags!!.size > 0) {
try {
val intent = ModularServiceManager.provide(IDynamicService::class.java).getBrosePictureActivityIntent(this@FeedBackActivity)
val intent = Intent()
intent.setClass(
this@FeedBackActivity,
BrowsePicturesActivity::class.java
)
intent.putExtra("browse_type", "preview")
intent.putExtra("position", position)
val bd = Bundle()
bd.putParcelableArrayList("allTrendImages", imags as ArrayList<out Parcelable>?)
intent.putExtra("allTrendImages_bd", bd)
startActivityForResult(intent, ModularServiceManager.provide(IDynamicService::class.java).getPublicPicBrowType())
startActivityForResult(intent, PUBLISH_PIC_BROW)
}catch (e: Exception) {}
}
......@@ -169,7 +174,6 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener {
Toast.makeText(this@FeedBackActivity, "最多选择9张照片", Toast.LENGTH_SHORT).show()
}
}
}
override fun OnAddLongClick(view: View, position: Int) {
......@@ -222,39 +226,6 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener {
}
})
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode,resultCode,data)
LogUtil.d("requestCode: $requestCode")
if (resultCode == Activity.RESULT_OK) {
try {
when (requestCode) {
ModularServiceManager.provide(IDynamicService::class.java).getPublicPicBrowType() -> {
if (data == null) {
return
}
val chane_state = data.getBooleanExtra("chane_state", false)
if (chane_state) {
val bundle = data.getBundleExtra("bundle")
imags = bundle.getParcelableArrayList("publish_img")
if (imags!!.size > 0) {
imags!!.add(ParcelableImage("default"))
iv_add_imag!!.visibility = View.GONE
feedback_img_rcv!!.visibility = View.VISIBLE
} else {
iv_add_imag!!.visibility = View.VISIBLE
feedback_img_rcv!!.visibility = View.GONE
}
adapter!!.updateDate(imags)
}
}
// PREVIEW_IMAGE_FROM_CAMERA -> onPreviewImageActivityResult(requestCode, data)
}
}catch (e: Exception) {}
}
}
/**
......@@ -308,7 +279,7 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener {
private fun DealFile2(path: String, size: Int): File {
var deal_file: File by Delegates.notNull()
try {
deal_file = ModularServiceManager.provide(IDynamicService::class.java).imageCompressScal(this, path, size)
deal_file = ImageCompress.scal(this@FeedBackActivity, path, size)
}catch (e:Exception){
}
......
......@@ -30,7 +30,7 @@ import java.lang.reflect.Method;
/**
* Created by Wi1ls on 2016/10/28;
*/
@Route(path = "/main/notifysetting")
@Route(path = "/user/notifysetting")
public class NotificationsSettingActivity extends BaseActivity {
TextView tv_isopen;
ToggleButton tb_voice;
......
......@@ -61,7 +61,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
* 个人资料
* Created by softrice on 15/12/2.
*/
@Route(path = "/main/personInfo")
@Route(path = "/user/personInfo")
public class PersonalInfoActivity extends BaseActivity implements View.OnClickListener {
public static final int REQUEST_NAME = 1;
......
package com.yidianling.user.mine
import android.app.Activity
import android.content.Intent
import android.os.Build
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextUtils
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.text.style.ForegroundColorSpan
import android.view.View
import android.widget.LinearLayout
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.GsonProvider
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.common.tools.RxImageTool
import com.yidianling.router.app.ReceiveRedPacketParam
import com.yidianling.user.R
import kotlinx.android.synthetic.main.activity_receive_redpacket.*
/**
* Created by wi1ls on 2017/1/11.
* 此界面可以用ViewStub优化
*/
@Route(path = "/user/receiveRedPacket")
class ReceiveRedPacketActivity : BaseActivity(),View.OnClickListener {
/* internal var status: Int = 0
internal var money: String? = null
internal var name: String? = null
internal var headUrl: String? = null
internal var expertUrl: String? = null
internal var expertName: String? = null
internal var expertTime: String? = null*/
private lateinit var param: ReceiveRedPacketParam
companion object {
private const val PARAM = "param"
private const val PARAMSTR = "paramStr"
/* private const val STATUS = "status"
private const val MONEY = "money"
private const val NAME = "name"
private const val HEAD_URL = "head_url"
private const val EXPERT_URL = "expert_url"
private const val EXPERT_NAME = "expert_name"
private const val EXPERT_TIME = "expert_time"*/
fun newIntent(activity: Activity, param: ReceiveRedPacketParam): Intent {
val intent = Intent(activity, ReceiveRedPacketActivity::class.java)
intent.putExtra(PARAM, param)
return intent
}
}
internal fun init() {
GlideApp.with(mContext).load(param.headUrl).into(receive_head!!)
title_bar!!.setDivideBg(-0x2ca8b4)
when (param.status) {
2//未领取
-> {
if (TextUtils.isEmpty(param.name)){
receive_name!!.visibility = View.GONE
}
receive_name!!.text = param.name + " 的红包"
receive_introduce!!.visibility = View.VISIBLE
receive_unreceived!!.visibility = View.VISIBLE
receive_unreceived!!.text = "红包金额" + param.money + "元,等待对方领取"
}
3//已经领取
-> {
if (TextUtils.isEmpty(param.name)){
receive_name!!.visibility = View.GONE
}
receive_name!!.text = param.name + " 的红包"
receive_received!!.visibility = View.VISIBLE
receive_money!!.text = "一个红包金额" + param.money + "元"
GlideApp.with(mContext).load(param.expertUrl).into(expert_header)
expert_name!!.text = param.expertName
expert_time!!.text = param.expertTime
expert_money!!.text = param.money + "元"
}
4//超时
-> {
receive_name!!.text = "已超时(过期)"
receive_name_!!.visibility = View.VISIBLE
receive_name_!!.text = "金额" + param.money
val st = "已退回账户余额,查看余额"
val sub = "查看余额"
val ssb = SpannableStringBuilder(st)
val index = st.indexOf(sub)
val clickableSpan = object : ClickableSpan() {
override fun onClick(widget: View) {
//进入账户历史金额
startActivity(Intent(mContext, AccountHistoryActivity::class.java))
}
}
val foregroundColorSpan = ForegroundColorSpan(-0x9d8d75)
ssb.setSpan(clickableSpan, index, index + sub.length, Spanned.SPAN_EXCLUSIVE_INCLUSIVE)
ssb.setSpan(foregroundColorSpan, index, index + sub.length, Spanned.SPAN_EXCLUSIVE_INCLUSIVE)
receive_mind!!.text = ssb
receive_mind!!.movementMethod = LinkMovementMethod.getInstance()
}
}
}
override fun onClick(view: View) {
when (view.id) {
R.id.receive_view -> {
//进入红包历史H5
val h5Params = H5Params(HttpConfig.H5_URL+ "consult/bonus", null)
NewH5Activity.start(mContext, h5Params)
}
}
}
override fun layoutResId(): Int {
return R.layout.activity_receive_redpacket
}
/**
* 初始化状态栏位置
*/
private fun initStatus() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4以下不支持状态栏变色
StatusBarUtils.setTransparentForImageView(this, null)
val statusBarHeight = StatusBarUtils.getStatusBarHeight(this)
val lp1 = title_bar.layoutParams as LinearLayout.LayoutParams
lp1.height = (RxImageTool.dp2px(45f) + statusBarHeight)
title_bar.setPadding(0, statusBarHeight, 0, 0)
}
}
override fun initDataAndEvent() {
initStatus()
if (intent.hasExtra(PARAM)) {
param = intent.getParcelableExtra(PARAM)
}
if (intent.hasExtra(PARAMSTR)) {
val str = intent.getStringExtra(PARAMSTR)
param = GsonProvider.getGson().fromJson<ReceiveRedPacketParam>(str,ReceiveRedPacketParam::class.java)
}
receive_view?.setOnClickListener(this)
/* var bundle = intent.getBundleExtra("bundle")
status = bundle.getInt("status", 0)
money = bundle.getString("money")
name = bundle.getString("name")
headUrl = bundle.getString("headUrl")
expertUrl = bundle.getString("expertUrl")
expertName = bundle.getString("expertName")
expertTime = bundle.getString("expertTime")*/
init()
}
}
......@@ -40,7 +40,7 @@ import io.reactivex.schedulers.Schedulers;
* 充值
* Created by softrice on 16/1/18.
*/
@Route(path = "/main/recharge")
@Route(path = "/user/recharge")
public class RechargeActivity extends BaseActivity {
@NotNull
@Override
......
......@@ -38,7 +38,7 @@ import java.util.*
/**
* Created by wi1ls on 2017/1/10.
*/
@Route(path = "/main/sendRedPacket")
@Route(path = "/user/sendRedPacket")
class SendRedPacketActivity : BaseActivity(), View.OnClickListener, TextWatcher {
override fun afterTextChanged(s: Editable?) {
......
......@@ -39,15 +39,15 @@ class AppServiceImpl: IAppService {
}
override fun receiverRedPacketIntent(activity: Activity, param: String) {
ARouter.getInstance().build("/main/receiveRedPacket").withString("paramStr",param).navigation()
ARouter.getInstance().build("/user/receiveRedPacket").withString("paramStr",param).navigation()
}
override fun personalInfoIntent(activity: Activity) {
ARouter.getInstance().build("/main/personInfo").navigation()
ARouter.getInstance().build("/user/personInfo").navigation()
}
override fun rechargeIntent(activity: Activity) {
ARouter.getInstance().build("/main/recharge").navigation()
ARouter.getInstance().build("/user/recharge").navigation()
}
override fun splashIntent(activity: Activity) {
......@@ -59,11 +59,11 @@ class AppServiceImpl: IAppService {
}
override fun sendRedPacketIntent(activity: Activity, toUid: String) {
ARouter.getInstance().build("/main/sendRedPacket").withString("to_uid",toUid).navigation()
ARouter.getInstance().build("/user/sendRedPacket").withString("to_uid",toUid).navigation()
}
override fun notificationSettingIntent(activity: Activity) {
ARouter.getInstance().build("/main/notifysetting").navigation()
ARouter.getInstance().build("/user/notifysetting").navigation()
}
override fun privacyIntent(activity: Activity) {
......@@ -75,7 +75,7 @@ class AppServiceImpl: IAppService {
}
override fun rechargeActivityIntent(activity: Activity) {
ARouter.getInstance().build("/main/recharge").navigation()
ARouter.getInstance().build("/user/recharge").navigation()
}
override fun init(context: Context?) {
......
......@@ -9,13 +9,11 @@ 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.router.YdlCommonOut
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.home.api.service.IHomeService
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.LoginUtils
......@@ -150,7 +148,6 @@ class SmsLoginActivity : BaseActivity() {
//关闭手势解锁页面与指纹解锁页面
finishFinger()
if (it.firstLogin == 1) {
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
baiduActionBury()
}else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.uid!!,UserBIConstants.ACTION_TYPE_CODE_LOGIN)
......
package com.yidianling.user.ui.login;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.utils.StatusBarUtils;
import com.ydl.ydlcommon.bean.StatusBarOptions;
import com.yidianling.common.tools.RxNetTool;
import com.yidianling.user.R;
import org.jetbrains.annotations.NotNull;
/**
* @author jiucheng
* @描述:
......@@ -25,15 +26,17 @@ import com.yidianling.user.R;
* [com.ydl.ydlcommon.h5.NewH5Activity]
* 不一样,没办法复用
*/
public class H5Activity extends Activity {
public class H5Activity extends BaseActivity {
private static final String INTENT_PRIVACY = "intent_privacy";
@NotNull
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_activity_h5);
StatusBarUtils.Companion.setWindowStatusBarColor(this, R.color.platform_white);
public StatusBarOptions getStatusViewOptions() {
return new StatusBarOptions(true,true);
}
@Override
protected void initDataAndEvent() {
WebView web_view = findViewById(R.id.web_view);
ImageView iv_pop = findViewById(R.id.iv_pop);
iv_pop.setOnClickListener(view -> {
......@@ -74,6 +77,12 @@ public class H5Activity extends Activity {
}
@Override
protected int layoutResId() {
return R.layout.user_activity_h5;
}
@Override
public void onBackPressed() {
finish();
overridePendingTransition(0, R.anim.platform_slide_out_to_bottom);
......@@ -88,4 +97,6 @@ public class H5Activity extends Activity {
starter.putExtra(INTENT_PRIVACY, userPrivacy);
context.startActivity(starter);
}
}
......@@ -79,13 +79,13 @@ class SecretActivity : BaseActivity() {
agreeAction()
}
// user_use_btn.setOnClickListener {
// H5Activity.start(this@SecretActivity, false)
// }
//
// user_secret_protect_btn.setOnClickListener {
// H5Activity.start(this@SecretActivity, true)
// }
user_use_btn.setOnClickListener {
H5Activity.start(this@SecretActivity, false)
}
user_secret_protect_btn.setOnClickListener {
H5Activity.start(this@SecretActivity, true)
}
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
......
......@@ -10,7 +10,6 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.home.api.service.IHomeService
import com.yidianling.user.LoginUtils
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
......@@ -59,7 +58,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
saveUserData(it.data)
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_RESET_PWD)
if (it.data.firstLogin == 1) {//第一次登录:是注册
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
// 重设密码登录已经不可能是首次登录,所以不进行百度埋点
//view.baiduActionBury()
} else {
......@@ -96,7 +95,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
} else {
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury()
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_PWD_LOGIN)
......
......@@ -11,7 +11,6 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.home.api.service.IHomeService
import com.yidianling.user.LoginUtils
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
......@@ -71,7 +70,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
//绑定手机号
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury(it.data.uid, UserBIConstants.POSITION_ALIYUN_REGISTER_CLICK)
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_DIRECT_LOGIN)
......@@ -198,14 +197,14 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
LogHelper.getInstance().writeLogSync(media.getName() + "登录成功")
if (media == SHARE_MEDIA.QQ) {
if (it.data.firstLogin == 1) {//第一次登录:是注册
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_QQ_REGISTER_CLICK)
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
}
} else {
if (it.data.firstLogin == 1) {//第一次登录:是注册
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_WX_REGISTER_CLICK)
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
......
......@@ -7,7 +7,6 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.home.api.service.IHomeService
import com.yidianling.user.LoginUtils
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
......@@ -145,7 +144,7 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury()
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_CODE_LOGIN)
......
......@@ -10,7 +10,6 @@ import android.text.Spanned
import android.text.TextPaint
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.text.style.ForegroundColorSpan
import android.view.Gravity
import android.view.View
import android.view.WindowManager
......@@ -18,7 +17,7 @@ import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.Utils
import com.yidianling.user.R
import com.yidianling.user.ui.login.H5Activity
import kotlinx.android.synthetic.main.user_activity_secret.*
import kotlinx.android.synthetic.main.user_dialog_secret.*
class SecretDescriptionDialog(
......@@ -30,7 +29,7 @@ class SecretDescriptionDialog(
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.user_activity_secret)
setContentView(R.layout.user_dialog_secret)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="0.5dp" android:color="#999999"/>
<corners android:radius="22dp" />
</shape>
\ 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:orientation="vertical">
<com.ydl.ydlcommon.view.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height"
android:background="#d3574c"
app:pa_left_start_icon="@drawable/platform_common_back"
app:pa_title_bar_text_color="#ffffff"
app:pa_title_text="感恩红包" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-5dp"
android:background="@drawable/redpacket_receive_bg">
<com.ydl.ydlcommon.view.CircleImageView
android:id="@+id/receive_head"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:src="@drawable/platform_default_img" />
<TextView
android:id="@+id/receive_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/receive_head"
android:layout_centerHorizontal="true"
android:padding="10dp"
android:textColor="#000000"
android:textSize="17sp"
tools:text="仁杰 的红包" />
<TextView
android:id="@+id/receive_name_"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/receive_name"
android:layout_centerHorizontal="true"
android:padding="10dp"
android:text="金额 2.00"
android:textColor="#000000"
android:textSize="17sp"
android:visibility="gone" />
<TextView
android:id="@+id/receive_mind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/receive_name_"
android:layout_centerHorizontal="true"
android:padding="10dp"
android:text="一点心意 请笑纳"
android:textColor="#888888"
android:textSize="15sp" />
<TextView
android:id="@+id/receive_unreceived"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/receive_mind"
android:background="#ffffff"
android:padding="20dp"
android:textSize="16sp"
android:visibility="invisible"
tools:text="红包金额100元,等待对方领取" />
<RelativeLayout
android:id="@+id/receive_received"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/receive_mind"
android:background="#ffffff"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/receive_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
tools:text="一个红包金额100元" />
<TextView
android:id="@+id/receive_divide"
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:layout_below="@+id/receive_money"
android:background="#EDEDED" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/receive_divide">
<com.ydl.ydlcommon.view.CircleImageView
android:id="@+id/expert_header"
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
tools:src="@drawable/previous_icon" />
<TextView
android:id="@+id/expert_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/expert_header"
android:paddingLeft="10dp"
android:paddingTop="10dp"
tools:text="李静" />
<TextView
android:id="@+id/expert_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/expert_name"
android:layout_toRightOf="@+id/expert_header"
android:paddingLeft="10dp"
android:paddingTop="5dp"
tools:text="07-21 10:10:21" />
<TextView
android:id="@+id/expert_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/expert_header"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:paddingTop="10dp"
tools:text="100元" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/receive_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:padding="10dp"
android:text="查看红包记录"
android:textColor="#4bc8df"
android:textSize="20sp" />
<TextView
android:id="@+id/receive_introduce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:text="超时未领取,金额将被退回"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
</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:tools="http://schemas.android.com/tools"
xmlns:myapp="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="34dp"
android:layout_marginRight="34dp"
android:background="@drawable/user_secret_dialog_bg">
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
myapp:pa_borderRadius="12dp"
myapp:pa_type="pa_round"
android:adjustViewBounds="true"
android:src="@drawable/user_secret_top_bg"/>
<RelativeLayout
android:id="@+id/user_top_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="@+id/secrey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="40dp"
android:text="隐私政策"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/secrey_title"
android:layout_marginLeft="25dp"
android:text="及使用协议说明"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold"/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout android:layout_width="match_parent" android:layout_height="194dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="194dp"
android:scrollbars="none"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
>
<TextView
android:id="@+id/user_secret_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineHeight="20dp"
tools:text="感谢您信任并使用壹点灵APP,\n
我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\n\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n
2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\n
3. 我们会采业界先进的安全措施保护您的信息安全;\n
4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\n
5. 您可以查询、更正、删除您的个人信息。"
android:textColor="#444444"
android:textSize="14dp"/>
</RelativeLayout>
</ScrollView>
<View
android:background="@drawable/user_secret_dectription_bg"
android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_height="30dp"/>
</RelativeLayout>
<TextView
android:id="@+id/tv_content"
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="阅读完整版《用户使用协议》、《隐私保护政策》"
android:textColor="#444444"
android:textSize="14dp"/>
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="阅读完整版"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_use_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《用户使用协议》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="、"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_secret_protect_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《隐私保护政策》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="24dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:orientation="vertical"
android:background="#ffffff">
<TextView
android:id="@+id/user_secret_agree"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_weight="1"
android:background="@drawable/user_secret_right_btn_bg"
android:gravity="center"
android:text="同意并继续"
android:textColor="#FFFFFF"
android:textSize="16dp"/>
<TextView
android:id="@+id/user_secret_no_agree"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:gravity="center"
android:text="仍不同意并退出"
android:textColor="#999999"
android:textSize="16dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
package com.channel.ydl_flutter_base.event;
/**
* MainActivity 滑动状态设置
*/
public class MainScrollEnableEvent {
public boolean canScroll ;
public MainScrollEnableEvent(boolean canScroll) {
this.canScroll = canScroll;
}
}
......@@ -2,6 +2,7 @@ package com.channel.ydl_flutter_base.plugin
import android.text.TextUtils
import com.channel.ydl_flutter_base.base.BaseFlutterFragment
import com.channel.ydl_flutter_base.event.MainScrollEnableEvent
import com.ydl.burypointlib.BuryPointHelper
import com.ydl.burypointlib.MD5Util
import com.ydl.ydlcommon.base.BaseApp
......@@ -14,6 +15,7 @@ import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.yidianling.common.tools.RxDeviceTool
import de.greenrobot.event.EventBus
import io.flutter.app.FlutterActivity
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
......@@ -45,6 +47,8 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
const val ACTION_PUSH_EVENT_TRACKING_TAP: String = "action_push_event_tracking_tap"// 点击事件埋点
const val ACTION_PUSH_EVENT_TRACKING_PV: String = "action_push_event_tracking_pv"//pv埋点
const val ACTION_ORIGIN_THEME: String = "platform_origin_theme"//马甲包获取应用各个主题色的action
const val REQUESTMAINSCROLLFOCUS: String = "requestMainScrollFocus"
const val RELEASEMAINSCROLLFOCUS: String = "releaseMainScrollFocus"
//activity注册
fun activityRegister(activity: FlutterActivity) {
......@@ -129,6 +133,20 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
LogUtil.i("platform_origin_theme:"+GsonProvider.getGson().toJson(mMap))
result.success(mMap)
}
REQUESTMAINSCROLLFOCUS -> {
EventBus.getDefault().post(
MainScrollEnableEvent(
false
)
)
}
RELEASEMAINSCROLLFOCUS -> {
EventBus.getDefault().post(
MainScrollEnableEvent(
true
)
)
}
}
}
......
......@@ -667,6 +667,7 @@ class PayActivity : BaseActivity() {
bean.payId = payId
HttpUtils.payByCharge(bean)
.compose(RxUtils.resultData())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog() }
.doAfterTerminate { dismissProgressDialog() }
......
package com.ydl.ydlcommon.actions.imagepicker;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import com.bumptech.glide.request.target.Target;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.utils.StringUtils;
import com.yidianling.common.tools.RxFileTool;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Created by xiongyu on 2017/3/17.
*/
public class DownLoadImageService implements Runnable {
private String url;
private Context context;
private ImageDownLoadCallBack callBack;
private File currentFile;
public DownLoadImageService(Context context, String url, ImageDownLoadCallBack callBack) {
this.url = url;
this.callBack = callBack;
this.context = context;
}
@Override
public void run() {
File file = null;
Bitmap bitmap = null;
try {
// file = Glide.with(context)
// .load(url)
// .downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
// .get();
bitmap = GlideApp.with(context)
.asBitmap()
.load(url)
.into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.get();
if (bitmap != null) {
// 在这里执行图片保存方法
saveImageToGallery(context, bitmap);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// if (file != null) {
// callBack.onDownLoadSuccess(file);
// } else {
// callBack.onDownLoadFailed();
// }
if (bitmap != null && currentFile.exists()) {
callBack.onDownLoadSuccess(bitmap);
} else {
callBack.onDownLoadFailed();
}
}
}
public void saveImageToGallery(Context context, Bitmap bmp) {
// 首先保存图片
String fileName = "trend";
File appDir = new File(RxFileTool.getStorageDirectory(context), fileName);
if (!appDir.exists()) {
appDir.mkdirs();
}
fileName = StringUtils.UrlToString(url);
currentFile = new File(appDir, fileName);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(currentFile);
bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fos != null) {
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
// 其次把文件插入到系统图库
// try {
// MediaStore.Images.Media.insertImage(context.getContentResolver(),
// currentFile.getAbsolutePath(), fileName, null);
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// }
// 最后通知图库更新
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.fromFile(new File(currentFile.getPath()))));
}
}
package com.ydl.ydlcommon.actions.imagepicker;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.yidianling.common.tools.RxFileTool;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ImageCompress {
public static File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
return image;
}
public static File scal(FragmentActivity activity, String path, int size) {
// String path = fileUri.getPath();
File outputFile = FileUtils.INSTANCE.getFileByUri(activity,path);
if (!outputFile.exists()){
return null;
}
long fileSize = outputFile.length();
final long fileMaxSize = size * 1024;
if (fileSize >= fileMaxSize) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
int height = options.outHeight;
int width = options.outWidth;
double scale = Math.sqrt((float) fileSize / fileMaxSize);
options.outHeight = (int) (height / scale);
options.outWidth = (int) (width / scale);
options.inSampleSize = (int) (scale + 0.5);
options.inJustDecodeBounds = false;
Bitmap bitmap = BitmapFactory.decodeFile(path, options);
outputFile = new File(PhotoUtil.createImageFile().getPath());
FileOutputStream fos = null;
try {
fos = new FileOutputStream(outputFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, fos);
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
Log.d("", "sss ok " + outputFile.length());
if (!bitmap.isRecycled()) {
bitmap.recycle();
} else {
File tempFile = outputFile;
outputFile = new File(PhotoUtil.createImageFile().getPath());
PhotoUtil.copyFileUsingFileChannels(tempFile, outputFile);
}
}
return outputFile;
}
public static File scaln(String path, int size) {
// String path = fileUri.getPath();
File outputFile = new File(path);
// long fileSize = outputFile.length();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Bitmap imagebm = BitmapFactory.decodeFile(path);
imagebm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
// final long fileMaxSize = size * 1024;
// 质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
int options = 100;
while (baos.toByteArray().length / 1024 > size) {
// 循环判断如果压缩后图片是否大于100kb,大于继续压缩
baos.reset();// 重置baos即清空baos
imagebm.compress(Bitmap.CompressFormat.JPEG, options, baos);
// 这里压缩options%,把压缩后的数据存放到baos中
options -= 10;// 每次都减少10
if (options <= 0) {
break;
}
}
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());
// 把压缩后的数据baos存放到ByteArrayInputStream中
// 把ByteArrayInputStream数据生成图片
imagebm = BitmapFactory.decodeStream(isBm, null, null);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(outputFile);
imagebm.compress(Bitmap.CompressFormat.JPEG, 50, fos);
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
if (!imagebm.isRecycled()) {
imagebm.recycle();
} else {
File tempFile = outputFile;
outputFile = new File(PhotoUtil.createImageFile().getPath());
PhotoUtil.copyFileUsingFileChannels(tempFile, outputFile);
}
return outputFile;
}
public static File scaln2(String path, int size) {
Bitmap bm = BitmapFactory.decodeFile(path);
bm=cQuality(bm,size);
File outputFile = null;
try {
outputFile = SaveBitmap(bm,path);
} catch (IOException e) {
e.printStackTrace();
}
return outputFile;
}
public static File SaveBitmap(Bitmap mBitmap, String path) throws IOException {
File file;
RxFileTool.fileExists(path);
File f = new File(path);
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
FileOutputStream fOut = null;
try {
fOut = new FileOutputStream(f);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
fOut.flush();
fOut.close();
file=new File(path);
return file;
}
/**
* 根据bitmap压缩图片质量
*
* @param bitmap 未压缩的bitmap
* @return 压缩后的bitmap
*/
public static Bitmap cQuality(Bitmap bitmap,int size) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
int beginRate = 100;
//第一个参数 :图片格式 ,第二个参数: 图片质量,100为最高,0为最差 ,第三个参数:保存压缩后的数据的流
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bOut);
while (bOut.size() / 1024 / 1024 > size) { //如果压缩后大于100Kb,则提高压缩率,重新压缩
beginRate -= 10;
bOut.reset();
bitmap.compress(Bitmap.CompressFormat.JPEG, beginRate, bOut);
}
ByteArrayInputStream bInt = new ByteArrayInputStream(bOut.toByteArray());
Bitmap newBitmap = BitmapFactory.decodeStream(bInt);
if (newBitmap != null) {
return newBitmap;
} else {
return bitmap;
}
}
}
package com.ydl.ydlcommon.actions.imagepicker;
import android.graphics.Bitmap;
import java.io.File;
/**
* Created by xiongyu on 2017/3/17.
*/
public interface ImageDownLoadCallBack {
void onDownLoadSuccess(File file);
void onDownLoadSuccess(Bitmap bitmap);
void onDownLoadFailed();
}
\ No newline at end of file
package com.ydl.ydlcommon.actions.imagepicker;
import android.net.Uri;
import android.os.Environment;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import java.util.Date;
public class PhotoUtil {
/**
* 一切都操作uri
* @return
*/
public static Uri createImageFile(){
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File image = null;
try {
image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
} catch (IOException e) {
e.printStackTrace();
}
// Save a file: path for use with ACTION_VIEW intents
return Uri.fromFile(image);
}
public static void copyFileUsingFileChannels(File source, File dest){
FileChannel inputChannel = null;
FileChannel outputChannel = null;
try {
try {
inputChannel = new FileInputStream(source).getChannel();
outputChannel = new FileOutputStream(dest).getChannel();
outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
} catch (IOException e) {
e.printStackTrace();
}
} finally {
try {
inputChannel.close();
outputChannel.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
......@@ -63,4 +63,20 @@ object ModularServiceManager {
return provider as T
}
/**
* 用以判断是否接入依赖某业务模块
*/
fun <T : IProvider> isDependByClz(clz: Class<T>): Boolean {
var provider: IProvider? = null
try {
provider = ARouter.getInstance().navigation(clz)
return provider != null
} catch (e: Exception) {
LogUtil.e(e.toString())
}
return provider != null
}
}
\ No newline at end of file
package com.ydl.ydlcommon.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
/**
* Created by xiongyu on 2017/3/18.
*/
public class SquareRelativeLayout extends RelativeLayout {
public SquareRelativeLayout(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
}
public SquareRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareRelativeLayout(Context context) {
super(context);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(getDefaultSize(0, widthMeasureSpec),
getDefaultSize(0, heightMeasureSpec));
int childWidthSize = getMeasuredWidth();
// 高度和宽度一样
heightMeasureSpec = widthMeasureSpec = MeasureSpec.makeMeasureSpec(
childWidthSize, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_black">
<android.support.v4.view.ViewPager
android:id="@+id/browse_pictures_vp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<View
android:id="@+id/browse_pictures_top_v"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:background="#00ffffff"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/title_bar_height"
android:layout_below="@+id/browse_pictures_top_v"
android:background="#00ffffff">
<ImageView
android:id="@+id/browse_pictures_back_iv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="15dp"
android:paddingRight="30dp"
android:src="@drawable/platform_common_back_un" />
<TextView
android:id="@+id/browse_pictures_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="1/9"
android:textColor="@color/platform_white"
android:textSize="@dimen/platform_dp_20" />
<TextView
android:id="@+id/browse_pictures_save_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="保存"
android:textColor="@color/platform_white"
android:textSize="@dimen/platform_dp_20" />
</RelativeLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<com.yidianling.dynamic.common.view.SquareRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.ydl.ydlcommon.view.SquareRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
......@@ -29,4 +30,4 @@
android:layout_alignParentTop="true"
android:src="@drawable/platform_img_delete" />
</com.yidianling.dynamic.common.view.SquareRelativeLayout>
</com.ydl.ydlcommon.view.SquareRelativeLayout>
package com.ydl.utils;
import android.text.TextUtils;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.data.PlatformDataManager;
import com.ydl.ydlcommon.data.http.EncryptUtils;
......@@ -35,6 +37,12 @@ public class WebUrlParamsUtils {
//存储原url所带参数
Map<String, String> map = getUrlParams(url);
if(!TextUtils.isEmpty(appendSuffix)) {
Map<String, String> appendMap = getUrlParams(appendSuffix);
if(appendMap!=null && appendMap.size()!=0) {
map.putAll(appendMap);
}
}
String[] keys = new String[map.size()];
String[] values = new String[map.size()];
......@@ -51,8 +59,9 @@ public class WebUrlParamsUtils {
if (myUrl.contains("?")) {
myUrl = myUrl.substring(0, myUrl.indexOf("?"));
}
//重新组装url所有参数并加签名
return myUrl + getSuffixNoButOther(keys, values) + appendSuffix;
return myUrl + getSuffixNoButOther(keys, values);
}
......
......@@ -2,6 +2,7 @@ package com.ydl.webview
import android.net.Uri
import android.text.TextUtils
import com.alibaba.android.arouter.facade.template.IProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
......@@ -70,4 +71,20 @@ object H5RouterUtils {
}
YDLRouterManager.router(linkUrl, params)
}
/**
* 用以判断是否接入依赖某业务模块
*/
fun <T : IProvider> isDependByClz(clz: Class<T>): Boolean {
var provider: IProvider? = null
try {
provider = ARouter.getInstance().navigation(clz)
return provider != null
} catch (e: Exception) {
com.ydl.ydlcommon.utils.LogUtil.e(e.toString())
}
return provider != null
}
}
......@@ -52,6 +52,7 @@ import com.ydl.ydlcommon.view.dialog.YDLShareDialog;
import com.yidianling.common.tools.RxDeviceTool;
import com.yidianling.common.tools.RxImageTool;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.dynamic.api.IDynamicService;
import com.yidianling.user.api.event.UserBindPhoneEvent;
import com.yidianling.user.api.event.UserLoginEvent;
......@@ -1342,12 +1343,20 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
minId = params.getShare().getMinProgramId();
}
YDLShareDialog dialog;
if (params != null && !TextUtils.isEmpty(params.getCourse_id())) {
dialog = YDLShareDialog.Companion.style5(this, shareTitle, shareUrl, shareDesc, cover);
} else {
dialog = YDLShareDialog.Companion.style1(this, shareTitle, shareUrl, shareDesc, cover, minPath, minId);
if(!H5RouterUtils.INSTANCE.isDependByClz(IDynamicService.class)) {
//如果未引入动态模块的话,隐藏分享至动态按钮
dialog = YDLShareDialog.Companion.style4(this, shareTitle, shareUrl, shareDesc, cover);
}else {
dialog = YDLShareDialog.Companion.style1(this, shareTitle, shareUrl, shareDesc, cover, minPath, minId);
}
}
dialog.setCallBack(type -> {
if (1 == type) {
if (!WebModularServiceUtils.Companion.getUserService().isLogin()) {
......
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