Kotlin高仿微信-项目实践58篇详细讲解了各个功能点,包括:注册、登录、主页、单聊(文本、表情、语音、图片、小视频、视频通话、语音通话、红包、转账)、群聊、个人信息、朋友圈、支付服务、扫一扫、搜索好友、添加好友、开通VIP等众多功能。
Kotlin高仿微信-项目实践58篇,点击查看详情
效果图:
实现代码:
private fun handlePermission(){ var permissions = arrayOf( Manifest.permission.CAMERA, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.READ_PHONE_STATE) var isGranted = true for (i in permissions.indices){ var permission = permissions[i] if(!checkPermission(permission)){ isGranted = false break } } if(!isGranted){ requestPermissions(permissions, 88) } } fun checkPermission(permission: String) :Boolean { return ContextCompat.checkSelfPermission(WcApp.getContext(), permission) == PackageManager.PERMISSION_GRANTED } override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) if(requestCode == 88 && grantResults != null && grantResults.size > 0){ (fragments.get(TAB_WECHAT) as WeChatFragment).refresh() (fragments.get(TAB_CONTACTS) as ContactsFragment).refresh() (fragments.get(TAB_ME) as MeFragment).refresh() processNotification() } } /** * 判断手机通知栏是否启用, 如果不启用,跳转到页面开启 */ private fun processNotification(){ var account = DataStoreUtils.getAccount() TagUtils.d("viewpager是否启用:${ChatNotificationUtils.isNotificationEnabled()}") if(!TextUtils.isEmpty(account) && !ChatNotificationUtils.isNotificationEnabled()){ NotificationSettingMsg().showNotificationSetting(requireActivity(), viewpager_container_root, false, object : BasePopupWindow.IOnDismissListener{ override fun onDismiss() { // } }) } }