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
857ecea7
Commit
857ecea7
authored
Mar 20, 2019
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copyFile
parent
215be7b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
16 deletions
+61
-16
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+4
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/BaseCardsAcitivity.java
...java/cn/garymb/ygomobile/ui/cards/BaseCardsAcitivity.java
+8
-8
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+49
-8
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
857ecea7
...
@@ -121,6 +121,7 @@ public interface Constants {
...
@@ -121,6 +121,7 @@ public interface Constants {
int
UNSORT_TIMES
=
0x80
;
int
UNSORT_TIMES
=
0x80
;
int
CARD_RESULT_GRAVITY
=
Gravity
.
LEFT
;
int
CARD_SEARCH_GRAVITY
=
Gravity
.
RIGHT
;
int
CARD_SEARCH_GRAVITY
=
Gravity
.
RIGHT
;
int
STRING_LIMIT_START
=
1315
;
int
STRING_LIMIT_START
=
1315
;
int
STRING_CATEGORY_START
=
1100
;
int
STRING_CATEGORY_START
=
1100
;
...
@@ -199,4 +200,7 @@ public interface Constants {
...
@@ -199,4 +200,7 @@ public interface Constants {
//额外的cdb
//额外的cdb
boolean
NETWORK_IMAGE
=
false
;
boolean
NETWORK_IMAGE
=
false
;
boolean
SHOW_MYCARD
=
!
"core"
.
equals
(
BuildConfig
.
FLAVOR
);
boolean
SHOW_MYCARD
=
!
"core"
.
equals
(
BuildConfig
.
FLAVOR
);
//打开ydk,是否复制到文件夹
boolean
COPY_YDK_FILE
=
false
;
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/BaseCardsAcitivity.java
View file @
857ecea7
...
@@ -160,25 +160,25 @@ public abstract class BaseCardsAcitivity extends BaseActivity implements CardLoa
...
@@ -160,25 +160,25 @@ public abstract class BaseCardsAcitivity extends BaseActivity implements CardLoa
protected
abstract
void
onCardLongClick
(
View
view
,
Card
cardInfo
,
int
pos
);
protected
abstract
void
onCardLongClick
(
View
view
,
Card
cardInfo
,
int
pos
);
protected
void
showSearch
(
boolean
auto
c
lose
)
{
protected
void
showSearch
(
boolean
auto
C
lose
)
{
if
(
mDrawerlayout
.
isDrawerOpen
(
Gravity
.
LEFT
))
{
if
(
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_RESULT_GRAVITY
))
{
mDrawerlayout
.
closeDrawer
(
Gravity
.
LEFT
);
mDrawerlayout
.
closeDrawer
(
Constants
.
CARD_RESULT_GRAVITY
);
}
}
if
(
auto
c
lose
&&
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_SEARCH_GRAVITY
))
{
if
(
auto
C
lose
&&
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_SEARCH_GRAVITY
))
{
mDrawerlayout
.
closeDrawer
(
Constants
.
CARD_SEARCH_GRAVITY
);
mDrawerlayout
.
closeDrawer
(
Constants
.
CARD_SEARCH_GRAVITY
);
}
else
if
(
isLoad
)
{
}
else
if
(
isLoad
)
{
mDrawerlayout
.
openDrawer
(
Constants
.
CARD_SEARCH_GRAVITY
);
mDrawerlayout
.
openDrawer
(
Constants
.
CARD_SEARCH_GRAVITY
);
}
}
}
}
protected
void
showResult
(
boolean
auto
c
lose
)
{
protected
void
showResult
(
boolean
auto
C
lose
)
{
if
(
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_SEARCH_GRAVITY
))
{
if
(
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_SEARCH_GRAVITY
))
{
mDrawerlayout
.
closeDrawer
(
Constants
.
CARD_SEARCH_GRAVITY
);
mDrawerlayout
.
closeDrawer
(
Constants
.
CARD_SEARCH_GRAVITY
);
}
}
if
(
auto
close
&&
mDrawerlayout
.
isDrawerOpen
(
Gravity
.
LEFT
))
{
if
(
auto
Close
&&
mDrawerlayout
.
isDrawerOpen
(
Constants
.
CARD_RESULT_GRAVITY
))
{
mDrawerlayout
.
closeDrawer
(
Gravity
.
LEFT
);
mDrawerlayout
.
closeDrawer
(
Constants
.
CARD_RESULT_GRAVITY
);
}
else
if
(
isLoad
)
{
}
else
if
(
isLoad
)
{
mDrawerlayout
.
openDrawer
(
Gravity
.
LEFT
);
mDrawerlayout
.
openDrawer
(
Constants
.
CARD_RESULT_GRAVITY
);
}
}
}
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
857ecea7
...
@@ -4,13 +4,27 @@ import java.io.BufferedReader;
...
@@ -4,13 +4,27 @@ import java.io.BufferedReader;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
public
class
FileUtils
{
public
class
FileUtils
{
public
static
boolean
deleteFile
(
File
file
){
if
(
file
.
isFile
()){
try
{
file
.
delete
();
}
catch
(
Throwable
e
){
return
false
;
}
}
return
true
;
}
public
static
List
<
String
>
readLines
(
String
file
,
String
encoding
)
{
public
static
List
<
String
>
readLines
(
String
file
,
String
encoding
)
{
InputStreamReader
in
=
null
;
InputStreamReader
in
=
null
;
FileInputStream
inputStream
=
null
;
FileInputStream
inputStream
=
null
;
...
@@ -64,20 +78,47 @@ public class FileUtils {
...
@@ -64,20 +78,47 @@ public class FileUtils {
return
true
;
return
true
;
}
}
public
static
void
copyFile
(
String
in
,
FileOutputStream
outputStream
)
{
public
static
void
copyFile
(
InputStream
in
,
File
out
)
{
FileOutputStream
outputStream
=
null
;
try
{
File
dir
=
out
.
getParentFile
();
if
(!
dir
.
exists
()){
dir
.
mkdirs
();
}
outputStream
=
new
FileOutputStream
(
out
);
copy
(
in
,
outputStream
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
finally
{
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
in
);
}
}
public
static
void
copyFile
(
File
in
,
File
out
)
{
FileOutputStream
outputStream
=
null
;
FileInputStream
inputStream
=
null
;
FileInputStream
inputStream
=
null
;
byte
[]
data
=
new
byte
[
1024
*
8
];
try
{
try
{
inputStream
=
new
FileInputStream
(
in
);
File
dir
=
out
.
getParentFile
();
int
len
;
if
(!
dir
.
exists
()){
while
((
len
=
inputStream
.
read
(
data
))
!=
-
1
)
{
dir
.
mkdirs
();
outputStream
.
write
(
data
,
0
,
len
);
}
}
inputStream
=
new
FileInputStream
(
in
);
outputStream
=
new
FileOutputStream
(
out
);
copy
(
inputStream
,
outputStream
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
//
e
.
printStackTrace
();
}
finally
{
}
finally
{
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
inputStream
);
IOUtils
.
close
(
inputStream
);
}
}
}
}
public
static
void
copy
(
InputStream
in
,
OutputStream
out
)
throws
IOException
{
byte
[]
data
=
new
byte
[
1024
*
8
];
int
len
;
while
((
len
=
in
.
read
(
data
))
!=
-
1
)
{
out
.
write
(
data
,
0
,
len
);
}
}
}
}
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