Commit a043a3f7 by 刘鹏

Merge remote-tracking branch 'origin/release' into d/v_confide_optimized

# Conflicts:
#	config.gradle
parents bbe9664c 894ab661
......@@ -5,22 +5,22 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.50",
"m-consultant" : "0.0.60.74",
"m-consultant" : "0.0.60.78",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.72",
"m-home" : "0.0.24.00",
"m-im" : "0.0.21.67",
"m-im" : "0.0.21.69",
"m-dynamic" : "0.0.7.80",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.87",
"m-tests" : "0.0.24.24",
"m-course" : "0.0.43.39",
//-------------- 功能组件 --------------
//mdt 组件
"ydl-tuicore" : "0.0.25",
//第一步
"ydl-platform" : "0.0.41.51",
"ydl-platform" : "0.0.41.54",
//第二步 若干
"ydl-webview" : "0.0.39.03",
"ydl-media" : "0.0.21.52",
......@@ -165,7 +165,6 @@ ext {
"cube" : "in.srain.cube:cube-sdk:1.0.44@aar",
"support-multidex" : 'androidx.multidex:multidex:2.0.0',
"ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.33",
"robust" : "com.meituan.robust:robust:0.4.87",
"walle" : "com.meituan.android.walle:library:1.1.5",
"jpush" : "cn.jiguang.sdk:jpush:3.3.6",
"jcore" : "cn.jiguang.sdk:jcore:2.1.4",
......
......@@ -114,10 +114,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private const val FILTER_STATUS_NORMAL = 0 //默认筛选状态
private const val FILTER_STATUS_FILTERED = 1 //非默认筛选状态
private const val FILTER_STATUS_OPEN = 2 //筛选窗打开状态
const val FROM_HOME_SREARCH = 0
const val FROM_FIND_EXPERT = 1
const val FROM_ONLINE_EXPERT = 2
const val PAGE_SIZE = 15
fun newIntent(
activity: Activity,
......@@ -406,6 +403,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
getPresenter().fetchListHead()
recommendListView.requestData(initCategory)
if (isRefresh) {
refresh(false)
}
......@@ -1061,8 +1059,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
viewDim.visibility = View.INVISIBLE
viewDim_filter.visibility = View.GONE
if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.doctorEdu.size + allFilter.title.size > 0 || !TextUtils.isEmpty(
allFilter.priceRanges?.minPrice
) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)
allFilter.priceRanges?.min_price
) || !TextUtils.isEmpty(allFilter.priceRanges?.max_price)
) {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED)
} else {
......@@ -1471,7 +1469,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onRefresh() {
refresh(false)
recommendListView.requestData()
recommendListView.requestData(initCategory)
}
//刷新列表
......
......@@ -346,6 +346,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
allFilter.showType.key = initShowType
getPresenter().fetchListHead()
recommendListView.requestData("")
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
......@@ -940,8 +941,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
viewDim.visibility = View.INVISIBLE
viewDim_filter.visibility = View.GONE
if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.doctorEdu.size + allFilter.title.size + allFilter.specialityCrowd.size > 0 || !TextUtils.isEmpty(
allFilter.priceRanges?.minPrice
) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)
allFilter.priceRanges?.min_price
) || !TextUtils.isEmpty(allFilter.priceRanges?.max_price)
) {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED)
} else {
......@@ -1344,8 +1345,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun onRefresh() {
refresh(false)
recommendListView.requestData()
recommendListView.requestData("")
}
/**
......
......@@ -87,10 +87,18 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
filterMap["tags.tag_id"] = categoriesMap
}
// 地区
if (allFilter.region.value == "海外") {
if (allFilter.region.code == "ABROAD") { // 海外
if (allFilter.region.code == allFilter.sub.code){ // 海外不限
val abroadMap = HashMap<String, Any>()
abroadMap["ne"] = "1"
filterMap["country_code"] = abroadMap
}else{
filterMap["country_code"] = allFilter.sub.code!!
}
} else if(allFilter.region.code=="1"&&allFilter.region.code==allFilter.sub.code){ // 全国不限
filterMap["country_code"] = allFilter.sub.code
} else{
if (allFilter.region.code != null&&allFilter.region.code!="1") {
}else{
if (allFilter.region.code != null) {
filterMap["province_code"] = allFilter.region.code
}
if (allFilter.sub.code != null&&allFilter.sub.code!=allFilter.region.code) {
......@@ -110,8 +118,12 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
// 服务均价
if (allFilter.priceRanges != null) {
val avgPriceMap = HashMap<String, Any?>()
avgPriceMap["gte"] = allFilter.priceRanges?.minPrice
avgPriceMap["lte"] = allFilter.priceRanges?.maxPrice
if (!TextUtils.isEmpty(allFilter.priceRanges?.min_price)){
avgPriceMap["gte"] = allFilter.priceRanges?.min_price
}
if (!TextUtils.isEmpty(allFilter.priceRanges?.max_price)) {
avgPriceMap["lte"] = allFilter.priceRanges?.max_price
}
filterMap["avg_price"] = avgPriceMap
}
// 年龄
......
......@@ -44,17 +44,12 @@ class ExpertSearchHttpImpl : IExpertSearchHttp {
return searchApi!!
}
// override fun searchDoctor(params: String?): Observable<BaseAPIResponse<ExpertSearchBean>> {
// return getSearchApi().searchDoctorService(HttpConfig.JAVA_BASE_URL+ "doctor/nlist?"+params)
//
// }
override fun getExpertList(map: Map<String, Any>): Observable<BaseAPIResponse<ExpertBean>> {
return getSearchApi().getExpertList(map)
}
override fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>> {
return getSearchApi().getBigShotData()
override fun getBigShotData(map:Map<String,Any>): Observable<BaseAPIResponse<ExpertSearchTopShowBean>> {
return getSearchApi().getBigShotData(map)
}
......
......@@ -37,6 +37,6 @@ interface IExpertSearchHttp{
/**
* 获取大咖专区和顶部推荐数据数据
*/
fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
fun getBigShotData(map:Map<String,Any>): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
}
\ No newline at end of file
......@@ -77,7 +77,7 @@ interface SearchApi {
//获取咨询助理uid
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@POST("doctor/querySpecialTopic")
fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
fun getBigShotData(@Body map: Map<String,@JvmSuppressWildcards Any>): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
......
......@@ -10,6 +10,6 @@ data class EnquiryItem(
@field:SerializedName("key")
val key: Int,
val checkRrl: String?,
val unCheckUrl: String?
val check_url: String?,
val un_check_url: String?
)
\ No newline at end of file
......@@ -30,7 +30,7 @@ data class Filters(
/**
* 服务均价
*/
@field:SerializedName("priceRanges")
@field:SerializedName("price_ranges")
val priceRanges: List<PriceRangesItem> = ArrayList(),
/**
......@@ -49,6 +49,6 @@ data class Filters(
/**
* 擅长人群
*/
@field:SerializedName("specialityCrowd")
@field:SerializedName("speciality_crowd")
val specialityCrowd: ArrayList<SpecialityCrowdBean> = ArrayList()
)
\ No newline at end of file
......@@ -4,12 +4,14 @@ import com.google.gson.annotations.SerializedName
data class PriceRangesItem(
@field:SerializedName("minPrice")
var minPrice: String? = null,
@field:SerializedName("min_price")
var min_price: String? = null,
@field:SerializedName("maxPrice")
var maxPrice: String? = null,
@field:SerializedName("max_price")
var max_price: String? = null,
@SerializedName("recommendPercent")
var recommendPercent: String? = null
@SerializedName("recommend_percent")
var recommend_percent: String? = null,
var display_range:String? = null
)
\ No newline at end of file
......@@ -43,7 +43,6 @@ class FilterPopupWindow(
private val tempFilter: AllFilter
) : PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private val mDisposableList = CompositeDisposable()
private val showTypeViews: ArrayList<View> = ArrayList()
private val enquiryViews: ArrayList<View> = ArrayList()
......@@ -168,7 +167,7 @@ class FilterPopupWindow(
tempFilter.enquiries.forEach {
if (textView.text.toString() == it.value) {
Glide.with(context)
.load(it.unCheckUrl)
.load(it.un_check_url)
.into(ivIcon)
}
}
......@@ -269,15 +268,15 @@ class FilterPopupWindow(
}
if (tempFilter.priceRanges != null) {
sb.append("&minPrice=").append(tempFilter.priceRanges?.minPrice)
sb.append("&maxPrice=").append(tempFilter.priceRanges?.maxPrice)
sb.append("&minPrice=").append(tempFilter.priceRanges?.min_price)
sb.append("&maxPrice=").append(tempFilter.priceRanges?.max_price)
if (ConsultBIConstants.POSITION_AVERAGE_SERVICE_INPUT == biEventName) {
var account = 0.0
if (!TextUtils.isEmpty(tempFilter.priceRanges?.minPrice)) {
account += tempFilter.priceRanges?.minPrice?.toDouble()!!
if (!TextUtils.isEmpty(tempFilter.priceRanges?.min_price)) {
account += tempFilter.priceRanges?.min_price?.toDouble()!!
}
if (!TextUtils.isEmpty(tempFilter.priceRanges?.maxPrice)) {
account += tempFilter.priceRanges?.maxPrice?.toDouble()!!
if (!TextUtils.isEmpty(tempFilter.priceRanges?.max_price)) {
account += tempFilter.priceRanges?.max_price?.toDouble()!!
}
biEventParams = ((account / 2).roundToInt()).toString()
......@@ -334,9 +333,6 @@ class FilterPopupWindow(
}
}
fun addSubscription(disposable: Disposable) {
mDisposableList.add(disposable)
}
/**
* 其他选择
......@@ -573,7 +569,7 @@ class FilterPopupWindow(
llLayout.layoutParams = params
textView.text = enquiry.value
Glide.with(context)
.load(enquiry.unCheckUrl)
.load(enquiry.un_check_url)
.into(ivIcon)
enquiryViews.add(llLayout)
......@@ -581,7 +577,7 @@ class FilterPopupWindow(
llLayout.isSelected = true
textView.paint.isFakeBoldText = true
Glide.with(context)
.load(enquiry.checkRrl)
.load(enquiry.check_url)
.into(ivIcon)
}
llLayout.setOnClickListener {
......@@ -590,14 +586,14 @@ class FilterPopupWindow(
llLayout.isSelected = false
textView.paint.isFakeBoldText = false
Glide.with(context)
.load(enquiry.unCheckUrl)
.load(enquiry.un_check_url)
.into(ivIcon)
} else {
tempFilter.enquiries.add(enquiry)
llLayout.isSelected = true
textView.paint.isFakeBoldText = true
Glide.with(context)
.load(enquiry.checkRrl)
.load(enquiry.check_url)
.into(ivIcon)
}
updateCount(ConsultBIConstants.POSITION_CONSULT_TYPE_CLICK)
......@@ -607,14 +603,13 @@ class FilterPopupWindow(
}
private fun initPriceViews(view: View) {
val priceRange =
View.inflate(context, R.layout.consultant_item_price_range, null) as LinearLayout
val priceRange = View.inflate(context, R.layout.consultant_item_price_range, null) as LinearLayout
etMinPrice = priceRange.findViewById(R.id.etMinPrice);
etMaxPrice = priceRange.findViewById(R.id.etMaxPrice);
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
// context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
var listener: TextView.OnEditorActionListener =
val listener: TextView.OnEditorActionListener =
TextView.OnEditorActionListener { _, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE || event != null && event.keyCode == KeyEvent.KEYCODE_ENTER) {
updatePriceFilter()
......@@ -625,8 +620,8 @@ class FilterPopupWindow(
}
if (tempFilter.priceRanges != null) {
etMinPrice?.setText(tempFilter.priceRanges?.minPrice)
etMaxPrice?.setText(tempFilter.priceRanges?.maxPrice)
etMinPrice?.setText(tempFilter.priceRanges?.min_price)
etMaxPrice?.setText(tempFilter.priceRanges?.max_price)
}
etMaxPrice?.setOnEditorActionListener(listener)
......@@ -673,16 +668,7 @@ class FilterPopupWindow(
0
)
textView.layoutParams = params
val maxPriceStr =
if (TextUtils.isEmpty(priceRangesItem.maxPrice)) "+" else "-" + priceRangesItem.maxPrice
val contentStr = String.format(
"%s%s\n%s",
priceRangesItem.minPrice,
maxPriceStr,
priceRangesItem.recommendPercent
)
val contentStr = String.format("%s\n%s", priceRangesItem.display_range, priceRangesItem.recommend_percent)
val msp = SpannableString(contentStr)
msp.setSpan(
AbsoluteSizeSpan(10, true),
......@@ -690,8 +676,7 @@ class FilterPopupWindow(
contentStr.length,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.text = msp;
textView.text = msp
textView.setSingleLine(false)
textView.setLineSpacing(1.0f, 1.2f)
......@@ -717,13 +702,14 @@ class FilterPopupWindow(
etMaxPrice?.setText("")
etMinPrice?.setText("")
} else {
tempFilter.priceRanges =
priceRangesItem.copy(priceRangesItem.minPrice, priceRangesItem.maxPrice)
tempFilter.priceRanges = priceRangesItem.copy(min_price = priceRangesItem.min_price, max_price = priceRangesItem.max_price)
textView.isSelected = true
textView.paint.isFakeBoldText = true
tempFilter.priceRangesView = textView
etMinPrice?.setText(priceRangesItem.minPrice)
etMaxPrice?.setText(priceRangesItem.maxPrice)
etMinPrice?.setText(priceRangesItem.min_price)
etMaxPrice?.setText(priceRangesItem.max_price)
etMinPrice?.setSelection(etMinPrice?.text!!.length)
etMaxPrice?.setSelection(etMaxPrice?.text!!.length)
}
updateCount(ConsultBIConstants.POSITION_AVERAGE_SERVICE_INPUT)
......@@ -743,8 +729,8 @@ class FilterPopupWindow(
tempFilter.priceRanges = priceRangesItem;
}
tempFilter.priceRanges!!.maxPrice = etMaxPrice?.text.toString()
tempFilter.priceRanges!!.minPrice = etMinPrice?.text.toString()
tempFilter.priceRanges!!.max_price = etMaxPrice?.text.toString()
tempFilter.priceRanges!!.min_price = etMinPrice?.text.toString()
tempFilter.priceRangesView?.isSelected = false
tempFilter.priceRangesView?.paint?.isFakeBoldText = false
tempFilter.priceRangesView = null
......@@ -794,7 +780,6 @@ class FilterPopupWindow(
}
override fun dismiss() {
mDisposableList.clear()
super.dismiss()
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yidianling.consultant.ui.view.topView
import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import android.util.AttributeSet
......@@ -71,12 +72,16 @@ class RecommendListView : LinearLayout {
recommendViewPagerIndicator.visibility = View.GONE
itemListView.visibility = View.GONE
requestData()
// requestData()
}
@SuppressLint("CheckResult")
fun requestData() {
ExpertSearchHttpImpl.getInstance().getBigShotData()
fun requestData(cateId:String) {
val map = HashMap<String, Any>()
if (!TextUtils.isEmpty(cateId)){
map["entrance"] = cateId
}
ExpertSearchHttpImpl.getInstance().getBigShotData(map)
.subscribeOn(Schedulers.io())
.compose(RxUtils.resultJavaData())
.map { it }
......@@ -114,7 +119,7 @@ class RecommendListView : LinearLayout {
/**
* 设置数据
*/
fun setData() {
private fun setData() {
// 顶部viewpager数据
if (mSceneSpecialTopicList.isNotEmpty()) {
......
......@@ -27,7 +27,6 @@
android:background="@drawable/shape_round_gray_bored"
android:inputType="number"
android:maxLines="1"
android:textCursorDrawable="@color/platform_main_theme"
android:textSize="13sp"
android:maxLength="7"
/>
......@@ -45,9 +44,8 @@
android:layout_marginLeft="10dp"
android:background="@drawable/shape_round_gray_bored"
android:inputType="number"
android:maxLines="1"
android:textCursorDrawable="@color/platform_main_theme"
android:textSize="13sp"
android:maxLines="1"
android:maxLength="7"
/>
......
......@@ -33,7 +33,7 @@
android:width="0dp"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:text="@string/platform_theme"
android:text="困扰"
android:textColor="@color/platform_color_242424" />
<com.ydl.ydlcommon.view.DrawableRightTextView
......
......@@ -195,15 +195,16 @@
android:background="@color/platform_white"
android:orientation="horizontal">
<TextView
android:id="@+id/btnReset"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_weight="1"
android:background="@drawable/consultant_bg_radius_gray_6"
android:background="@drawable/consultant_stroke_ebebeb_r_8"
android:gravity="center"
android:text="@string/platform_reset"
android:textColor="@color/platform_color_999999"
android:textColor="@color/platform_color_242424"
android:textSize="16sp" />
<TextView
......@@ -212,11 +213,10 @@
android:layout_height="44dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@drawable/consultant_bg_radius_5_dark"
android:background="@drawable/consultant_solid_main_theme_color_r_8"
android:gravity="center"
android:hint="确定"
android:text="确定"
android:textColor="@color/white"
android:textColorHint="@color/platform_color_E0E0E0"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
......@@ -18,4 +18,8 @@ public class SystemConfigByKeywordBean {
*/
public String value1;
/**
* 0:不弹信息卡,1:弹信息卡
* */
public String value2;
}
......@@ -63,6 +63,8 @@ object IMChatUtil {
private const val USER_TYPE_EXPERT = 2//专家
private const val USER_TYPE_ASSISTANT = 3//助理
private const val USER_TYPE_USER = 1//用户
//展示信息收集卡
private const val SHOW_EMS_POP = 1L
lateinit var doctorId: String
/**
......@@ -98,7 +100,9 @@ object IMChatUtil {
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
val skipTime = it.value1.toLong()
if (isJumpToIm(skipTime)) {
//0:不弹信息卡,1:弹信息卡
val isPopCms = it.value2.toLong()
if (SHOW_EMS_POP != isPopCms || isJumpToIm(skipTime)) {
// 请求接口获取咨询助理的uid
getImJavaApi().getConsultAssistantUidRequest(location, ffrom2)
.subscribeOn(Schedulers.io())
......@@ -191,7 +195,10 @@ object IMChatUtil {
.subscribe {
//请求接口获取 前置信息收集间隔时间
val skipTime = it.value1.toLong()
if (isJumpToIm(skipTime)) {
//0:不弹信息卡,1:弹信息卡
val isPopCms = it.value2.toLong()
if (SHOW_EMS_POP != isPopCms || isJumpToIm(skipTime)) {
//时间内已收集过信息,直接跳转到聊天页
startChat(context, toUid, isFromQingShu)
} else {
......
......@@ -239,15 +239,6 @@ public class RxDeviceTool {
return tm.getSimState();
}
/**
* 获取ANDROID ID
*
* @param context
* @return
*/
public static String getAndroidId(Context context) {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}
/**
* 获取设备型号,如MI2SC
......
......@@ -138,7 +138,6 @@ dependencies {
api rootProject.ext.dependencies["flowlayout"]
api rootProject.ext.dependencies["androidanimations"]
//====================Tools====================
api rootProject.ext.dependencies["robust"]
api rootProject.ext.dependencies["walle"]
api rootProject.ext.dependencies["jpush"]
api rootProject.ext.dependencies["jcore"]
......
......@@ -10,7 +10,11 @@ import com.ydl.ydlcommon.base.BaseApp
*/
object JPushUtils{
fun getRegistrationID():String{
return JPushInterface.getRegistrationID(BaseApp.getApp());
fun getRegistrationID(): String? {
return if (DeviceTool.checkHasAgreeSecret()) {
JPushInterface.getRegistrationID(BaseApp.getApp());
} else {
null;
}
}
}
\ No newline at end of file
......@@ -288,10 +288,11 @@ class ActionCountUtils {
baiduActionDataParams.appName(appName)
try {
@SuppressLint("HardwareIds") val id =
Settings.Secure.getString(
RxTool.getContext().contentResolver,
Settings.Secure.ANDROID_ID
)
if (DeviceTool.checkHasAgreeSecret()){
Settings.Secure.getString(RxTool.getContext().contentResolver, Settings.Secure.ANDROID_ID)
}else{
""
}
LogUtil.e("androidid未加密:${id}")
} catch (e: java.lang.Exception) {
......
......@@ -256,17 +256,6 @@ public class RxDeviceTool {
}
/**
* 获取SIM卡的序列号
*
* @param context
* @return
*/
// public static String getSimSerialNumber(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getSimSerialNumber();
// }
/**
* 获取SIM的状态信息
*
* @param context
......@@ -278,38 +267,6 @@ public class RxDeviceTool {
}
/**
* 获取唯一的用户ID
*
* @param context
* @return
*/
// public static String getSubscriberId(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getSubscriberId();
// }
/**
* 获取语音邮件号码
*
* @param context
* @return
*/
// public static String getVoiceMailNumber(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getVoiceMailNumber();
// }
/**
* 获取ANDROID ID
*
* @param context
* @return
*/
public static String getAndroidId(Context context) {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}
/**
* 获取设备型号,如MI2SC
*
* @return 设备型号
......@@ -418,69 +375,6 @@ public class RxDeviceTool {
}
return result;
}
/**
* 获取设备信息
*
* @param context
* @return
*/
// public static String getDeviceInfo(Context context) {
// try {
// org.json.JSONObject json = new org.json.JSONObject();
// TelephonyManager tm = (TelephonyManager) context
// .getSystemService(Context.TELEPHONY_SERVICE);
// String device_id = null;
// if (checkPermission(context, Manifest.permission.READ_PHONE_STATE)) {
// device_id = getDeviceIdIMEI(context);
// }
// String mac = null;
// FileReader fstream = null;
// try {
// fstream = new FileReader("/sys/class/net/wlan0/address");
// } catch (FileNotFoundException e) {
// fstream = new FileReader("/sys/class/net/eth0/address");
// }
// BufferedReader in = null;
// if (fstream != null) {
// try {
// in = new BufferedReader(fstream, 1024);
// mac = in.readLine();
// } catch (IOException e) {
// } finally {
// if (fstream != null) {
// try {
// fstream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (in != null) {
// try {
// in.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
// json.put("mac", mac);
// if (TextUtils.isEmpty(device_id)) {
// device_id = mac;
// }
// if (TextUtils.isEmpty(device_id)) {
// device_id = Settings.Secure.getString(context.getContentResolver(),
// Settings.Secure.ANDROID_ID);
// }
// json.put("device_id", device_id);
// return json.toString();
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
// }
/**
* 遍历LOG输出HashMap
*
......@@ -578,9 +472,6 @@ public class RxDeviceTool {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String str = "";
// str += "DeviceId(IMEI) = " + getDeviceIdIMEI(context) + "\n";
// str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n";
// str += "Line1Number = " + tm.getLine1Number() + "\n";
str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n";
str += "NetworkOperator = " + tm.getNetworkOperator() + "\n";
str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n";
......@@ -589,10 +480,7 @@ public class RxDeviceTool {
str += "SimCountryIso = " + tm.getSimCountryIso() + "\n";
str += "SimOperator = " + tm.getSimOperator() + "\n";
str += "SimOperatorName = " + tm.getSimOperatorName() + "\n";
// str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n";
str += "SimState = " + tm.getSimState() + "\n";
// str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";
// str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";
return str;
}
......@@ -607,174 +495,6 @@ public class RxDeviceTool {
}
/**
* 获取手机联系人
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>}</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_CONTACTS"/>}</p>
*
* @param context 上下文;
* @return 联系人链表
*/
// public static List<HashMap<String, String>> getAllContactInfo(Context context) {
// SystemClock.sleep(3000);
// ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
// // 1.获取内容解析者
// ContentResolver resolver = context.getContentResolver();
// // 2.获取内容提供者的地址:com.android.contacts
// // raw_contacts表的地址 :raw_contacts
// // view_data表的地址 : data
// // 3.生成查询地址
// Uri raw_uri = Uri.parse("content://com.android.contacts/raw_contacts");
// Uri date_uri = Uri.parse("content://com.android.contacts/data");
// // 4.查询操作,先查询raw_contacts,查询contact_id
// // projection : 查询的字段
// Cursor cursor = resolver.query(raw_uri, new String[]{"contact_id"},
// null, null, null);
// // 5.解析cursor
// while (cursor.moveToNext()) {
// // 6.获取查询的数据
// String contact_id = cursor.getString(0);
// // cursor.getString(cursor.getColumnIndex("contact_id"));//getColumnIndex
// // : 查询字段在cursor中索引值,一般都是用在查询字段比较多的时候
// // 判断contact_id是否为空
// if (!RxDataTool.isNullString(contact_id)) {//null ""
// // 7.根据contact_id查询view_data表中的数据
// // selection : 查询条件
// // selectionArgs :查询条件的参数
// // sortOrder : 排序
// // 空指针: 1.null.方法 2.参数为null
// Cursor c = resolver.query(date_uri, new String[]{"data1",
// "mimetype"}, "raw_contact_id=?",
// new String[]{contact_id}, null);
// HashMap<String, String> map = new HashMap<String, String>();
// // 8.解析c
// while (c.moveToNext()) {
// // 9.获取数据
// String data1 = c.getString(0);
// String mimetype = c.getString(1);
// // 10.根据类型去判断获取的data1数据并保存
// if (mimetype.equals("vnd.android.cursor.item/phone_v2")) {
// // 电话
// map.put("phone", data1);
// } else if (mimetype.equals("vnd.android.cursor.item/name")) {
// // 姓名
// map.put("name", data1);
// }
// }
// // 11.添加到集合中数据
// list.add(map);
// // 12.关闭cursor
// c.close();
// }
// }
// // 12.关闭cursor
// cursor.close();
// return list;
// }
/**
* 打开手机联系人界面点击联系人后便获取该号码
* <p>参照以下注释代码</p>
*/
public static void getContantNum() {
Log.i("tips", "U should copy the following code.");
/*
Intent intent = new Intent();
intent.setAction("android.intent.action.PICK");
intent.setType("vnd.android.cursor.dir/phone_v2");
startActivityForResult(intent, 0);
@Override
protected void onActivityResult ( int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
if (data != null) {
Uri uri = data.getData();
String num = null;
// 创建内容解析者
ContentResolver contentResolver = getContentResolver();
Cursor cursor = contentResolver.query(uri,
null, null, null, null);
while (cursor.moveToNext()) {
num = cursor.getString(cursor.getColumnIndex("data1"));
}
cursor.close();
num = num.replaceAll("-", "");//替换的操作,555-6 -> 5556
}
}
*/
}
/**
* 获取手机短信并保存到xml中
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_SMS"/>}</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>}</p>
*
* @param context 上下文
*/
// public static void getAllSMS(Context context) {
// // 1.获取短信
// // 1.1获取内容解析者
// ContentResolver resolver = context.getContentResolver();
// // 1.2获取内容提供者地址 sms,sms表的地址:null 不写
// // 1.3获取查询路径
// Uri uri = Uri.parse("content://sms");
// // 1.4.查询操作
// // projection : 查询的字段
// // selection : 查询的条件
// // selectionArgs : 查询条件的参数
// // sortOrder : 排序
// Cursor cursor = resolver.query(uri, new String[]{"address", "date", "type", "body"}, null, null, null);
// // 设置最大进度
// int count = cursor.getCount();//获取短信的个数
// // 2.备份短信
// // 2.1获取xml序列器
// XmlSerializer xmlSerializer = Xml.newSerializer();
// try {
// // 2.2设置xml文件保存的路径
// // os : 保存的位置
// // encoding : 编码格式
// xmlSerializer.setOutput(new FileOutputStream(new File("/mnt/sdcard/backupsms.xml")), "utf-8");
// // 2.3设置头信息
// // standalone : 是否独立保存
// xmlSerializer.startDocument("utf-8", true);
// // 2.4设置根标签
// xmlSerializer.startTag(null, "smss");
// // 1.5.解析cursor
// while (cursor.moveToNext()) {
// SystemClock.sleep(1000);
// // 2.5设置短信的标签
// xmlSerializer.startTag(null, "sms");
// // 2.6设置文本内容的标签
// xmlSerializer.startTag(null, "address");
// String address = cursor.getString(0);
// // 2.7设置文本内容
// xmlSerializer.text(address);
// xmlSerializer.endTag(null, "address");
// xmlSerializer.startTag(null, "date");
// String date = cursor.getString(1);
// xmlSerializer.text(date);
// xmlSerializer.endTag(null, "date");
// xmlSerializer.startTag(null, "type");
// String type = cursor.getString(2);
// xmlSerializer.text(type);
// xmlSerializer.endTag(null, "type");
// xmlSerializer.startTag(null, "body");
// String body = cursor.getString(3);
// xmlSerializer.text(body);
// xmlSerializer.endTag(null, "body");
// xmlSerializer.endTag(null, "sms");
// System.out.println("address:" + address + " date:" + date + " type:" + type + " body:" + body);
// }
// xmlSerializer.endTag(null, "smss");
// xmlSerializer.endDocument();
// // 2.8将数据刷新到文件中
// xmlSerializer.flush();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
/**
* 设置屏幕为横屏
* <p>还有一种就是在Activity中加属性android:screenOrientation="landscape"</p>
* <p>不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次</p>
......
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