Commit e1755026 authored by fengruiyu's avatar fengruiyu

3D 街景的项目 搭建已完成

parent a82f2c24
Pipeline #250 canceled with stages
GoodNews
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
<bytecodeTargetLevel target="11" />
</component>
</project>
\ No newline at end of file
......@@ -13,7 +13,6 @@
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/library_ad" />
<option value="$PROJECT_DIR$/library_base" />
<option value="$PROJECT_DIR$/mvvmhabit" />
</set>
......
......@@ -77,7 +77,6 @@ dependencies {
//util
implementation 'com.blankj:utilcodex:1.26.0'
api project(':library_base')
api project(':library_ad')
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mints.goodnews">
package="com.mints.street">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
......@@ -8,7 +8,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".AppApplication"
android:name="com.mints.street.AppApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
......@@ -17,14 +17,17 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
>
<activity android:name=".main.MainActivity">
<activity android:name="com.mints.street.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".login.LoginActivity">
<activity android:name="com.mints.street.login.LoginActivity">
</activity>
<activity android:name="com.mints.street.splash.SplashActivity">
</activity>
</application>
......
package com.mints.goodnews.main.take_photo
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentTakePhotoBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class TakePhotoFragment:BaseFragment<FragmentTakePhotoBinding,TakePhotoViewModel>() {
override fun initContentView(inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?)= R.layout.fragment_take_photo
override fun initVariableId() = BR.viewModel
}
\ No newline at end of file
package com.mints.goodnews.main.take_photo
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class TakePhotoViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.goodmoney.ui.adapter
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager.widget.PagerAdapter
class FriendsPagerAdapter(titltStr: List<String>, recyList: MutableList<RecyclerView>)
: PagerAdapter() {
private val mRecyList: MutableList<RecyclerView> = recyList
private val mTitleList: List<String> = titltStr
override fun getItemPosition(`object`: Any): Int {
// 处理notify方法失效
return POSITION_NONE
}
override fun getCount() = mTitleList.size
override fun isViewFromObject(view: View, `object`: Any): Boolean {
return view === `object`
}
override fun instantiateItem(container: ViewGroup, position: Int): Any {
val recyclerView = mRecyList[position]
container.addView(mRecyList[position])
return recyclerView
}
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
container.removeView(`object` as View?)
}
override fun getPageTitle(position: Int): CharSequence? {
return mTitleList[position]
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import com.mints.goodnews.R
import com.mints.goodnews.main.task.utils.GlideUtils
import com.mints.goodnews.main.task.bean.FriendHallMsgBean
class InvitedAdapter(context: Context, invitedData: MutableList<FriendHallMsgBean.ListBean>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
companion object {
const val HOLDER_TYPE_EMPTY = 0
const val HOLDER_TYPE_INVITED = 1
}
private var mContext: Context = context
private var invitedData: List<FriendHallMsgBean.ListBean> = invitedData
private var mOnItemClickListener: OnItemClickListener? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if (viewType == HOLDER_TYPE_EMPTY) {
val emptyView = LayoutInflater.from(parent.context).inflate(R.layout.item_empty, parent, false)
return EmptyHolder(emptyView)
}
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_recy_invited, parent, false)
return InvitedHolder(view)
}
override fun getItemCount(): Int {
return if (invitedData.isEmpty()) {
1
} else {
invitedData.size
}
}
override fun getItemViewType(position: Int): Int {
if (invitedData.isEmpty()) {
return HOLDER_TYPE_EMPTY
}
return HOLDER_TYPE_INVITED
}
override fun onBindViewHolder(viewHolder: RecyclerView.ViewHolder, position: Int) {
if (viewHolder is EmptyHolder) {
return
}
val holder = viewHolder as InvitedHolder
when (position) {
0 -> {
holder.tvNum.visibility = View.GONE
holder.ivRanking.visibility = View.VISIBLE
holder.ivRanking.setImageResource(R.mipmap.icon_ranking_first)
}
1 -> {
holder.tvNum.visibility = View.GONE
holder.ivRanking.visibility = View.VISIBLE
holder.ivRanking.setImageResource(R.mipmap.icon_ranking_second)
}
2 -> {
holder.tvNum.visibility = View.GONE
holder.ivRanking.visibility = View.VISIBLE
holder.ivRanking.setImageResource(R.mipmap.icon_ranking_third)
}
else -> {
holder.tvNum.visibility = View.VISIBLE
holder.ivRanking.visibility = View.GONE
holder.tvNum.text = "" + (position + 1)
}
}
val data = invitedData[position]
GlideUtils.loadCircleImageView(mContext, data.head, holder.ivAvatar, R.mipmap.ic_avatar_ph, R.mipmap.ic_avatar_ph)
holder.tvName.text = data.name
holder.tvCoin.text = "" + data.contribution
holder.tvStr.text = "" + data.unit
holder.itemView.setOnClickListener {
mOnItemClickListener?.onItemClick(holder.itemView, position)
}
}
inner class EmptyHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
inner class InvitedHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val tvNum: TextView = itemView.findViewById(R.id.item_invited_tv_num)
val ivAvatar: ImageView = itemView.findViewById(R.id.item_invited_iv_avatar)
val ivRanking: ImageView = itemView.findViewById(R.id.item_invite_iv_ranking)
val tvName: TextView = itemView.findViewById(R.id.item_invited_tv_name)
val tvCoin: TextView = itemView.findViewById(R.id.item_invited_tv_coin)
val tvStr: TextView = itemView.findViewById(R.id.item_invited_tv_str)
}
fun setOnItemClickListener(listener: OnItemClickListener) {
mOnItemClickListener = listener
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.adapter.listener
import android.view.View
//define interface
interface OnItemClickListener {
fun onItemClick(view: View?, position: Int)
}
\ No newline at end of file
package com.mints.goodnews.main.task.bean;
import java.io.Serializable;
import java.util.List;
public class FriendHallMsgBean implements Serializable {
/**
* titleMsg : 6元
* button :
* rate : 1:?
* contribution_yesterday : 0.18
* periods : 第20201113期
* cashMsg : 未达目标,今日加油
* list : [{"id":6,"sid":2031418094401000000,"date":"2020-11-14","level":2,"contribution":0.2,"status":0,"name":"186****1558","head":null}]
* contribution_today : 0.2
* cash : 0
* status : 1
*/
private String titleMsg;
private String button;
private String rate;
private double contribution_yesterday;
private String periods;
private String cashMsg;
private double contribution_today;
private double cash;
private int status;
private int friendCount;
private int directFriendsCount;
private int indirectFriendsCount;
private String rules;
private String remark;
public String getRules() {
return rules;
}
public void setRules(String rules) {
this.rules = rules;
}
public int getDirectFriendsCount() {
return directFriendsCount;
}
public void setDirectFriendsCount(int directFriendsCount) {
this.directFriendsCount = directFriendsCount;
}
public int getIndirectFriendsCount() {
return indirectFriendsCount;
}
public void setIndirectFriendsCount(int indirectFriendsCount) {
this.indirectFriendsCount = indirectFriendsCount;
}
public int getFriendCount() {
return friendCount;
}
public void setFriendCount(int friendCount) {
this.friendCount = friendCount;
}
private List<ListBean> list;
public String getTitleMsg() {
return titleMsg;
}
public void setTitleMsg(String titleMsg) {
this.titleMsg = titleMsg;
}
public String getButton() {
return button;
}
public void setButton(String button) {
this.button = button;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public double getContribution_yesterday() {
return contribution_yesterday;
}
public void setContribution_yesterday(double contribution_yesterday) {
this.contribution_yesterday = contribution_yesterday;
}
public String getPeriods() {
return periods;
}
public void setPeriods(String periods) {
this.periods = periods;
}
public String getCashMsg() {
return cashMsg;
}
public void setCashMsg(String cashMsg) {
this.cashMsg = cashMsg;
}
public double getContribution_today() {
return contribution_today;
}
public void setContribution_today(double contribution_today) {
this.contribution_today = contribution_today;
}
public double getCash() {
return cash;
}
public void setCash(double cash) {
this.cash = cash;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public List<ListBean> getList() {
return list;
}
public void setList(List<ListBean> list) {
this.list = list;
}
public class ListBean implements Serializable {
/**
* id : 6
* sid : 2031418094401000000
* date : 2020-11-14
* level : 2
* contribution : 0.2
* status : 0
* name : 186****1558
* head : null
*/
private int id;
private long sid;
private String date;
private int level;
private double contribution;
private int status;
private String name;
private String createTime;
private String head = null;
private String unit;
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getSid() {
return sid;
}
public void setSid(long sid) {
this.sid = sid;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public double getContribution() {
return contribution;
}
public void setContribution(double contribution) {
this.contribution = contribution;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getHead() {
return head;
}
public void setHead(String head) {
this.head = head;
}
}
}
package com.mints.goodnews.main.task.bean
import java.io.Serializable
/**
* 描述:用户信息
* 作者:孟崔广
* 时间:2019/10/29 18:42
* 邮箱:mengcga@163.com
*/
class UserBean : Serializable {
val token: String? = null
val toKeepAnAccount: String? = null
val consumer: ConsumerBean? = null
inner class ConsumerBean : Serializable {
val head: String? = null
val openid: String? = null
val nickname: String? = null
val mobile: String? = null
val real_name: String? = null
val alipay_account: String? = null
val idcode: String? = null
val gameInfo: String? = null
var sumCoin: String? = null
val surplus //余额
= 0.0
val coin // 积分
= 0
val pk_id // 用户id
: Long = 0
val isFirstSignInApp // 首次登录app true:首次
= false
}
}
package com.mints.goodnews.main.task.manager
import android.text.TextUtils
import com.mints.goodnews.main.task.bean.UserBean
import com.tencent.mmkv.MMKV
/**
* 描述:管理用户信息
* 作者:孟崔广
* 时间:2019/10/28 13:54
*/
class UserManager {
companion object {
/**
* 游客 or 登录用户
*/
private const val IS_TEMP_USER = "is_temp_user"
/**
* 用户ID
*/
private const val USER_ID = "userId"
/**
* 用户CODE_ID
*/
private const val CODE_ID = "codeId"
/**
* 登陆状态ID
*/
private const val TOKEN_ID = "tokenId"
/**
* 手机号
*/
private const val MOBILE = "mobile"
/**
* 姓名
*/
private const val REAL_NAME = "realName"
/**
* 支付宝
*/
private const val ALIPAY_ACCOUNT = "alipay_account"
/**
* 用户金币
*/
private const val USER_GOLD = "user_gold"
/**
* 用户总金币
*/
private const val USER_SUM_GOLD = "user_sum_gold"
/**
* 用户零钱
*/
private const val USER_CASH = "user_cash"
/**
* 是否老用户 true-老用户
*/
private const val USER_OLD = "user_old"
/**
* 猎豹游戏info
*/
private const val GAME_INFO = "game_info"
/**
* 广告隐藏标识
*/
private const val AD_SHOW_FLAG = "ad_show_flag"
/**
* 微信名称
*/
private const val WX_NAME = "wx_name"
/**
* 微信头像
*/
private const val WX_HEADER = "wx_header"
/**
* 微信id
*/
private const val WX_OPENID = "wx_openid"
val INSTANCE: UserManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
UserManager()
}
}
init {
// TODO 初始化穿山甲
}
/**
* 保存用户信息
*
* @param userInfo
*/
fun saveUserInfo(userInfo: UserBean) {
val user = userInfo.consumer
val token = userInfo.token
if (token != null) {
MMKV.mmkvWithID(TOKEN_ID).encode(TOKEN_ID, token)
}
if (user != null) {
val mobile: String? = user.mobile
val openid: String? = user.openid
if (mobile == null && openid == null) {
MMKV.mmkvWithID(IS_TEMP_USER).remove(IS_TEMP_USER)
} else {
MMKV.mmkvWithID(IS_TEMP_USER).encode(IS_TEMP_USER, mobile + openid)
}
MMKV.mmkvWithID(USER_ID).encode(USER_ID, user.pk_id.toString())
MMKV.mmkvWithID(CODE_ID).encode(CODE_ID, user.idcode.toString())
MMKV.mmkvWithID(MOBILE).encode(MOBILE, mobile)
MMKV.mmkvWithID(ALIPAY_ACCOUNT)
.encode(ALIPAY_ACCOUNT, user.alipay_account.toString())
MMKV.mmkvWithID(USER_GOLD).encode(USER_GOLD, user.coin.toString())
MMKV.mmkvWithID(USER_CASH)
.encode(USER_CASH, String.format("%.2f", user.surplus))
MMKV.mmkvWithID(USER_SUM_GOLD).encode(USER_SUM_GOLD, user.sumCoin.toString())
MMKV.mmkvWithID(USER_OLD).encode(USER_OLD, !user.isFirstSignInApp)
MMKV.mmkvWithID(WX_NAME).encode(WX_NAME, user.nickname.toString())
MMKV.mmkvWithID(WX_HEADER).encode(WX_HEADER, user.head)
MMKV.mmkvWithID(WX_OPENID).encode(WX_OPENID, openid)
MMKV.mmkvWithID(GAME_INFO).encode(GAME_INFO, user.gameInfo)
MMKV.mmkvWithID(REAL_NAME).encode(REAL_NAME, user.real_name)
}
}
/**
* 单独获取用户id
*/
fun getMobile(): String {
val kv = MMKV.mmkvWithID(MOBILE)
return kv.decodeString(MOBILE, "")
}
/**
* 判断用户是否已登录
*
* @return true为已登录 false 为未登录
*/
fun userIsLogin(): Boolean {
val kv = MMKV.mmkvWithID(IS_TEMP_USER).decodeString(IS_TEMP_USER, "")
return !TextUtils.isEmpty(kv)
}
/**
* 单独获取用户id
*/
fun getUserID(): String {
val kv = MMKV.mmkvWithID(USER_ID)
return kv.decodeString(USER_ID, "")
}
/**
* 获取用户登陆状态
*/
fun getTokenID(): String {
val kv = MMKV.mmkvWithID(TOKEN_ID)
return kv.decodeString(TOKEN_ID, "")
}
/**
* 获取用户邀请码
*/
fun getCodeID(): String {
val kv = MMKV.mmkvWithID(CODE_ID)
return kv.decodeString(CODE_ID, "")
}
/**
* 获取真实姓名
*/
fun getRealName(): String {
val kv = MMKV.mmkvWithID(REAL_NAME)
return kv.decodeString(REAL_NAME, "")
}
/**
* 设置真实姓名
*
* @param name
*/
fun setRealName(name: String?) {
val kv = MMKV.mmkvWithID(REAL_NAME)
kv.encode(REAL_NAME, name)
}
/**
* 是否老用户 true-老用户
*/
fun getUserOld(): Boolean {
val kv = MMKV.mmkvWithID(USER_OLD)
return kv.decodeBool(USER_OLD, false)
}
fun getAdShowFlag(): Boolean {
val kv = MMKV.mmkvWithID(AD_SHOW_FLAG)
return kv.decodeBool(AD_SHOW_FLAG, false)
}
/**
* 设置真实姓名
*
* @param userOld
*/
fun setUserOld(userOld: Boolean) {
val kv = MMKV.mmkvWithID(USER_OLD)
kv.encode(USER_OLD, userOld)
}
/**
* 获取支付宝账户
*/
fun getAlipayAccount(): String {
val kv = MMKV.mmkvWithID(ALIPAY_ACCOUNT)
return kv.decodeString(ALIPAY_ACCOUNT, "")
}
/**
* 设置支付宝账户
*
* @param alipay
*/
fun setAlipayAccount(alipay: String?) {
val kv = MMKV.mmkvWithID(ALIPAY_ACCOUNT)
kv.encode(ALIPAY_ACCOUNT, alipay)
}
fun getUserSumGold(): String {
val kv = MMKV.mmkvWithID(USER_SUM_GOLD)
return kv.decodeString(USER_SUM_GOLD, "")
}
/**
* 获取用户金币/积分
*/
fun getUserGold(): String {
val kv = MMKV.mmkvWithID(USER_GOLD)
return kv.decodeString(USER_GOLD, "")
}
/**
* 设置用户金币/积分
*
* @param gold
*/
fun setUserGold(gold: String?) {
val kv = MMKV.mmkvWithID(USER_GOLD)
kv.encode(USER_GOLD, gold)
}
/**
* 获取用户零钱
*/
fun getUserCash(): String {
val kv = MMKV.mmkvWithID(USER_CASH)
return kv.decodeString(USER_CASH, "")
}
fun getGameInfo(): String {
val kv = MMKV.mmkvWithID(GAME_INFO)
return kv.decodeString(GAME_INFO, "")
}
fun getWxName(): String {
val kv = MMKV.mmkvWithID(WX_NAME)
return kv.decodeString(WX_NAME, "")
}
fun getWxHeader(): String {
val kv = MMKV.mmkvWithID(WX_HEADER)
return kv.decodeString(WX_HEADER, "")
}
fun getWxOpenid(): String {
val kv = MMKV.mmkvWithID(WX_OPENID)
return kv.decodeString(WX_OPENID, "")
}
/**
* 设置用户零钱
*
* @param cash
*/
fun setUserCash(cash: String?) {
val kv = MMKV.mmkvWithID(USER_CASH)
kv.encode(WX_OPENID, cash)
}
fun setGameInfo(gameInfo: String?) {
val kv = MMKV.mmkvWithID(GAME_INFO)
kv.encode(GAME_INFO, gameInfo)
}
fun setWxName(wxName: String?) {
val kv = MMKV.mmkvWithID(WX_NAME)
kv.encode(WX_NAME, wxName)
}
fun setWxHeader(wxHeader: String?) {
val kv = MMKV.mmkvWithID(WX_HEADER)
kv.encode(WX_HEADER, wxHeader)
}
/**
* mobile
*
* @param mobile
*/
fun setMobile(mobile: String?) {
val kv = MMKV.mmkvWithID(MOBILE)
kv.encode(MOBILE, mobile)
}
fun setAdShowFlag(adShowFlag: Boolean) {
val kv = MMKV.mmkvWithID(AD_SHOW_FLAG)
kv.encode(AD_SHOW_FLAG, adShowFlag)
}
fun userLogout() {
MMKV.mmkvWithID(USER_ID).remove(USER_ID)
MMKV.mmkvWithID(CODE_ID).remove(CODE_ID)
MMKV.mmkvWithID(TOKEN_ID).remove(TOKEN_ID)
MMKV.mmkvWithID(REAL_NAME).remove(REAL_NAME)
MMKV.mmkvWithID(IS_TEMP_USER).remove(IS_TEMP_USER)
MMKV.mmkvWithID(ALIPAY_ACCOUNT).remove(ALIPAY_ACCOUNT)
MMKV.mmkvWithID(USER_GOLD).remove(USER_GOLD)
MMKV.mmkvWithID(USER_CASH).remove(USER_CASH)
MMKV.mmkvWithID(USER_OLD).remove(USER_OLD)
MMKV.mmkvWithID(WX_OPENID).remove(WX_OPENID)
MMKV.mmkvWithID(WX_NAME).remove(WX_NAME)
MMKV.mmkvWithID(WX_HEADER).remove(WX_HEADER)
// MMKV.mmkvWithID(GAME_INFO).remove(GAME_INFO)
}
}
\ No newline at end of file
package com.mints.goodnews.main.task.utils;
import android.content.Context;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey;
/**
* 描述:GlideUtils
* 作者:孟崔广
* 时间:2018/1/10 17:51
* 邮箱:mengcga@163.com
*/
public class GlideUtils {
/**
* Glide特点
* 使用简单
* 可配置度高,自适应程度高
* 支持常见图片格式 Jpg png gif webp
* 支持多种数据源 网络、本地、资源、Assets 等
* 高效缓存策略 支持Memory和Disk图片缓存 默认Bitmap格式采用RGB_565内存使用至少减少一半
* 生命周期集成 根据Activity/Fragment生命周期自动管理请求
* 高效处理Bitmap 使用Bitmap Pool使Bitmap复用,主动调用recycle回收需要回收的Bitmap,减小系统回收压力
* 这里默认支持Context,Glide支持Context,Activity,Fragment,FragmentActivity
*/
//默认加载
public static void loadImageView(Context mContext, String path, ImageView mImageView) {
Glide.with(mContext).load(path).into(mImageView);
}
//默认加载
public static void loadImageViewNoAnim(Context mContext, String path, ImageView mImageView) {
Glide.with(mContext).load(path).dontAnimate().into(mImageView);
}
//设置加载中图片
public static void loadImageViewLoding(Context mContext, String path, ImageView mImageView, int lodingImage) {
RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(lodingImage);
Glide.with(mContext).load(path).apply(requestOptions).into(mImageView);
}
//设置加载中以及加载失败图片
public static void loadImageViewLoding(Context mContext, String path, ImageView mImageView, int lodingImage, int errorImageView) {
RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(lodingImage);
requestOptions.error(errorImageView);
Glide.with(mContext).load(path).apply(requestOptions).into(mImageView);
}
//设置加载中以及加载失败圆形图片
public static void loadCircleImageView(Context mContext, String path, ImageView mImageView, int lodingImage, int errorImageView) {
RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(lodingImage);
requestOptions.error(errorImageView);
requestOptions.circleCrop();
Glide.with(mContext).load(path).apply(requestOptions).into(mImageView);
}
//加载Gif
public static void loadImageViewGif(Context mContext, int drawable, ImageView imageView) {
Glide.with(mContext).load(drawable).into(imageView);
}
//加载Gif
public static void loadImageViewGifUrl(Context mContext, ImageView view, String url) {
RequestOptions options = (new RequestOptions())
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.timeout(60000)
.signature(new ObjectKey(System.currentTimeMillis()))
.priority(Priority.HIGH);
Glide.with(mContext).load(url).apply(options).into(view);
}
}
package com.mints.goodnews
package com.mints.street
import android.os.StrictMode
import android.os.StrictMode.VmPolicy
......
package com.mints.goodnews.api
package com.mints.street.api
import com.fry.base.netwrok.HttpManager
import com.mints.goodnews.bean.AwardBean
import com.mints.goodnews.bean.UserBean
import com.mints.street.bean.AwardBean
import com.mints.street.bean.UserBean
import io.reactivex.Observable
import me.goldze.mvvmhabit.http.BaseResponse
import retrofit2.Response
......
package com.mints.goodnews.bean
package com.mints.street.bean
import android.annotation.SuppressLint
import android.os.Parcelable
......
package com.mints.goodnews.bean
package com.mints.street.bean
import java.io.Serializable
......
package com.mints.goodnews.login
package com.mints.street.login
import android.os.Bundle
import com.fry.base.base.BaseActivity
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.ActivityLoginBinding
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivityLoginBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
......
package com.mints.goodnews.login
package com.mints.street.login
import android.app.Application
import com.fry.base.basenetwork.HttpSubscribeImpl
import com.mints.goodnews.bean.AwardBean
import com.mints.goodnews.bean.UserBean
import com.mints.goodnews.model.ApiModel
import com.mints.street.bean.AwardBean
import com.mints.street.model.ApiModel
import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.http.BaseResponse
import me.goldze.mvvmhabit.utils.KLog
import retrofit2.Response
/**
* Created by 冯瑞雨 on 2021/7/2.
......
package com.mints.goodnews.main
package com.mints.street.main
import android.app.Activity
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
......@@ -8,20 +7,16 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.bumptech.glide.Glide
import com.fry.base.base.BaseActivity
import com.fry.base.utils.ImageLoader
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.ActivityMainBinding
import com.mints.goodnews.main.home.HomeFragment
import com.mints.goodnews.main.my.MyFragment
import com.mints.goodnews.main.square.SquareFragment
import com.mints.goodnews.main.take_photo.TakePhotoFragment
import com.mints.goodnews.main.task.TakeFragment
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivityMainBinding
import com.mints.street.main.vr.VRFragment
import com.mints.street.main.my.MyFragment
import com.mints.street.main.home.HomeFragment
class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
......@@ -39,10 +34,8 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
when (it) {
R.id.menu_home -> binding.mainViewpager.setCurrentItem(0, false)
R.id.menu_square -> binding.mainViewpager.setCurrentItem(1, false)
R.id.menu_empty -> binding.mainViewpager.setCurrentItem(2, false)
R.id.menu_task -> binding.mainViewpager.setCurrentItem(3, false)
R.id.menu_my -> {
binding.mainViewpager.setCurrentItem(4, false)
binding.mainViewpager.setCurrentItem(2, false)
// stopAnim()
}
}
......@@ -55,8 +48,6 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
binding.mainBottom.interceptLongClick(
R.id.menu_home,
R.id.menu_square,
R.id.menu_empty,
R.id.menu_task,
R.id.menu_my
)
......@@ -94,24 +85,15 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 {
}
1 -> {
//广场
SquareFragment()
VRFragment()
}
2 -> {
//拍照
TakePhotoFragment()
}
3 -> {
//任务中心
TakeFragment()
}
4 -> {
//个人中心
MyFragment()
}
else -> {
//首页
HomeFragment()
VRFragment()
}
}
......
package com.mints.goodnews.main
package com.mints.street.main
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
......
package com.mints.goodnews.main.square
package com.mints.street.main.home
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentSquareBinding
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.FragmentHomeBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 广场页面
* 首页页面
*/
class SquareFragment:BaseFragment<FragmentSquareBinding,SquareViewModel>() {
class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>() {
override fun initContentView(inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?)= R.layout.fragment_square
savedInstanceState: Bundle?)= R.layout.fragment_home
override fun initVariableId()=BR.viewModel
}
\ No newline at end of file
package com.mints.goodnews.main.home
package com.mints.street.main.home
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
......
package com.mints.goodnews.main.my
package com.mints.street.main.my
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.fry.base.base.BaseFragment
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentMyBinding
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.FragmentMyBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
......
package com.mints.goodnews.main.my
package com.mints.street.main.my
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
......
package com.mints.goodnews.main.home
package com.mints.street.main.vr
import android.content.Context
import android.graphics.Color
......@@ -14,10 +14,10 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.fry.base.base.BaseFragment
import com.fry.base.widget.ScaleTransitionPagerTitleView
import com.mints.goodnews.BR
import com.mints.goodnews.R
import com.mints.goodnews.databinding.FragmentHomeBinding
import com.mints.goodnews.main.my.MyFragment
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.FragmentVrBinding
import com.mints.street.main.my.MyFragment
import me.goldze.mvvmhabit.utils.Utils
import net.lucode.hackware.magicindicator.MagicIndicator
import net.lucode.hackware.magicindicator.buildins.UIUtil
......@@ -29,13 +29,13 @@ import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.Li
/**
* Created by 冯瑞雨 on 2021/7/2.
* 首页页面
* VR页面
*/
class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>() {
class VRFragment : BaseFragment<FragmentVrBinding, VRViewModel>() {
override fun initContentView(
inflater: LayoutInflater?, container: ViewGroup?,
savedInstanceState: Bundle?) =
R.layout.fragment_home
R.layout.fragment_vr
override fun initVariableId() = BR.viewModel
......@@ -48,16 +48,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>() {
val tabNames = mutableListOf<String>()
tabNames.add("热门")
tabNames.add("变老特效")
tabNames.add("变年轻特效")
tabNames.add("老照片修复")
tabNames.add("黑白照片上色")
val fragments = mutableListOf<Fragment>()
fragments.add(MyFragment())
fragments.add(MyFragment())
fragments.add(MyFragment())
fragments.add(MyFragment())
fragments.add(MyFragment())
//初始化viewpager2
......
package com.mints.goodnews.main.task
package com.mints.street.main.vr
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
......@@ -6,5 +6,5 @@ import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class TakeViewModel(application:Application):BaseViewModel(application) {
class VRViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.street.manager
import com.mints.street.bean.UserBean
import me.goldze.mvvmhabit.utils.SPUtils
/**
* Created by 冯瑞雨 on 2021/7/6.
*/
object UserManager {
private val spUtils = SPUtils.getInstance("user")
private const val USER_INFO = "user_info"
private var user :UserBean?=null
}
\ No newline at end of file
package com.mints.goodnews.model
package com.mints.street.model
import com.fry.base.netwrok.HttpManager
import com.mints.goodnews.api.MainApi
import com.mints.goodnews.bean.AwardBean
import com.mints.goodnews.bean.UserBean
import com.mints.street.api.MainApi
import com.mints.street.bean.AwardBean
import com.mints.street.bean.UserBean
import com.trello.rxlifecycle2.LifecycleProvider
import io.reactivex.Observable
import me.goldze.mvvmhabit.http.BaseResponse
......
package com.mints.street.splash
import android.os.Bundle
import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivitySplashBinding
/**
* Created by 冯瑞雨 on 2021/7/5.
* 优量汇开屏页
*/
class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_splash
override fun initVariableId() = BR.viewModel
override fun initData() {
super.initData()
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
// 但是把打完包的apk(Release)安装在其他手机上时,回到桌面后点击图标会重新打开启动页
if (!isTaskRoot) {
finish()
return
}
checkAppSign()
}
/**
* 校验App签名
*/
private fun checkAppSign() {
}
}
\ No newline at end of file
package com.mints.goodnews.main.square
package com.mints.street.splash
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
* Created by 冯瑞雨 on 2021/7/5.
*/
class SquareViewModel(application: Application):BaseViewModel(application) {
class SplashViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.goodnews.widget;
package com.mints.street.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
......@@ -12,7 +12,7 @@ import android.view.animation.Animation;
import android.view.animation.CycleInterpolator;
import android.view.animation.TranslateAnimation;
import com.mints.goodnews.R;
import com.mints.street.R;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.core.content.ContextCompat;
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#80000000"/>
<padding
android:bottom="3dp"
android:left="8dp"
android:right="8dp"
android:top="3dp"/>
<corners
android:bottomLeftRadius="45dp"
android:bottomRightRadius="45dp"
android:topLeftRadius="45dp"
android:topRightRadius="45dp"/>
</shape>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.login.LoginViewModel" />
type="com.mints.street.login.LoginViewModel" />
</data>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
......@@ -25,7 +25,7 @@
android:layout_height="wrap_content"
android:text="@string/str_phone_num_1" />
<com.mints.goodnews.widget.ClearEditText
<com.mints.street.widget.ClearEditText
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="50dp"
......@@ -64,7 +64,7 @@
android:layout_height="50dp"
android:layout_marginStart="20dp">
<com.mints.goodnews.widget.ClearEditText
<com.mints.street.widget.ClearEditText
android:id="@+id/et_sms"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -3,7 +3,7 @@
<data>
<variable
name="viewModel"
type="com.mints.goodnews.main.MainViewModel" />
type="com.mints.street.main.MainViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
......@@ -53,41 +53,7 @@
android:scaleType="fitXY" />
</FrameLayout>
<TextView
android:id="@+id/tv_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:background="@mipmap/ic_hint"
android:gravity="center"
android:paddingStart="18dp"
android:paddingTop="2dp"
android:paddingEnd="10dp"
android:paddingBottom="10dp"
android:text="30次"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintCircle="@+id/flTakephoto"
app:layout_constraintCircleAngle="65"
app:layout_constraintCircleRadius="60dp"
tools:ignore="MissingConstraints" />
<TextView
android:id="@+id/tv_just"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:background="@mipmap/ic_hint"
android:gravity="center"
android:paddingStart="12dp"
android:paddingTop="2dp"
android:paddingEnd="6dp"
android:paddingBottom="6dp"
android:text="领金币"
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@id/flMainBootom"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:id="@+id/fl_splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<!--这里模拟一张oneshot单的焦点图展示-->
<ImageView
android:id="@+id/oneshot_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="400px" />
<RelativeLayout
android:id="@+id/splash_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<!-- 广点通开屏广告支持“半屏/全屏”展示,开发者可以把Logo区域放在屏幕底部,然后在Logo上方提供一个容器来放置半开屏广告,请注意此容器高度不得小于400dp -->
<!-- 1.Logo区域:展示半开屏广告时使用,如果想展示全开屏广告,可以不需要这个Logo区域 -->
<!-- 注意:如需要这个Logo区域,建议开发者使用自己的Logo资源,而不是联盟的Logo资源@drawable/gdt_splash_logo,资源规格可参照@drawable/gdt_splash_logo -->
<FrameLayout
android:id="@+id/splash_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo" />
<!-- 2.预设开屏图片区域: -->
<!-- 开发者可以把自家App设计开屏图片摆放在这里,本示例中放置了一张静态图片。!-->
<!-- 注意1:直接将此图放在广告容器的下面即可,始终不要将广告容器splash_container的设为invisible,否则将不会展示广告无法计费,返回错误码600。-->
<!-- 注意2:建议开发者使用自己的开屏图片资源,而不是联盟的@drawable/splash_holder,资源规格可参照@drawable/splash_holder -->
<ImageView
android:id="@+id/splash_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo"
android:scaleType="fitXY" />
<!-- 3.开屏广告容器区域:-->
<!-- 注意:该区域高度不得小于400dp。在本示例中没有写死splash_container的高度值,是因为第1部分的app_logo区域是一个高度很小的图片。 -->
<ImageView
android:id="@+id/app_logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
/>
<!-- 4.自定义跳过按钮区域:开发者可以根据需要自己实现不同样式的跳过按钮 -->
<!-- 注意1:根据广告法规定,跳过按钮必须在屏幕当中出现。因此广告展示的时候,必须让将SkipView显示出来,即visible,否则将SDK将不展示广告,返回错误码608。。 -->
<!-- 注意2:SDK除了会检查跳过按钮的可见性,还将检测它的尺寸,其尺寸不得小于3dp*3dp,否则将SDK将不展示广告,返回错误码608。 -->
<TextView
android:id="@+id/skip_view"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_bg_circle"
android:gravity="center"
android:text="点击跳过"
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
<!-- 本示例省略了自定义的倒计时,和跳过按钮放在一起实现了。开发者也可以实现自己的倒计时View,方法是在onADTick回调中获得广告剩余的展示时间,并自由决定倒计时View的样式,SDK对倒计时的View没有要求。 -->
<!-- 自定义wifi预加载按钮,需设置状态为不显示,当素材为视频且视频开始播放时,SDK内部会处理为显示状态-->
<TextView
android:id="@+id/preload_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
android:background="@drawable/shape_bg_circle"
android:gravity="center"
android:text="已Wi-Fi预加载"
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>
<data>
<variable
name="viewModel"
type="com.mints.street.splash.SplashViewModel" />
</data>
</layout>
\ No newline at end of file
......@@ -3,23 +3,20 @@
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.home.HomeViewModel" />
type="com.mints.street.main.home.HomeViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/magic_indicator"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="46dp"
android:layout_gravity="center" />
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="广场"
android:textColor="@color/black"
android:textSize="39dp"
/>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.my.MyViewModel" />
type="com.mints.street.main.my.MyViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.square.SquareViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="广场"
android:textColor="@color/black"
android:textSize="39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.goodnews.main.take_photo.TakePhotoViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="拍照"
android:textColor="@color/black"
android:textSize="39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="ViewModel"
type="com.mints.street.main.vr.VRViewModel" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/magic_indicator"
android:layout_width="wrap_content"
android:layout_height="46dp"
android:layout_gravity="center" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</layout>
\ No newline at end of file
<resources>
<string name="app_name">GoodNews</string>
<string name="app_name">3D高清街景</string>
</resources>
\ No newline at end of file
......@@ -9,7 +9,7 @@ ext {
android = [
compileSdkVersion: 30,
buildToolsVersion: "30.0.2",
applicationId : "com.mints.goodnews",
applicationId : "com.mints.street",
minSdkVersion : 21,
targetSdkVersion : 30,
versionCode : 1,
......
plugins {
id 'com.android.library'
id 'kotlin-android'
}
apply from: "../library.build.gradle"
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
// 快手
// api(name: 'kssdk-ad-3.3.9', ext: 'aar')
// // 穿山甲 GroMore
// // mediation_ad_sdk
// api(name: 'mediation_ad_sdk_2.8.0.2', ext: 'aar')
// api(name: 'gdt_adapter_4.351.1221.3', ext: 'aar')
// api(name: 'ks_adapter_3.3.9.2', ext: 'aar')
// // 穿山甲广告 版本3.6.1.3
// api(name: 'open_ad_sdk_3.6.1.3', ext: 'aar')
// // 广点通广告 腾讯
// api(name: 'GDTSDK.unionNormal.4.351.1221', ext: 'aar')
// // OneWay
// api(name: 'oneway-common-core-1.0.10', ext: 'aar')
// // 闪电盒子
// api(name: 'wannuosili_ad_2.2.0', ext: 'aar')
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.mints.library_ad
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mints.library_ad.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mints.library_ad">
</manifest>
\ No newline at end of file
package com.mints.library_ad
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
......@@ -4,11 +4,8 @@ import android.app.Application;
import android.view.Gravity;
import com.alibaba.android.arouter.launcher.ARouter;
import com.fry.base.global.Constants;
import com.tencent.bugly.crashreport.CrashReport;
import me.goldze.mvvmhabit.utils.KLog;
import me.goldze.mvvmhabit.utils.SPUtils2;
import me.goldze.mvvmhabit.utils.ToastUtils;
import com.fry.base.BuildConfig;
......
package com.fry.base.utils;
import android.app.Activity;
import com.fry.base.R;
/**
* 2019-12-15 created
* activity 进场和退出的动画效果
*
* @author KOM
*/
public class ActivityAnimUtil {
public static void zoomAnim(Activity activity, boolean isIn) {
if (isIn) {
activity.overridePendingTransition(R.anim.zoom_enter, R.anim.hold_anim);
} else {
activity.overridePendingTransition(R.anim.hold_anim, R.anim.zoom_exit);
}
}
public static void bottomToTopAnim(Activity activity, boolean isIn) {
if (isIn) {
activity.overridePendingTransition(R.anim.push_bottom_in, R.anim.push_top_out);
} else {
activity.overridePendingTransition(R.anim.push_top_out, R.anim.push_bottom_in);
}
}
}
package com.fry.base.utils;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.text.TextUtils;
import java.util.List;
/**
* 2019-10-14 created
*
* @author KOM
*/
public class ActivityUtils {
/**
* 判断某个界面是否在前台
*
* @param activity 要判断的Activity
* @return 是否在前台显示
*/
public static boolean isForeground(Activity activity) {
return isForeground(activity, activity.getClass().getName());
}
/**
* 判断某个界面是否在前台
*
* @param context Context
* @param className 界面的类名
* @return 是否在前台显示
*/
public static boolean isForeground(Context context, String className) {
if (context == null || TextUtils.isEmpty(className)) {
return false;
}
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> list = am.getRunningTasks(1);
if (list != null && list.size() > 0) {
ComponentName cpn = list.get(0).topActivity;
if (className.equals(cpn.getClassName())) {
return true;
}
}
return false;
}
}
package com.fry.base.utils
import android.app.Activity
import android.app.Application
import android.os.Bundle
/**
* 2020/5/5 created
* @author KOM
*/
object AppFrontBackHelper {
private var activityStartCount: Int = 0
var listener: OnAppStatusChangeListener? = null
/**
* App是否在前台
*/
fun isFront() = activityStartCount > 0
fun register(application: Application, listener: OnAppStatusChangeListener) {
this.listener = listener
application.registerActivityLifecycleCallbacks(callback)
}
fun unRegister(application: Application) {
this.listener = null
application.unregisterActivityLifecycleCallbacks(callback)
}
private val callback = object : Application.ActivityLifecycleCallbacks {
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
}
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
}
override fun onActivityStarted(activity: Activity) {
activityStartCount++
// App从后台切到前台
if (activityStartCount == 1) {
listener?.onFront()
}
}
override fun onActivityResumed(activity: Activity) {
}
override fun onActivityPaused(activity: Activity) {
}
override fun onActivityStopped(activity: Activity) {
activityStartCount--
// App从前台切到后台
if (activityStartCount == 0) {
listener?.onBack()
}
}
override fun onActivityDestroyed(activity: Activity) {
}
}
}
/**
* App状态改变时侦听
*/
interface OnAppStatusChangeListener {
/**
* 当App切换到前台时被调用
*/
fun onFront()
/**
* 当App切换到后台时被调用
*/
fun onBack()
}
package com.fry.base.utils;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
/**
* 2020/7/7 created
*
* @author KOM
*/
public class ClassHelper {
/**
* @param name 类路劲
* @param classParas Class类信息参数列表
* 如果是基本数据类型是可以使用其Tpye类型,如果用class字段是无效的
* 如果是非数据类型可以使用的class字段来创建其Class类信息对象,这些都要遵守。
* @param paras 实际参数列表数据
* @return 返回Object引用的对象,实际实际创建出来的对象,如果要使用可以强制转换为自己想要的对象
* <p>
* 带参数的反射创建对象
*/
public static Object getInstance(String name, Class classParas[], Object paras[]) {
Object o = null;
try {
Class c = getclass(name);
Constructor con = c.getConstructor(classParas);//获取使用当前构造方法来创建对象的Constructor对象,用它来获取构造函数的一些
try {
//信息
o = con.newInstance(paras);//传入当前构造函数要的参数列表
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException ex) {
} catch (InvocationTargetException ex) {
}
} catch (NoSuchMethodException ex) {
} catch (SecurityException ex) {
}
return o;//返回这个用Object引用的对象
}
/**
* @param className 类路劲的名字
* @return 返回根据className指明的类信息
*/
public static Class getclass(String className) {
Class c = null;
try {
c = Class.forName(className);
} catch (ClassNotFoundException ex) {
}
return c;
}
}
package com.fry.base.utils;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.fry.base.BuildConfig;
import com.fry.base.bean.AppConfigBean;
import com.meituan.android.walle.WalleChannelReader;
import me.goldze.mvvmhabit.utils.SPUtils2;
import me.goldze.mvvmhabit.utils.Utils;
/**
* 配置管理类
* 包括从后端获取的初始参数
* 渠道号
*
* @author jeme
* @date 2019/9/30
*/
public class ConfigManager {
public enum EnvironmentType {
/***
* 默认
*/
DEFAULT("config"),
/***
* test环境
*/
TEST("configTest"),
/***
* 用户集成测试环境
*/
UAT("configUAT"),
/***
* 预发布
*/
PRE("configPre"),
/***
* 线上
*/
PRODUCT("configProduct"),
/***
* apifz
*/
API_FZ("configFz");
String configType;
EnvironmentType(String configType) {
this.configType = configType;
}
public static EnvironmentType map(String configType) {
if (TextUtils.equals(EnvironmentType.DEFAULT.configType, configType)) {
return EnvironmentType.DEFAULT;
} else if (TextUtils.equals(EnvironmentType.TEST.configType, configType)) {
return EnvironmentType.TEST;
} else if (TextUtils.equals(EnvironmentType.UAT.configType, configType)) {
return EnvironmentType.UAT;
} else if (TextUtils.equals(EnvironmentType.PRE.configType, configType)) {
return EnvironmentType.PRE;
} else if (TextUtils.equals(EnvironmentType.PRODUCT.configType, configType)) {
return EnvironmentType.PRODUCT;
} else if (TextUtils.equals(EnvironmentType.API_FZ.configType, configType)) {
return EnvironmentType.API_FZ;
} else {
return EnvironmentType.DEFAULT;
}
}
}
private Gson mGson;
private static final String APP_CONFIG = "appConfig";
private static final String APP_ENV = "appEnv";
private final String APP_CONFIG_FILE = "appConfigFile";
private AppConfigBean mAppConfig;
private EnvironmentType mCurrentEnvType;
private ConfigManager() {
mGson = new Gson();
}
public static ConfigManager getDefault() {
return ConfigManager.HOLDER.INSTANCE;
}
private static class HOLDER {
static ConfigManager INSTANCE = new ConfigManager();
}
/***
* 保存全局配置信息
*/
public void saveConfig(AppConfigBean appConfig) {
if (appConfig == null) {
return;
}
String appConfigJson = mGson.toJson(appConfig);
if (TextUtils.isEmpty(appConfigJson)) {
return;
}
SPUtils2.getInstance(APP_CONFIG_FILE).encode(APP_CONFIG, appConfigJson);
mAppConfig = appConfig;
}
/***
* 获取全局配置信息
*/
public AppConfigBean getAppConfig() {
if (mAppConfig == null) {
String userInfoStr = SPUtils2.getInstance(APP_CONFIG_FILE).decodeString(APP_CONFIG);
mAppConfig = mGson.fromJson(userInfoStr, AppConfigBean.class);
}
//如果没有配置,创建空对象,外层无需判断是否为空
if (mAppConfig == null) {
mAppConfig = new AppConfigBean("");
}
return mAppConfig;
}
/***
* 获取app渠道号
*/
public String getAppChannel() {
String channel = WalleChannelReader.getChannel(Utils.getContext());
if (TextUtils.isEmpty(channel)) {
channel = "ddg";
}
return channel;
}
/***
* 保存环境
* 指在切换时调用一次
*/
public void saveAppEnv(EnvironmentType type) {
SPUtils2.getInstance(APP_CONFIG_FILE).encode(APP_ENV, type.configType);
}
/***
* 获取环境
*/
public EnvironmentType getAppEnv() {
if (mCurrentEnvType == null) {
String env;
if (BuildConfig.IS_DEV) {
env = SPUtils2.getInstance(APP_CONFIG_FILE).decodeString(APP_ENV, EnvironmentType.DEFAULT.configType);
if (TextUtils.isEmpty(env)) {
env = EnvironmentType.DEFAULT.configType;
}
} else {
env = EnvironmentType.DEFAULT.configType;
}
mCurrentEnvType = EnvironmentType.map(env);
}
return mCurrentEnvType;
}
}
package com.fry.base.utils;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
/**
* 复制工具类
*/
public class CopyUtils {
public static void copy(Context context, String content) {
// 得到剪贴板管理器
ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
// cmb.setText(content.trim());
cmb.setPrimaryClip(ClipData.newPlainText(null, content.trim()));
}
}
......@@ -15,18 +15,7 @@ import me.goldze.mvvmhabit.utils.ToastUtils
* @author KOM
*/
enum class APPThird(var cnName: String, var packageName: String) {
/**
* [百度地图](http://lbsyun.baidu.com/index.php?title=uri/api/android)
*/
BAI_DU_MAP("百度地图", "com.baidu.BaiduMap"),
/**
* [高德地图](https://lbs.amap.com/api/amap-mobile/guide/android/route)
*/
GAO_DE_MAP("高德地图", "com.autonavi.minimap"),
/**
* [腾讯地图](https://lbs.qq.com/uri_v1/index.html)
*/
TENCENT_MAP("腾讯地图", "com.tencent.map"),
/**
* 微信
*/
......@@ -54,90 +43,5 @@ fun isAvailable(context: Context, packageName: String): Boolean {
return packageNames.contains(packageName)
}
fun appDownloadByMarket(context: Context, packageName: String) {
val uri: Uri = Uri.parse("market://details?id=${packageName}")
context.startActivity(Intent(Intent.ACTION_VIEW, uri))
}
/**
* 百度地图位置-路径规划页
* @param location 经纬度
* @param destinationName 目的地名称
* @param isGuideInstall 未安装时是否引导安装
*/
fun locationByBaiDu(context: Context,
longitude: Double, latitude: Double, destinationName: String,
isGuideInstall: Boolean = true) {
var intent: Intent? = null
if (isAvailable(context, APPThird.BAI_DU_MAP.packageName)) {//传入指定应用包名
try {
intent = Intent().apply {
data = Uri.parse("baidumap://map/direction?destination=latlng:${latitude},${longitude}|name:${destinationName}&coord_type=gcj02&mode=transit&sy=3&index=0&target=1&src=andr.yipingcang")
}
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
}
} else {
ToastUtils.showShort("您尚未安装百度地图")
if (isGuideInstall) {
appDownloadByMarket(context, APPThird.BAI_DU_MAP.packageName)
}
}
}
/**
* 高德地图位置-路径规划页
* @param location 经纬度
* @param destinationName 目的地名称
* @param isGuideInstall 未安装时是否引导安装
*/
fun locationByGaoDe(context: Context,
longitude: Double, latitude: Double,
destinationName: String, isGuideInstall: Boolean = true) {
var intent: Intent? = null
if (isAvailable(context, APPThird.GAO_DE_MAP.packageName)) {
try {
intent = Intent().apply {
data = Uri.parse("amapuri://route/plan/?sname=我的位置&dlat=${latitude}&dlon=${longitude}&dname=${destinationName}&dev=0&t=1")
}
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
}
} else {
ToastUtils.showShort("您尚未安装高德地图")
if (isGuideInstall) {
appDownloadByMarket(context, APPThird.GAO_DE_MAP.packageName)
}
}
}
/**
* 腾讯地图位置-路径规划页
* @param location 经纬度
* @param destinationName 目的地名称
* @param isGuideInstall 未安装时是否引导安装
*/
fun locationByTencentMap(context: Context,
longitude: Double, latitude: Double,
destinationName: String, isGuideInstall: Boolean = true) {
var intent: Intent? = null
if (isAvailable(context, APPThird.GAO_DE_MAP.packageName)) {
try {
intent = Intent().apply {
data = Uri.parse("qqmap://map/routeplan?from=我的位置&type=bus&to=${destinationName}&tocoord=${latitude},${longitude}")
}
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
}
} else {
ToastUtils.showShort("您尚未安装腾讯地图")
if (isGuideInstall) {
appDownloadByMarket(context, APPThird.TENCENT_MAP.packageName)
}
}
}
\ No newline at end of file
package com.fry.base.utils
/**
* 2020/6/22 created
* @author KOM
*/
interface CallBack<Success> {
fun success(msg: Success)
}
interface CallBack2<Success,Failure> : CallBack<Success> {
fun failure(msg: Failure)
}
interface CallBack3<Success,Failure, Cancel> : CallBack2<Success,Failure> {
fun cancel(msg: Cancel)
}
......@@ -11,14 +11,6 @@
android:icon="@drawable/menu_square"
android:title="@string/bottom_name_square" />
<item
android:id="@+id/menu_empty"
android:title="@string/bottom_name_takephoto" />
<item
android:id="@+id/menu_task"
android:icon="@drawable/menu_task"
android:title="@string/bottom_name_task" />
<item
android:id="@+id/menu_my"
......
#Mon Jul 05 15:08:59 CST 2021
VERSION_BUILD=2561
#Thu Jul 08 17:51:32 CST 2021
VERSION_BUILD=2593
......@@ -7,7 +7,7 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import me.goldze.mvvmhabit.utils.DensityUtils;
import me.goldze.mvvmhabit.utils.SPUtils2;
import me.goldze.mvvmhabit.utils.SPUtils;
import me.goldze.mvvmhabit.utils.Utils;
/**
......@@ -21,7 +21,7 @@ public class BaseApplication extends Application {
public void onCreate() {
super.onCreate();
setApplication(this);
SPUtils2.init(this);
SPUtils.init(this);
}
/**
......
package me.goldze.mvvmhabit.utils;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Parcelable;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.tencent.mmkv.MMKV;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by goldze on 2017/5/14.
* SharedPreferences工具类
*/
public final class SPUtils2 {
private static Map<String, SPUtils2> sSPMap = new HashMap<>();
private static final String DEFAULT_KEY = "spUtils";
private MMKV mv;
public static void init(Application application){
MMKV.initialize(application);
}
/**
* 获取SP实例
*
* @return {@link SPUtils2}
*/
public static SPUtils2 getInstance() {
return getInstance("");
/* if (isSpace(spName)) spName = "spUtils";
if (sInstance == null) {
synchronized (SPUtils2.class) {
if (sInstance == null) {
sInstance = new SPUtils2();
}
}
}
return sInstance;*/
}
public static SPUtils2 getInstance(String name) {
String key = name;
if(TextUtils.isEmpty(key)) {
key = DEFAULT_KEY;
}
SPUtils2 sp = sSPMap.get(key);
if(sp == null) {
synchronized (SPUtils2.class) {
if (sp == null) {
sp = new SPUtils2(name);
sSPMap.put(key, sp);
}
}
}
return sp;
}
/***
* 迁移所有sp,如果新应用,不需要调用
*/
public void importFromSp(String key){
String name = TextUtils.isEmpty(key) ? DEFAULT_KEY : key;
SharedPreferences oldSp = Utils.getContext().getSharedPreferences(name, Context.MODE_PRIVATE);
if(oldSp != null) {
mv.importFromSharedPreferences(oldSp);
oldSp.edit().clear().apply();
}
}
/**
* 获取SP实例
*
* @return {@link SPUtils2}
*/
private SPUtils2(String key) {
if(TextUtils.isEmpty(key)) {
mv = MMKV.defaultMMKV();
}else {
mv = MMKV.mmkvWithID(key);
}
importFromSp(key);
}
/**
* 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
*
* @param key
* @param object
*/
public void encode(String key, Object object) {
if(mv == null){
return;
}
if (object instanceof String) {
mv.encode(key, (String) object);
} else if (object instanceof Integer) {
mv.encode(key, (Integer) object);
} else if (object instanceof Boolean) {
mv.encode(key, (Boolean) object);
} else if (object instanceof Float) {
mv.encode(key, (Float) object);
} else if (object instanceof Long) {
mv.encode(key, (Long) object);
} else if (object instanceof Double) {
mv.encode(key, (Double) object);
} else if (object instanceof byte[] ) {
mv.encode(key, (byte[]) object);
} else {
mv.encode(key, object.toString());
}
}
public void encodeSet(String key,Set<String> sets) {
mv.encode(key, sets);
}
public void encodeParcelable(String key,Parcelable obj) {
mv.encode(key, obj);
}
/**
* 得到保存数据的方法,我们根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值
*/
public Integer decodeInt(String key,int defaultValue) {
return mv.decodeInt(key, defaultValue);
}
public Double decodeDouble(String key) {
return mv.decodeDouble(key, 0.00);
}
public Long decodeLong(String key) {
return mv.decodeLong(key, 0L);
}
public Boolean decodeBoolean(String key,boolean defaultValue) {
return mv.decodeBool(key, defaultValue);
}
public Float decodeFloat(String key) {
return mv.decodeFloat(key, 0F);
}
public byte[] decodeBytes(String key) {
return mv.decodeBytes(key);
}
public String decodeString(String key) {
return mv.decodeString(key,"");
}
public String decodeString(String key,String defaultValue) {
return mv.decodeString(key,defaultValue);
}
public Set<String> decodeStringSet(String key) {
return mv.decodeStringSet(key, Collections.<String>emptySet());
}
public Parcelable decodeParcelable(String key) {
return mv.decodeParcelable(key, null);
}
/**
* 移除某个key对
*
* @param key
*/
public void removeKey(String key) {
mv.removeValueForKey(key);
}
/**
* 清除所有key
*/
public void clearAll() {
mv.clearAll();
}
}
include ':library_ad'
include ':library_base'
include ':mvvmhabit'
include ':app'
rootProject.name = "GoodNews"
\ No newline at end of file
rootProject.name = "3D_Street_view"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment