Commit 2f52dd1a authored by mengcuiguang's avatar mengcuiguang

banner自定义方案、添加本地视频管理、修改个人中心等

parent 2112529e
......@@ -64,7 +64,11 @@
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true"
android:theme="@style/AppTheme.TranslucentSplish">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.activitys.SplashAdActivity"
......@@ -80,15 +84,11 @@
<activity
android:name=".ui.activitys.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:exported="false"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoneTranslucent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.activitys.WebActivity"
......
......@@ -89,8 +89,8 @@ public class MintsApplication extends MultiDexApplication {
*/
public void thirdConfig() {
// 未同意权限弹窗,不进行SDK初始化
// if (AppPreferencesManager.INSTANCE.get()
// .getBoolean(Constant.LOAN_PERMISSION_FLAG, true)) return;
if (AppPreferencesManager.INSTANCE.get()
.getBoolean(Constant.LOAN_PERMISSION_FLAG, true)) return;
initMiitHelper();
......@@ -109,8 +109,6 @@ public class MintsApplication extends MultiDexApplication {
UmengManager.INSTANCE.initUm(this,
MateUtils.INSTANCE.getAppMetaData(this, "CHANNEL_NAME"));
// TalkingDataManager.INSTANCE.init(this);
// bugly
CrashReport.initCrashReport(this, "d035276c5b", BuildConfig.DEBUG);
}
......
......@@ -5,6 +5,7 @@ object Constant {
const val GRO_MORE_ADTYPE2 = "2"
const val AD_SOURCE_GROMORE = "GROMORE"
const val PAGE_SIZE = 12
const val LOCAL_VEDIO = "LOCAL_VEDIO"
/**
* 首次弹出权限声明
......
package com.mints.wisdomclean.manager
import android.text.TextUtils
import com.mints.library.utils.json.JsonUtil
import com.mints.wisdomclean.common.Constant
import com.mints.wisdomclean.mvp.model.BannerBean
import com.mints.wisdomclean.utils.AppPreferencesManager
/**
* 本地视频缓存管理
*/
object LocalVedioManager {
var vedioCache: Any? = null
/**
* 提交当前视频数据
*/
fun commitVedio(data: Any) {
cacheVedio(data)
TrackManager.getInstance().commitVedio()
}
/**
* 内存、本地都缓存视频
*/
private fun cacheVedio(data: Any) {
vedioCache = data
AppPreferencesManager.get().put(Constant.LOCAL_VEDIO, JsonUtil.toJson(data))
}
/**
* 关闭缓存视频
*/
fun closeCacheVedio() {
vedioCache = null
AppPreferencesManager.get().put(Constant.LOCAL_VEDIO, "")
}
/**
* 是否有缓存的视频
*
* true-有
*/
fun isCacheVedio(): Boolean {
if (vedioCache != null) {
return true
}
val localVedio = AppPreferencesManager.get().getString(Constant.LOCAL_VEDIO, "")
if (!TextUtils.isEmpty(localVedio)) {
return true
}
return false
}
/**
* 展示缓存视频
*/
fun getCacheVedio(): Any? {
if (vedioCache != null) {
return vedioCache as Any
}
val localVedio = AppPreferencesManager.get().getString(Constant.LOCAL_VEDIO, "")
if (!TextUtils.isEmpty(localVedio)) {
return JsonUtil.parseJson(localVedio, BannerBean::class.java)
}
return null
}
}
\ No newline at end of file
......@@ -61,4 +61,10 @@ public class TrackManager {
trackPresenter.saveV6Terminal();
}
}
public void commitVedio() {
if (trackPresenter != null ) {
// trackPresenter.commitVedio();
}
}
}
package com.mints.wisdomclean.mvp.model;
import java.io.Serializable;
public class BannerBean implements Serializable {
private String imageRes;
private String title;
public String getImageRes() {
return imageRes;
}
public void setImageRes(String imageRes) {
this.imageRes = imageRes;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
......@@ -48,16 +48,14 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else if (TextUtils.equals(getClass().getSimpleName(), "VideoActivity")) {
StatusBarUtil.transparencyBar(this); //设置状态栏全透明
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getWindow().setNavigationBarColor(Color.BLACK);
}
} else {
StatusBarUtil.transparencyBar(this); //设置状态栏全透明
StatusBarUtil.StatusBarLightMode(this); //设置白底黑字
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getWindow().setNavigationBarColor(Color.TRANSPARENT);
}
}
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
getWindow().setNavigationBarColor(Color.BLACK);
// }
} catch (Exception e) {
e.printStackTrace();
}
......
package com.mints.wisdomclean.ui.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.mints.library.utils.GlideUtils;
import com.mints.wisdomclean.R;
import com.mints.wisdomclean.mvp.model.BannerBean;
import com.youth.banner.adapter.BannerAdapter;
import java.util.List;
/**
* 自定义布局,图片+标题
*/
public class ImageTitleAdapter extends BannerAdapter<BannerBean, ImageTitleHolder> {
private Context context;
public ImageTitleAdapter(List<BannerBean> mDatas) {
super(mDatas);
}
@Override
public ImageTitleHolder onCreateHolder(ViewGroup parent, int viewType) {
context=parent.getContext();
return new ImageTitleHolder(LayoutInflater.from(context).inflate(R.layout.banner_image_title, parent, false));
}
@Override
public void onBindView(ImageTitleHolder holder, BannerBean data, int position, int size) {
// holder.imageView.setImageResource(data.getImageRes());
GlideUtils.INSTANCE.loadImageViewGifForFitCenter(context, data.getImageRes(), holder.imageView);
holder.title.setText(data.getTitle());
}
}
package com.mints.wisdomclean.ui.adapter;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mints.wisdomclean.R;
public class ImageTitleHolder extends RecyclerView.ViewHolder {
public ImageView imageView;
public TextView title;
public ImageTitleHolder(@NonNull View view) {
super(view);
imageView = view.findViewById(R.id.image);
title = view.findViewById(R.id.bannerTitle);
}
}
......@@ -15,13 +15,16 @@ import com.mints.library.utils.nodoubleclick.AntiShake
import com.mints.wisdomclean.R
import com.mints.wisdomclean.common.AppConfig
import com.mints.wisdomclean.common.Constant
import com.mints.wisdomclean.manager.LocalVedioManager
import com.mints.wisdomclean.manager.UserManager
import com.mints.wisdomclean.mvp.model.BannerBean
import com.mints.wisdomclean.mvp.model.HotStyleTypesBean
import com.mints.wisdomclean.mvp.model.HotStyleTypesListBean
import com.mints.wisdomclean.mvp.model.UserBean
import com.mints.wisdomclean.mvp.presenters.HomePresenter
import com.mints.wisdomclean.mvp.views.HomeView
import com.mints.wisdomclean.ui.adapter.HomeVideoPageAdapter
import com.mints.wisdomclean.ui.adapter.ImageTitleAdapter
import com.mints.wisdomclean.ui.adapter.TopAdapter
import com.mints.wisdomclean.ui.fragment.base.BaseFragment
import com.mints.wisdomclean.ui.fragment.base.LazyLoadBaseFragment
......@@ -51,6 +54,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
private var mSelectTabIndex = -1
private val tabsData = mutableListOf<HotStyleTypesBean>()
private val bannerList = mutableListOf<BannerBean>()
private var vpAdapter: HomeVideoPageAdapter? = null
private var topAdapter: TopAdapter? = null
......@@ -84,7 +88,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
loadData()
}
banner?.start()
setWatchingStatus(Any())
setWatchingStatus()
}
}
......@@ -93,34 +97,22 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
private fun initView() {
val bannerLayout1 = (banner as Banner<String, BannerImageAdapter<String>>)
bannerLayout1.apply {
addBannerLifecycleObserver(activity)
indicator = CircleIndicator(activity)
setAdapter(object : BannerImageAdapter<String>(imageUrls) {
override fun onBindView(
holder: BannerImageHolder,
data: String,
position: Int,
size: Int
) {
holder.imageView.scaleType = ImageView.ScaleType.FIT_XY
GlideUtils.loadImageViewGifForFitCenter(activity!!, data, holder.imageView)
}
})
setOnBannerListener { data, position ->
when (position) {
0 -> {
// mCurrentStyleType = Constant.STYLE_BANNER1
}
}
}
for (i in 0 until imageUrls.size) {
val bean = BannerBean()
bean.title = "天师下山各显神勇" + i
bean.imageRes = imageUrls.get(i)
bannerList.add(bean)
}
banner.addBannerLifecycleObserver(this)
.setAdapter(ImageTitleAdapter(bannerList))
.setOnBannerListener { data, position ->
showToast(position.toString())
}
}
private fun initListener() {
srlMainPage.setOnRefreshListener(this)
tv_test.setOnClickListener(this)
iv_main_watching_close.setOnClickListener(this)
tv_main_watching_goto.setOnClickListener(this)
}
......@@ -129,14 +121,18 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
if (AntiShake.check(v?.id)) return
when (v?.id) {
R.id.tv_test -> {
readyGo(VideoActivity::class.java)
}
// R.id.tv_test -> {
// readyGo(VideoActivity::class.java)
// }
R.id.iv_main_watching_close -> {
LocalVedioManager.closeCacheVedio()
ll_main_watching_root.visibility = View.GONE
}
R.id.tv_main_watching_goto -> {
val cacheVedio = LocalVedioManager.getCacheVedio()
if (cacheVedio != null) {
}
}
}
}
......@@ -224,15 +220,25 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
}
fun setWatchingStatus(bean: Any) {
GlideUtils.loadImageViewGifForFitCenter(
requireContext(),
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg-bcurd/img/bg_vip_top1.png",
iv_main_watching_pic
)
fun setWatchingStatus() {
if (LocalVedioManager.isCacheVedio()) {
ll_main_watching_root.visibility = View.VISIBLE
val cacheVedio = LocalVedioManager.getCacheVedio()
if (cacheVedio != null) {
}
GlideUtils.loadImageViewGifForFitCenter(
requireContext(),
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg-bcurd/img/bg_vip_top1.png",
iv_main_watching_pic
)
// tv_main_watching_name.text=""
// tv_main_watching_text1.text=""
// tv_main_watching_text2.text=""
} else {
ll_main_watching_root.visibility = View.GONE
}
}
override fun getHomeV1MsgSuc(data: HotStyleTypesListBean) {
......
......@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#95000000" />
<solid android:color="#99000000" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="5dip" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
<TextView
android:id="@+id/bannerTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:singleLine="true"
android:textSize="18sp"
android:textColor="#ffffff"
android:layout_marginLeft="10dp"
android:layout_marginBottom="8dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout 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"
......@@ -147,8 +147,10 @@
android:id="@+id/ll_main_watching_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="15dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_bg_black">
<ImageView
......@@ -198,10 +200,11 @@
<ImageView
android:id="@+id/iv_main_watching_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:layout_alignParentRight="true"
android:padding="5dp"
android:src="@mipmap/ic_activity_quit"></ImageView>
<TextView
......@@ -223,4 +226,4 @@
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</FrameLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="bannerTitle" type="id" />
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<style name="SwipeBackLayout">
<item name="edge_size">0dp</item>
</style>
......@@ -85,7 +86,32 @@
<item name="android:button">@drawable/selector_cb</item>
</style>
<style name="BottomDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowAnimationStyle">@style/BottomDialog.AnimationStyle</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
</style>
<style name="BottomDialog.AnimationStyle" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
<item name="android:windowExitAnimation">@anim/push_bottom_out</item>
</style>
<!--Big File Detail Alert Dialog-->
<style name="TransTabLayoutTextSize">
<item name="android:textSize">16sp</item>
</style>
<style name="Theme.ADSplash" parent="Theme.Light">
<!-- <item name="android:windowBackground">@drawable/splash</item>-->
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Light" parent="Theme.AppCompat.Light">
<item name="android:windowBackground">@color/white</item>
</style>
</resources>
......@@ -8,8 +8,20 @@
<item name="android:windowAnimationStyle">@null</item>
</style>
<style name="TransparentTheme" parent="Theme.AppCompat.NoActionBar">
<!--不设置activity进入和退出动画样式-->
<item name="android:windowAnimationStyle">@null</item>
<!--设置窗口的背景为透明,设置透明背景必须要设置此项-->
<item name="android:windowBackground">@color/full_transparent</item>
<!--设置窗口的背景是否为半透明,设置透明背景必须要设置此项-->
<item name="android:windowIsTranslucent">true</item>
<!--设置状态栏的背景为半透明-->
<item name="android:windowTranslucentStatus">true</item>
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@drawable/sr_primary</item>
<item name="colorPrimaryDark">@drawable/sr_primary</item>
......
......@@ -40,11 +40,7 @@ WEIXIN_APP_ID =wx6830d86ba20be254
WEIXIN_APP_SECRET =91f91c0721bd989cf8b9c9b8dc8a5e9c
#umeng
<<<<<<< Updated upstream
RELEASE_UMENG_KEY=64a67d4fa1a164591b44f0e8
=======
RELEASE_UMENG_KEY=63c0fd97d64e68613917170f
>>>>>>> Stashed changes
GROMORE_APP_ID="5404192"
GROMORE_SPLASH_CODE="102371299"
......
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