Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
b11a74fd
Commit
b11a74fd
authored
Jan 20, 2020
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
长按重新下载卡图
parent
9c78cec2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
29 deletions
+71
-29
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
...rc/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
+71
-29
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
View file @
b11a74fd
package
cn.garymb.ygomobile.ui.cards
;
package
cn.garymb.ygomobile.ui.cards
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.content.DialogInterface
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
...
@@ -25,6 +26,7 @@ import cn.garymb.ygomobile.lite.R;
...
@@ -25,6 +26,7 @@ import cn.garymb.ygomobile.lite.R;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.adapters.BaseAdapterPlus
;
import
cn.garymb.ygomobile.ui.adapters.BaseAdapterPlus
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.utils.CardUtils
;
import
cn.garymb.ygomobile.utils.CardUtils
;
import
cn.garymb.ygomobile.utils.DownloadUtil
;
import
cn.garymb.ygomobile.utils.DownloadUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
...
@@ -75,6 +77,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -75,6 +77,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private
LinearLayout
ll_bar
;
private
LinearLayout
ll_bar
;
private
ProgressBar
pb_loading
;
private
ProgressBar
pb_loading
;
private
TextView
tv_loading
;
private
TextView
tv_loading
;
private
boolean
isDownloadCardImage
=
true
;
@SuppressLint
(
"HandlerLeak"
)
@SuppressLint
(
"HandlerLeak"
)
Handler
handler
=
new
Handler
()
{
Handler
handler
=
new
Handler
()
{
...
@@ -84,19 +87,21 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -84,19 +87,21 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
super
.
handleMessage
(
msg
);
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
)
{
switch
(
msg
.
what
)
{
case
TYPE_DOWNLOAD_CARD_IMAGE_OK:
case
TYPE_DOWNLOAD_CARD_IMAGE_OK:
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
out_from_bottom
));
isDownloadCardImage
=
true
;
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
out_from_bottom
));
ll_bar
.
setVisibility
(
View
.
GONE
);
ll_bar
.
setVisibility
(
View
.
GONE
);
imageLoader
.
bindImage
(
photoView
,
msg
.
arg1
,
null
,
true
);
imageLoader
.
bindImage
(
photoView
,
msg
.
arg1
,
null
,
true
);
imageLoader
.
bindImage
(
cardImage
,
msg
.
arg1
,
null
,
true
);
imageLoader
.
bindImage
(
cardImage
,
msg
.
arg1
,
null
,
true
);
break
;
break
;
case
TYPE_DOWNLOAD_CARD_IMAGE_ING:
case
TYPE_DOWNLOAD_CARD_IMAGE_ING:
tv_loading
.
setText
(
"下载高清卡图中 "
+
msg
.
arg1
+
"%"
);
tv_loading
.
setText
(
"下载高清卡图中 "
+
msg
.
arg1
+
"%"
);
pb_loading
.
setProgress
(
msg
.
arg1
);
pb_loading
.
setProgress
(
msg
.
arg1
);
break
;
break
;
case
TYPE_DOWNLOAD_CARD_IMAGE_EXCEPTION:
case
TYPE_DOWNLOAD_CARD_IMAGE_EXCEPTION:
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
out_from_bottom
));
isDownloadCardImage
=
true
;
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
out_from_bottom
));
ll_bar
.
setVisibility
(
View
.
GONE
);
ll_bar
.
setVisibility
(
View
.
GONE
);
YGOUtil
.
show
(
"下载失败,原因为"
+
msg
.
obj
);
YGOUtil
.
show
(
"下载失败,原因为"
+
msg
.
obj
);
break
;
break
;
}
}
...
@@ -303,12 +308,51 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -303,12 +308,51 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
dialog
.
dis
();
dialog
.
dis
();
});
});
photoView
.
setOnLongClickListener
(
new
View
.
OnLongClickListener
()
{
@Override
public
boolean
onLongClick
(
View
v
)
{
if
(!
isDownloadCardImage
)
return
false
;
DialogPlus
dialogPlus
=
new
DialogPlus
(
context
);
dialogPlus
.
setMessage
(
"是否重新下载高清卡图?"
);
dialogPlus
.
setLeftButtonText
(
"重新下载"
);
dialogPlus
.
setRightButtonText
(
"取消"
);
dialogPlus
.
setRightButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
}
});
dialogPlus
.
setLeftButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
ll_bar
.
setVisibility
(
View
.
VISIBLE
);
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
in_from_top
));
downloadCardImage
(
code
,
file
);
}
});
dialogPlus
.
show
();
return
true
;
}
});
//先显示普通卡片大图,判断如果没有高清图就下载
//先显示普通卡片大图,判断如果没有高清图就下载
imageLoader
.
bindImage
(
photoView
,
code
,
null
,
true
);
imageLoader
.
bindImage
(
photoView
,
code
,
null
,
true
);
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
ll_bar
.
setVisibility
(
View
.
VISIBLE
);
ll_bar
.
setVisibility
(
View
.
VISIBLE
);
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
in_from_top
));
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
in_from_top
));
downloadCardImage
(
code
,
file
);
}
}
private
void
downloadCardImage
(
int
code
,
File
file
)
{
isDownloadCardImage
=
false
;
DownloadUtil
.
get
().
download
(
YGOUtil
.
getCardImageDetailUrl
(
code
),
file
.
getParent
(),
file
.
getName
(),
new
DownloadUtil
.
OnDownloadListener
()
{
DownloadUtil
.
get
().
download
(
YGOUtil
.
getCardImageDetailUrl
(
code
),
file
.
getParent
(),
file
.
getName
(),
new
DownloadUtil
.
OnDownloadListener
()
{
@Override
@Override
public
void
onDownloadSuccess
(
File
file
)
{
public
void
onDownloadSuccess
(
File
file
)
{
...
@@ -336,8 +380,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -336,8 +380,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
});
});
}
}
}
public
void
onPreCard
()
{
public
void
onPreCard
()
{
int
position
=
getCurPosition
();
int
position
=
getCurPosition
();
CardListProvider
provider
=
getProvider
();
CardListProvider
provider
=
getProvider
();
...
...
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