Commit d2cec167 authored by 王雪伟's avatar 王雪伟

Merge remote-tracking branch 'origin/master'

parents f4e408e6 64db18f3
......@@ -60,6 +60,7 @@ import com.zxhl.cms.utils.Utils;
import com.zxhl.cms.widget.ChatDialogUtils;
import com.zxhl.cms.widget.LoadingDialog;
import com.zxhl.main.page.fragment.ConstellationMachFragment;
import com.zxhl.main.page.fragment.HomeFragment;
import com.zxhl.main.page.fragment.PopularFragment;
import com.zxhl.main.page.view.NavigationBottomView;
import com.zxhl.uc.page.fragment.UserCenterFragment;
......@@ -163,7 +164,7 @@ public class MainActivity extends BaseActivity implements NavigationBottomView.N
}
private void initFragment() {
fragments.add(new PopularFragment());
fragments.add(new HomeFragment());
fragments.add(new ConstellationMachFragment());
fragments.add(new ChatFragment());
fragments.add(new UserCenterFragment());
......
<resources>
<string name="app_name" translatable="false">StarLight</string>
<string name="app_name" translatable="false">Starlight</string>
</resources>
......@@ -132,7 +132,7 @@ public class NetConfig {
public static class User {
public static final String URL_USER_DEVICE_LOGIN = "app/v1/auth/tourist-login";
public static final String URL_USER_GET_USERINFO_ = "app/v1/game/star/user";
public static final String URL_USER_GET_USERINFO_ = "app/v1/hk/game/star/user";
public static final String URL_PAY_CONFIG = "app/v2/location/user/pay-config";//獲取配置列表
public static final String URL_PAY_ORDER = "app/v4/location/user/pay";//請求支付訂單
......@@ -254,7 +254,7 @@ public class NetConfig {
public static final String HOME_STAR_LIGHT_FANLIST = "app/v1/game/star/fanList";//我的 - 粉丝列表
public static final String HOME_STAR_LIGHT_LIKEMYLIST = "app/v1/game/star/likeMyList";//我的 - 喜欢我列表
public static final String HOME_STAR_LIGHT_REPORT = "app/v1/game/star/report";//举报
public static final String HOME_STAR_LIGHT_UPDATE_USER_INFO = "app/v1/game/star/updateUserInfo";//我的 - 编辑个人信息
public static final String HOME_STAR_LIGHT_UPDATE_USER_INFO = "app/v1/hk/game/star/updateUserInfo";//我的 - 编辑个人信息
public static final String HOME_STAR_LIGHT_UPDATE_USER_INFO_NO_HEAD_IMG = "app/v1/game/star/updateUserInfo";//我的 - 编辑个人信息 不带头像的
public static final String HOME_STAR_LIGHT_UPDATE_USER_VOICE = "app/v1/game/star/updateUserVoice";//我的 - 编辑语音签名
public static final String HOME_STAR_LIGHT_MEMBER_RECORD = "app/v1/game/star/memberRecord";//购买会员记录
......@@ -296,6 +296,9 @@ public class NetConfig {
public static final String HOME_STAR_LIGHT_GET_RECENT_CONTACTS = "app/v1/game/star/getRecentContacts";//语音房版本 - 获取最近联系人(邀请)
public static final String HOME_STAR_LIGHT_GET_ROOM_USER = "app/v1/game/star/roomUser";//语音房版本 - 获取当前房内用户
public static final String HOME_STAR_LIGHT_BLACKLIST = "app/v1/hk/game/star/blacklist";//我的 - 黑名单列表
public static final String HOME_STAR_BLACK= "app/v1/hk/game/star/black";//拉黑/取消拉黑
public static final String HOME_STAR_CONSTELLATION_PAIRING= "app/v1/hk/game/star/constellationPairing";//星座配对头像列表
}
......
......@@ -1477,6 +1477,19 @@ public class SettingPreference {
setUUid(str);
return str;
}
public static void setUserDesc(String str) {
SharedPreferences settings = AppContext.get().getSharedPreferences(USER_SETTING, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("USER_HEAD_DESC", str);
editor.commit();
}
public static String getUserDesc() {
SharedPreferences settings = AppContext.get().getSharedPreferences(USER_SETTING, 0);
String str = settings.getString("USER_HEAD_DESC", UUID.randomUUID().toString());
setUUid(str);
return str;
}
public static void setUserCoinNum(String str) {
......@@ -1648,4 +1661,5 @@ public class SettingPreference {
SharedPreferences settings = AppContext.get().getSharedPreferences(USER_SETTING, 0);
return settings.getString("LIKE_USER_ID", "");
}
}
......@@ -19,7 +19,8 @@ interface IHomeApi {
fun getHomelist(
@Query("page") page: Int,
@Query("size") size: Int,
@Query("free") free: Int
@Query("free") free: Int,
@Query("category") category: String
): Observable<Response<List<HomeListEntity>>>
@GET(NetConfig.StarLight.HOME_STAR_LIGHT_USER_INFO)
......@@ -71,6 +72,32 @@ interface IHomeApi {
@Query("weight") weight: String
): Observable<Response<Any>>
@Multipart
@POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
fun updateUserHeadImg(
@Part headImage: MultipartBody.Part?
): Observable<Response<Any>>
@POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
fun updateUserNickName(
@Query("nickname") nickname: String,
): Observable<Response<Any>>
@POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
fun updateUserGender(
@Query("sex") sex: String,
): Observable<Response<Any>>
@POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
fun updateUserAge(
@Query("age") age: String,
): Observable<Response<Any>>
@POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_INFO)
fun updateUserDescrption(
@Query("description") description: String,
): Observable<Response<Any>>
@Multipart
@POST(NetConfig.StarLight.HOME_STAR_LIGHT_UPDATE_USER_VOICE)
fun updateUserVoice(
......@@ -256,4 +283,17 @@ interface IHomeApi {
@Query("picture") picture: String?
): Observable<Response<WxBindEntity?>>
@GET(NetConfig.StarLight.HOME_STAR_LIGHT_BLACKLIST)
fun getBlackList(
@Query("page") page: Int,
@Query("size") size: Int
): Observable<Response<List<FollowEntity>>>
@POST(NetConfig.StarLight.HOME_STAR_BLACK)
fun blackUser(
@Query("userId") userId: String?
): Observable<Response<Any>>
@GET(NetConfig.StarLight.HOME_STAR_CONSTELLATION_PAIRING)
fun getConstellation(): Observable<Response<Any>>
}
\ No newline at end of file
package com.zxhl.cms.net.model.box
class HomeListEntity {
//var id: String? = ""
var uid: String? = ""
......@@ -34,7 +35,19 @@ class HomeListEntity {
var picturesList: List<String>? = null
var ifchoose: Boolean = false
var distance: String? = ""
var countryEn:String? = ""
var countryEn: String? = ""
var nationalFlag: String? = ""
var isUpload = false
var videoPrice: String? = ""
var location: LocationHomeEntity? = null
}
class LocationHomeEntity {
var en: EnLocationEntity? = null
}
}
\ No newline at end of file
class EnLocationEntity {
var country: String? = ""
var province: String? = ""
var city: String? = ""
}
package com.zxhl.cms.net.model.uc;
import com.zxhl.cms.net.model.box.LocationHomeEntity;
import java.io.Serializable;
import java.util.List;
......@@ -27,7 +29,7 @@ public class UserInfo implements Serializable {
public String province;//城市
public String tags;//标签
public String pictures;
// public String isVip;//是否为会员
// public String isVip;//是否为会员
public String voice;//语音url
public String voiceTime;//语音时长
public String weight;//体重
......@@ -69,5 +71,5 @@ public class UserInfo implements Serializable {
//未充值过:true/false
public boolean noRecharged;
public LocationHomeEntity location;
}
......@@ -229,7 +229,7 @@ interface RounterApi {
fun getIntentUpdateNickName(): Intent
@RounterUri(Constant.scheme + "://updateintrodution")
fun getIntentUpdateIntrodution(): Intent
fun getIntentUpdateIntrodution(@RounterParam("description") str: String): Intent
@RounterUri(Constant.scheme + "://coin_store")
fun getIntentCoinStore(): Intent
......
......@@ -223,7 +223,6 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "This version is not supported, please update the version!");
}
}
public static void BlockListJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentBlockList();
......@@ -233,7 +232,6 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void UpdateNickNameJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentUpdateNickName();
......@@ -243,10 +241,9 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void UpdateIntrodutionJump() {
public static void UpdateIntrodutionJump(String description) {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentUpdateIntrodution();
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentUpdateIntrodution(description);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AppContext.get().startActivity(intent);
} catch (Exception e) {
......
......@@ -18,6 +18,7 @@ object UserDataUtils {
override fun onSuccess(result: UserInfo) {
SettingPreference.saveUserInfo(result)
SettingPreference.setUserName(result.nickname)
SettingPreference.setUserDesc(result.description)
SettingPreference.setIsVip("${result.memberType}")
SettingPreference.setMemberEndTime(result.memberEndTime)
SettingPreference.setUserHeadImg(result.headImage)
......
......@@ -56,4 +56,5 @@ dependencies {
implementation 'com.contrarywind:Android-PickerView:4.1.9'
implementation 'com.zhy:percent-support-extends:1.0.1'
implementation 'com.cncoderx.wheelview:library:1.2.5'
implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
}
package com.zxhl.main.page.activity
import android.util.Log
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.model.chat.FollowEntity
import com.zxhl.cms.utils.OnRecycleItemClickListener
import com.zxhl.cms.utils.Utils
import com.zxhl.main.R
import com.zxhl.main.page.adapter.BlockAdapter
import com.zxhl.main.page.contract.BlockContract
import com.zxhl.main.page.presenter.BlockPresenter
import kotlinx.android.synthetic.main.activity_layout_block_list.*
import kotlinx.android.synthetic.main.activity_layout_block_list.id_img_back
import kotlinx.android.synthetic.main.activity_layout_block_list.id_refresh_layout
import kotlinx.android.synthetic.main.layout_empty_view.*
class BlockListActivity : BaseActivity() {
override fun init() {
id_img_back?.setOnClickListener {
finish()
}
}
class BlockListActivity : BaseActivity(), BlockContract.View,
OnRecycleItemClickListener<FollowEntity> {
private var mPresenter: BlockPresenter? = null
private var mAdapter: BlockAdapter? = null
override fun before() {
super.before()
setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
......@@ -24,4 +34,75 @@ class BlockListActivity : BaseActivity() {
override fun layoutID(): Int {
return R.layout.activity_layout_block_list
}
override fun init() {
mPresenter = BlockPresenter(this)
id_img_back?.setOnClickListener {
finish()
}
mAdapter = BlockAdapter(this, this)
id_rl_black?.layoutManager = LinearLayoutManager(this)
id_rl_black?.adapter = mAdapter
Utils.setOnScrollBottomListener(id_rl_black) { _, _ ->
mPresenter?.getBlackList(false)
}
id_rl_black.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (Utils.isSlideToBottom(recyclerView)) {
if ((mAdapter?.list?.size ?: 0) > 0) {
mPresenter?.getBlackList(false)
}
}
}
})
id_refresh_layout.setColorSchemeColors(resources.getColor(com.zxhl.cms.R.color.color_aa60ff))
id_refresh_layout?.setOnRefreshListener {
mPresenter?.getBlackList(true)
}
mPresenter?.getBlackList(true)
}
override fun setData(isRefresh: Boolean, reslut: List<FollowEntity>?) {
id_ll_empty?.visibility = View.GONE
if (isRefresh) {
mAdapter?.clear()
}
id_refresh_layout?.isRefreshing = false
val start = mAdapter?.getItemCount() ?: 0
mAdapter?.appendToList(reslut)
if (isRefresh) {
mAdapter?.notifyDataSetChanged()
} else {
val end = mAdapter?.getItemCount() ?: 0
mAdapter?.notifyItemRangeChanged(start, end)
}
}
override fun setEmptyView() {
if(mAdapter!=null){
mAdapter?.clear()
}
id_refresh_layout?.isRefreshing = false
id_ll_empty?.visibility = View.VISIBLE
id_tv_empty_text.text = "There is no blacklist yet"
}
override fun blackSuc() {
mPresenter?.getBlackList(true)
}
override fun onItemClick(view: View?, position: Int, data: FollowEntity?) {
when (view?.id) {
R.id.id_tv_remove_black -> {
mPresenter?.blackUser(data?.uid)
}
}
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ import com.zxhl.main.page.contract.MyLikesContract
import com.zxhl.main.page.presenter.MyLikesPresenter
import kotlinx.android.synthetic.main.activity_layout_my_likes.*
import kotlinx.android.synthetic.main.activity_layout_my_likes.id_refresh_layout
import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.fragment_popular.*
import kotlinx.android.synthetic.main.layout_empty_view.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
......
package com.zxhl.main.page.activity
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.View
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.model.uc.UserInfo
import com.zxhl.cms.utils.AdCallback
import com.zxhl.cms.utils.NoDoubleClickListener
import com.zxhl.cms.utils.UserDataUtils
import com.zxhl.cms.widget.LoadingDialog
import com.zxhl.main.R
import com.zxhl.main.page.contract.EditUserInfoContract
import com.zxhl.main.page.presenter.EditUserInfoPresenter
import kotlinx.android.synthetic.main.activity_layout_update_introdution.*
import kotlinx.android.synthetic.main.activity_layout_update_introdution.id_img_back
import kotlinx.android.synthetic.main.activity_layout_update_introdution.id_tv_length
class UpdateIntrodutionActivity : BaseActivity() {
class UpdateIntrodutionActivity : BaseActivity(), EditUserInfoContract.View ,AdCallback<String>{
private var mPresenter: EditUserInfoPresenter? = null
private var mLoading: LoadingDialog? = null
override fun init() {
var desc = intent?.data?.getQueryParameter("description") ?: ""
id_edit_introdution.setText(desc)
id_tv_length?.text = id_edit_introdution.length().toString() + "/140"
mPresenter = EditUserInfoPresenter(this)
mLoading = LoadingDialog.getLoadingDialog(
this,
getString(com.zxhl.cms.R.string.wait_ing),
false,
false
)
id_img_back?.setOnClickListener {
finish()
}
id_tv_save_introduction?.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(v: View?) {
saveIntroduction()
}
})
id_edit_introdution?.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s != null) {
id_tv_length?.text = s!!.length.toString() + "/140"
}
}
override fun afterTextChanged(s: Editable?) {
}
})
}
override fun before() {
......@@ -22,4 +73,48 @@ class UpdateIntrodutionActivity : BaseActivity() {
override fun layoutID(): Int {
return R.layout.activity_layout_update_introdution
}
fun saveIntroduction() {
if (!TextUtils.isEmpty(id_edit_introdution.text.toString())) {
mLoading?.setLoading("loading")
mLoading?.show()
mPresenter?.updateIntroduction(id_edit_introdution.text.toString())
} else {
// showToast("")
}
}
override fun setData(result: UserInfo?) {
}
override fun updateSuc() {
mLoading?.setResult(true, "success", 1000)
UserDataUtils.updateUserInfo(this)
}
override fun updateFail() {
mLoading?.setResult(false, "fail", 1000)
}
override fun uploadSuc(result: String) {
}
override fun uploadFail() {
}
override fun updatePicSuc() {
}
override fun updatePicFail() {
}
override fun onResult(code: Int, result: String?) {
finish()
}
}
\ No newline at end of file
package com.zxhl.main.page.activity
import android.text.TextUtils
import android.util.Log
import android.view.View
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.model.uc.UserInfo
import com.zxhl.cms.utils.AdCallback
import com.zxhl.cms.utils.NoDoubleClickListener
import com.zxhl.cms.utils.UserDataUtils
import com.zxhl.cms.widget.LoadingDialog
import com.zxhl.main.R
import com.zxhl.main.page.contract.EditUserInfoContract
import com.zxhl.main.page.presenter.EditUserInfoPresenter
import kotlinx.android.synthetic.main.activity_layout_update_nick_name.*
class UpdateNickNameActivity : BaseActivity() {
class UpdateNickNameActivity : BaseActivity(), EditUserInfoContract.View, AdCallback<String> {
private var mPresenter: EditUserInfoPresenter? = null
private var mLoading: LoadingDialog? = null
override fun init() {
mPresenter = EditUserInfoPresenter(this)
mLoading = LoadingDialog.getLoadingDialog(
this,
getString(com.zxhl.cms.R.string.wait_ing),
false,
false
)
id_img_back?.setOnClickListener {
finish()
}
id_tv_sava_nick_name?.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(v: View?) {
saveName()
}
})
id_img_clear?.setOnClickListener {
id_edit_nickname?.setText("")
}
}
override fun before() {
super.before()
setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
}
override fun onClick(v: View?) {
}
......@@ -20,4 +53,47 @@ class UpdateNickNameActivity : BaseActivity() {
override fun layoutID(): Int {
return R.layout.activity_layout_update_nick_name
}
fun saveName() {
if (!TextUtils.isEmpty(id_edit_nickname.text.toString())) {
mLoading?.setLoading("loading")
mLoading?.show()
mPresenter?.updateUserNickName(id_edit_nickname.text.toString())
} else {
showToast("please input")
}
}
override fun setData(result: UserInfo?) {
}
override fun updateSuc() {
mLoading?.setResult(true, "success", 1000)
UserDataUtils.updateUserInfo(this)
}
override fun updateFail() {
mLoading?.setResult(false, "fail", 1000)
}
override fun uploadSuc(result: String) {
}
override fun uploadFail() {
}
override fun updatePicSuc() {
}
override fun updatePicFail() {
}
override fun onResult(code: Int, result: String?) {
finish()
}
}
\ No newline at end of file
......@@ -53,6 +53,11 @@ import com.zxhl.main.page.entity.JsonBean
import com.zxhl.main.page.presenter.EditUserInfoPresenter
import com.zxhl.main.page.view.DialogUtils
import kotlinx.android.synthetic.main.activity_layout_user_info.*
import kotlinx.android.synthetic.main.activity_layout_user_info.id_img_back
import kotlinx.android.synthetic.main.activity_layout_user_info.id_img_head
import kotlinx.android.synthetic.main.activity_layout_user_info.id_tv_address
import kotlinx.android.synthetic.main.activity_layout_user_info.id_tv_height
import kotlinx.android.synthetic.main.activity_layout_user_info.id_tv_zhiye
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.MultipartBody
import okhttp3.RequestBody
......@@ -156,7 +161,7 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
JumpUtils.UpdateNickNameJump()
}
id_rl_introduction?.setOnClickListener {
JumpUtils.UpdateIntrodutionJump()
JumpUtils.UpdateIntrodutionJump(description)
}
}
......@@ -202,6 +207,7 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
id_rl_choose_photo.setAdapter(mAdapter)
}
var headImg: MultipartBody.Part? = null
fun saveInfo() {
// if()
if (TextUtils.isEmpty(id_tv_birth?.text.toString()) || TextUtils.isEmpty(id_edit_desc?.text.toString()) ||
......@@ -214,7 +220,7 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
showToast("请继续完善未填写项哦~")
return
}
var headImg: MultipartBody.Part? = null
if (!selectList.isNullOrEmpty()) {
val f = File(selectList!![0].compressPath)
val requestFile = RequestBody.create("multipart/form-data".toMediaTypeOrNull(), f)
......@@ -245,11 +251,11 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
mLoading?.setLoading("请稍后")
mLoading?.setLoading("loading")
mLoading?.show()
}
var description: String = ""
override fun setData(result: UserInfo?) {
if (result != null) {
id_edit_nickname?.setText(result?.nickname)
......@@ -260,7 +266,22 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
} else {
id_img_head.setImageResource(R.drawable.icon_user_photo_default)
}
if(result?.location!=null){
id_tv_location?.text=result.location.en?.country
}
id_tv_birth?.text = "${result.age}"
if (!TextUtils.isEmpty(result.description)) {
description = result.description
id_tv_introduction?.text = "${result.description}"
}
if (TextUtils.equals(result.sex.toString(), "1")) {
id_tv_gender?.text = "Boy"
} else {
id_tv_gender?.text = "Girl"
}
if (!TextUtils.isEmpty(result.description)) {
id_edit_desc?.setText(result.description)
id_tv_length.text = (30 - result.description.length).toString()
......@@ -378,6 +399,7 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
if (data != null && resultCode == -1) {
if (requestCode == PictureConfig.REQUEST_CAMERA) {
selectList = PictureSelector.obtainMultipleResult(data)
updateHeadImg()
val photoSize = Utils.dip2px(90)
Glide.with(this).asBitmap().load(selectList!![0].compressPath)
.apply(
......@@ -601,12 +623,22 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
id_tv_zhiye?.text = string
}
}
override fun chooseGender(string: String?) {
if (TextUtils.isEmpty(string)) {
} else {
mLoading?.setLoading("loading")
mLoading?.show()
id_tv_gender?.text = string
if (TextUtils.equals(string, "Boy")) {
mPresenter?.updateUserSex("1")
} else {
mPresenter?.updateUserSex("2")
}
}
}
override fun onItemClick(view: View?, position: Int, data: String?) {
when (view?.id) {
R.id.id_img_add -> {
......@@ -675,6 +707,23 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
}
override fun onResume() {
super.onResume()
updateNickName()
}
//返回更新用户姓名和签名
fun updateNickName() {
val user = SettingPreference.getUserInfoData()
if (user == null) {
return
}
id_edit_nickname?.text=user.nickname
if(!TextUtils.isEmpty(user.description)){
id_tv_introduction.text=user.description
}
}
fun updateView() {
val user = SettingPreference.getUserInfoData()
if (user == null) {
......@@ -703,12 +752,12 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
}
override fun updateSuc() {
mLoading?.setResult(true, "修改成功", 1000)
finish()
mLoading?.setResult(true, "success", 1000)
// finish()
}
override fun updateFail() {
mLoading?.setResult(false, "修改失败", 1000)
mLoading?.setResult(false, "fail", 1000)
}
override fun uploadSuc(result: String) {
......@@ -731,5 +780,13 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
mLoading?.setResult(true, "Fail", 1000)
}
fun updateHeadImg() {
if (!selectList.isNullOrEmpty()) {
val f = File(selectList!![0].compressPath)
val requestFile = RequestBody.create("multipart/form-data".toMediaTypeOrNull(), f)
headImg = MultipartBody.Part.createFormData("headImage", f.name, requestFile)
mPresenter?.updateUserHeadImg(headImg)
}
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@ class BlockAdapter : BaseRecyclerAdapter<FollowEntity, BlockAdapter.ViewHolder>
override fun onCreateViewHolder(holder: ViewGroup, p1: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(holder.context).inflate(R.layout.item_layout_fans, holder, false)
LayoutInflater.from(holder.context).inflate(R.layout.layout_item_block_list, holder, false)
)
}
......@@ -42,50 +42,38 @@ class BlockAdapter : BaseRecyclerAdapter<FollowEntity, BlockAdapter.ViewHolder>
if (!TextUtils.isEmpty(data.headImage)) {
Glide.with(AppContext.get()).load(data.headImage)
.apply(RequestOptions.bitmapTransform(CircleCrop()))
.into(holder.id_img_follow)
.into(holder.id_img_head)
} else {
holder.id_img_follow.setImageResource(R.drawable.icon_user_photo_default)
}
holder.id_tv_look_time.text="${data.dateStr} 看过你"
if(TextUtils.equals(data.hasFollows,"0")){
holder.id_tv_if_follow.text="关注Ta"
holder.id_tv_if_follow.setBackgroundResource(R.drawable.shape_aa60ff_r3)
holder.id_tv_if_follow.setTextColor(AppContext.get().resources.getColor(R.color.white))
}else{
holder.id_tv_if_follow.text="互相关注"
holder.id_tv_if_follow.setBackgroundResource(R.drawable.shape_999999_r3)
holder.id_tv_if_follow.setTextColor(AppContext.get().resources.getColor(R.color.color_999999))
holder.id_img_head.setImageResource(R.drawable.icon_user_photo_default)
}
}
inner class ViewHolder : RecyclerView.ViewHolder {
var id_tv_name: TextView
var id_tv_look_time: TextView
var id_tv_if_follow: TextView
var id_img_follow: ImageView
var id_rl_item: RelativeLayout
var id_tv_remove_black: TextView
var id_img_head: ImageView
constructor(itemView: View) : super(itemView) {
id_img_follow = itemView.findViewById(R.id.id_img_follow_head)
id_tv_name = itemView.findViewById(R.id.id_tv_follow_name)
id_tv_look_time = itemView.findViewById(R.id.id_tv_look_time)
id_tv_if_follow = itemView.findViewById(R.id.id_tv_if_follow)
id_rl_item = itemView.findViewById(R.id.id_rl_item)
id_tv_if_follow.setOnClickListener {
val pos = adapterPosition
if (pos >= 0 && pos < mList.size) {
listener.onItemClick(it,pos,mList[pos])
}
}
id_rl_item.setOnClickListener {
id_img_head = itemView.findViewById(R.id.id_img_block_head)
id_tv_name = itemView.findViewById(R.id.id_tv_block_name)
id_tv_remove_black = itemView.findViewById(R.id.id_tv_remove_black)
id_tv_remove_black.setOnClickListener {
val pos = adapterPosition
if (pos >= 0 && pos < mList.size) {
listener.onItemClick(it,pos,mList[pos])
}
}
// id_rl_item.setOnClickListener {
// val pos = adapterPosition
// if (pos >= 0 && pos < mList.size) {
// listener.onItemClick(it,pos,mList[pos])
// }
// }
}
}
......
......@@ -18,6 +18,8 @@ import android.widget.RelativeLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.SettingPreference
......@@ -31,6 +33,7 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
private val listener: OnRecycleItemClickListener<HomeListEntity>
private var ifplay: Boolean = false
private var lastpostion: Int = -1
//private val HEAD = 1009
private val CONTENT = 1000
public val LOADMORE = 1001
......@@ -169,10 +172,21 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is ViewHolder) {
val data = mList[position]
holder.id_tv_age.text = "${data.age}"
holder.id_tv_countryEn.text = "${data.countryEn}"
holder.id_tv_chat_price.text="${data.videoPrice}/min"
holder.id_img_guoqi.setLoadImageUrl("${data.nationalFlag}", false)
if (TextUtils.equals(data.sex, "2")) {
//girl
holder.id_ll_sex_bg.setBackgroundResource(R.drawable.shape_girl_bg)
} else {
//boy
holder.id_ll_sex_bg.setBackgroundResource(R.drawable.shape_boy_bg)
}
if (TextUtils.isEmpty(data.voice)) {
holder.id_rl_play_audio.visibility = View.GONE
} else {
holder.id_rl_play_audio.visibility = View.VISIBLE
holder.id_rl_play_audio.visibility = View.GONE
}
if (TextUtils.equals(data.onlineStatus, "1")) {
holder.id_img_online.visibility = View.GONE
......@@ -218,15 +232,18 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
val height: Float = width * 1.33f
holder.rl_item.setLayoutParams(RelativeLayout.LayoutParams(width, height.toInt()))
if (!data.picturesList.isNullOrEmpty()) {
holder.img.setLoadImageUrl(data.picturesList?.get(0), false)
Glide.with(mContext!!).load(data.picturesList?.get(0))
.apply(RequestOptions.bitmapTransform(RoundedCorners(10)))
.into(holder.img)
// holder.img.setLoadImageUrl(data.picturesList?.get(0), false)
} else {
holder.img.setLoadImageUrl(data.headImage, false)
//holder.img.setLoadImageUrl(data.headImage, false)
}
if(!TextUtils.isEmpty(data.voiceTime)){
if(data.voiceTime?.contains("s") == true){
if (!TextUtils.isEmpty(data.voiceTime)) {
if (data.voiceTime?.contains("s") == true) {
holder.id_tv_voicetime.text = data.voiceTime
}else{
holder.id_tv_voicetime.text = data.voiceTime+"s"
} else {
holder.id_tv_voicetime.text = data.voiceTime + "s"
}
}
......@@ -261,7 +278,7 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
inner class ViewHolder : RecyclerView.ViewHolder {
var img: RecycleImageView
var img: ImageView
var rl_item: RelativeLayout
var id_tv_satus: TextView
var id_tv_chakan_juli: TextView
......@@ -275,6 +292,11 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
var id_img_online: ImageView
var id_tv_chat_status: TextView
var id_tv_user_nick_name: TextView
var id_tv_age: TextView//年龄
var id_ll_sex_bg: LinearLayout
var id_img_guoqi: RecycleImageView
var id_tv_countryEn: TextView
var id_tv_chat_price: TextView
constructor(itemView: View) : super(itemView) {
img = itemView.findViewById(R.id.id_img_photo)
......@@ -291,7 +313,12 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
id_img_online = itemView.findViewById(R.id.id_img_online)
id_tv_chat_status = itemView.findViewById(R.id.id_tv_chat_status)
id_tv_user_nick_name = itemView.findViewById(R.id.id_tv_user_nick_name)
id_img_home_like.setOnClickListener(object :NoDoubleClickListener(){
id_tv_age = itemView.findViewById(R.id.id_tv_age)
id_ll_sex_bg = itemView.findViewById(R.id.id_ll_sex_bg)
id_img_guoqi = itemView.findViewById(R.id.id_img_guoqi)
id_tv_countryEn = itemView.findViewById(R.id.id_tv_countryEn)
id_tv_chat_price = itemView.findViewById(R.id.id_tv_chat_price)
id_img_home_like.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(v: View?) {
val pos = adapterPosition
if (pos >= 0 && pos < mList.size) {
......@@ -308,7 +335,7 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
id_tv_chat_status.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(v: View?) {
val pos = adapterPosition
Log.e("MXL","pos"+pos)
Log.e("MXL", "pos" + pos)
if (pos >= 0 && pos < mList.size) {
listener.onItemClick(v, pos, mList[pos])
}
......@@ -321,7 +348,7 @@ class UserAdapter : BaseRecyclerAdapter<HomeListEntity, RecyclerView.ViewHolder>
listener.onItemClick(it, pos, mList[pos])
}
}
id_tv_chakan_juli.setOnClickListener(object: NoDoubleClickListener(){
id_tv_chakan_juli.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(v: View?) {
val pos = adapterPosition
if (pos >= 0 && pos < mList.size) {
......
package com.zxhl.main.page.contract
import com.zxhl.cms.net.model.chat.FollowEntity
class BlockContract {
interface View {
fun setData(boolean: Boolean, reslut: List<FollowEntity>?)
fun setEmptyView()
fun blackSuc()
}
interface Presenter {
fun getBlackList(ifRefresh: Boolean)
fun blackUser(uid: String?)
}
}
\ No newline at end of file
......@@ -40,7 +40,13 @@ class EditUserInfoContract {
province: String,
weight: String,
)
fun upload(file: MultipartBody.Part?)
fun pictures(list:String?)
fun pictures(list: String?)
fun updateUserHeadImg(headImage: MultipartBody.Part?)
fun updateUserNickName(nickname: String)
fun updateUserSex(sex: String)
fun updateUserAge(age: String)
fun updateIntroduction(indroduction: String)
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ class HomeContract {
}
interface Presenter {
fun getHomeList(ifRefresh:Boolean,free:Int)
fun getHomeList(ifRefresh:Boolean,free:Int,category:String)
fun getNewUserReceive()
fun likeUser(uid: String?,free:String)
fun clearPage()
......
package com.zxhl.main.page.fragment
import android.util.Log
import android.view.FrameMetrics
import android.view.View
import androidx.fragment.app.Fragment
import com.flyco.tablayout.listener.CustomTabEntity
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.main.R
import com.zxhl.main.page.view.BaseViewPagerFragment
import com.zxhl.main.page.view.TabEntity
class HomeFragment: BaseViewPagerFragment() {
override val createTitles = ArrayList<CustomTabEntity>().apply {
add(TabEntity("Popular"))
add(TabEntity("Hot",R.drawable.icon_fire,R.drawable.icon_fire))
}
override val createFragments: Array<Fragment> = arrayOf(
PopularFragment.newInstance(),
HotFragment.newInstance()
)
override fun layoutID(): Int {
return R.layout.fragment_layout_home
}
override fun init(view: View?) {
viewPager?.currentItem = 0
}
override fun lazyLoad() {
super.lazyLoad()
if (isVisible && isInitial) {
createFragments[viewPager?.currentItem ?: 0].userVisibleHint = true
}
}
override fun onDestroy() {
super.onDestroy()
}
companion object {
fun newInstance() = HomeFragment()
}
}
\ No newline at end of file
......@@ -22,7 +22,6 @@ import com.zxhl.cms.widget.ChatDialogUtils
import com.zxhl.cms.widget.ChatDialogUtils.ChatDialogCallBack
import com.zxhl.cms.widget.ChatDialogUtils.ChatDialogCallBackParams
import com.zxhl.cms.widget.MemberDialogUtils
import com.zxhl.cms.widget.OnItemEnterOrExitVisibleHelper
import com.zxhl.cms.widget.RecyclerViewSpacesItemDecoration
import com.zxhl.main.R
import com.zxhl.main.page.adapter.UserAdapter
......@@ -31,7 +30,7 @@ import com.zxhl.main.page.presenter.HomePresenter
import com.zxhl.main.page.view.AccostDialog
import com.zxhl.main.page.view.DialogUtils
import com.zxhl.main.page.view.SignDialog
import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.fragment_popular.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
......@@ -48,7 +47,7 @@ class PopularFragment : BaseFragment(), HomeContract.View, OnRecycleItemClickLis
private var mMediaPlayer: MediaPlayer? = null
override fun layoutID(): Int {
return R.layout.fragment_home
return R.layout.fragment_popular
}
override fun lazyLoad() {
......@@ -150,7 +149,7 @@ class PopularFragment : BaseFragment(), HomeContract.View, OnRecycleItemClickLis
override fun onResult(result: ChatMessageChargeOrNotEntity?) {
if (result?.charge!! <= 0) {
free = 0
mPresenter?.getHomeList(refsh, free)
mPresenter?.getHomeList(refsh, free,"popular")
} else {
id_refresh_layout?.isRefreshing = false
free = 1
......@@ -616,16 +615,19 @@ class PopularFragment : BaseFragment(), HomeContract.View, OnRecycleItemClickLis
return
}
Log.e("MXL",""+user.newUser)
if (TextUtils.equals("${user.newUser}", "1")) {
DialogUtils.showFirstGuide(mActivity, View.OnClickListener {
mPresenter?.getNewUserReceive()
})
} else if (user.signInPopup == 1) {
requestSignReceive()
} else {
mPresenter?.getRecommend()
}
// if (TextUtils.equals("${user.newUser}", "1")) {
// DialogUtils.showFirstGuide(mActivity, View.OnClickListener {
// mPresenter?.getNewUserReceive()
// })
// } else if (user.signInPopup == 1) {
// requestSignReceive()
// } else {
// mPresenter?.getRecommend()
// }
}
companion object {
fun newInstance() = PopularFragment()
}
}
\ No newline at end of file
package com.zxhl.main.page.presenter
import android.util.Log
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.chat.FollowEntity
import com.zxhl.main.page.contract.BlockContract
class BlockPresenter :BlockContract.Presenter{
private val mView: BlockContract.View
constructor(mView: BlockContract.View) {
this.mView = mView
}
private var page = 1
private val size = 20
private var isMore = false
override fun getBlackList(ifRefresh: Boolean) {
if (ifRefresh) {
page = 1
isMore = false
} else if (isMore) {
return
}
isMore = true
ApiClient.homeApi.getBlackList(page, size)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<List<FollowEntity>>() {
override fun onSuccess(result: List<FollowEntity>?) {
if (result != null) {
if(!result.isNullOrEmpty()){
if (result.size <= size) {
page++
isMore = false
} else {
isMore = true
}
mView.setData(ifRefresh, result)
}else{
if(page==1){
mView.setEmptyView()
}
}
}else{
mView.setEmptyView()
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
}
})
}
override fun blackUser(uid: String?) {
ApiClient.homeApi.blackUser(uid).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
mView.blackSuc()
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("MXL", "ERROR" + code + errorMsg)
}
})
}
}
\ No newline at end of file
......@@ -133,5 +133,90 @@ class EditUserInfoPresenter : EditUserInfoContract.Presenter {
})
}
override fun updateUserHeadImg(headImage: MultipartBody.Part?) {
ApiClient.homeApi.updateUserHeadImg(
headImage
)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
mView.updateSuc()
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("MXL", "ERROR" + code + errorMsg)
mView.updateFail()
}
})
}
override fun updateUserNickName(nickname: String) {
ApiClient.homeApi.updateUserNickName(
nickname
)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
mView.updateSuc()
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("MXL", "ERROR" + code + errorMsg)
mView.updateFail()
}
})
}
override fun updateUserSex(sex: String) {
ApiClient.homeApi.updateUserGender(
sex
)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
mView.updateSuc()
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("MXL", "ERROR" + code + errorMsg)
mView.updateFail()
}
})
}
override fun updateUserAge(age: String) {
ApiClient.homeApi.updateUserAge(
age
)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
mView.updateSuc()
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("MXL", "ERROR" + code + errorMsg)
mView.updateFail()
}
})
}
override fun updateIntroduction(indroduction: String) {
ApiClient.homeApi.updateUserDescrption(
indroduction
)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
mView.updateSuc()
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("MXL", "ERROR" + code + errorMsg)
mView.updateFail()
}
})
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ class HomePresenter : HomeContract.Presenter {
private var page = 1
private val size = 20
private var isMore = false
override fun getHomeList(ifRefresh: Boolean, free: Int) {
override fun getHomeList(ifRefresh: Boolean, free: Int,category:String) {
// if (ifRefresh) {
// page = 1
// isMore = false
......@@ -31,7 +31,7 @@ class HomePresenter : HomeContract.Presenter {
if (ifRefresh) {
clearPage()
}
ApiClient.homeApi.getHomelist(page, size, free)
ApiClient.homeApi.getHomelist(page, size, free,category)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<List<HomeListEntity>>() {
override fun onSuccess(result: List<HomeListEntity>?) {
......
package com.zxhl.main.page.view
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.flyco.tablayout.CommonTabLayout
import com.flyco.tablayout.listener.CustomTabEntity
import com.flyco.tablayout.listener.OnTabSelectListener
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.main.R
abstract class BaseViewPagerFragment : BaseFragment() {
protected var viewPager: ViewPager2? = null
protected var pageChangeCallback: PageChangeCallback? = null
protected var tabLayout: CommonTabLayout? = null
protected val adapter: VpAdapter by lazy { VpAdapter(requireActivity()!!).apply { addFragments(createFragments) } }
protected var offscreenPageLimit =1
abstract val createTitles: ArrayList<CustomTabEntity>
abstract val createFragments: Array<Fragment>
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setupViews()
}
override fun onDestroy() {
super.onDestroy()
pageChangeCallback?.run { viewPager?.unregisterOnPageChangeCallback(this) }
pageChangeCallback = null
}
open fun setupViews() {
initViewPager()
}
protected fun initViewPager() {
viewPager = fragmentView?.findViewById(R.id.viewPager)
tabLayout = fragmentView?.findViewById(R.id.id_fragment_home_tab)
viewPager?.offscreenPageLimit = offscreenPageLimit
//val adapter = FragmentAdapter(childFragmentManager)
viewPager?.adapter = adapter
// for (i in createFragments.indices) {
// adapter?.addFrag(createFragments[i], createTitles[i].tabTitle)
// }
tabLayout?.setTabData(createTitles)
tabLayout?.setOnTabSelectListener(object : OnTabSelectListener {
override fun onTabSelect(position: Int) {
viewPager?.currentItem = position
}
override fun onTabReselect(position: Int) {
}
})
pageChangeCallback = PageChangeCallback()
viewPager?.registerOnPageChangeCallback(pageChangeCallback!!)
// adapter?.notifyDataSetChanged()
// tabLayout?.setOverScrollMode(View.OVER_SCROLL_NEVER)
}
inner class PageChangeCallback : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
tabLayout?.currentTab = position
}
}
inner class VpAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
private val fragments = mutableListOf<Fragment>()
fun addFragments(fragment: Array<Fragment>) {
fragments.addAll(fragment)
}
override fun getItemCount() = fragments.size
override fun createFragment(position: Int) = fragments[position]
}
}
\ No newline at end of file
package com.zxhl.main.page.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
public class RoundImageView extends androidx.appcompat.widget.AppCompatImageView {
//圆角大小,默认为10
private int mBorderRadius = 10;
private Paint mPaint;
// 3x3 矩阵,主要用于缩小放大
private Matrix mMatrix;
//渲染图像,使用图像为绘制图形着色
private BitmapShader mBitmapShader;
public RoundImageView(Context context) {
this(context, null);
}
public RoundImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mMatrix = new Matrix();
mPaint = new Paint();
mPaint.setAntiAlias(true);
}
@Override
protected void onDraw(Canvas canvas) {
if (getDrawable() == null){
return;
}
Bitmap bitmap = drawableToBitamp(getDrawable());
mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
float scale = 1.0f;
if (!(bitmap.getWidth() == getWidth() && bitmap.getHeight() == getHeight()))
{
// 如果图片的宽或者高与view的宽高不匹配,计算出需要缩放的比例;缩放后的图片的宽高,一定要大于我们view的宽高;所以我们这里取大值;
scale = Math.max(getWidth() * 1.0f / bitmap.getWidth(),
getHeight() * 1.0f / bitmap.getHeight());
}
// shader的变换矩阵,我们这里主要用于放大或者缩小
mMatrix.setScale(scale, scale);
// 设置变换矩阵
mBitmapShader.setLocalMatrix(mMatrix);
// 设置shader
mPaint.setShader(mBitmapShader);
canvas.drawRoundRect(new RectF(0,0,getWidth(),getHeight()), mBorderRadius, mBorderRadius,
mPaint);
}
private Bitmap drawableToBitamp(Drawable drawable)
{
if (drawable instanceof BitmapDrawable)
{
BitmapDrawable bd = (BitmapDrawable) drawable;
return bd.getBitmap();
}
// 当设置不为图片,为颜色时,获取的drawable宽高会有问题,所有当为颜色时候获取控件的宽高
int w = drawable.getIntrinsicWidth() <= 0 ? getWidth() : drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight() <= 0 ? getHeight() : drawable.getIntrinsicHeight();
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
drawable.draw(canvas);
return bitmap;
}
}
/*
* Copyright (c) 2020. vipyinzhiwei <vipyinzhiwei@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zxhl.main.page.view
import com.flyco.tablayout.listener.CustomTabEntity
/**
* 与CommonTabLayout搭配使用的实体类。
*
* @author vipyinzhiwei
* @since 2020/5/10
*/
class TabEntity(private var title: String, private var selectedIcon: Int = 0, private var unSelectedIcon: Int = 0) : CustomTabEntity {
override fun getTabTitle(): String {
return title
}
override fun getTabSelectedIcon(): Int {
return selectedIcon
}
override fun getTabUnselectedIcon(): Int {
return unSelectedIcon
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:startColor="#ff662cf5"
android:endColor="#ffbd8aff"
android:type="linear"
android:useLevel="true" />
<corners android:radius="27dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#00000000"
android:startColor="#7F000000"
android:type="linear"
android:useLevel="true" />
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/transparent" />
<solid android:color="@color/white" />
<stroke android:width="2dp" android:color="#f6f6f6"/>
<corners android:radius="5dp" />
<!-- <stroke android:width="2dp" android:color="#f6f6f6"/>-->
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F6F6F6"
android:orientation="vertical">
android:background="#F6F6F6">
<RelativeLayout
android:id="@+id/id_rl_title"
......@@ -32,12 +31,16 @@
</RelativeLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/id_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_below="@+id/id_rl_title">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/id_rl_black"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<include layout="@layout/layout_empty_view"/>
</RelativeLayout>
......@@ -31,6 +31,7 @@
android:textSize="18sp" />
<TextView
android:id="@+id/id_tv_save_introduction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
......@@ -53,10 +54,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:padding="10dp"
android:gravity="left"
android:maxLength="140"
android:textColor="@color/color_999999"
android:textColorHint="#CCCCCC"
android:cursorVisible="true"
android:textCursorDrawable="@color/color_824fff"
android:textSize="@dimen/sp_13" />
......
......@@ -31,6 +31,7 @@
android:textSize="18sp" />
<TextView
android:id="@+id/id_tv_sava_nick_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
......@@ -61,6 +62,7 @@
android:textSize="@dimen/sp_13" />
<ImageView
android:id="@+id/id_img_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
......
......@@ -352,7 +352,6 @@
android:layout_centerVertical="true"
android:drawableRight="@drawable/icon_edit_right"
android:drawablePadding="10dp"
android:visibility="invisible"
android:textColor="@color/color_999999"
android:textColorHint="#CCCCCC"
android:textSize="15sp" />
......
......@@ -5,6 +5,7 @@
android:background="@drawable/bj_xingzuo"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -16,17 +17,170 @@
android:textStyle="bold" />
<RelativeLayout
android:id="@+id/id_rl_xingzuo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/id_img_xingzuo"
android:layout_width="259dp"
android:layout_height="252dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:adjustViewBounds="true"
android:src="@drawable/icon_xingzuo" />
<ImageView
android:id="@+id/id_img_shuiping"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="106dp"
android:layout_marginTop="40dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_shuangyu"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="162dp"
android:layout_marginTop="12dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_mojie"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="64dp"
android:layout_marginTop="101dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_juxie"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="180dp"
android:layout_marginEnd="64dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_shuangzi"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="99dp"
android:layout_marginEnd="64dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_jinniu"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="38dp"
android:layout_marginEnd="101dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_shizi"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="239dp"
android:layout_marginEnd="101dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_chunv"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="266dp"
android:layout_marginEnd="157dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_tianping"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="157dp"
android:layout_marginTop="269dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_tianxie"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="98dp"
android:layout_marginTop="234dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_sheshou"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="63dp"
android:layout_marginTop="174dp"
android:src="@drawable/icon_photo" />
<ImageView
android:id="@+id/id_img_baiyang"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="12dp"
android:layout_marginEnd="158dp"
android:src="@drawable/icon_photo" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:text="0"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="girls are waiting to be matched"
android:textColor="@color/white"
android:textSize="18sp" />
<TextView
android:layout_width="280dp"
android:layout_height="45dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/shape_bd8aff_662cf5_r27"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="Start matching"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<?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:background="@color/white"
android:orientation="vertical">
<com.flyco.tablayout.CommonTabLayout
android:id="@+id/id_fragment_home_tab"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="24dp"
app:tl_iconVisible="true"
app:tl_iconGravity="RIGHT"
app:tl_iconMargin="5dp"
app:tl_indicator_bounce_enable="false"
app:tl_indicator_color="@color/transparent"
app:tl_indicator_width="10dp"
app:tl_tab_space_equal="true"
app:tl_textBold="BOTH"
app:tl_textSelectColor="@color/color_824fff"
app:tl_textUnselectColor="@color/color_666666"
app:tl_textsize="18sp" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
......@@ -9,7 +9,8 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:background="@color/white">
android:background="@color/white"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
......
......@@ -4,18 +4,18 @@
android:layout_width="@dimen/dp_168"
android:layout_height="@dimen/dp_223">
<com.zxhl.cms.widget.RecycleImageView
<com.zxhl.main.page.view.RoundImageView
android:id="@+id/id_img_photo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
android:scaleType="centerCrop"/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/user_photo_bg" />
android:background="@drawable/user_photo_bg"
android:visibility="gone"/>
<TextView
android:id="@+id/id_tv_satus"
......@@ -104,9 +104,10 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/shape_bg_000000_8000000"
android:orientation="vertical"
android:paddingBottom="11.5dp">
......@@ -133,6 +134,7 @@
android:textSize="13sp" />
<LinearLayout
android:id="@+id/id_ll_sex_bg"
android:layout_width="36dp"
android:layout_height="16dp"
android:layout_marginLeft="5dp"
......@@ -155,6 +157,40 @@
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.zxhl.cms.widget.RecycleImageView
android:id="@+id/id_img_guoqi"
android:layout_width="20dp"
android:layout_height="14dp" />
<TextView
android:id="@+id/id_tv_countryEn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="China"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="@+id/id_tv_chat_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:drawableLeft="@drawable/icon_xingbi_wode_2"
android:textColor="#FFCB3A"
android:textSize="11sp"
android:drawablePadding="5dp"/>
<RelativeLayout
android:id="@+id/id_rl_play_audio"
......@@ -212,8 +248,8 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:src="@drawable/icon_shipin" />
<LinearLayout
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="40dp"
android:background="@drawable/user_photo_bg"
>
</LinearLayout>
......@@ -2,37 +2,55 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
android:background="#F6F6F6"
android:orientation="vertical">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/item_head" />
<TextView
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:ellipsize="end"
android:lines="1"
android:text="Mike"
android:textColor="@color/color_333333"
android:textSize="15sp"
android:textStyle="bold" />
android:layout_margin="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_824fff_r16"
android:paddingLeft="10dp"
android:paddingTop="5dp"
android:paddingRight="10dp"
android:paddingBottom="5dp"
android:text="Remove Blacklist"
android:textColor="@color/white"
android:textSize="15sp" />
<ImageView
android:id="@+id/id_img_block_head"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/item_head" />
<TextView
android:id="@+id/id_tv_block_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:ellipsize="end"
android:lines="1"
android:text="Mike"
android:textColor="@color/color_333333"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/id_tv_remove_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_824fff_r16"
android:paddingLeft="10dp"
android:paddingTop="5dp"
android:paddingRight="10dp"
android:paddingBottom="5dp"
android:text="Remove Blacklist"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginLeft="70dp"
android:background="#EDEDED" />
</LinearLayout>
......@@ -3,6 +3,7 @@ package com.zxhl.uc.page.fragment
import android.view.View
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.utils.PhoneUtils
import com.zxhl.uc.R
import kotlinx.android.synthetic.main.activity_layout_about_us.*
......@@ -12,6 +13,7 @@ class AboutUsActivity:BaseActivity() {
id_img_back?.setOnClickListener {
finish()
}
id_tv_version?.text= "Verson ${PhoneUtils.getAppVersionName(context)}"
}
override fun before() {
super.before()
......
......@@ -141,7 +141,8 @@ class UserCenterFragment : BaseFragment(), AdCallback<String>,
JumpUtils.SettingJump()
}
id_rl_about_us?.setOnClickListener {
JumpUtils.webJump("About us", NetConfig.H5.WEB_URL_ABOUT_US)
JumpUtils.AbuoutUsJump()
//JumpUtils.webJump("About us", NetConfig.H5.WEB_URL_ABOUT_US)
}
......
......@@ -26,7 +26,7 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:includeFontPadding="false"
android:text="关于我们"
android:text="About Us"
android:textColor="@color/color_333333"
android:textSize="18sp" />
</RelativeLayout>
......@@ -59,7 +59,15 @@
android:gravity="center"
android:text="copyright@2022\n北京掌驰文化传媒有限公司\n联系邮箱zwak740167128@gmail.com"
android:textColor="@color/color_666666"
android:textSize="13sp" />
android:textSize="13sp"
android:visibility="gone" />
<TextView
android:id="@+id/id_tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/color_666666"/>
</LinearLayout>
</LinearLayout>
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