Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
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
1
Merge Requests
1
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
lify
RvApp
Commits
3dfa4f57
Commit
3dfa4f57
authored
Jul 02, 2019
by
jianglx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改会员模块的bug;完善升级提示框的ui
parent
8fa9d751
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
847 additions
and
85 deletions
+847
-85
MainActivity.java
RvClient/src/main/java/com/test/rv/MainActivity.java
+1
-1
SettingActivity.java
...src/main/java/com/rv/rvmine/traveler/SettingActivity.java
+1
-1
MemberCenterActivity.java
...ber/src/main/java/com/rv.member/MemberCenterActivity.java
+12
-10
MemberListAdapter.java
...rc/main/java/com/rv.member/adapter/MemberListAdapter.java
+29
-9
shape_rv_bg_btn_grap_yellow.xml
...ber/src/main/res/drawable/shape_rv_bg_btn_grap_yellow.xml
+5
-0
activity_member.xml
plugin_member/src/main/res/layout/activity_member.xml
+6
-6
item_member_detail_view.xml
...in_member/src/main/res/layout/item_member_detail_view.xml
+1
-1
view_member_privilege.xml
plugin_member/src/main/res/layout/view_member_privilege.xml
+3
-4
VersionUpdateDialog.java
...ion/src/main/java/com/rv/version/VersionUpdateDialog.java
+33
-16
UpdateBean.java
...version/src/main/java/com/rv/version/bean/UpdateBean.java
+114
-0
VersionCheckBean.java
...n/src/main/java/com/rv/version/bean/VersionCheckBean.java
+9
-0
ConfirmDialog.java
...rc/main/java/com/rv/version/customview/ConfirmDialog.java
+60
-0
UpdateAppReceiver.java
.../main/java/com/rv/version/receiver/UpdateAppReceiver.java
+5
-1
DownloadAppUtils.java
...n/src/main/java/com/rv/version/util/DownloadAppUtils.java
+84
-0
UpdateAppUtils.java
...ion/src/main/java/com/rv/version/util/UpdateAppUtils.java
+180
-0
bg_version_btn.xml
plugin_version/src/main/res/drawable-hdpi/bg_version_btn.xml
+5
-0
home_icon_close.png
...in_version/src/main/res/drawable-hdpi/home_icon_close.png
+0
-0
home_icon_close.png
...n_version/src/main/res/drawable-xhdpi/home_icon_close.png
+0
-0
home_icon_close.png
..._version/src/main/res/drawable-xxhdpi/home_icon_close.png
+0
-0
home_icon_close.png
...version/src/main/res/drawable-xxxhdpi/home_icon_close.png
+0
-0
bg_dialog_confirm.xml
plugin_version/src/main/res/drawable/bg_dialog_confirm.xml
+9
-0
dialog_content_bg.xml
plugin_version/src/main/res/drawable/dialog_content_bg.xml
+7
-0
icon_dialog_top.png
plugin_version/src/main/res/drawable/icon_dialog_top.png
+0
-0
dialog_confirm.xml
plugin_version/src/main/res/layout/dialog_confirm.xml
+86
-0
dialog_update_view.xml
plugin_version/src/main/res/layout/dialog_update_view.xml
+49
-36
view_version_tips_dialog.xml
..._version/src/main/res/layout/view_version_tips_dialog.xml
+87
-0
colors.xml
plugin_version/src/main/res/values/colors.xml
+8
-0
styles.xml
plugin_version/src/main/res/values/styles.xml
+49
-0
update_file_paths.xml
plugin_version/src/main/res/xml/update_file_paths.xml
+4
-0
No files found.
RvClient/src/main/java/com/test/rv/MainActivity.java
View file @
3dfa4f57
...
@@ -120,7 +120,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> {
...
@@ -120,7 +120,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> {
.
apkPath
(
versionCheckBean
.
getData
().
getDownloadUrl
())
.
apkPath
(
versionCheckBean
.
getData
().
getDownloadUrl
())
.
updateInfo
(
versionCheckBean
.
getData
().
getContent
())
.
updateInfo
(
versionCheckBean
.
getData
().
getContent
())
.
apkSize
(
versionCheckBean
.
getData
().
getPackagesize
())
.
apkSize
(
versionCheckBean
.
getData
().
getPackagesize
())
.
isForce
(
fals
e
)
.
isForce
(
versionCheckBean
.
getData
().
getIsCompe
()
==
0
?
false
:
tru
e
)
.
update
();
.
update
();
}
}
}
}
...
...
module_mine/src/main/java/com/rv/rvmine/traveler/SettingActivity.java
View file @
3dfa4f57
...
@@ -64,7 +64,7 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
...
@@ -64,7 +64,7 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
.
apkPath
(
versionCheckBean
.
getData
().
getDownloadUrl
())
.
apkPath
(
versionCheckBean
.
getData
().
getDownloadUrl
())
.
updateInfo
(
versionCheckBean
.
getData
().
getContent
())
.
updateInfo
(
versionCheckBean
.
getData
().
getContent
())
.
apkSize
(
versionCheckBean
.
getData
().
getPackagesize
())
.
apkSize
(
versionCheckBean
.
getData
().
getPackagesize
())
.
isForce
(
fals
e
)
.
isForce
(
versionCheckBean
.
getData
().
getIsCompe
()
==
0
?
false
:
tru
e
)
.
update
();
.
update
();
}
}
}
else
{
}
else
{
...
...
plugin_member/src/main/java/com/rv.member/MemberCenterActivity.java
View file @
3dfa4f57
...
@@ -149,22 +149,23 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
...
@@ -149,22 +149,23 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
}
}
@OnClick
({
R2
.
id
.
iv_avatar
,
R2
.
id
.
tv_login
,
R2
.
id
.
tv_verified
})
@OnClick
({
R2
.
id
.
iv_avatar
,
R2
.
id
.
tv_login
,
R2
.
id
.
tv_verified
,
R2
.
id
.
iv_title
})
public
void
onViewClicked
(
View
view
)
{
public
void
onViewClicked
(
View
view
)
{
int
id
=
view
.
getId
();
int
id
=
view
.
getId
();
if
(
id
==
R
.
id
.
iv_avatar
)
{
if
(
id
==
R
.
id
.
iv_avatar
)
{
//头像
//头像
if
(
isLogin
())
return
;
if
(
!
isLogin
())
return
;
}
else
if
(
id
==
R
.
id
.
tv_login
)
{
}
else
if
(
id
==
R
.
id
.
tv_login
)
{
//登录
if
(!
isLogin
())
return
;
startActivityForResult
(
LoginRvActivity
.
getIntent
(
MemberCenterActivity
.
this
),
REQUEST_LOGIN
);
}
else
if
(
id
==
R
.
id
.
tv_verified
)
{
}
else
if
(
id
==
R
.
id
.
tv_verified
)
{
//实名认证
//实名认证
if
(
isLogin
())
return
;
if
(
!
isLogin
())
return
;
ComponentName
componentName
=
new
ComponentName
(
MemberCenterActivity
.
this
,
"com.rv.rvmine.personal.IDCardCertificationActivity"
);
ComponentName
componentName
=
new
ComponentName
(
MemberCenterActivity
.
this
,
"com.rv.rvmine.personal.IDCardCertificationActivity"
);
Intent
intent
=
new
Intent
();
Intent
intent
=
new
Intent
();
intent
.
setComponent
(
componentName
);
intent
.
setComponent
(
componentName
);
startActivityForResult
(
intent
,
REQUEST_VERIFIED
);
startActivityForResult
(
intent
,
REQUEST_VERIFIED
);
}
else
if
(
id
==
R
.
id
.
iv_title
)
{
finish
();
}
}
}
}
...
@@ -175,11 +176,11 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
...
@@ -175,11 +176,11 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
*/
*/
private
boolean
isLogin
()
{
private
boolean
isLogin
()
{
if
(
TextUtils
.
isEmpty
(
OkGoUtil
.
getToken
()))
{
if
(
TextUtils
.
isEmpty
(
OkGoUtil
.
getToken
()))
{
startActivity
(
LoginRvActivity
.
getIntent
(
this
));
startActivityForResult
(
LoginRvActivity
.
getIntent
(
MemberCenterActivity
.
this
),
REQUEST_LOGIN
);
return
true
;
}
return
false
;
return
false
;
}
}
return
true
;
}
@Override
@Override
...
@@ -222,7 +223,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
...
@@ -222,7 +223,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
}
}
tvConsumeRecord
.
setText
(
info
.
getPayCount
()
+
"\n 消费记录"
);
tvConsumeRecord
.
setText
(
info
.
getPayCount
()
+
"\n 消费记录"
);
tv
FreeDay
.
setText
(
info
.
getRentFreeDays
()
+
"\n 可免费租车 (天)"
);
tv
PurchaseRecord
.
setText
(
info
.
getRentFreeDays
()
+
"\n 可免费租车 (天)"
);
tvFreeDay
.
setText
(
info
.
getBuyCount
()
+
"\n 购买记录 (次)"
);
tvFreeDay
.
setText
(
info
.
getBuyCount
()
+
"\n 购买记录 (次)"
);
}
}
...
@@ -239,7 +240,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
...
@@ -239,7 +240,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
ivMember
.
setVisibility
(
View
.
VISIBLE
);
ivMember
.
setVisibility
(
View
.
VISIBLE
);
if
(
info
.
getIsMember
()
==
0
)
{
if
(
info
.
getIsMember
()
==
0
)
{
memberLevel
=
1
;
memberLevel
=
0
;
if
(
adapter
!=
null
)
{
if
(
adapter
!=
null
)
{
adapter
.
setMemberLevel
(
memberLevel
);
adapter
.
setMemberLevel
(
memberLevel
);
}
}
...
@@ -284,6 +285,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
...
@@ -284,6 +285,7 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
private
MemberListAdapter
.
PayListener
payListener
=
new
MemberListAdapter
.
PayListener
()
{
private
MemberListAdapter
.
PayListener
payListener
=
new
MemberListAdapter
.
PayListener
()
{
@Override
@Override
public
void
pay
(
final
MemberListBean
.
MemberCard
card
)
{
public
void
pay
(
final
MemberListBean
.
MemberCard
card
)
{
if
(!
isLogin
())
return
;
new
PaymentTypeSelection
(
MemberCenterActivity
.
this
)
{
new
PaymentTypeSelection
(
MemberCenterActivity
.
this
)
{
@Override
@Override
...
...
plugin_member/src/main/java/com/rv.member/adapter/MemberListAdapter.java
View file @
3dfa4f57
...
@@ -19,6 +19,7 @@ import android.widget.GridView;
...
@@ -19,6 +19,7 @@ import android.widget.GridView;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.ruiwenliu.wrapper.util.glide.GlideManager
;
import
com.ruiwenliu.wrapper.util.glide.GlideManager
;
...
@@ -36,6 +37,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -36,6 +37,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
private
int
memberLevel
;
private
int
memberLevel
;
private
GridMemerAdapter
adapter
;
private
GridMemerAdapter
adapter
;
private
MemberListBean
.
MemberCard
selectCard
;
private
MemberListBean
.
MemberCard
selectCard
;
private
int
selectPostion
;
public
interface
PayListener
{
public
interface
PayListener
{
void
pay
(
MemberListBean
.
MemberCard
card
);
void
pay
(
MemberListBean
.
MemberCard
card
);
...
@@ -55,13 +57,14 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -55,13 +57,14 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
this
.
memberLevel
=
memberLevel
;
this
.
memberLevel
=
memberLevel
;
this
.
mContext
=
context
;
this
.
mContext
=
context
;
this
.
payListener
=
listener
;
this
.
payListener
=
listener
;
selectPostion
=
1
;
initData
(
data
);
initData
(
data
);
}
}
private
void
initData
(
List
<
MemberListBean
.
MemberCard
>
data
)
{
private
void
initData
(
List
<
MemberListBean
.
MemberCard
>
data
)
{
data
.
add
(
0
,
null
);
data
.
add
(
0
,
null
);
mData
=
data
;
mData
=
data
;
selectCard
=
mData
.
get
(
1
);
selectCard
=
mData
.
get
(
selectPostion
);
}
}
...
@@ -99,23 +102,31 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -99,23 +102,31 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
}
/*******
* 是否已经同意协议
*/
private
boolean
hasAgree
=
false
;
private
void
setHeadViewData
(
final
HeadViewHolder
viewHolder
)
{
private
void
setHeadViewData
(
final
HeadViewHolder
viewHolder
)
{
setMemeberTop
(
viewHolder
);
setMemeberTop
(
viewHolder
);
SpannableString
spannableString
=
new
SpannableString
(
viewHolder
.
tv_agreement
.
getText
());
SpannableString
spannableString
=
new
SpannableString
(
viewHolder
.
tv_agreement
.
getText
());
spannableString
.
setSpan
(
new
ForegroundColorSpan
(
Color
.
parseColor
(
"#FFB74B"
)),
6
,
spannableString
.
length
(),
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
spannableString
.
setSpan
(
new
ForegroundColorSpan
(
Color
.
parseColor
(
"#FFB74B"
)),
6
,
spannableString
.
length
(),
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
viewHolder
.
tv_agreement
.
setText
(
spannableString
);
viewHolder
.
tv_agreement
.
setText
(
spannableString
);
viewHolder
.
img_agree
.
setImageResource
(
hasAgree
?
R
.
drawable
.
common_icon_selected
:
R
.
drawable
.
common_icon_radio_unche
);
viewHolder
.
btn_buy
.
setBackgroundResource
(
hasAgree
?
R
.
drawable
.
shape_rv_bg_dark_yellow
:
R
.
drawable
.
shape_rv_bg_btn_grap_yellow
);
viewHolder
.
img_agree
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
viewHolder
.
img_agree
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
if
(
viewHolder
.
agreeState
==
1
)
{
if
(
hasAgree
)
{
viewHolder
.
agreeState
=
0
;
hasAgree
=
false
;
viewHolder
.
img_agree
.
setImageResource
(
R
.
drawable
.
common_icon_radio_unche
);
viewHolder
.
img_agree
.
setImageResource
(
R
.
drawable
.
common_icon_radio_unche
);
viewHolder
.
btn_buy
.
set
Enabled
(
false
);
viewHolder
.
btn_buy
.
set
BackgroundResource
(
R
.
drawable
.
shape_rv_bg_btn_grap_yellow
);
}
else
{
}
else
{
viewHolder
.
agreeState
=
1
;
hasAgree
=
true
;
viewHolder
.
img_agree
.
setImageResource
(
R
.
drawable
.
common_icon_selected
);
viewHolder
.
img_agree
.
setImageResource
(
R
.
drawable
.
common_icon_selected
);
viewHolder
.
btn_buy
.
set
Enabled
(
true
);
viewHolder
.
btn_buy
.
set
BackgroundResource
(
R
.
drawable
.
shape_rv_bg_dark_yellow
);
}
}
}
}
});
});
...
@@ -123,6 +134,11 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -123,6 +134,11 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
viewHolder
.
btn_buy
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
viewHolder
.
btn_buy
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
if
(!
hasAgree
)
{
Toast
.
makeText
(
mContext
,
"需同意服务协议"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
if
(
payListener
!=
null
)
{
if
(
payListener
!=
null
)
{
payListener
.
pay
(
selectCard
);
payListener
.
pay
(
selectCard
);
}
}
...
@@ -162,6 +178,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -162,6 +178,7 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
@Override
@Override
public
void
select
(
MemberListBean
.
MemberCard
memberCard
)
{
public
void
select
(
MemberListBean
.
MemberCard
memberCard
)
{
selectCard
=
memberCard
;
selectCard
=
memberCard
;
selectPostion
=
mData
.
indexOf
(
memberCard
);
viewHolder
.
btn_buy
.
setText
(
"立即开通"
+
memberCard
.
getName
());
viewHolder
.
btn_buy
.
setText
(
"立即开通"
+
memberCard
.
getName
());
}
}
});
});
...
@@ -193,10 +210,12 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -193,10 +210,12 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
break
;
break
;
}
}
}
else
{
viewHolder
.
rlTop
.
setVisibility
(
View
.
GONE
);
}
}
}
}
protected
void
setCommonViewData
(
CommonViewHolder
viewHolder
,
MemberListBean
.
MemberCard
bean
)
{
protected
void
setCommonViewData
(
CommonViewHolder
viewHolder
,
final
MemberListBean
.
MemberCard
bean
)
{
if
(!
TextUtils
.
isEmpty
(
bean
.
getName
()))
{
if
(!
TextUtils
.
isEmpty
(
bean
.
getName
()))
{
viewHolder
.
tv_member_type
.
setText
(
bean
.
getName
());
viewHolder
.
tv_member_type
.
setText
(
bean
.
getName
());
viewHolder
.
btn_buy
.
setText
(
"立即开通"
+
bean
.
getName
());
viewHolder
.
btn_buy
.
setText
(
"立即开通"
+
bean
.
getName
());
...
@@ -205,7 +224,9 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -205,7 +224,9 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
viewHolder
.
btn_buy
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
viewHolder
.
btn_buy
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
if
(
payListener
!=
null
)
{
payListener
.
pay
(
bean
);
}
}
}
});
});
if
(!
TextUtils
.
isEmpty
(
bean
.
getIcon
()))
if
(!
TextUtils
.
isEmpty
(
bean
.
getIcon
()))
...
@@ -224,7 +245,6 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
...
@@ -224,7 +245,6 @@ public class MemberListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
public
class
HeadViewHolder
extends
RecyclerView
.
ViewHolder
{
public
class
HeadViewHolder
extends
RecyclerView
.
ViewHolder
{
int
agreeState
=
1
;
// 选中状态
GridView
gridview
;
GridView
gridview
;
TextView
tv_agreement
;
TextView
tv_agreement
;
ImageView
img_agree
;
ImageView
img_agree
;
...
...
plugin_member/src/main/res/drawable/shape_rv_bg_btn_grap_yellow.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"30dp"
/>
<solid
android:color=
"#FAD9A7"
/>
</shape>
\ No newline at end of file
plugin_member/src/main/res/layout/activity_member.xml
View file @
3dfa4f57
...
@@ -11,12 +11,12 @@
...
@@ -11,12 +11,12 @@
android:minHeight=
"@dimen/size_45"
>
android:minHeight=
"@dimen/size_45"
>
<ImageView
<ImageView
android:id=
"@+id/iv_title
_left
"
android:id=
"@+id/iv_title"
android:layout_width=
"@dimen/
size_32
"
android:layout_width=
"@dimen/
dp_40
"
android:layout_height=
"@dimen/
size_32
"
android:layout_height=
"@dimen/
dp_40
"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"@dimen/size_5"
android:layout_marginLeft=
"@dimen/size_5"
android:padding=
"@dimen/size_
8
"
android:padding=
"@dimen/size_
10
"
android:src=
"@drawable/rv_common_icon_back_dark"
/>
android:src=
"@drawable/rv_common_icon_back_dark"
/>
...
@@ -75,8 +75,8 @@
...
@@ -75,8 +75,8 @@
<ImageView
<ImageView
android:id=
"@+id/iv_member"
android:id=
"@+id/iv_member"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
@dimen/size_60
"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
@dimen/size_20
"
android:layout_marginTop=
"@dimen/text_10"
android:layout_marginTop=
"@dimen/text_10"
android:src=
"@drawable/mycenter_icon_goldmembership"
android:src=
"@drawable/mycenter_icon_goldmembership"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
...
...
plugin_member/src/main/res/layout/item_member_detail_view.xml
View file @
3dfa4f57
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
<TextView
<TextView
android:id=
"@+id/tv_type_icon"
android:id=
"@+id/tv_type_icon"
android:layout_width=
"@dimen/size_
6
0"
android:layout_width=
"@dimen/size_
7
0"
android:layout_height=
"@dimen/size_30"
android:layout_height=
"@dimen/size_30"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:gravity=
"center"
android:gravity=
"center"
...
...
plugin_member/src/main/res/layout/view_member_privilege.xml
View file @
3dfa4f57
...
@@ -149,7 +149,7 @@
...
@@ -149,7 +149,7 @@
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
@dimen/dp_10
"
android:layout_marginTop=
"
7dp
"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
...
@@ -160,8 +160,7 @@
...
@@ -160,8 +160,7 @@
android:paddingLeft=
"@dimen/dp_10"
android:paddingLeft=
"@dimen/dp_10"
android:paddingTop=
"@dimen/dp_10"
android:paddingTop=
"@dimen/dp_10"
android:paddingRight=
"@dimen/size_5"
android:paddingRight=
"@dimen/size_5"
android:paddingBottom=
"@dimen/dp_10"
android:paddingBottom=
"@dimen/dp_10"
/>
android:src=
"@drawable/common_icon_selected"
/>
<TextView
<TextView
android:id=
"@+id/tv_agreement"
android:id=
"@+id/tv_agreement"
...
@@ -178,7 +177,7 @@
...
@@ -178,7 +177,7 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_38"
android:layout_height=
"@dimen/size_38"
android:layout_marginLeft=
"@dimen/size_20"
android:layout_marginLeft=
"@dimen/size_20"
android:layout_marginTop=
"@dimen/size_1
5
"
android:layout_marginTop=
"@dimen/size_1
0
"
android:layout_marginRight=
"@dimen/size_20"
android:layout_marginRight=
"@dimen/size_20"
android:layout_marginBottom=
"@dimen/size_20"
android:layout_marginBottom=
"@dimen/size_20"
android:background=
"@drawable/shape_rv_bg_dark_yellow"
android:background=
"@drawable/shape_rv_bg_dark_yellow"
...
...
plugin_version/src/main/java/com/rv/version/VersionUpdateDialog.java
View file @
3dfa4f57
...
@@ -7,9 +7,12 @@ import android.text.TextUtils;
...
@@ -7,9 +7,12 @@ import android.text.TextUtils;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.rv.version.bean.UpdateBean
;
import
com.rv.version.bean.UpdateBean
;
public
class
VersionUpdateDialog
extends
Dialog
{
public
class
VersionUpdateDialog
extends
Dialog
{
public
VersionUpdateDialog
(
@NonNull
Context
context
)
{
public
VersionUpdateDialog
(
@NonNull
Context
context
)
{
...
@@ -24,9 +27,10 @@ public class VersionUpdateDialog extends Dialog {
...
@@ -24,9 +27,10 @@ public class VersionUpdateDialog extends Dialog {
private
Context
mContext
;
private
Context
mContext
;
private
UpdateBean
updateBean
;
private
UpdateBean
updateBean
;
private
TextView
txtSur
e
;
private
Button
btn_updat
e
;
private
TextView
txtContent
;
private
TextView
txtContent
;
private
TextView
txtSize
;
private
TextView
tv_version_name
;
private
ImageView
imgClose
;
private
DownloadListener
mListener
;
private
DownloadListener
mListener
;
public
Builder
(
Context
context
,
DownloadListener
listener
)
{
public
Builder
(
Context
context
,
DownloadListener
listener
)
{
...
@@ -54,33 +58,46 @@ public class VersionUpdateDialog extends Dialog {
...
@@ -54,33 +58,46 @@ public class VersionUpdateDialog extends Dialog {
*/
*/
public
VersionUpdateDialog
create
()
{
public
VersionUpdateDialog
create
()
{
LayoutInflater
inflater
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
LayoutInflater
inflater
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
final
VersionUpdateDialog
dialog
=
new
VersionUpdateDialog
(
mContext
,
R
.
style
.
CustomDialog
);
final
VersionUpdateDialog
dialog
=
new
VersionUpdateDialog
(
mContext
,
R
.
style
.
DialogActivityTheme
);
// 获取对话框的布局
// 获取对话框的布局
View
layout
=
inflater
.
inflate
(
R
.
layout
.
dialog_update_view
,
null
);
View
layout
=
inflater
.
inflate
(
R
.
layout
.
dialog_update_view
,
null
);
// 为对话框添加布局和设置大小
// 为对话框添加布局和设置大小
dialog
.
addContentView
(
layout
,
new
WindowManager
.
LayoutParams
(
WindowManager
.
LayoutParams
.
MATCH_PARENT
,
WindowManager
.
LayoutParams
.
WRAP_CONTENT
));
dialog
.
addContentView
(
layout
,
new
WindowManager
.
LayoutParams
(
WindowManager
.
LayoutParams
.
MATCH_PARENT
,
WindowManager
.
LayoutParams
.
WRAP_CONTENT
));
this
.
t
xtSize
=
layout
.
findViewById
(
R
.
id
.
txt_siz
e
);
this
.
t
v_version_name
=
layout
.
findViewById
(
R
.
id
.
tv_version_nam
e
);
this
.
txtContent
=
layout
.
findViewById
(
R
.
id
.
txt_content
);
this
.
txtContent
=
layout
.
findViewById
(
R
.
id
.
txt_content
);
this
.
txtSure
=
layout
.
findViewById
(
R
.
id
.
txt_sure
);
this
.
btn_update
=
layout
.
findViewById
(
R
.
id
.
btn_update
);
this
.
imgClose
=
layout
.
findViewById
(
R
.
id
.
img_close
);
this
.
btn_update
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
mListener
!=
null
)
{
mListener
.
download
();
}
dialog
.
dismiss
();
}
});
this
.
imgClose
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
dialog
.
dismiss
();
}
});
if
(
this
.
updateBean
!=
null
)
{
if
(
this
.
updateBean
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
this
.
updateBean
.
getUpdateInfo
()))
{
if
(!
TextUtils
.
isEmpty
(
this
.
updateBean
.
getUpdateInfo
()))
{
txtContent
.
setText
(
this
.
updateBean
.
getUpdateInfo
());
txtContent
.
setText
(
this
.
updateBean
.
getUpdateInfo
());
}
}
if
(!
TextUtils
.
isEmpty
(
this
.
updateBean
.
get
PackageSiz
e
()))
{
if
(!
TextUtils
.
isEmpty
(
this
.
updateBean
.
get
ServerVersionNam
e
()))
{
t
xtSize
.
setText
(
this
.
updateBean
.
getPackageSiz
e
());
t
v_version_name
.
setText
(
this
.
updateBean
.
getServerVersionNam
e
());
}
}
if
(
updateBean
.
getForce
())
{
this
.
imgClose
.
setVisibility
(
View
.
GONE
);
}
else
{
this
.
imgClose
.
setVisibility
(
View
.
VISIBLE
);
}
}
this
.
txtSure
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
mListener
!=
null
)
{
mListener
.
download
();
}
}
dialog
.
dismiss
();
}
});
//默认不能点击对话框其他区域退出 和按返回键退出
//默认不能点击对话框其他区域退出 和按返回键退出
dialog
.
setCancelable
(
false
);
dialog
.
setCancelable
(
false
);
...
...
plugin_version/src/main/java/com/rv/version/bean/UpdateBean.java
0 → 100644
View file @
3dfa4f57
package
com
.
rv
.
version
.
bean
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
com.rv.version.util.UpdateAppUtils
;
public
class
UpdateBean
{
private
int
downloadBy
=
UpdateAppUtils
.
DOWNLOAD_BY_APP
;
// 下载方式:默认app下载
private
String
apkPath
=
""
;
// apk 下载地址
private
String
updateInfo
=
""
;
// 更新说明
private
Boolean
isForce
=
false
;
// 是否强制更新
private
String
serverVersionName
=
""
;
// 服务器上版本名
private
int
serverVersionCode
=
0
;
// 服务器上版本号
private
String
localVersionName
=
""
;
// 当前本地版本名
private
int
localVersionCode
=
0
;
// 当前本地版本号
private
String
packageSize
;
// 新的APK大小
private
int
checkBy
=
UpdateAppUtils
.
CHECK_BY_VERSION_CODE
;
// 检查方式 按版本名或版本号
private
boolean
showNotification
=
true
;
// 是否在通知栏显示
public
boolean
isShowNotification
()
{
return
showNotification
;
}
public
void
setShowNotification
(
boolean
showNotification
)
{
this
.
showNotification
=
showNotification
;
}
public
int
getDownloadBy
()
{
return
downloadBy
;
}
public
void
setDownloadBy
(
int
downloadBy
)
{
this
.
downloadBy
=
downloadBy
;
}
public
String
getApkPath
()
{
return
apkPath
;
}
public
void
setApkPath
(
String
apkPath
)
{
this
.
apkPath
=
apkPath
;
}
public
String
getUpdateInfo
()
{
return
updateInfo
;
}
public
void
setUpdateInfo
(
String
updateInfo
)
{
this
.
updateInfo
=
updateInfo
;
}
public
Boolean
getForce
()
{
return
isForce
;
}
public
void
setForce
(
Boolean
force
)
{
isForce
=
force
;
}
public
String
getServerVersionName
()
{
return
serverVersionName
;
}
public
void
setServerVersionName
(
String
serverVersionName
)
{
this
.
serverVersionName
=
serverVersionName
;
}
public
int
getServerVersionCode
()
{
return
serverVersionCode
;
}
public
void
setServerVersionCode
(
int
serverVersionCode
)
{
this
.
serverVersionCode
=
serverVersionCode
;
}
public
String
getLocalVersionName
()
{
return
localVersionName
;
}
public
void
setLocalVersionName
(
String
localVersionName
)
{
this
.
localVersionName
=
localVersionName
;
}
public
int
getLocalVersionCode
()
{
return
localVersionCode
;
}
public
void
setLocalVersionCode
(
int
localVersionCode
)
{
this
.
localVersionCode
=
localVersionCode
;
}
public
int
getCheckBy
()
{
return
checkBy
;
}
public
void
setCheckBy
(
int
checkBy
)
{
this
.
checkBy
=
checkBy
;
}
public
String
getPackageSize
()
{
return
packageSize
;
}
public
void
setPackageSize
(
String
packageSize
)
{
this
.
packageSize
=
packageSize
;
}
public
UpdateBean
()
{
}
}
plugin_version/src/main/java/com/rv/version/bean/VersionCheckBean.java
View file @
3dfa4f57
...
@@ -31,6 +31,7 @@ public class VersionCheckBean extends BaseBean {
...
@@ -31,6 +31,7 @@ public class VersionCheckBean extends BaseBean {
private
String
content
;
private
String
content
;
private
String
downloadUrl
;
private
String
downloadUrl
;
private
int
downloadSwitch
;
private
int
downloadSwitch
;
private
int
isCompe
;
private
int
weigh
;
private
int
weigh
;
private
int
crtTime
;
private
int
crtTime
;
private
int
isDel
;
private
int
isDel
;
...
@@ -122,5 +123,13 @@ public class VersionCheckBean extends BaseBean {
...
@@ -122,5 +123,13 @@ public class VersionCheckBean extends BaseBean {
public
void
setIsDel
(
int
isDel
)
{
public
void
setIsDel
(
int
isDel
)
{
this
.
isDel
=
isDel
;
this
.
isDel
=
isDel
;
}
}
public
int
getIsCompe
()
{
return
isCompe
;
}
public
void
setIsCompe
(
int
isCompe
)
{
this
.
isCompe
=
isCompe
;
}
}
}
}
}
plugin_version/src/main/java/com/rv/version/customview/ConfirmDialog.java
0 → 100644
View file @
3dfa4f57
package
com
.
rv
.
version
.
customview
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.TextView
;
import
com.rv.version.R
;
/**
* Created by Teprinciple on 2016/10/13.
*/
public
class
ConfirmDialog
extends
Dialog
{
Callback
callback
;
private
TextView
content
;
private
TextView
sureBtn
;
private
TextView
cancleBtn
;
public
ConfirmDialog
(
Context
context
,
Callback
callback
)
{
super
(
context
,
R
.
style
.
CustomDialog
);
this
.
callback
=
callback
;
setCustomDialog
();
}
private
void
setCustomDialog
()
{
View
mView
=
LayoutInflater
.
from
(
getContext
()).
inflate
(
R
.
layout
.
dialog_confirm
,
null
);
sureBtn
=
(
TextView
)
mView
.
findViewById
(
R
.
id
.
dialog_confirm_sure
);
cancleBtn
=
(
TextView
)
mView
.
findViewById
(
R
.
id
.
dialog_confirm_cancle
);
content
=
(
TextView
)
mView
.
findViewById
(
R
.
id
.
dialog_confirm_title
);
sureBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
callback
.
callback
(
1
);
ConfirmDialog
.
this
.
cancel
();
}
});
cancleBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
callback
.
callback
(
0
);
ConfirmDialog
.
this
.
cancel
();
}
});
super
.
setContentView
(
mView
);
}
public
ConfirmDialog
setContent
(
String
s
)
{
content
.
setText
(
s
);
return
this
;
}
public
interface
Callback
{
void
callback
(
int
position
);
}
}
plugin_version/src/main/java/com/rv/version/receiver/UpdateAppReceiver.java
View file @
3dfa4f57
...
@@ -9,6 +9,7 @@ import android.content.Intent;
...
@@ -9,6 +9,7 @@ import android.content.Intent;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Build
;
import
android.support.v4.content.FileProvider
;
import
android.support.v4.content.FileProvider
;
import
android.text.TextUtils
;
import
com.rv.version.R
;
import
com.rv.version.R
;
import
com.rv.version.util.DownloadAppUtils
;
import
com.rv.version.util.DownloadAppUtils
;
...
@@ -58,7 +59,7 @@ public class UpdateAppReceiver extends BroadcastReceiver {
...
@@ -58,7 +59,7 @@ public class UpdateAppReceiver extends BroadcastReceiver {
}
}
// 安装apk
// 安装apk
if
(
DownloadAppUtils
.
downloadUpdateApkFilePath
!=
null
)
{
if
(
!
TextUtils
.
isEmpty
(
DownloadAppUtils
.
downloadUpdateApkFilePath
)
)
{
toInstall
(
context
);
toInstall
(
context
);
}
}
}
}
...
@@ -119,6 +120,9 @@ public class UpdateAppReceiver extends BroadcastReceiver {
...
@@ -119,6 +120,9 @@ public class UpdateAppReceiver extends BroadcastReceiver {
Intent
i
=
new
Intent
(
Intent
.
ACTION_VIEW
);
Intent
i
=
new
Intent
(
Intent
.
ACTION_VIEW
);
File
apkFile
=
new
File
(
DownloadAppUtils
.
downloadUpdateApkFilePath
);
File
apkFile
=
new
File
(
DownloadAppUtils
.
downloadUpdateApkFilePath
);
if
(!
apkFile
.
exists
()
||
!
apkFile
.
isFile
())
{
return
;
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
i
.
setFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
i
.
setFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
...
...
plugin_version/src/main/java/com/rv/version/util/DownloadAppUtils.java
0 → 100644
View file @
3dfa4f57
package
com
.
rv
.
version
.
util
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Environment
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.liulishuo.filedownloader.BaseDownloadTask
;
import
com.liulishuo.filedownloader.FileDownloadLargeFileListener
;
import
com.liulishuo.filedownloader.FileDownloader
;
import
java.io.File
;
public
class
DownloadAppUtils
{
private
static
final
String
TAG
=
DownloadAppUtils
.
class
.
getSimpleName
();
public
static
String
downloadUpdateApkFilePath
;
//下载更新Apk 文件路径
public
static
void
download
(
final
Context
context
,
String
url
,
final
String
serverVersionName
)
{
String
packageName
=
context
.
getPackageName
();
String
rootPath
=
null
;
if
(
Environment
.
getExternalStorageState
().
equals
(
Environment
.
MEDIA_MOUNTED
))
{
//外部存储卡
rootPath
=
Environment
.
getExternalStorageDirectory
()
+
File
.
separator
+
Environment
.
DIRECTORY_DOWNLOADS
+
File
.
separator
+
packageName
+
File
.
separator
;
}
else
{
Toast
.
makeText
(
context
,
"没有SD卡"
,
Toast
.
LENGTH_SHORT
).
show
();
Log
.
i
(
TAG
,
"没有SD卡"
);
return
;
}
send
(
context
,
-
1
,
serverVersionName
);
File
file
=
new
File
(
rootPath
);
if
(!
file
.
exists
())
{
file
.
mkdirs
();
}
String
apkLocalPath
=
rootPath
+
"app_"
+
serverVersionName
+
".apk"
;
downloadUpdateApkFilePath
=
apkLocalPath
;
FileDownloader
.
setup
(
context
);
FileDownloader
.
getImpl
().
create
(
url
)
.
setPath
(
apkLocalPath
)
.
setListener
(
new
FileDownloadLargeFileListener
()
{
@Override
protected
void
pending
(
BaseDownloadTask
task
,
long
soFarBytes
,
long
totalBytes
)
{
Log
.
e
(
TAG
,
"pending"
);
}
@Override
protected
void
progress
(
BaseDownloadTask
task
,
long
soFarBytes
,
long
totalBytes
)
{
send
(
context
,
(
int
)
(
soFarBytes
*
100.0
/
totalBytes
),
serverVersionName
);
}
@Override
protected
void
paused
(
BaseDownloadTask
task
,
long
soFarBytes
,
long
totalBytes
)
{
Log
.
e
(
TAG
,
"paused"
);
}
@Override
protected
void
completed
(
BaseDownloadTask
task
)
{
send
(
context
,
100
,
serverVersionName
);
}
@Override
protected
void
error
(
BaseDownloadTask
task
,
Throwable
e
)
{
Toast
.
makeText
(
context
,
"下载出错"
,
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
protected
void
warn
(
BaseDownloadTask
task
)
{
Log
.
e
(
TAG
,
"warn"
);
}
}).
start
();
}
private
static
void
send
(
Context
context
,
int
progress
,
String
serverVersionName
)
{
Intent
intent
=
new
Intent
(
"teprinciple.update"
);
intent
.
putExtra
(
"progress"
,
progress
);
intent
.
putExtra
(
"title"
,
serverVersionName
);
context
.
sendBroadcast
(
intent
);
}
}
plugin_version/src/main/java/com/rv/version/util/UpdateAppUtils.java
0 → 100644
View file @
3dfa4f57
package
com
.
rv
.
version
.
util
;
import
android.Manifest
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.rv.version.VersionUpdateDialog
;
import
com.rv.version.bean.UpdateBean
;
public
class
UpdateAppUtils
{
private
final
String
TAG
=
"UpdateAppUtils"
;
public
static
final
int
CHECK_BY_VERSION_NAME
=
1001
;
public
static
final
int
CHECK_BY_VERSION_CODE
=
1002
;
public
static
final
int
DOWNLOAD_BY_APP
=
1003
;
public
static
final
int
DOWNLOAD_BY_BROWSER
=
1004
;
private
Activity
activity
;
public
static
boolean
showNotification
=
true
;
// 将所有的 属性 放入model
private
UpdateBean
updateBean
=
new
UpdateBean
();
private
UpdateAppUtils
(
Activity
activity
)
{
this
.
activity
=
activity
;
getAPPLocalVersion
(
activity
);
}
public
static
UpdateAppUtils
from
(
Activity
activity
)
{
return
new
UpdateAppUtils
(
activity
);
}
public
UpdateAppUtils
checkBy
(
int
checkBy
)
{
updateBean
.
setCheckBy
(
checkBy
);
return
this
;
}
public
UpdateAppUtils
apkPath
(
String
apkPath
)
{
updateBean
.
setApkPath
(
apkPath
);
return
this
;
}
public
UpdateAppUtils
apkSize
(
String
packageSize
)
{
updateBean
.
setPackageSize
(
packageSize
);
return
this
;
}
public
UpdateAppUtils
downloadBy
(
int
downloadBy
)
{
updateBean
.
setDownloadBy
(
downloadBy
);
return
this
;
}
public
UpdateAppUtils
showNotification
(
boolean
showNotification
)
{
updateBean
.
setShowNotification
(
showNotification
);
this
.
showNotification
=
showNotification
;
return
this
;
}
public
UpdateAppUtils
updateInfo
(
String
updateInfo
)
{
updateBean
.
setUpdateInfo
(
updateInfo
);
return
this
;
}
public
UpdateAppUtils
serverVersionCode
(
int
serverVersionCode
)
{
updateBean
.
setServerVersionCode
(
serverVersionCode
);
return
this
;
}
public
UpdateAppUtils
serverVersionName
(
String
serverVersionName
)
{
updateBean
.
setServerVersionName
(
serverVersionName
);
return
this
;
}
public
UpdateAppUtils
isForce
(
boolean
isForce
)
{
updateBean
.
setForce
(
isForce
);
return
this
;
}
/**
* 获取apk的版本号 currentVersionCode
*/
private
void
getAPPLocalVersion
(
Context
ctx
)
{
PackageManager
manager
=
ctx
.
getPackageManager
();
try
{
PackageInfo
info
=
manager
.
getPackageInfo
(
ctx
.
getPackageName
(),
0
);
updateBean
.
setLocalVersionCode
(
info
.
versionCode
);
updateBean
.
setLocalVersionName
(
info
.
versionName
);
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
/**
* 检查更新
*/
public
void
update
()
{
switch
(
updateBean
.
getCheckBy
())
{
case
CHECK_BY_VERSION_CODE:
if
(
updateBean
.
getServerVersionCode
()
>
updateBean
.
getLocalVersionCode
())
{
toUpdate
();
}
else
{
Log
.
i
(
TAG
,
"当前版本是最新版本"
+
updateBean
.
getServerVersionCode
()
+
"/"
+
updateBean
.
getServerVersionName
());
}
break
;
case
CHECK_BY_VERSION_NAME:
if
(!
updateBean
.
getServerVersionName
().
equals
(
updateBean
.
getLocalVersionName
()))
{
toUpdate
();
}
else
{
Log
.
i
(
TAG
,
"当前版本是最新版本"
+
updateBean
.
getServerVersionCode
()
+
"/"
+
updateBean
.
getServerVersionName
());
}
break
;
}
}
public
static
String
getAppVersionName
(
Context
context
)
{
PackageManager
manager
=
context
.
getPackageManager
();
try
{
PackageInfo
info
=
manager
.
getPackageInfo
(
context
.
getPackageName
(),
0
);
return
info
.
versionName
;
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
e
.
printStackTrace
();
}
return
""
;
}
/**
* 更新
*/
private
void
toUpdate
()
{
new
VersionUpdateDialog
.
Builder
(
activity
,
listener
)
.
setData
(
updateBean
)
.
show
();
}
private
VersionUpdateDialog
.
Builder
.
DownloadListener
listener
=
new
VersionUpdateDialog
.
Builder
.
DownloadListener
()
{
@Override
public
void
download
()
{
preDownLoad
();
}
};
private
static
final
int
PERMISSION_CODE
=
1001
;
/**
* 预备下载 进行 6.0权限检查
*/
private
void
preDownLoad
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
M
)
{
download
();
}
else
{
if
(
ContextCompat
.
checkSelfPermission
(
activity
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
download
();
}
else
{
//申请权限
ActivityCompat
.
requestPermissions
(
activity
,
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
PERMISSION_CODE
);
}
}
}
public
void
download
()
{
Toast
.
makeText
(
activity
.
getApplicationContext
()
,
"下载中..."
,
Toast
.
LENGTH_SHORT
).
show
();
DownloadAppUtils
.
download
(
activity
,
updateBean
.
getApkPath
(),
updateBean
.
getServerVersionName
());
}
}
\ No newline at end of file
plugin_version/src/main/res/drawable-hdpi/bg_version_btn.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"30dp"
/>
<solid
android:color=
"@color/gray_FFB74B"
/>
</shape>
\ No newline at end of file
plugin_version/src/main/res/drawable-hdpi/home_icon_close.png
0 → 100644
View file @
3dfa4f57
873 Bytes
plugin_version/src/main/res/drawable-xhdpi/home_icon_close.png
0 → 100644
View file @
3dfa4f57
1.29 KB
plugin_version/src/main/res/drawable-xxhdpi/home_icon_close.png
0 → 100644
View file @
3dfa4f57
1.97 KB
plugin_version/src/main/res/drawable-xxxhdpi/home_icon_close.png
0 → 100644
View file @
3dfa4f57
2.53 KB
plugin_version/src/main/res/drawable/bg_dialog_confirm.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:height=
"20dp"
android:width=
"40dp"
/>
<solid
android:color=
"#EFEFEF"
/>
<corners
android:radius=
"12dp"
/>
</shape>
\ No newline at end of file
plugin_version/src/main/res/drawable/dialog_content_bg.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<!--背景颜色-->
<solid
android:color=
"#ffffff"
/>
<!--设置圆角的角度-->
<corners
android:radius=
"15dp"
/>
</shape>
plugin_version/src/main/res/drawable/icon_dialog_top.png
0 → 100644
View file @
3dfa4f57
93.8 KB
plugin_version/src/main/res/layout/dialog_confirm.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"270dp"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:background=
"@drawable/bg_dialog_confirm"
>
<TextView
android:layout_marginTop=
"15dp"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"15dp"
android:gravity=
"center_horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textSize=
"19sp"
android:text=
"提示"
android:textColor=
"@color/text_black"
/>
<TextView
android:id=
"@+id/dialog_confirm_title"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"15dp"
android:gravity=
"center_horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textSize=
"17sp"
android:lineSpacingExtra=
"5dp"
android:textColor=
"@color/text_black"
/>
<View
android:layout_marginTop=
"13dp"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DFDFDF"
/>
<LinearLayout
android:orientation=
"horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"44dp"
>
<TextView
android:clickable=
"true"
android:id=
"@+id/dialog_confirm_cancle"
android:gravity=
"center"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"match_parent"
android:text=
"@string/cancel"
android:textSize=
"17sp"
android:textColor=
"@color/text_blue"
/>
<View
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:background=
"#DFDFDF"
/>
<TextView
android:clickable=
"true"
android:id=
"@+id/dialog_confirm_sure"
android:gravity=
"center"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"match_parent"
android:text=
"@string/sure"
android:textSize=
"17sp"
android:textColor=
"@color/text_blue"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
plugin_version/src/main/res/layout/dialog_update_view.xml
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<
Frame
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
match_par
ent"
android:layout_height=
"
wrap_cont
ent"
android:
focusable=
"true
"
android:
gravity=
"center_horizontal
"
android:
focusableInTouchMode=
"true
"
>
android:
orientation=
"vertical
"
>
<LinearLayout
<LinearLayout
android:id=
"@+id/ll_main"
android:layout_width=
"300dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:background=
"@drawable/dialog_content_bg"
android:background=
"@color/white"
android:gravity=
"center_horizontal"
android:gravity=
"center_horizontal"
android:minWidth=
"3
3
0dp"
android:minWidth=
"3
0
0dp"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
<ImageView
android:id=
"@+id/txt_title"
android:layout_width=
"300dp"
android:layout_width=
"wrap_content"
android:layout_height=
"110dp"
android:layout_height=
"wrap_content"
android:src=
"@drawable/icon_dialog_top"
/>
android:layout_marginTop=
"16dp"
android:text=
"升级"
android:textColor=
"#ff333333"
android:textSize=
"24sp"
/>
<TextView
<TextView
android:id=
"@+id/txt_size"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:gravity=
"center"
android:gravity=
"center"
android:text=
"更新提示"
android:textColor=
"#ff5e5e5e"
android:textColor=
"#ff5e5e5e"
android:textSize=
"18sp"
/>
android:textSize=
"18sp"
/>
<TextView
<TextView
android:id=
"@+id/txt_content"
android:layout_marginTop=
"@dimen/size_5"
android:id=
"@+id/tv_version_name"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:gravity=
"center"
android:gravity=
"center"
android:textColor=
"#ff5e5e5e"
android:textColor=
"#ff5e5e5e"
android:textSize=
"18sp"
/>
android:textSize=
"@dimen/sp_14"
/>
<LinearLayout
android:layout_width=
"fill_parent"
android:layout_height=
"50dp"
>
<TextView
<TextView
android:id=
"@+id/txt_sure"
android:lineSpacingMultiplier=
"1.3"
android:layout_width=
"0.0dip"
android:id=
"@+id/txt_content"
android:layout_height=
"fill_parent"
android:layout_width=
"match_parent"
android:layout_weight=
"1.0"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
android:gravity=
"left"
android:paddingLeft=
"13dp"
android:paddingRight=
"13dp"
android:textColor=
"#ff5e5e5e"
android:textSize=
"16sp"
/>
<Button
android:id=
"@+id/btn_update"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/size_40"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/size_15"
android:background=
"@drawable/bg_version_btn"
android:gravity=
"center"
android:gravity=
"center"
android:maxLines=
"1
"
android:text=
"立即更新
"
android:text=
"升级
"
android:textColor=
"@color/white
"
android:textSize=
"22sp
"
/>
android:textSize=
"@dimen/sp_16
"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:id=
"@+id/img_close"
android:layout_width=
"@dimen/size_30"
android:layout_height=
"@dimen/size_30"
android:layout_marginTop=
"10dp"
android:src=
"@drawable/home_icon_close"
/>
</
Frame
Layout>
</
Linear
Layout>
plugin_version/src/main/res/layout/view_version_tips_dialog.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"270dp"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:background=
"@drawable/bg_dialog_confirm"
>
<TextView
android:layout_marginTop=
"15dp"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"15dp"
android:gravity=
"center_horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textSize=
"19sp"
android:text=
"提示"
android:textColor=
"@color/text_black"
/>
<TextView
android:id=
"@+id/dialog_confirm_title"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"15dp"
android:gravity=
"center_horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textSize=
"17sp"
android:lineSpacingExtra=
"5dp"
android:textColor=
"@color/text_black"
/>
<View
android:layout_marginTop=
"13dp"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:background=
"#DFDFDF"
/>
<LinearLayout
android:orientation=
"horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"44dp"
>
<TextView
android:clickable=
"true"
android:id=
"@+id/dialog_confirm_cancle"
android:gravity=
"center"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"match_parent"
android:text=
"@string/cancel"
android:textSize=
"17sp"
android:textColor=
"@color/text_blue"
/>
<View
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:background=
"#DFDFDF"
/>
<TextView
android:clickable=
"true"
android:id=
"@+id/dialog_confirm_sure"
android:gravity=
"center"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"match_parent"
android:text=
"@string/sure"
android:textSize=
"17sp"
android:textColor=
"@color/text_blue"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
plugin_version/src/main/res/values/colors.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color
name=
"colorPrimary"
>
#3F51B5
</color>
<color
name=
"colorPrimaryDark"
>
#303F9F
</color>
<color
name=
"colorAccent"
>
#FF4081
</color>
<color
name=
"text_blue"
>
#0076FF
</color>
<color
name=
"text_black"
>
#333333
</color>
</resources>
plugin_version/src/main/res/values/styles.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"CustomDialog"
parent=
"@android:style/Theme.Dialog"
>
<item
name=
"android:windowFrame"
>
@null
</item>
<item
name=
"android:windowIsFloating"
>
true
</item>
<item
name=
"android:windowIsTranslucent"
>
false
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowBackground"
>
@drawable/bg_dialog_confirm
</item>
<item
name=
"android:backgroundDimEnabled"
>
true
</item>
</style>
<style
name=
"AppTheme"
parent=
"Theme.AppCompat.NoActionBar"
/>
<style
name=
"DialogActivityTheme"
parent=
"Theme.AppCompat.Dialog"
>
<item
name=
"android:windowFrame"
>
@null
</item>
<!-- 边框 -->
<item
name=
"android:windowIsFloating"
>
true
</item>
<!-- 是否浮现在activity之上 -->
<item
name=
"android:windowIsTranslucent"
>
true
</item>
<!-- 半透明 -->
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:windowBackground"
>
@android:color/transparent
</item>
<item
name=
"android:background"
>
@android:color/transparent
</item>
<item
name=
"android:backgroundDimEnabled"
>
true
</item>
<!-- 模糊 -->
<item
name=
"android:windowCloseOnTouchOutside"
>
false
</item>
<!-- 重点,去掉标题 -->
<item
name=
"windowNoTitle"
>
true
</item>
</style>
<style
name=
"mdialog"
parent=
"@android:style/Theme.DeviceDefault.Dialog"
>
<!-- 是否有边框 -->
<item
name=
"android:windowFrame"
>
@null
</item>
<!--是否在悬浮Activity之上 -->
<item
name=
"android:windowIsFloating"
>
true
</item>
<!--标题 -->
<item
name=
"android:windowNoTitle"
>
true
</item>
<!--阴影 -->
<item
name=
"android:windowIsTranslucent"
>
true
</item>
<!--透明背景-->
<item
name=
"android:background"
>
@android:color/transparent
</item>
<!--窗口背景透明-->
<item
name=
"android:windowBackground"
>
@android:color/transparent
</item>
<!--弹窗背景是否变暗-->
<item
name=
"android:backgroundDimEnabled"
>
false
</item>
</style>
</resources>
\ No newline at end of file
plugin_version/src/main/res/xml/update_file_paths.xml
0 → 100644
View file @
3dfa4f57
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
path=
""
name=
"files_root"
/>
</paths>
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