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
2c25cc48
Commit
2c25cc48
authored
Jul 14, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善背景图片三张自定义
parent
03f7c622
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
19 deletions
+107
-19
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
...mb/ygomobile/ui/preference/fragments/SettingFragment.java
+54
-15
mobile/src/main/res/layout/dialog_bg_select.xml
mobile/src/main/res/layout/dialog_bg_select.xml
+44
-0
mobile/src/main/res/layout/dialog_cover_select.xml
mobile/src/main/res/layout/dialog_cover_select.xml
+4
-4
mobile/src/main/res/values-zh/strings.xml
mobile/src/main/res/values-zh/strings.xml
+3
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
2c25cc48
...
@@ -73,6 +73,8 @@ public interface Constants {
...
@@ -73,6 +73,8 @@ public interface Constants {
String
CORE_SKIN_COVER
=
"cover.jpg"
;
String
CORE_SKIN_COVER
=
"cover.jpg"
;
String
CORE_SKIN_COVER2
=
"cover2.jpg"
;
String
CORE_SKIN_COVER2
=
"cover2.jpg"
;
String
CORE_SKIN_BG
=
"bg.jpg"
;
String
CORE_SKIN_BG
=
"bg.jpg"
;
String
CORE_SKIN_BG_MENU
=
"bg_menu.jpg"
;
String
CORE_SKIN_BG_DECK
=
"bg_deck.jpg"
;
String
CORE_SKIN_AVATAR_ME
=
"me.jpg"
;
String
CORE_SKIN_AVATAR_ME
=
"me.jpg"
;
String
CORE_SKIN_AVATAR_OPPONENT
=
"opponent.jpg"
;
String
CORE_SKIN_AVATAR_OPPONENT
=
"opponent.jpg"
;
String
UNKNOWN_IMAGE
=
"unknown.jpg"
;
String
UNKNOWN_IMAGE
=
"unknown.jpg"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
View file @
2c25cc48
...
@@ -45,6 +45,8 @@ import ocgcore.ConfigManager;
...
@@ -45,6 +45,8 @@ import ocgcore.ConfigManager;
import
static
android
.
R
.
attr
.
key
;
import
static
android
.
R
.
attr
.
key
;
import
static
android
.
R
.
attr
.
packageNames
;
import
static
android
.
R
.
attr
.
packageNames
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_RELOAD
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_RELOAD
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_SKIN_BG_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_SKIN_CARD_COVER_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_CHANGE_LOG
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_CHANGE_LOG
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_CHECK_UPDATE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_CHECK_UPDATE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DECK_DELETE_DILAOG
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DECK_DELETE_DILAOG
;
...
@@ -185,6 +187,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -185,6 +187,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
//选择ttf字体文件,保存
//选择ttf字体文件,保存
showFileChooser
(
preference
,
"*.ttf"
,
mSettings
.
getFontDirPath
(),
getString
(
R
.
string
.
dialog_select_font
));
showFileChooser
(
preference
,
"*.ttf"
,
mSettings
.
getFontDirPath
(),
getString
(
R
.
string
.
dialog_select_font
));
}
else
if
(
SETTINGS_COVER
.
equals
(
key
))
{
}
else
if
(
SETTINGS_COVER
.
equals
(
key
))
{
//显示卡背图片对话框
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
dialog
.
setContentView
(
R
.
layout
.
dialog_cover_select
);
dialog
.
setContentView
(
R
.
layout
.
dialog_cover_select
);
dialog
.
setTitle
(
R
.
string
.
card_cover
);
dialog
.
setTitle
(
R
.
string
.
card_cover
);
...
@@ -192,26 +195,60 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -192,26 +195,60 @@ public class SettingFragment extends PreferenceFragmentPlus {
View
viewDialog
=
dialog
.
getContentView
();
View
viewDialog
=
dialog
.
getContentView
();
ImageView
cover1
=
viewDialog
.
findViewById
(
R
.
id
.
cover1
);
ImageView
cover1
=
viewDialog
.
findViewById
(
R
.
id
.
cover1
);
ImageView
cover2
=
viewDialog
.
findViewById
(
R
.
id
.
cover2
);
ImageView
cover2
=
viewDialog
.
findViewById
(
R
.
id
.
cover2
);
setImage
(
getDatapath
(
mSettings
.
getCoreSkinPath
()+
Constants
.
CORE_SKIN_COVER
)
,
cover1
);
setImage
(
mSettings
.
getCoreSkinPath
()+
"/"
+
Constants
.
CORE_SKIN_COVER
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
]
,
cover1
);
setImage
(
getDatapath
(
mSettings
.
getCoreSkinPath
()+
Constants
.
CORE_SKIN_COVER2
)
,
cover2
);
setImage
(
mSettings
.
getCoreSkinPath
()+
"/"
+
Constants
.
CORE_SKIN_COVER2
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
]
,
cover2
);
cover1
.
setOnClickListener
((
v
)
->
{
cover1
.
setOnClickListener
((
v
)
->
{
//
显示图片对话框?
//
打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER
).
getAbsolutePath
();
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
card_cover
),
showImageDialog
(
preference
,
getString
(
R
.
string
.
card_cover
),
outFile
,
outFile
,
true
,
Constants
.
CORE_SKIN_CARD_COVER_SIZE
[
0
],
Constants
.
CORE_SKIN_CARD_COVER_SIZE
[
1
]);
true
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
]);
dialog
.
dismiss
();
});
});
cover2
.
setOnClickListener
((
v
)
->
{
cover2
.
setOnClickListener
((
v
)
->
{
//
显示图片对话框?
//
打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER2
).
getAbsolutePath
();
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER2
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
card_cover
),
showImageDialog
(
preference
,
getString
(
R
.
string
.
card_cover
),
outFile
,
outFile
,
true
,
Constants
.
CORE_SKIN_CARD_COVER_SIZE
[
0
],
Constants
.
CORE_SKIN_CARD_COVER_SIZE
[
1
]);
true
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
]);
dialog
.
dismiss
();
});
});
}
else
if
(
SETTINGS_CARD_BG
.
equals
(
key
))
{
}
else
if
(
SETTINGS_CARD_BG
.
equals
(
key
))
{
//显示图片对话框?
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
();
dialog
.
setContentView
(
R
.
layout
.
dialog_bg_select
);
showImageDialog
(
preference
,
getString
(
R
.
string
.
game_bg
),
outFile
,
true
,
Constants
.
CORE_SKIN_BG_SIZE
[
0
],
Constants
.
CORE_SKIN_BG_SIZE
[
1
]);
dialog
.
setTitle
(
R
.
string
.
game_bg
);
dialog
.
show
();
View
viewDialog
=
dialog
.
getContentView
();
ImageView
bg
=
viewDialog
.
findViewById
(
R
.
id
.
bg
);
ImageView
bg_menu
=
viewDialog
.
findViewById
(
R
.
id
.
bg_menu
);
ImageView
bg_deck
=
viewDialog
.
findViewById
(
R
.
id
.
bg_deck
);
setImage
(
mSettings
.
getCoreSkinPath
()+
"/"
+
Constants
.
CORE_SKIN_BG
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg
);
setImage
(
mSettings
.
getCoreSkinPath
()+
"/"
+
Constants
.
CORE_SKIN_BG_MENU
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg_menu
);
setImage
(
mSettings
.
getCoreSkinPath
()+
"/"
+
Constants
.
CORE_SKIN_BG_DECK
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg_deck
);
bg
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
bg
),
outFile
,
true
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
]);
dialog
.
dismiss
();
});
bg_menu
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG_MENU
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
bg_menu
),
outFile
,
true
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
]);
dialog
.
dismiss
();
});
bg_deck
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG_DECK
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
bg_deck
),
outFile
,
true
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
]);
dialog
.
dismiss
();
});
}
else
if
(
PREF_USE_EXTRA_CARD_CARDS
.
equals
(
key
))
{
}
else
if
(
PREF_USE_EXTRA_CARD_CARDS
.
equals
(
key
))
{
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
if
(
checkBoxPreference
.
isChecked
())
{
if
(
checkBoxPreference
.
isChecked
())
{
...
@@ -296,12 +333,14 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -296,12 +333,14 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
}
}
}
public
void
setImage
(
String
path
,
ImageView
imageView
){
public
void
setImage
(
String
outFile
,
int
outWidth
,
int
outHeight
,
ImageView
imageView
){
//图片显示代码
File
img
=
new
File
(
outFile
);
Glide
.
with
(
this
).
load
(
path
)
if
(
img
.
exists
())
{
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
Glide
.
with
(
this
).
load
(
img
).
signature
(
new
StringSignature
(
img
.
getName
()
+
img
.
lastModified
()))
.
override
(
Constants
.
CORE_SKIN_CARD_COVER_SIZE
[
0
],
Constants
.
CORE_SKIN_CARD_COVER_SIZE
[
1
])
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
.
into
(
imageView
);
.
override
(
outWidth
,
outHeight
)
.
into
(
imageView
);
}
}
}
private
void
copyDataBase
(
Preference
preference
,
String
file
)
{
private
void
copyDataBase
(
Preference
preference
,
String
file
)
{
...
...
mobile/src/main/res/layout/dialog_bg_select.xml
0 → 100644
View file @
2c25cc48
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:gravity=
"center"
>
<TextView
android:layout_width=
"@dimen/label_width_middle"
android:layout_height=
"wrap_content"
android:text=
"@string/bg"
/>
<ImageView
android:id=
"@+id/bg"
android:layout_width=
"320dp"
android:layout_height=
"180dp"
/>
<TextView
android:layout_width=
"@dimen/label_width_middle"
android:layout_height=
"wrap_content"
android:text=
"@string/bg_menu"
/>
<ImageView
android:id=
"@+id/bg_menu"
android:layout_width=
"320dp"
android:layout_height=
"180dp"
/>
<TextView
android:layout_width=
"@dimen/label_width_middle"
android:layout_height=
"wrap_content"
android:text=
"@string/bg_deck"
/>
<ImageView
android:id=
"@+id/bg_deck"
android:layout_width=
"320dp"
android:layout_height=
"180dp"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/dialog_cover_select.xml
View file @
2c25cc48
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
<ImageView
<ImageView
android:id=
"@+id/cover1"
android:id=
"@+id/cover1"
android:layout_width=
"
44
dp"
android:layout_width=
"
88
dp"
android:layout_height=
"
64
dp"
/>
android:layout_height=
"
128
dp"
/>
<TextView
<TextView
android:layout_width=
"@dimen/label_width_middle"
android:layout_width=
"@dimen/label_width_middle"
...
@@ -21,8 +21,8 @@
...
@@ -21,8 +21,8 @@
<ImageView
<ImageView
android:id=
"@+id/cover2"
android:id=
"@+id/cover2"
android:layout_width=
"
44
dp"
android:layout_width=
"
88
dp"
android:layout_height=
"
64
dp"
/>
android:layout_height=
"
128
dp"
/>
</LinearLayout>
</LinearLayout>
...
...
mobile/src/main/res/values-zh/strings.xml
View file @
2c25cc48
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
<string
name=
"copy_databse"
>
复制数据库中
</string>
<string
name=
"copy_databse"
>
复制数据库中
</string>
<string
name=
"card_cover"
>
卡片背面
</string>
<string
name=
"card_cover"
>
卡片背面
</string>
<string
name=
"game_bg"
>
游戏背景
</string>
<string
name=
"game_bg"
>
游戏背景
</string>
<string
name=
"bg"
>
决斗背景
</string>
<string
name=
"bg_menu"
>
菜单背景
</string>
<string
name=
"bg_deck"
>
卡组背景
</string>
<string
name=
"action_add_server"
>
添加服务器
</string>
<string
name=
"action_add_server"
>
添加服务器
</string>
<string
name=
"no_find_file_selectotr"
>
没有找到文件选择器
</string>
<string
name=
"no_find_file_selectotr"
>
没有找到文件选择器
</string>
<string
name=
"no_find_image_selector"
>
没有找到图片选择器
</string>
<string
name=
"no_find_image_selector"
>
没有找到图片选择器
</string>
...
...
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