Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
a58c013d
Commit
a58c013d
authored
Jul 24, 2019
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享卡组时取消排序
分享卡组操作优化 卡组管理
parent
1cb1cf93
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
954 additions
and
163 deletions
+954
-163
mobile/build.gradle
mobile/build.gradle
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/bean/DeckType.java
mobile/src/main/java/cn/garymb/ygomobile/bean/DeckType.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/bean/events/DeckFile.java
...c/main/java/cn/garymb/ygomobile/bean/events/DeckFile.java
+6
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/TextSelectAdapter.java
...va/cn/garymb/ygomobile/ui/adapters/TextSelectAdapter.java
+74
-44
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
...cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
+158
-66
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/adapter/ChatAdapter.java
...arymb/ygomobile/ui/mycard/mcchat/adapter/ChatAdapter.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/util/ImageUtil.java
.../cn/garymb/ygomobile/ui/mycard/mcchat/util/ImageUtil.java
+33
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
...mb/ygomobile/ui/preference/fragments/SettingFragment.java
+2
-1
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+49
-0
mobile/src/main/java/cn/garymb/ygomobile/utils/IOUtils.java
mobile/src/main/java/cn/garymb/ygomobile/utils/IOUtils.java
+0
-20
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
...rc/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
+344
-17
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
+4
-0
mobile/src/main/java/cn/garymb/ygomobile/utils/recyclerview/DeckTypeTouchHelperCallback.java
...obile/utils/recyclerview/DeckTypeTouchHelperCallback.java
+77
-0
mobile/src/main/res/drawable-xhdpi/ic_add.png
mobile/src/main/res/drawable-xhdpi/ic_add.png
+0
-0
mobile/src/main/res/drawable-xhdpi/ic_copy.png
mobile/src/main/res/drawable-xhdpi/ic_copy.png
+0
-0
mobile/src/main/res/drawable-xhdpi/ic_del.png
mobile/src/main/res/drawable-xhdpi/ic_del.png
+0
-0
mobile/src/main/res/drawable-xhdpi/ic_move.png
mobile/src/main/res/drawable-xhdpi/ic_move.png
+0
-0
mobile/src/main/res/layout/dialog_deck_select.xml
mobile/src/main/res/layout/dialog_deck_select.xml
+137
-8
mobile/src/main/res/layout/dialog_deck_share.xml
mobile/src/main/res/layout/dialog_deck_share.xml
+64
-0
mobile/src/main/res/layout/text_select_item.xml
mobile/src/main/res/layout/text_select_item.xml
+2
-1
No files found.
mobile/build.gradle
View file @
a58c013d
...
@@ -104,8 +104,8 @@ dependencies {
...
@@ -104,8 +104,8 @@ dependencies {
//
//
implementation
(
name:
'paysdk-release-1.2.4'
,
ext:
'aar'
)
implementation
(
name:
'paysdk-release-1.2.4'
,
ext:
'aar'
)
implementation
"com.pgyersdk:sdk:3.0.5"
implementation
"com.pgyersdk:sdk:3.0.5"
//dialog库
//dialog库
implementation
'com.github.feihuaduo:DialogUtils:1.8.9'
implementation
'com.github.feihuaduo:DialogUtils:1.8.9'
//recyclerview的adapter库
implementation
'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
}
}
mobile/src/main/java/cn/garymb/ygomobile/bean/DeckType.java
View file @
a58c013d
...
@@ -8,7 +8,7 @@ public class DeckType extends TextSelect {
...
@@ -8,7 +8,7 @@ public class DeckType extends TextSelect {
this
.
name
=
name
;
this
.
name
=
name
;
this
.
path
=
path
;
this
.
path
=
path
;
super
.
setName
(
name
);
super
.
setName
(
name
);
s
uper
.
s
etObject
(
this
);
setObject
(
this
);
}
}
public
String
getName
()
{
public
String
getName
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/bean/events/DeckFile.java
View file @
a58c013d
package
cn.garymb.ygomobile.bean.events
;
package
cn.garymb.ygomobile.bean.events
;
import
androidx.annotation.Nullable
;
import
java.io.File
;
import
java.io.File
;
import
cn.garymb.ygomobile.bean.TextSelect
;
import
cn.garymb.ygomobile.bean.TextSelect
;
...
@@ -14,13 +16,15 @@ public class DeckFile extends TextSelect {
...
@@ -14,13 +16,15 @@ public class DeckFile extends TextSelect {
name
=
new
File
(
path
).
getName
();
name
=
new
File
(
path
).
getName
();
name
=
name
.
substring
(
0
,
name
.
lastIndexOf
(
"."
));
name
=
name
.
substring
(
0
,
name
.
lastIndexOf
(
"."
));
super
.
setName
(
name
);
super
.
setName
(
name
);
s
uper
.
s
etObject
(
this
);
setObject
(
this
);
}
}
public
DeckFile
(
File
file
)
{
public
DeckFile
(
File
file
)
{
path
=
file
.
getAbsolutePath
();
path
=
file
.
getAbsolutePath
();
name
=
file
.
getName
();
name
=
file
.
getName
();
name
=
name
.
substring
(
0
,
name
.
lastIndexOf
(
"."
));
name
=
name
.
substring
(
0
,
name
.
lastIndexOf
(
"."
));
super
.
setName
(
name
);
setObject
(
this
);
}
}
public
String
getName
()
{
public
String
getName
()
{
...
@@ -38,4 +42,5 @@ public class DeckFile extends TextSelect {
...
@@ -38,4 +42,5 @@ public class DeckFile extends TextSelect {
public
void
setPath
(
String
path
)
{
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
this
.
path
=
path
;
}
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/TextSelectAdapter.java
View file @
a58c013d
package
cn.garymb.ygomobile.ui.adapters
;
package
cn.garymb.ygomobile.ui.adapters
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
cn.garymb.ygomobile.bean.TextSelect
;
import
cn.garymb.ygomobile.bean.TextSelect
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
public
class
TextSelectAdapter
extends
RecyclerView
.
Adapter
<
TextSelectAdapter
.
ViewHolder
>
{
public
class
TextSelectAdapter
<
T
extends
TextSelect
>
extends
BaseQuickAdapter
<
T
,
Base
ViewHolder
>
{
private
OnItemSelectListener
onItemSelectListener
;
private
OnItemSelectListener
onItemSelectListener
;
private
List
<?
extends
TextSelect
>
data
;
private
int
selectPosition
;
private
int
selectPosition
;
private
boolean
isSelect
;
public
TextSelectAdapter
(
List
<?
extends
TextSelect
>
data
,
int
selectPosition
)
{
private
boolean
isManySelect
;
this
.
data
=
data
;
private
List
<
T
>
selectList
;
this
.
selectPosition
=
selectPosition
;
}
public
TextSelectAdapter
(
List
<
T
>
data
,
int
select
)
{
super
(
R
.
layout
.
text_select_item
,
data
);
@NonNull
this
.
selectPosition
=
select
;
@Override
if
(
select
>=
0
)
public
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
isSelect
=
true
;
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
text_select_item
,
parent
,
false
);
else
return
new
ViewHolder
(
view
);
isSelect
=
false
;
}
isManySelect
=
false
;
selectList
=
new
ArrayList
<>();
@Override
setOnItemClickListener
(
new
OnItemClickListener
()
{
public
void
onBindViewHolder
(
@NonNull
ViewHolder
holder
,
int
position
)
{
holder
.
tv_name
.
setText
(
data
.
get
(
position
).
getName
());
if
(
position
==
selectPosition
){
holder
.
view
.
setBackgroundColor
(
YGOUtil
.
c
(
R
.
color
.
gray
));
}
else
{
holder
.
view
.
setBackgroundColor
(
YGOUtil
.
c
(
R
.
color
.
white
));
}
holder
.
view
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
on
Click
(
View
v
)
{
public
void
on
ItemClick
(
BaseQuickAdapter
adapter
,
View
view
,
int
position
)
{
if
(
position
==
selectPosition
)
if
(
isSelect
&&
position
==
selectPosition
)
return
;
return
;
selectPosition
=
position
;
selectPosition
=
position
;
notifyDataSetChanged
();
notifyDataSetChanged
();
onItemSelectListener
.
onItemSelect
(
position
,
data
.
get
(
position
).
getObject
());
if
(
onItemSelectListener
!=
null
)
onItemSelectListener
.
onItemSelect
(
position
,
data
.
get
(
position
).
getObject
());
}
}
});
});
}
}
public
void
setOnItemSelectListener
(
OnItemSelectListener
onItemSelectListener
)
{
@Override
this
.
onItemSelectListener
=
onItemSelectListener
;
protected
void
convert
(
BaseViewHolder
helper
,
T
item
)
{
int
position
=
helper
.
getAdapterPosition
();
helper
.
setText
(
R
.
id
.
tv_name
,
item
.
getName
());
if
(
isManySelect
)
{
if
(
selectList
.
contains
(
item
))
helper
.
setBackgroundColor
(
R
.
id
.
ll_layout
,
YGOUtil
.
c
(
R
.
color
.
gray
));
else
helper
.
setBackgroundRes
(
R
.
id
.
ll_layout
,
R
.
drawable
.
click_background
);
}
else
if
(
isSelect
)
{
if
(
position
==
selectPosition
)
{
helper
.
setBackgroundColor
(
R
.
id
.
ll_layout
,
YGOUtil
.
c
(
R
.
color
.
gray
));
}
else
{
helper
.
setBackgroundRes
(
R
.
id
.
ll_layout
,
R
.
drawable
.
click_background
);
}
}
else
{
helper
.
setBackgroundRes
(
R
.
id
.
ll_layout
,
R
.
drawable
.
click_background
);
}
}
}
@Override
public
void
setSelectPosition
(
int
selectPosition
)
{
public
int
getItemCount
()
{
this
.
selectPosition
=
selectPosition
;
return
data
.
size
();
}
public
boolean
isSelect
()
{
return
isSelect
;
}
}
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
boolean
isManySelect
()
{
return
isManySelect
;
}
View
view
;
public
void
addManySelect
(
T
t
)
{
TextView
tv_name
;
if
(
selectList
.
contains
(
t
))
selectList
.
remove
(
t
);
else
selectList
.
add
(
t
);
}
public
ViewHolder
(
View
view
)
{
public
void
setManySelect
(
boolean
manySelect
)
{
super
(
view
);
isManySelect
=
manySelect
;
this
.
view
=
view
;
if
(!
isManySelect
)
{
this
.
tv_name
=
view
.
findViewById
(
R
.
id
.
tv_name
);
selectList
.
clear
();
notifyDataSetChanged
();
}
}
}
}
public
List
<
T
>
getSelectList
()
{
return
selectList
;
}
public
int
getSelectPosition
()
{
return
selectPosition
;
}
public
void
setOnItemSelectListener
(
OnItemSelectListener
onItemSelectListener
)
{
this
.
onItemSelectListener
=
onItemSelectListener
;
}
public
interface
OnItemSelectListener
<
T
>
{
public
interface
OnItemSelectListener
<
T
>
{
void
onItemSelect
(
int
position
,
T
item
);
void
onItemSelect
(
int
position
,
T
item
);
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
View file @
a58c013d
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/adapter/ChatAdapter.java
View file @
a58c013d
...
@@ -66,7 +66,7 @@ public class ChatAdapter extends RecyclerView.Adapter<ChatAdapter.ViewHolder> {
...
@@ -66,7 +66,7 @@ public class ChatAdapter extends RecyclerView.Adapter<ChatAdapter.ViewHolder> {
vh
.
ic_name
.
setText
(
cm
.
getName
());
vh
.
ic_name
.
setText
(
cm
.
getName
());
//vh.ic_time.setText(cm.getTime());
//vh.ic_time.setText(cm.getTime());
vh
.
ic_message
.
setText
(
cm
.
getMessage
());
vh
.
ic_message
.
setText
(
cm
.
getMessage
());
ImageUtil
.
tuxian
(
context
,
cm
.
getAvatar
(),
vh
.
ic_avatar
);
ImageUtil
.
setAvatar
(
context
,
cm
.
getAvatar
(),
vh
.
ic_avatar
);
if
(
position
!=
0
)
{
if
(
position
!=
0
)
{
if
(
cm
.
getName
().
equals
(
data
.
get
(
position
-
1
).
getName
()))
{
if
(
cm
.
getName
().
equals
(
data
.
get
(
position
-
1
).
getName
()))
{
vh
.
ic_name
.
setVisibility
(
View
.
GONE
);
vh
.
ic_name
.
setVisibility
(
View
.
GONE
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/util/ImageUtil.java
View file @
a58c013d
package
cn.garymb.ygomobile.ui.mycard.mcchat.util
;
package
cn.garymb.ygomobile.ui.mycard.mcchat.util
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.ColorFilter
;
import
android.graphics.ColorMatrix
;
import
android.graphics.ColorMatrixColorFilter
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.util.Log
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
java.util.HashMap
;
import
java.util.Map
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
public
class
ImageUtil
{
public
class
ImageUtil
{
public
static
void
tuxian
(
Context
context
,
String
url
,
final
ImageView
im
)
{
public
static
void
setAvatar
(
Context
context
,
String
url
,
final
ImageView
im
)
{
if
(
url
!=
null
)
{
if
(
url
!=
null
)
{
Glide
.
with
(
context
)
Glide
.
with
(
context
)
.
load
(
Uri
.
parse
(
url
))
.
load
(
Uri
.
parse
(
url
))
...
@@ -21,4 +29,28 @@ public class ImageUtil {
...
@@ -21,4 +29,28 @@ public class ImageUtil {
}
}
}
}
public
static
void
setImage
(
Context
context
,
String
url
,
final
ImageView
im
)
{
if
(
url
!=
null
)
{
Glide
.
with
(
context
)
.
load
(
url
)
.
asBitmap
()
.
diskCacheStrategy
(
DiskCacheStrategy
.
SOURCE
)
.
placeholder
(
R
.
drawable
.
unknown
)
.
into
(
im
);
}
}
public
static
void
setGrayImage
(
int
key
,
ImageView
imageView
)
{
ColorMatrix
matrix
=
new
ColorMatrix
();
matrix
.
setSaturation
(
0
);
ColorMatrixColorFilter
filter
=
new
ColorMatrixColorFilter
(
matrix
);
imageView
.
setColorFilter
(
filter
);
}
public
static
void
reImageColor
(
int
key
,
ImageView
imageView
)
{
imageView
.
setColorFilter
(
null
);
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
View file @
a58c013d
...
@@ -40,6 +40,7 @@ import cn.garymb.ygomobile.ui.plus.DialogPlus;
...
@@ -40,6 +40,7 @@ import cn.garymb.ygomobile.ui.plus.DialogPlus;
import
cn.garymb.ygomobile.ui.plus.ServiceDuelAssistant
;
import
cn.garymb.ygomobile.ui.plus.ServiceDuelAssistant
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.ui.preference.PreferenceFragmentPlus
;
import
cn.garymb.ygomobile.ui.preference.PreferenceFragmentPlus
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.SystemUtils
;
import
cn.garymb.ygomobile.utils.SystemUtils
;
import
ocgcore.ConfigManager
;
import
ocgcore.ConfigManager
;
...
@@ -402,7 +403,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -402,7 +403,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
process
.
waitFor
();
process
.
waitFor
();
IOUtils
.
delete
(
soFile
);
IOUtils
.
delete
(
soFile
);
IO
Utils
.
copyFile
(
file
,
soFile
.
getAbsolutePath
(),
true
);
File
Utils
.
copyFile
(
file
,
soFile
.
getAbsolutePath
(),
true
);
me
.
what
=
COPY_SO_OK
;
me
.
what
=
COPY_SO_OK
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
a58c013d
...
@@ -3,6 +3,7 @@ package cn.garymb.ygomobile.utils;
...
@@ -3,6 +3,7 @@ package cn.garymb.ygomobile.utils;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -114,6 +115,54 @@ public class FileUtils {
...
@@ -114,6 +115,54 @@ public class FileUtils {
}
}
}
}
public
static
void
copyFile
(
String
oldPath
,
String
newPath
,
boolean
isName
)
throws
FileNotFoundException
,
IOException
{
//判断复制后的路径是否含有文件名,如果没有则加上
if
(!
isName
)
{
//由于newPath是路径加文件名,所以获取要复制的文件名与复制后的路径组成新的newPath
String
abb
[]=
oldPath
.
split
(
"/"
);
newPath
=
newPath
+
"/"
+
abb
[
abb
.
length
-
1
];
}
FileInputStream
fis
=
new
FileInputStream
(
oldPath
);
FileOutputStream
fos
=
new
FileOutputStream
(
newPath
);
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
0
;
while
((
len
=
fis
.
read
(
buf
))
!=
-
1
)
{
fos
.
write
(
buf
,
0
,
len
);
}
fos
.
close
();
fis
.
close
();
}
public
static
void
moveFile
(
String
oldPath
,
String
newPath
,
boolean
isName
)
throws
FileNotFoundException
,
IOException
{
//判断复制后的路径是否含有文件名,如果没有则加上
if
(!
isName
)
{
//由于newPath是路径加文件名,所以获取要复制的文件名与复制后的路径组成新的newPath
String
abb
[]=
oldPath
.
split
(
"/"
);
newPath
=
newPath
+
"/"
+
abb
[
abb
.
length
-
1
];
}
FileInputStream
fis
=
new
FileInputStream
(
oldPath
);
FileOutputStream
fos
=
new
FileOutputStream
(
newPath
);
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
0
;
while
((
len
=
fis
.
read
(
buf
))
!=
-
1
)
{
fos
.
write
(
buf
,
0
,
len
);
}
fos
.
close
();
fis
.
close
();
//删除文件
File
file
=
new
File
(
oldPath
);
if
(
file
.
exists
()
&&
file
.
isFile
())
{
file
.
delete
();
}
}
public
static
void
copy
(
InputStream
in
,
OutputStream
out
)
throws
IOException
{
public
static
void
copy
(
InputStream
in
,
OutputStream
out
)
throws
IOException
{
byte
[]
data
=
new
byte
[
1024
*
8
];
byte
[]
data
=
new
byte
[
1024
*
8
];
int
len
;
int
len
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/IOUtils.java
View file @
a58c013d
...
@@ -225,26 +225,6 @@ public class IOUtils {
...
@@ -225,26 +225,6 @@ public class IOUtils {
return
false
;
return
false
;
}
}
public
static
void
copyFile
(
String
oldPath
,
String
newPath
,
boolean
isname
)
throws
FileNotFoundException
,
IOException
{
//判断复制后的路径是否含有文件名,如果没有则加上
if
(!
isname
)
{
//由于newPath是路径加文件名,所以获取要复制的文件名与复制后的路径组成新的newPath
String
abb
[]=
oldPath
.
split
(
"/"
);
newPath
=
newPath
+
"/"
+
abb
[
abb
.
length
-
1
];
}
FileInputStream
fis
=
new
FileInputStream
(
oldPath
);
FileOutputStream
fos
=
new
FileOutputStream
(
newPath
);
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
0
;
while
((
len
=
fis
.
read
(
buf
))
!=
-
1
)
{
fos
.
write
(
buf
,
0
,
len
);
}
fos
.
close
();
fis
.
close
();
}
public
static
File
asFile
(
InputStream
is
,
String
outPath
)
throws
IOException
{
public
static
File
asFile
(
InputStream
is
,
String
outPath
)
throws
IOException
{
OutputStream
os
=
null
;
OutputStream
os
=
null
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
View file @
a58c013d
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
View file @
a58c013d
...
@@ -5,6 +5,7 @@ import android.widget.Toast;
...
@@ -5,6 +5,7 @@ import android.widget.Toast;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.ContextCompat
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.lite.R
;
public
class
YGOUtil
{
public
class
YGOUtil
{
...
@@ -16,4 +17,7 @@ public class YGOUtil {
...
@@ -16,4 +17,7 @@ public class YGOUtil {
public
static
int
c
(
int
colorId
){
public
static
int
c
(
int
colorId
){
return
ContextCompat
.
getColor
(
App
.
get
(),
colorId
);
return
ContextCompat
.
getColor
(
App
.
get
(),
colorId
);
}
}
public
static
String
s
(
int
stringId
){
return
App
.
get
().
getResources
().
getString
(
stringId
);
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/utils/recyclerview/DeckTypeTouchHelperCallback.java
0 → 100644
View file @
a58c013d
package
cn.garymb.ygomobile.utils.recyclerview
;
import
android.content.DialogInterface
;
import
androidx.recyclerview.widget.ItemTouchHelper
;
import
androidx.recyclerview.widget.RecyclerView
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.garymb.ygomobile.bean.DeckType
;
import
cn.garymb.ygomobile.bean.events.DeckFile
;
import
cn.garymb.ygomobile.ui.adapters.TextSelectAdapter
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.YGODialogUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
public
class
DeckTypeTouchHelperCallback
extends
ItemTouchHelper
.
Callback
{
private
int
dragFlags
;
private
int
swipeFlags
;
private
RecyclerView
recyclerView
;
private
YGODialogUtil
.
OnDeckTypeListener
onDeckTypeListener
;
public
DeckTypeTouchHelperCallback
(
YGODialogUtil
.
OnDeckTypeListener
onDeckTypeListener
)
{
this
.
onDeckTypeListener
=
onDeckTypeListener
;
}
@Override
public
int
getMovementFlags
(
RecyclerView
recyclerView
,
RecyclerView
.
ViewHolder
p2
)
{
dragFlags
=
0
;
swipeFlags
=
0
;
this
.
recyclerView
=
recyclerView
;
if
(
p2
.
getAdapterPosition
()
>
2
)
swipeFlags
=
ItemTouchHelper
.
START
|
ItemTouchHelper
.
END
;
return
makeMovementFlags
(
dragFlags
,
swipeFlags
);
}
@Override
public
boolean
onMove
(
RecyclerView
p1
,
RecyclerView
.
ViewHolder
p2
,
RecyclerView
.
ViewHolder
p3
)
{
return
false
;
}
@Override
public
void
onSwiped
(
RecyclerView
.
ViewHolder
vh
,
int
dire
)
{
int
positon
=
vh
.
getAdapterPosition
();
TextSelectAdapter
textSelectAdapter
=
((
TextSelectAdapter
)
recyclerView
.
getAdapter
());
DialogPlus
dialogPlus
=
new
DialogPlus
(
recyclerView
.
getContext
());
dialogPlus
.
setMessage
(
"确定删除该分类吗?分类下的卡组也将全部被删除"
);
dialogPlus
.
setLeftButtonText
(
"删除"
);
dialogPlus
.
setRightButtonText
(
"取消"
);
dialogPlus
.
setLeftButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialogPlus
.
dismiss
();
onDeckTypeListener
.
onDeckTypeListener
(
positon
);
}
});
dialogPlus
.
setRightButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
textSelectAdapter
.
notifyItemChanged
(
positon
);
dialog
.
dismiss
();
}
});
dialogPlus
.
show
();
}
}
mobile/src/main/res/drawable-xhdpi/ic_add.png
0 → 100644
View file @
a58c013d
2.37 KB
mobile/src/main/res/drawable-xhdpi/ic_copy.png
0 → 100644
View file @
a58c013d
1.22 KB
mobile/src/main/res/drawable-xhdpi/ic_del.png
0 → 100644
View file @
a58c013d
1.01 KB
mobile/src/main/res/drawable-xhdpi/ic_move.png
0 → 100644
View file @
a58c013d
1.41 KB
mobile/src/main/res/layout/dialog_deck_select.xml
View file @
a58c013d
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:gravity=
"center"
android:padding=
"10dp"
android:text=
"卡组管理"
android:textColor=
"@color/black"
android:textSize=
"15sp"
android:textStyle=
"bold"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
android:layout_marginBottom=
"5dp"
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/ll_add"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@drawable/click_background"
android:gravity=
"center"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_add"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
app:srcCompat=
"@drawable/ic_add"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_add"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"3dp"
android:text=
"新建"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_move"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@drawable/click_background"
android:gravity=
"center"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_move"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
app:srcCompat=
"@drawable/ic_move"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_move"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"3dp"
android:text=
"移动"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_copy"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@drawable/click_background"
android:gravity=
"center"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_copy"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
app:srcCompat=
"@drawable/ic_copy"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_copy"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"3dp"
android:text=
"复制"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_del"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@drawable/click_background"
android:gravity=
"center"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_del"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
app:srcCompat=
"@drawable/ic_del"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_del"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"3dp"
android:text=
"删除"
android:textColor=
"@color/black"
android:textSize=
"12sp"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
...
@@ -13,17 +133,26 @@
...
@@ -13,17 +133,26 @@
android:id=
"@+id/rv_type"
android:id=
"@+id/rv_type"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
/>
android:layout_weight=
"1"
<View
android:nestedScrollingEnabled=
"false"
/>
android:background=
"@color/gray"
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
/>
<androidx.recyclerview.widget.RecyclerView
<View
android:id=
"@+id/rv_deck"
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:background=
"@color/gray"
/>
<LinearLayout
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"2"
/>
android:layout_weight=
"2"
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_deck"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:nestedScrollingEnabled=
"true"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/dialog_deck_share.xml
0 → 100644
View file @
a58c013d
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<LinearLayout
android:background=
"@color/white"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"20dp"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/share_deck"
android:textColor=
"@color/black"
android:textSize=
"23sp"
android:textStyle=
"bold"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_image"
android:layout_width=
"140dp"
android:layout_height=
"280dp"
android:layout_marginTop=
"20dp"
android:scaleType=
"centerCrop"
/>
<Button
android:id=
"@+id/bt_image_share"
android:layout_marginTop=
"20dp"
android:textSize=
"15sp"
android:text=
"图片分享"
android:layout_width=
"140dp"
android:layout_height=
"50dp"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_marginTop=
"20dp"
>
<androidx.appcompat.widget.AppCompatEditText
android:textColor=
"@color/black"
android:layout_marginTop=
"5dp"
android:layout_marginBottom=
"5dp"
android:id=
"@+id/et_code"
android:gravity=
"center"
android:textSize=
"16sp"
android:inputType=
"text"
android:background=
"@color/gray"
android:padding=
"10dp"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"match_parent"
/>
<Button
android:id=
"@+id/bt_code_share"
android:textSize=
"15sp"
android:text=
"卡组码分享"
android:layout_marginLeft=
"20dp"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
/>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
mobile/src/main/res/layout/text_select_item.xml
View file @
a58c013d
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/ll_layout"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
match_par
ent"
android:layout_height=
"
wrap_cont
ent"
android:padding=
"10dp"
android:padding=
"10dp"
android:gravity=
"center"
android:gravity=
"center"
android:background=
"@drawable/click_background"
android:background=
"@drawable/click_background"
...
...
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