Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_xunmi
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_xunmi
Commits
f990cdfb
Commit
f990cdfb
authored
Nov 05, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
95119d20
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
457 additions
and
403 deletions
+457
-403
build.gradle
position/app/build.gradle
+2
-0
TopOnNativeAd.kt
...ion/app/src/main/java/com/mints/xunmi/ad/TopOnNativeAd.kt
+8
-4
AppConfig.java
...n/app/src/main/java/com/mints/xunmi/common/AppConfig.java
+0
-4
VipPayManager.kt
...pp/src/main/java/com/mints/xunmi/manager/VipPayManager.kt
+14
-14
MainFragmentPresenter.kt
...a/com/mints/xunmi/mvp/presenters/MainFragmentPresenter.kt
+3
-0
CallMeActivity.kt
.../main/java/com/mints/xunmi/ui/activitys/CallMeActivity.kt
+1
-1
MainActivity.java
.../main/java/com/mints/xunmi/ui/activitys/MainActivity.java
+3
-0
SplashADActivity.java
...n/java/com/mints/xunmi/ui/activitys/SplashADActivity.java
+293
-293
SplashAdShowActivity.java
...va/com/mints/xunmi/ui/activitys/SplashAdShowActivity.java
+8
-1
SplashBackActivity.java
...java/com/mints/xunmi/ui/activitys/SplashBackActivity.java
+8
-1
MainFragment.kt
...src/main/java/com/mints/xunmi/ui/fragment/MainFragment.kt
+70
-28
MyFragment.kt
...p/src/main/java/com/mints/xunmi/ui/fragment/MyFragment.kt
+2
-40
PositionFragment.kt
...main/java/com/mints/xunmi/ui/fragment/PositionFragment.kt
+40
-15
SPUtil.java
position/app/src/main/java/com/mints/xunmi/utils/SPUtil.java
+4
-2
fragment_main_my.xml
position/app/src/main/res/layout/fragment_main_my.xml
+1
-0
No files found.
position/app/build.gradle
View file @
f990cdfb
...
@@ -214,6 +214,8 @@ dependencies {
...
@@ -214,6 +214,8 @@ dependencies {
// 三方接入
// 三方接入
// leakcanary
debugImplementation
'com.squareup.leakcanary:leakcanary-android:2.4'
// shareSdk
// shareSdk
implementation
project
(
':shareSdkLib'
)
implementation
project
(
':shareSdkLib'
)
// umeng
// umeng
...
...
position/app/src/main/java/com/mints/xunmi/ad/TopOnNativeAd.kt
View file @
f990cdfb
...
@@ -21,6 +21,7 @@ object TopOnNativeAd {
...
@@ -21,6 +21,7 @@ object TopOnNativeAd {
private
val
TAG
=
TopOnNativeAd
::
class
.
java
.
simpleName
private
val
TAG
=
TopOnNativeAd
::
class
.
java
.
simpleName
var
context
:
Context
?
=
null
var
atNatives
:
ATNative
?
=
null
var
atNatives
:
ATNative
?
=
null
var
mNativeAd
:
NativeAd
?
=
null
var
mNativeAd
:
NativeAd
?
=
null
var
anyThinkNativeAdView
:
ATNativeAdView
?
=
null
var
anyThinkNativeAdView
:
ATNativeAdView
?
=
null
...
@@ -32,6 +33,7 @@ object TopOnNativeAd {
...
@@ -32,6 +33,7 @@ object TopOnNativeAd {
* 应用初始化
* 应用初始化
*/
*/
fun
init
(
context
:
Context
)
{
fun
init
(
context
:
Context
)
{
this
.
context
=
context
atNatives
=
ATNative
(
context
,
TopOnManager
.
INFORMATION_ID
,
object
:
ATNativeNetworkListener
{
atNatives
=
ATNative
(
context
,
TopOnManager
.
INFORMATION_ID
,
object
:
ATNativeNetworkListener
{
override
fun
onNativeAdLoaded
()
{
override
fun
onNativeAdLoaded
()
{
LogUtil
.
e
(
TAG
,
"onNativeAdLoaded"
)
LogUtil
.
e
(
TAG
,
"onNativeAdLoaded"
)
...
@@ -61,16 +63,16 @@ object TopOnNativeAd {
...
@@ -61,16 +63,16 @@ object TopOnNativeAd {
/**
/**
* 预加载
* 预加载
*/
*/
fun
loadNativeAd
(
context
:
Context
,
frameLayout
:
FrameLayout
?)
{
fun
loadNativeAd
(
frameLayout
:
FrameLayout
?)
{
atNatives
?.
makeAdRequest
()
atNatives
?.
makeAdRequest
()
showNativeAd
(
context
,
frameLayout
)
showNativeAd
(
frameLayout
)
}
}
/**
/**
* 显示
* 显示
*/
*/
fun
showNativeAd
(
context
:
Context
,
frameLayout
:
FrameLayout
?)
{
private
fun
showNativeAd
(
frameLayout
:
FrameLayout
?)
{
val
nativeAd
=
atNatives
?.
nativeAd
val
nativeAd
=
atNatives
?.
nativeAd
nativeAd
?.
let
{
nativeAd
?.
let
{
if
(
mNativeAd
!=
null
)
{
if
(
mNativeAd
!=
null
)
{
...
@@ -118,7 +120,7 @@ object TopOnNativeAd {
...
@@ -118,7 +120,7 @@ object TopOnNativeAd {
it
.
prepare
(
anyThinkNativeAdView
,
anyThinkRender
.
getClickView
(),
null
)
it
.
prepare
(
anyThinkNativeAdView
,
anyThinkRender
.
getClickView
(),
null
)
if
(
anyThinkNativeAdView
!=
null
&&
anyThinkNativeAdView
!!
.
parent
==
null
)
{
if
(
anyThinkNativeAdView
!=
null
&&
anyThinkNativeAdView
!!
.
parent
==
null
)
{
frameLayout
?.
addView
(
anyThinkNativeAdView
,
FrameLayout
.
LayoutParams
(
context
.
getResources
()
.
getDisplayMetrics
().
widthPixels
,
containerHeight
))
frameLayout
?.
addView
(
anyThinkNativeAdView
,
FrameLayout
.
LayoutParams
(
context
?.
getResources
()
!!
.
getDisplayMetrics
().
widthPixels
,
containerHeight
))
}
}
}
}
}
}
...
@@ -138,6 +140,8 @@ object TopOnNativeAd {
...
@@ -138,6 +140,8 @@ object TopOnNativeAd {
}
}
fun
onDestroy
()
{
fun
onDestroy
()
{
anyThinkNativeAdView
?.
destory
()
mNativeAd
?.
destory
()
mNativeAd
?.
destory
()
context
=
null
}
}
}
}
\ No newline at end of file
position/app/src/main/java/com/mints/xunmi/common/AppConfig.java
View file @
f990cdfb
...
@@ -30,11 +30,7 @@ public class AppConfig {
...
@@ -30,11 +30,7 @@ public class AppConfig {
public
static
volatile
double
curLatitude
=
0
;
//纬度 39.977181
public
static
volatile
double
curLatitude
=
0
;
//纬度 39.977181
public
static
volatile
String
curAddress
=
"授权定位权限后获取位置"
;
//位置
public
static
volatile
String
curAddress
=
"授权定位权限后获取位置"
;
//位置
public
static
volatile
String
poiName
=
""
;
//位置
public
static
volatile
String
poiName
=
""
;
//位置
public
static
volatile
String
aoiName
=
""
;
//建筑
public
static
volatile
double
preChangeLongitude
=
1
;
//位置变化改变 上一次经度 116.307511
public
static
volatile
double
preChangeLatitude
=
1
;
//位置变化改变 上一次纬度 39.977181
// public static volatile int canSaveMinimumM = 50;//范围 米
public
static
volatile
int
canSaveMinimumM
=
1
;
//范围 米
public
static
volatile
int
canSaveMinimumM
=
1
;
//范围 米
...
...
position/app/src/main/java/com/mints/xunmi/manager/VipPayManager.kt
View file @
f990cdfb
...
@@ -35,7 +35,7 @@ class VipPayManager private constructor(activity: Activity) {
...
@@ -35,7 +35,7 @@ class VipPayManager private constructor(activity: Activity) {
private
fun
init
(
activity
:
Activity
)
{
private
fun
init
(
activity
:
Activity
)
{
this
.
activity
=
activity
this
.
activity
=
activity
spUtil
=
SPUtil
.
getInstance
(
activity
)
spUtil
=
SPUtil
.
getInstance
()
}
}
/**
/**
...
@@ -56,19 +56,19 @@ class VipPayManager private constructor(activity: Activity) {
...
@@ -56,19 +56,19 @@ class VipPayManager private constructor(activity: Activity) {
/**
/**
* 跳转支付界面 type-3 五折, type-4 全款
* 跳转支付界面 type-3 五折, type-4 全款
*/
*/
fun
gotoPayPage
(
type
:
Int
)
{
//
fun gotoPayPage(type: Int) {
if
(
activity
==
null
)
return
//
if (activity == null) return
//
if
(
TextUtils
.
equals
(
"onePrice"
,
spUtil
?.
getString
(
Constant
.
PAY_PAGE_TYPE
)))
{
//
if (TextUtils.equals("onePrice", spUtil?.getString(Constant.PAY_PAGE_TYPE))) {
//固定套餐
//
//固定套餐
readyGo
(
Vip2Activity
::
class
.
java
)
//
readyGo(Vip2Activity::class.java)
}
else
{
//
} else {
//多价格套餐
//
//多价格套餐
val
bundle
=
Bundle
()
//
val bundle = Bundle()
bundle
.
putInt
(
Constant
.
PRICE_TYPE
,
type
)
//
bundle.putInt(Constant.PRICE_TYPE, type)
readyGo
(
Vip3Activity
::
class
.
java
,
bundle
)
//
readyGo(Vip3Activity::class.java, bundle)
}
//
}
}
//
}
private
fun
readyGo
(
clazz
:
Class
<
*
>?)
{
private
fun
readyGo
(
clazz
:
Class
<
*
>?)
{
activity
.
let
{
activity
.
let
{
...
...
position/app/src/main/java/com/mints/xunmi/mvp/presenters/MainFragmentPresenter.kt
View file @
f990cdfb
...
@@ -26,6 +26,9 @@ import java.util.*
...
@@ -26,6 +26,9 @@ import java.util.*
class
MainFragmentPresenter
:
BasePresenter
<
MainFragmentView
>()
{
class
MainFragmentPresenter
:
BasePresenter
<
MainFragmentView
>()
{
/**
* 获取关心的人
*/
fun
getAllReqMy
()
{
fun
getAllReqMy
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getCares
(),
.
call
(
loanService
.
getCares
(),
...
...
position/app/src/main/java/com/mints/xunmi/ui/activitys/CallMeActivity.kt
View file @
f990cdfb
...
@@ -30,7 +30,7 @@ class CallMeActivity : BaseActivity(), View.OnClickListener {
...
@@ -30,7 +30,7 @@ class CallMeActivity : BaseActivity(), View.OnClickListener {
if
(
UserManager
.
getInstance
().
vipFlag
)
{
if
(
UserManager
.
getInstance
().
vipFlag
)
{
rlCallmeQQ
.
visibility
=
View
.
VISIBLE
rlCallmeQQ
.
visibility
=
View
.
VISIBLE
val
phone
=
SPUtil
.
getInstance
(
context
).
getString
(
Constant
.
USER_TELEPHONE
)
val
phone
=
SPUtil
.
getInstance
().
getString
(
Constant
.
USER_TELEPHONE
)
tvCallPhone
.
text
=
phone
tvCallPhone
.
text
=
phone
}
else
{
}
else
{
rlCallmeQQ
.
visibility
=
View
.
GONE
rlCallmeQQ
.
visibility
=
View
.
GONE
...
...
position/app/src/main/java/com/mints/xunmi/ui/activitys/MainActivity.java
View file @
f990cdfb
...
@@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentTransaction;
...
@@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentTransaction;
import
com.mints.xunmi.MintsApplication
;
import
com.mints.xunmi.MintsApplication
;
import
com.mints.xunmi.R
;
import
com.mints.xunmi.R
;
import
com.mints.xunmi.ad.TopOnNativeAd
;
import
com.mints.xunmi.common.AppConfig
;
import
com.mints.xunmi.common.AppConfig
;
import
com.mints.xunmi.common.Constant
;
import
com.mints.xunmi.common.Constant
;
import
com.mints.xunmi.manager.MainAmapLocationManager
;
import
com.mints.xunmi.manager.MainAmapLocationManager
;
...
@@ -93,6 +94,8 @@ public class MainActivity extends BaseActivity implements MainView {
...
@@ -93,6 +94,8 @@ public class MainActivity extends BaseActivity implements MainView {
@Override
@Override
public
void
onDestroy
()
{
public
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
TopOnNativeAd
.
INSTANCE
.
onDestroy
();
}
}
@Override
@Override
...
...
position/app/src/main/java/com/mints/xunmi/ui/activitys/SplashADActivity.java
View file @
f990cdfb
This diff is collapsed.
Click to expand it.
position/app/src/main/java/com/mints/xunmi/ui/activitys/SplashAdShowActivity.java
View file @
f990cdfb
...
@@ -2,6 +2,7 @@ package com.mints.xunmi.ui.activitys;
...
@@ -2,6 +2,7 @@ package com.mints.xunmi.ui.activitys;
import
android.os.CountDownTimer
;
import
android.os.CountDownTimer
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
...
@@ -163,5 +164,11 @@ public class SplashAdShowActivity extends BaseActivity implements ATSplashAdList
...
@@ -163,5 +164,11 @@ public class SplashAdShowActivity extends BaseActivity implements ATSplashAdList
}
}
}
}
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
return
true
;
}
return
super
.
onKeyDown
(
keyCode
,
event
);
}
}
}
position/app/src/main/java/com/mints/xunmi/ui/activitys/SplashBackActivity.java
View file @
f990cdfb
...
@@ -2,6 +2,7 @@ package com.mints.xunmi.ui.activitys;
...
@@ -2,6 +2,7 @@ package com.mints.xunmi.ui.activitys;
import
android.os.CountDownTimer
;
import
android.os.CountDownTimer
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
...
@@ -128,5 +129,11 @@ public class SplashBackActivity extends BaseActivity implements ATSplashAdListen
...
@@ -128,5 +129,11 @@ public class SplashBackActivity extends BaseActivity implements ATSplashAdListen
}
}
}
}
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
return
true
;
}
return
super
.
onKeyDown
(
keyCode
,
event
);
}
}
}
position/app/src/main/java/com/mints/xunmi/ui/fragment/MainFragment.kt
View file @
f990cdfb
...
@@ -3,14 +3,13 @@ package com.mints.xunmi.ui.fragment
...
@@ -3,14 +3,13 @@ package com.mints.xunmi.ui.fragment
import
android.Manifest
import
android.Manifest
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.os.Message
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
android.widget.FrameLayout
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.mints.library.recyclerview.HeaderAndFooterRecyclerViewAdapter
import
com.mints.library.recyclerview.HeaderAndFooterRecyclerViewAdapter
import
com.mints.library.recyclerview.RecyclerViewUtils
import
com.mints.library.recyclerview.RecyclerViewUtils
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.mints.xunmi.BuildConfig
import
com.mints.xunmi.R
import
com.mints.xunmi.R
import
com.mints.xunmi.ad.TopOnNativeAd
import
com.mints.xunmi.ad.TopOnNativeAd
import
com.mints.xunmi.common.AppConfig
import
com.mints.xunmi.common.AppConfig
...
@@ -26,7 +25,10 @@ import com.mints.xunmi.ui.adapter.MyConcernedPeopleAdapter
...
@@ -26,7 +25,10 @@ import com.mints.xunmi.ui.adapter.MyConcernedPeopleAdapter
import
com.mints.xunmi.ui.adapter.MyMainConcernedPeopleAdapterFooter
import
com.mints.xunmi.ui.adapter.MyMainConcernedPeopleAdapterFooter
import
com.mints.xunmi.ui.fragment.base.BaseFragment
import
com.mints.xunmi.ui.fragment.base.BaseFragment
import
com.mints.xunmi.ui.widgets.*
import
com.mints.xunmi.ui.widgets.*
import
com.mints.xunmi.utils.LogUtil
import
com.mints.xunmi.utils.SPUtil
import
com.mints.xunmi.utils.SPUtil
import
com.mints.xunmi.utils.WeakHandler
import
com.mints.xunmi.utils.WeakHandler.IHandler
import
com.tbruyelle.rxpermissions.RxPermissions
import
com.tbruyelle.rxpermissions.RxPermissions
import
kotlinx.android.synthetic.main.fragment_main_first.*
import
kotlinx.android.synthetic.main.fragment_main_first.*
...
@@ -36,10 +38,17 @@ import kotlinx.android.synthetic.main.fragment_main_first.*
...
@@ -36,10 +38,17 @@ import kotlinx.android.synthetic.main.fragment_main_first.*
* 时间:2020/6/4 17:30
* 时间:2020/6/4 17:30
*/
*/
class
MainFragment
:
BaseFragment
()
class
MainFragment
:
BaseFragment
()
,
MainFragmentView
,
MyConcernedPeopleAdapter
.
OnItemClickListener
,
View
.
OnClickListener
{
,
MainFragmentView
,
MyConcernedPeopleAdapter
.
OnItemClickListener
,
View
.
OnClickListener
,
IHandler
{
private
val
TAG
=
MainFragment
::
class
.
java
.
simpleName
private
val
TAG
=
MainFragment
::
class
.
java
.
simpleName
/*首页位置刷新相关*/
private
var
refreshLocationFlag
=
true
private
val
LOCATION_TIME
:
Long
=
3000
private
val
LOCATION_MSG
:
Int
=
102
private
var
mHandler
:
WeakHandler
?
=
null
private
var
friendsSetBottomDialog
:
FriendsSetBottomDialog
?
=
null
private
var
friendsSetBottomDialog
:
FriendsSetBottomDialog
?
=
null
private
var
powerDialog
:
PowerDialog
?
=
null
private
var
powerDialog
:
PowerDialog
?
=
null
private
var
messageDialog
:
MessageDialog
?
=
null
private
var
messageDialog
:
MessageDialog
?
=
null
...
@@ -69,7 +78,7 @@ class MainFragment : BaseFragment()
...
@@ -69,7 +78,7 @@ class MainFragment : BaseFragment()
context
?.
let
{
context
?.
let
{
TopOnNativeAd
.
init
(
it
)
TopOnNativeAd
.
init
(
it
)
TopOnNativeAd
.
loadNativeAd
(
it
,
null
)
TopOnNativeAd
.
loadNativeAd
(
null
)
}
}
linearLayoutManager
=
LinearLayoutManager
(
activity
)
linearLayoutManager
=
LinearLayoutManager
(
activity
)
...
@@ -85,6 +94,8 @@ class MainFragment : BaseFragment()
...
@@ -85,6 +94,8 @@ class MainFragment : BaseFragment()
// discountDialog()
// discountDialog()
// }
// }
// }
// }
mHandler
=
WeakHandler
(
this
)
}
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
...
@@ -129,27 +140,34 @@ class MainFragment : BaseFragment()
...
@@ -129,27 +140,34 @@ class MainFragment : BaseFragment()
getCares
(
null
)
getCares
(
null
)
mainFragmentPresenter
?.
userLogin
(
context
!!
)
mainFragmentPresenter
?.
userLogin
(
context
!!
)
}
}
// refreshLocationFlag = true
mHandler
?.
sendEmptyMessageDelayed
(
LOCATION_MSG
,
LOCATION_TIME
)
}
}
}
}
override
fun
onPause
()
{
super
.
onPause
()
refreshLocationFlag
=
false
}
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
mHandler
?.
removeCallbacksAndMessages
(
null
)
mHandler
=
null
mainFragmentPresenter
.
detachView
()
mainFragmentPresenter
.
detachView
()
}
}
override
fun
getCares
(
data
:
MyCareBean
?)
{
override
fun
getCares
(
data
:
MyCareBean
?)
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
())
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
())
{
myConcernedPeopleBeanArrayList
=
arrayListOf
<
MyCareBean
.
ListBean
>()
myConcernedPeopleBeanArrayList
=
arrayListOf
<
MyCareBean
.
ListBean
>()
val
people
=
MyCareBean
.
ListBean
()
myConcernedPeopleBeanArrayList
?.
addAll
(
listOf
(
getMyLocationInfo
()))
people
.
cmobile
=
"我自己"
people
.
update
=
System
.
currentTimeMillis
()
/
1000
people
.
gpsMsg
=
AppConfig
.
curAddress
people
.
cuid
=
Constant
.
MY_USER_UID
(
myConcernedPeopleBeanArrayList
as
ArrayList
<
MyCareBean
.
ListBean
>).
addAll
(
listOf
(
people
))
if
(
data
!=
null
&&
data
.
list
!=
null
&&
data
.
list
.
size
>
0
)
{
if
(
data
!=
null
&&
data
.
list
!=
null
&&
data
.
list
.
size
>
0
)
{
(
myConcernedPeopleBeanArrayList
as
ArrayList
<
MyCareBean
.
ListBean
>)
.
addAll
(
data
.
list
)
myConcernedPeopleBeanArrayList
?
.
addAll
(
data
.
list
)
}
}
initRvView
()
initRvView
()
...
@@ -298,7 +316,7 @@ class MainFragment : BaseFragment()
...
@@ -298,7 +316,7 @@ class MainFragment : BaseFragment()
}
}
private
fun
initManager
()
{
private
fun
initManager
()
{
spUtil
=
SPUtil
.
getInstance
(
context
)
spUtil
=
SPUtil
.
getInstance
()
userManager
=
UserManager
.
getInstance
()
userManager
=
UserManager
.
getInstance
()
// 首次安装APP时,只弹一次权限声明
// 首次安装APP时,只弹一次权限声明
...
@@ -410,22 +428,46 @@ class MainFragment : BaseFragment()
...
@@ -410,22 +428,46 @@ class MainFragment : BaseFragment()
* 五折弹窗
* 五折弹窗
*/
*/
private
fun
discountDialog
()
{
private
fun
discountDialog
()
{
discountDialog
=
DiscountDialog
(
context
,
object
:
DialogListener
()
{
// discountDialog = DiscountDialog(context, object : DialogListener() {
override
fun
onClick
(
v
:
View
)
{
// override fun onClick(v: View) {
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
()
&&
// if (activity != null && !activity!!.isFinishing() &&
discountDialog
!=
null
&&
discountDialog
!!
.
isShowing
())
{
// discountDialog != null && discountDialog!!.isShowing()) {
discountDialog
!!
.
onDestory
()
// discountDialog!!.onDestory()
discountDialog
!!
.
dismiss
()
// discountDialog!!.dismiss()
}
// }
when
(
v
.
id
)
{
// when (v.id) {
R
.
id
.
tv_dialog_discount
->
{
// R.id.tv_dialog_discount -> {
if
(!
userManager
?.
vipFlag
!!
)
{
// if (!userManager?.vipFlag!!) {
activity
?.
let
{
VipPayManager
.
getInstance
(
it
)
!!
.
gotoPayPage
(
3
)
}
// activity?.let { VipPayManager.getInstance(it)!!.gotoPayPage(3) }
// }
// }
// }
// }
// })
// discountDialog!!.show()
}
}
override
fun
handleMsg
(
msg
:
Message
?)
{
if
(
msg
?.
what
==
LOCATION_MSG
)
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
()
&&
refreshLocationFlag
)
{
LogUtil
.
d
(
TAG
,
"mainfragment handleMsg"
)
mHandler
?.
sendEmptyMessageDelayed
(
LOCATION_MSG
,
LOCATION_TIME
)
myConcernedPeopleBeanArrayList
?.
set
(
0
,
getMyLocationInfo
())
myConcernedPeopleAdapter
.
notifyItemChanged
(
0
)
}
}
}
}
}
}
})
discountDialog
!!
.
show
()
fun
getMyLocationInfo
():
MyCareBean
.
ListBean
{
val
people
=
MyCareBean
.
ListBean
()
people
.
cmobile
=
"我自己"
people
.
update
=
System
.
currentTimeMillis
()
/
1000
people
.
gpsMsg
=
AppConfig
.
curAddress
people
.
cuid
=
Constant
.
MY_USER_UID
return
people
}
}
}
}
\ No newline at end of file
position/app/src/main/java/com/mints/xunmi/ui/fragment/MyFragment.kt
View file @
f990cdfb
...
@@ -68,7 +68,7 @@ class MyFragment : BaseFragment()
...
@@ -68,7 +68,7 @@ class MyFragment : BaseFragment()
}
}
myPresenter
.
attachView
(
this
)
myPresenter
.
attachView
(
this
)
spUtil
=
SPUtil
.
getInstance
(
context
)
spUtil
=
SPUtil
.
getInstance
()
userManager
=
UserManager
.
getInstance
()
userManager
=
UserManager
.
getInstance
()
drawable
=
activity
?.
let
{
ContextCompat
.
getDrawable
(
it
,
R
.
mipmap
.
ic_launcher
)
}
drawable
=
activity
?.
let
{
ContextCompat
.
getDrawable
(
it
,
R
.
mipmap
.
ic_launcher
)
}
initListener
()
initListener
()
...
@@ -92,7 +92,7 @@ class MyFragment : BaseFragment()
...
@@ -92,7 +92,7 @@ class MyFragment : BaseFragment()
myPresenter
?.
userLogin
(
context
!!
)
myPresenter
?.
userLogin
(
context
!!
)
}
}
// context?.let { TopOnNativeAd.loadNativeAd(it, flMyAdContainer) }
TopOnNativeAd
.
loadNativeAd
(
flMyAdContainer
)
}
}
}
}
...
@@ -168,7 +168,6 @@ class MyFragment : BaseFragment()
...
@@ -168,7 +168,6 @@ class MyFragment : BaseFragment()
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
TopOnNativeAd
.
onDestroy
()
myPresenter
.
detachView
()
myPresenter
.
detachView
()
}
}
...
@@ -187,12 +186,6 @@ class MyFragment : BaseFragment()
...
@@ -187,12 +186,6 @@ class MyFragment : BaseFragment()
override
fun
getSysBaseMsg
(
msgNum
:
Int
,
notifyNum
:
Int
,
phone
:
String
)
{
override
fun
getSysBaseMsg
(
msgNum
:
Int
,
notifyNum
:
Int
,
phone
:
String
)
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
())
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
())
{
// if (msgNum >= 1) {
// ivMyFragmentNofity.setImageResource(R.mipmap.ic_main_msg_enable)
// } else {
// ivMyFragmentNofity.setImageResource(R.mipmap.ic_main_msg)
// }
if
(
notifyNum
>=
1
)
{
if
(
notifyNum
>=
1
)
{
messageDialog
()
messageDialog
()
}
}
...
@@ -271,21 +264,6 @@ class MyFragment : BaseFragment()
...
@@ -271,21 +264,6 @@ class MyFragment : BaseFragment()
readyGo
(
WebActivity
::
class
.
java
,
bundle
)
readyGo
(
WebActivity
::
class
.
java
,
bundle
)
}
}
R
.
id
.
rlMyShare
->
{
R
.
id
.
rlMyShare
->
{
// sendSMS(BuildConfig.MainIp + "instructions.html")
// val wechat_sp = ShareParams()
// wechat_sp.shareType = Platform.SHARE_WEBPAGE
// wechat_sp.title = Constant.SHARE_TITLE
// wechat_sp.text = Constant.SHARE_CONTENT
// wechat_sp.imageData = ImageUtil.drawableToBitmap(drawable)
// wechat_sp.url = Constant.SHARE_URL
// val wechat = ShareSDK.getPlatform(Wechat.NAME)
// if (wechat.isClientValid) {
// // 执行图文分享
// wechat.share(wechat_sp)
// } else {
// showToast("请先安装微信")
// }
bottomDialog
=
BottomDialog
.
create
(
supportFragmentManager
)
bottomDialog
=
BottomDialog
.
create
(
supportFragmentManager
)
.
setViewListener
{
v
->
.
setViewListener
{
v
->
v
.
findViewById
<
LinearLayout
>(
R
.
id
.
llDialogShareWx
).
setOnClickListener
(
this
)
v
.
findViewById
<
LinearLayout
>(
R
.
id
.
llDialogShareWx
).
setOnClickListener
(
this
)
...
@@ -326,22 +304,6 @@ class MyFragment : BaseFragment()
...
@@ -326,22 +304,6 @@ class MyFragment : BaseFragment()
}
}
AppPackageUsageUtils
.
gotoMessage
(
context
,
""
)
AppPackageUsageUtils
.
gotoMessage
(
context
,
""
)
// val sp = ShareParams()
// sp.title = Constant.SHARE_TITLE
// sp.titleUrl = Constant.SHARE_URL
// sp.text = Constant.SHARE_CONTENT
// sp.site = getString(R.string.app_name)
// sp.siteUrl = Constant.SHARE_URL
// val qq = ShareSDK.getPlatform(QQ.NAME)
// if (qq.isClientValid) {
// // 执行图文分享
// qq.share(sp)
// } else {
// showToast("请先安装QQ")
// }
}
}
R
.
id
.
tvDialogShareNext
->
{
R
.
id
.
tvDialogShareNext
->
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
())
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
())
{
...
...
position/app/src/main/java/com/mints/xunmi/ui/fragment/PositionFragment.kt
View file @
f990cdfb
...
@@ -6,6 +6,7 @@ import android.content.Intent
...
@@ -6,6 +6,7 @@ import android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.os.Message
import
android.provider.Settings
import
android.provider.Settings
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.LayoutInflater
...
@@ -29,6 +30,7 @@ import com.mints.xunmi.ui.activitys.CarePeopleActivity
...
@@ -29,6 +30,7 @@ import com.mints.xunmi.ui.activitys.CarePeopleActivity
import
com.mints.xunmi.ui.activitys.MyLocusActivity
import
com.mints.xunmi.ui.activitys.MyLocusActivity
import
com.mints.xunmi.utils.LogUtil
import
com.mints.xunmi.utils.LogUtil
import
com.mints.xunmi.utils.TimeRender
import
com.mints.xunmi.utils.TimeRender
import
com.mints.xunmi.utils.WeakHandler
import
com.tbruyelle.rxpermissions.RxPermissions
import
com.tbruyelle.rxpermissions.RxPermissions
import
kotlinx.android.synthetic.main.fragment_main_position.*
import
kotlinx.android.synthetic.main.fragment_main_position.*
import
java.util.*
import
java.util.*
...
@@ -39,10 +41,16 @@ import java.util.*
...
@@ -39,10 +41,16 @@ import java.util.*
* 时间:2020/6/4 17:30
* 时间:2020/6/4 17:30
*/
*/
class
PositionFragment
:
Fragment
()
class
PositionFragment
:
Fragment
()
,
PositionView
,
View
.
OnClickListener
{
,
PositionView
,
View
.
OnClickListener
,
WeakHandler
.
IHandler
{
private
val
TAG
=
PositionFragment
::
class
.
java
.
simpleName
private
val
TAG
=
PositionFragment
::
class
.
java
.
simpleName
/*首页位置刷新相关*/
private
var
refreshLocationFlag
=
true
private
val
LOCATION_TIME
:
Long
=
3000
private
val
LOCATION_MSG
:
Int
=
103
private
var
mHandler
:
WeakHandler
?
=
null
private
lateinit
var
positionPresenter
:
PositionPresenter
private
lateinit
var
positionPresenter
:
PositionPresenter
private
var
mapLayout
:
View
?
=
null
private
var
mapLayout
:
View
?
=
null
...
@@ -82,6 +90,7 @@ class PositionFragment : Fragment()
...
@@ -82,6 +90,7 @@ class PositionFragment : Fragment()
positionPresenter
?.
userLogin
(
context
!!
)
positionPresenter
?.
userLogin
(
context
!!
)
}
}
mHandler
=
WeakHandler
(
this
)
initMapStyle
()
initMapStyle
()
initListener
()
initListener
()
...
@@ -120,19 +129,21 @@ class PositionFragment : Fragment()
...
@@ -120,19 +129,21 @@ class PositionFragment : Fragment()
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
if
(
AppConfig
.
fragmentClickFlag
===
Constant
.
FRAGMENT_CLICK_POSITION
)
{
if
(
AppConfig
.
fragmentClickFlag
===
Constant
.
FRAGMENT_CLICK_POSITION
)
{
tvFragmentPositionPosition
.
text
=
AppConfig
.
curAddress
tvFragmentPositionPosition
.
text
=
AppConfig
.
curAddress
tvFragmentPositionDate
.
text
=
TimeRender
.
formatDate
(
Date
(),
TimeRender
.
ALL_FORMAT_LINE2
)
tvFragmentPositionDate
.
text
=
TimeRender
.
formatDate
(
Date
(),
TimeRender
.
ALL_FORMAT_LINE2
)
if
(
mapPosition
!=
null
)
{
if
(
mapPosition
!=
null
)
{
mapPosition
.
onResume
()
mapPosition
.
onResume
()
}
}
LogUtil
.
d
(
TAG
,
" PositionFragment onResume"
)
mHandler
?.
sendEmptyMessageDelayed
(
LOCATION_MSG
,
LOCATION_TIME
)
}
}
}
}
override
fun
onPause
()
{
override
fun
onPause
()
{
super
.
onPause
()
super
.
onPause
()
refreshLocationFlag
=
false
if
(
mapPosition
!=
null
)
{
if
(
mapPosition
!=
null
)
{
mapPosition
.
onPause
()
mapPosition
.
onPause
()
}
}
...
@@ -148,6 +159,9 @@ class PositionFragment : Fragment()
...
@@ -148,6 +159,9 @@ class PositionFragment : Fragment()
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
mHandler
?.
removeCallbacksAndMessages
(
null
)
mHandler
=
null
mMap
?.
let
{
mMap
?.
let
{
mMap
!!
.
setOnMyLocationChangeListener
(
null
)
mMap
!!
.
setOnMyLocationChangeListener
(
null
)
mMap
=
null
mMap
=
null
...
@@ -191,20 +205,20 @@ class PositionFragment : Fragment()
...
@@ -191,20 +205,20 @@ class PositionFragment : Fragment()
// 实现定位蓝点
// 实现定位蓝点
myLocationStyle
=
MyLocationStyle
()
//初始化定位蓝点样式类myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE)//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。
myLocationStyle
=
MyLocationStyle
()
//初始化定位蓝点样式类myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE)//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。
myLocationStyle
?.
let
{
myLocationStyle
?.
let
{
myLocationStyle
!!
.
showMyLocation
(
true
)
//设置是否显示定位小蓝点,用于满足只想使用定位,不想使用定位小蓝点的场景,设置false以后图面上不再有定位蓝点的概念,但是会持续回调位置信息。
it
.
showMyLocation
(
true
)
//设置是否显示定位小蓝点,用于满足只想使用定位,不想使用定位小蓝点的场景,设置false以后图面上不再有定位蓝点的概念,但是会持续回调位置信息。
myLocationStyle
!!
.
interval
(
5000
)
//设置连续定位模式下的定位间隔,只在连续定位模式下生效,单次定位模式下不会生效。单位为毫秒。
it
.
interval
(
5000
)
//设置连续定位模式下的定位间隔,只在连续定位模式下生效,单次定位模式下不会生效。单位为毫秒。
}
}
mMap
?.
let
{
mMap
?.
let
{
uiSettings
=
mMap
!!
.
getUiSettings
()
uiSettings
=
it
.
getUiSettings
()
mMap
!!
.
moveCamera
(
CameraUpdateFactory
.
zoomTo
(
16F
))
//设置希望展示的地图缩放级别
it
.
moveCamera
(
CameraUpdateFactory
.
zoomTo
(
16F
))
//设置希望展示的地图缩放级别
mMap
!!
.
setMyLocationStyle
(
myLocationStyle
!!
.
myLocationType
(
MyLocationStyle
.
LOCATION_TYPE_LOCATION_ROTATE
))
//连续定位、且将视角移动到地图中心点,定位蓝点跟随设备移动
it
.
setMyLocationStyle
(
myLocationStyle
!!
.
myLocationType
(
MyLocationStyle
.
LOCATION_TYPE_LOCATION_ROTATE
))
//连续定位、且将视角移动到地图中心点,定位蓝点跟随设备移动
mMap
!!
.
setMyLocationEnabled
(
true
)
// 设置为true表示启动显示定位蓝点,false表示隐藏定位蓝点并不进行定位,默认是false。
it
.
setMyLocationEnabled
(
true
)
// 设置为true表示启动显示定位蓝点,false表示隐藏定位蓝点并不进行定位,默认是false。
}
}
uiSettings
?.
let
{
uiSettings
?.
let
{
uiSettings
!!
.
setMyLocationButtonEnabled
(
false
)
//设置默认定位按钮是否显示
it
.
setMyLocationButtonEnabled
(
false
)
//设置默认定位按钮是否显示
uiSettings
!!
.
setScaleControlsEnabled
(
false
)
//设置地图默认的比例尺是否显示
it
.
setScaleControlsEnabled
(
false
)
//设置地图默认的比例尺是否显示
uiSettings
!!
.
setZoomControlsEnabled
(
false
)
//设置缩放按钮
it
.
setZoomControlsEnabled
(
false
)
//设置缩放按钮
}
}
}
}
...
@@ -215,15 +229,12 @@ class PositionFragment : Fragment()
...
@@ -215,15 +229,12 @@ class PositionFragment : Fragment()
}
}
override
fun
showLoading
(
msg
:
String
?)
{
override
fun
showLoading
(
msg
:
String
?)
{
TODO
(
"Not yet implemented"
)
}
}
override
fun
showToast
(
msg
:
String
?)
{
override
fun
showToast
(
msg
:
String
?)
{
TODO
(
"Not yet implemented"
)
}
}
override
fun
hideLoading
()
{
override
fun
hideLoading
()
{
TODO
(
"Not yet implemented"
)
}
}
override
fun
getBaseApplication
():
MintsApplication
=
activity
?.
application
as
MintsApplication
override
fun
getBaseApplication
():
MintsApplication
=
activity
?.
application
as
MintsApplication
...
@@ -263,4 +274,18 @@ class PositionFragment : Fragment()
...
@@ -263,4 +274,18 @@ class PositionFragment : Fragment()
builder
.
setCancelable
(
false
)
builder
.
setCancelable
(
false
)
builder
.
show
()
builder
.
show
()
}
}
override
fun
handleMsg
(
msg
:
Message
?)
{
if
(
msg
?.
what
==
LOCATION_MSG
)
{
if
(
activity
!=
null
&&
!
activity
!!
.
isFinishing
()
&&
refreshLocationFlag
)
{
LogUtil
.
d
(
TAG
,
"PositionFragment handleMsg"
)
tvFragmentPositionPosition
?.
text
=
AppConfig
.
curAddress
tvFragmentPositionDate
?.
text
=
TimeRender
.
formatDate
(
Date
(),
TimeRender
.
ALL_FORMAT_LINE2
)
mHandler
?.
sendEmptyMessageDelayed
(
LOCATION_MSG
,
LOCATION_TIME
)
}
}
}
}
}
\ No newline at end of file
position/app/src/main/java/com/mints/xunmi/utils/SPUtil.java
View file @
f990cdfb
...
@@ -3,6 +3,8 @@ package com.mints.xunmi.utils;
...
@@ -3,6 +3,8 @@ package com.mints.xunmi.utils;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
com.mints.xunmi.MintsApplication
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -22,9 +24,9 @@ public class SPUtil {
...
@@ -22,9 +24,9 @@ public class SPUtil {
private
static
SPUtil
spUtil
;
private
static
SPUtil
spUtil
;
public
static
SPUtil
getInstance
(
Context
context
)
{
public
static
SPUtil
getInstance
()
{
if
(
spUtil
==
null
)
{
if
(
spUtil
==
null
)
{
mContext
=
context
;
mContext
=
MintsApplication
.
getContext
()
;
spUtil
=
new
SPUtil
();
spUtil
=
new
SPUtil
();
mPreferences
=
mContext
.
getSharedPreferences
(
mShareName
,
Context
.
MODE_PRIVATE
);
mPreferences
=
mContext
.
getSharedPreferences
(
mShareName
,
Context
.
MODE_PRIVATE
);
}
}
...
...
position/app/src/main/res/layout/fragment_main_my.xml
View file @
f990cdfb
...
@@ -399,6 +399,7 @@
...
@@ -399,6 +399,7 @@
android:scaleType=
"fitXY"
android:scaleType=
"fitXY"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20pt"
android:layout_marginTop=
"20pt"
android:layout_marginBottom=
"20pt"
android:src=
"@mipmap/bg_banner"
/>
android:src=
"@mipmap/bg_banner"
/>
</LinearLayout>
</LinearLayout>
...
...
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