Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_flowbox
Commits
07483780
Commit
07483780
authored
Jul 10, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
92581452
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
118 additions
and
43 deletions
+118
-43
InitAppService.kt
app/src/main/java/com/mints/flowbox/InitAppService.kt
+3
-0
MintsApplication.java
app/src/main/java/com/mints/flowbox/MintsApplication.java
+27
-16
AlarmManager.java
...c/main/java/com/mints/flowbox/keepalive/AlarmManager.java
+14
-1
SpeedFastActivity.kt
.../java/com/mints/flowbox/ui/activitys/SpeedFastActivity.kt
+22
-7
MoneyFragment.kt
.../main/java/com/mints/flowbox/ui/fragment/MoneyFragment.kt
+2
-1
WifiFragment.kt
...c/main/java/com/mints/flowbox/ui/fragment/WifiFragment.kt
+10
-8
ImageUtil.java
app/src/main/java/com/mints/flowbox/utils/ImageUtil.java
+28
-1
GlideUtils.java
app/src/main/java/com/mints/library/utils/GlideUtils.java
+6
-1
activity_increasespeed2.xml
app/src/main/res/layout/activity_increasespeed2.xml
+1
-1
activity_speed_fast.xml
app/src/main/res/layout/activity_speed_fast.xml
+1
-3
dialog_wifi.xml
app/src/main/res/layout/dialog_wifi.xml
+2
-2
item_wifi_empty.xml
app/src/main/res/layout/item_wifi_empty.xml
+2
-2
No files found.
app/src/main/java/com/mints/flowbox/InitAppService.kt
View file @
07483780
...
...
@@ -8,6 +8,7 @@ import cn.jpush.android.api.BasicPushNotificationBuilder
import
cn.jpush.android.api.JPushInterface
import
com.downloader.PRDownloader
import
com.downloader.PRDownloaderConfig
import
com.mints.flowbox.manager.YlVideoManager
import
com.mob.MobSDK
/**
...
...
@@ -60,6 +61,8 @@ class InitAppService : IntentService("InitializeService") {
// PR下载附件
initPRDownloader
()
// 一览视频
YlVideoManager
.
init
(
MintsApplication
.
getContext
())
}
/**
...
...
app/src/main/java/com/mints/flowbox/MintsApplication.java
View file @
07483780
...
...
@@ -33,6 +33,7 @@ import com.mints.flowbox.manager.MiitHelper;
import
com.mints.flowbox.manager.ad.OwManager
;
import
com.mints.flowbox.manager.ad.TzManager
;
import
com.mints.flowbox.manager.ad.WnManager
;
import
com.mints.flowbox.manager.ad.XmManager
;
import
com.mints.flowbox.manager.wifi.WifiDataManager
;
import
com.mints.flowbox.net.LoanService
;
import
com.mints.flowbox.ui.activitys.ApkActivity
;
...
...
@@ -103,6 +104,8 @@ public class MintsApplication extends BaseApp {
// TODO 加ua字段
initKeepAlive
();
// XmManager.INSTANCE.init(this);
// 三方配置
// thirdConfig();
}
...
...
@@ -398,19 +401,11 @@ public class MintsApplication extends BaseApp {
*/
private
void
thirdConfig
()
{
System
.
out
.
println
(
"mints ------------> thirdConfig <------------"
);
// 初始化toast
initToast
();
// GroMore
CsjGroMoreManager
.
INSTANCE
.
init
(
this
);
if
(!
getProcessName
(
this
).
contains
(
":"
))
{
// OneWay
OwManager
.
INSTANCE
.
init
(
this
);
System
.
out
.
println
(
"mints ------------> MainProgress <------------"
);
// 闪电盒子
WnManager
.
INSTANCE
.
initWn
(
this
);
XmManager
.
INSTANCE
.
init
(
this
);
// 天卓珊瑚
TzManager
.
INSTANCE
.
initTz
(
this
);
...
...
@@ -427,6 +422,22 @@ public class MintsApplication extends BaseApp {
InitAppService
.
Companion
.
start
(
this
);
//初始化数据
}
}
}
System
.
out
.
println
(
"mints ------------> thirdConfig <------------"
);
// 初始化toast
initToast
();
// GroMore
CsjGroMoreManager
.
INSTANCE
.
init
(
this
);
// OneWay
OwManager
.
INSTANCE
.
init
(
this
);
// 闪电盒子
WnManager
.
INSTANCE
.
initWn
(
this
);
}
/**
...
...
app/src/main/java/com/mints/flowbox/keepalive/AlarmManager.java
View file @
07483780
...
...
@@ -5,10 +5,12 @@ import android.os.Message;
import
com.bytedance.msdk.adapter.util.WeakHandler
;
import
com.mints.flowbox.MintsApplication
;
import
com.mints.flowbox.ad.express.ExpressManager
;
import
com.mints.flowbox.common.AppConfig
;
import
com.mints.flowbox.manager.TrackManager
;
import
com.mints.flowbox.ui.activitys.BoostActivity
;
import
com.mints.flowbox.utils.ForegroundOrBackground
;
import
com.mints.flowbox.utils.LogUtil
;
/**
* 描述:应用外广告定时器
...
...
@@ -24,6 +26,7 @@ public class AlarmManager implements WeakHandler.IHandler {
public
static
final
int
APP_OUT_CLEAR_MINTER
=
10
;
//单位-分钟,应用外清理
public
static
final
long
ONE_MINTER_Interval
=
60
*
1000
;
//60秒
public
static
final
long
TEN_SECOND_Interval
=
10
*
1000
;
//10秒
public
static
final
int
MSG1
=
1001
;
private
volatile
int
curTime
=
1
;
//每分钟变一次
...
...
@@ -65,10 +68,16 @@ public class AlarmManager implements WeakHandler.IHandler {
// 防止userTime超出Integer范围
if
(
userTime
<
20
)
userTime
++;
LogUtil
.
d
(
"BBBBB"
+
curTime
);
// 固定时间增长
exeActionForTime
(
curTime
);
// 用户操作按时间增长
userActionForTime
(
userTime
);
if
(
mHandler
!=
null
)
{
mHandler
.
sendEmptyMessageDelayed
(
MSG1
,
ONE_MINTER_Interval
);
}
}
}
...
...
@@ -80,12 +89,16 @@ public class AlarmManager implements WeakHandler.IHandler {
private
void
userActionForTime
(
int
userTime
)
{
if
(
userTime
%
APP_OUT_CLEAR_MINTER
==
0
)
{
LogUtil
.
d
(
"AAAA -> "
+
userTime
);
// 应用在前台时,不弹出应用外广告
if
(
ForegroundOrBackground
.
isForeground
())
{
if
(
ForegroundOrBackground
.
isForeground
2
())
{
this
.
resetUserActionTime
();
return
;
}
// 预加载信息流
ExpressManager
.
INSTANCE
.
loadExpress
();
//用户关闭界面后10分钟调用
Intent
intent
=
new
Intent
(
MintsApplication
.
getContext
(),
BoostActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/SpeedFastActivity.kt
View file @
07483780
...
...
@@ -7,7 +7,8 @@ import androidx.core.content.ContextCompat
import
com.bumptech.glide.load.resource.gif.GifDrawable
import
com.mints.flowbox.R
import
com.mints.flowbox.ad.express.ExpressManager
import
com.mints.flowbox.ad.inscreen.InsertScreenAdManager
import
com.mints.flowbox.ad.wifi.WifiAdManager
import
com.mints.flowbox.ad.wifi.WifiAdStatusListener
import
com.mints.flowbox.ui.activitys.base.BaseActivity
import
com.mints.library.utils.GlideUtils
import
kotlinx.android.synthetic.main.activity_speed_fast.*
...
...
@@ -28,7 +29,7 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
private
var
mTimer
:
Timer
?
=
null
private
var
mStep
=
0
private
var
insertScreenAdManager
:
InsertScreen
AdManager
?
=
null
private
var
mWifiAdManager
:
Wifi
AdManager
?
=
null
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_speed_fast
...
...
@@ -37,8 +38,20 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
override
fun
initViewsAndEvents
()
{
initView
()
insertScreenAdManager
=
InsertScreenAdManager
()
insertScreenAdManager
?.
loadInterstitial
(
this
)
mWifiAdManager
=
WifiAdManager
()
mWifiAdManager
?.
loadWifiAd
(
this
)
mWifiAdManager
?.
setWifiAdStatusListener
(
object
:
WifiAdStatusListener
{
override
fun
adSuccess
()
{
}
override
fun
adFail
()
{
}
override
fun
adClose
()
{
finish
()
}
})
}
fun
startTimer
()
{
...
...
@@ -71,7 +84,7 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
tv_progress
.
visibility
=
View
.
INVISIBLE
// 动画结束后 展示插屏广告
insertScreen
AdManager
?.
showInterstitial
()
mWifi
AdManager
?.
showInterstitial
()
if
(
iv_gif
.
drawable
is
GifDrawable
)
{
val
drawable
=
iv_gif
.
drawable
as
GifDrawable
...
...
@@ -100,6 +113,8 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
tv_tab
.
text
=
topStr
[
0
]
tv_progress
.
text
=
speedStr
[
0
]
GlideUtils
.
loadImageViewBitMap
(
this
,
R
.
drawable
.
wifi_speed
,
iv_gif
)
btn
.
setOnClickListener
(
this
)
}
...
...
@@ -142,8 +157,8 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
}
override
fun
onDestroy
()
{
insertScreen
AdManager
?.
onDestroy
()
insertScreen
AdManager
=
null
mWifi
AdManager
?.
onDestroy
()
mWifi
AdManager
=
null
fl_ad
?.
removeAllViews
()
// 预加载信息流
...
...
app/src/main/java/com/mints/flowbox/ui/fragment/MoneyFragment.kt
View file @
07483780
...
...
@@ -39,9 +39,10 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
override
fun
initViewsAndEvents
()
{
if
(!
AppConfig
.
isXmlyInit
)
{
XmManager
.
init
(
MintsApplication
.
getContext
())
//
XmManager.init(MintsApplication.getContext())
// 一览视频
YlVideoManager
.
init
(
MintsApplication
.
getContext
())
AppConfig
.
isXmlyInit
=
true
}
initView
()
...
...
app/src/main/java/com/mints/flowbox/ui/fragment/WifiFragment.kt
View file @
07483780
...
...
@@ -87,6 +87,8 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
if
(!
TextUtils
.
isEmpty
(
UserManager
.
getInstance
().
userID
))
{
(
requireActivity
()
as
MainActivity
).
refreshHall
()
}
else
{
(
requireActivity
()
as
MainActivity
).
userLogin
(
Constant
.
FRAGMENT_CLICK_THREE
)
}
}
}
...
...
app/src/main/java/com/mints/flowbox/utils/ImageUtil.java
View file @
07483780
...
...
@@ -8,6 +8,7 @@ import android.graphics.BitmapFactory;
import
android.graphics.Canvas
;
import
android.graphics.LinearGradient
;
import
android.graphics.Matrix
;
import
android.graphics.Movie
;
import
android.graphics.Paint
;
import
android.graphics.PixelFormat
;
import
android.graphics.PorterDuff.Mode
;
...
...
@@ -22,7 +23,10 @@ import com.mints.flowbox.common.Constant;
import
com.mints.library.utils.TLog
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
/**
* 图片util
...
...
@@ -196,7 +200,6 @@ public class ImageUtil {
// e.printStackTrace();
// }
// }
public
static
Bitmap
getBitmap
(
Context
context
,
String
name
)
{
Bitmap
bitmap
=
null
;
try
{
...
...
@@ -219,5 +222,29 @@ public class ImageUtil {
return
bitmap
;
}
/**
* 获取gif第一帧
*
* @param url
* @return
*/
public
static
Bitmap
loadGifFirstBitmap
(
String
url
)
{
Bitmap
bitmap
=
null
;
try
{
HttpURLConnection
urlConnection
=
(
HttpURLConnection
)
new
URL
(
url
).
openConnection
();
InputStream
is
=
urlConnection
.
getInputStream
();
Movie
movie
=
Movie
.
decodeStream
(
is
);
//Bitmap.Config.ARGB_8888 这里是核心,如果出现图片显示不正确,就换编码试试
bitmap
=
Bitmap
.
createBitmap
(
movie
.
width
(),
movie
.
height
(),
Bitmap
.
Config
.
ARGB_8888
);
Canvas
canvas
=
new
Canvas
(
bitmap
);
movie
.
draw
(
canvas
,
0
,
0
);
canvas
.
save
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
return
bitmap
;
}
}
}
app/src/main/java/com/mints/library/utils/GlideUtils.java
View file @
07483780
...
...
@@ -73,6 +73,11 @@ public class GlideUtils {
Glide
.
with
(
mContext
).
load
(
drawable
).
into
(
imageView
);
}
//加载Gif
public
static
void
loadImageViewBitMap
(
Context
mContext
,
int
drawable
,
ImageView
imageView
)
{
Glide
.
with
(
mContext
).
asBitmap
().
load
(
drawable
).
into
(
imageView
);
}
//加载Gif
public
static
void
loadImageViewGifUrl
(
Context
mContext
,
ImageView
view
,
String
url
)
{
RequestOptions
options
=
(
new
RequestOptions
())
...
...
@@ -125,7 +130,7 @@ public class GlideUtils {
},
delay
);
}
catch
(
NoSuchFieldException
e
)
{
e
.
printStackTrace
();
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
...
...
app/src/main/res/layout/activity_increasespeed2.xml
View file @
07483780
...
...
@@ -7,7 +7,7 @@
<View
android:layout_width=
"match_parent"
android:layout_height=
"280dp"
android:background=
"
@drawable/shape_bg_speed
"
/>
android:background=
"
#8275DF
"
/>
<LinearLayout
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/activity_speed_fast.xml
View file @
07483780
...
...
@@ -41,9 +41,7 @@
android:id=
"@+id/iv_gif"
android:layout_width=
"wrap_content"
android:layout_height=
"200dp"
android:layout_gravity=
"center"
android:src=
"@drawable/wifi_speed"
android:visibility=
"visible"
/>
android:layout_gravity=
"center"
/>
</FrameLayout>
...
...
app/src/main/res/layout/dialog_wifi.xml
View file @
07483780
...
...
@@ -118,6 +118,7 @@
android:hint=
"输入密码"
android:inputType=
"textPassword"
android:padding=
"10dp"
android:textSize=
"12sp"
app:layout_constraintTop_toBottomOf=
"@id/textView11"
/>
<Button
...
...
@@ -135,8 +136,7 @@
android:id=
"@+id/tv_cancel"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:layout_marginTop=
"2dp"
android:padding=
"10dp"
android:text=
"取消"
android:textSize=
"16sp"
...
...
app/src/main/res/layout/item_wifi_empty.xml
View file @
07483780
...
...
@@ -15,7 +15,7 @@
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
2
0dp"
android:layout_marginTop=
"
1
0dp"
android:text=
"WIFI开关未开启"
android:textColor=
"@color/black"
android:textSize=
"18sp"
/>
...
...
@@ -29,7 +29,7 @@
<Button
android:id=
"@+id/btn"
android:layout_width=
"140dp"
android:layout_height=
"4
6
dp"
android:layout_height=
"4
0
dp"
android:layout_marginTop=
"15dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/shape_main"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment