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
0deb90b1
Commit
0deb90b1
authored
Dec 09, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/fallenstardust/YGOMobile-cn-ko-en
parents
fc625291
6b603cff
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
183 additions
and
40 deletions
+183
-40
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
...re/src/main/java/cn/garymb/ygomobile/GameApplication.java
+11
-2
mobile/build.gradle
mobile/build.gradle
+0
-2
mobile/src/main/java/cn/garymb/ygomobile/App.java
mobile/src/main/java/cn/garymb/ygomobile/App.java
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
.../java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
...cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+7
-7
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCardActivity.java
...in/java/cn/garymb/ygomobile/ui/mycard/MyCardActivity.java
+103
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
...ava/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
+14
-6
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
...mb/ygomobile/ui/preference/fragments/SettingFragment.java
+31
-21
mobile/src/main/res/layout/activity_home.xml
mobile/src/main/res/layout/activity_home.xml
+1
-1
No files found.
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
View file @
0deb90b1
...
@@ -20,12 +20,13 @@ public abstract class GameApplication extends Application implements IrrlichtBri
...
@@ -20,12 +20,13 @@ public abstract class GameApplication extends Application implements IrrlichtBri
private
Map
<
String
,
Integer
>
mSoundIdMap
;
private
Map
<
String
,
Integer
>
mSoundIdMap
;
private
static
GameApplication
sGameApplication
;
private
static
GameApplication
sGameApplication
;
private
boolean
isInitSoundEffectPool
=
false
;
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
sGameApplication
=
this
;
sGameApplication
=
this
;
initSoundEffectPool
();
//
initSoundEffectPool();
}
}
public
static
GameApplication
get
()
{
public
static
GameApplication
get
()
{
...
@@ -43,8 +44,16 @@ public abstract class GameApplication extends Application implements IrrlichtBri
...
@@ -43,8 +44,16 @@ public abstract class GameApplication extends Application implements IrrlichtBri
mSoundEffectPool
.
release
();
mSoundEffectPool
.
release
();
}
}
public
boolean
isInitSoundEffectPool
()
{
return
isInitSoundEffectPool
;
}
protected
void
setInitSoundEffectPool
(
boolean
initSoundEffectPool
)
{
isInitSoundEffectPool
=
initSoundEffectPool
;
}
@SuppressWarnings
(
"deprecation"
)
@SuppressWarnings
(
"deprecation"
)
p
rotected
void
initSoundEffectPool
()
{
p
ublic
void
initSoundEffectPool
()
{
mSoundEffectPool
=
new
SoundPool
(
2
,
AudioManager
.
STREAM_MUSIC
,
0
);
mSoundEffectPool
=
new
SoundPool
(
2
,
AudioManager
.
STREAM_MUSIC
,
0
);
AssetManager
am
=
getAssets
();
AssetManager
am
=
getAssets
();
String
[]
sounds
;
String
[]
sounds
;
...
...
mobile/build.gradle
View file @
0deb90b1
...
@@ -86,8 +86,6 @@ dependencies {
...
@@ -86,8 +86,6 @@ dependencies {
implementation
'com.android.support:design:'
+
rootProject
.
ext
.
supportVersion
implementation
'com.android.support:design:'
+
rootProject
.
ext
.
supportVersion
implementation
'org.jdeferred:jdeferred-android-aar:1.2.4'
implementation
'org.jdeferred:jdeferred-android-aar:1.2.4'
implementation
'org.jdeferred:jdeferred-android-aar:1.2.4'
implementation
'com.github.bumptech.glide:glide:3.7.0'
implementation
'com.github.bumptech.glide:glide:3.7.0'
implementation
'com.github.bumptech.glide:glide:3.7.0'
implementation
(
'com.github.chrisbanes.photoview:library:1.2.4'
)
{
implementation
(
'com.github.chrisbanes.photoview:library:1.2.4'
)
{
implementation
'com.github.chrisbanes.photoview:library:1.2.4'
implementation
'com.github.chrisbanes.photoview:library:1.2.4'
...
...
mobile/src/main/java/cn/garymb/ygomobile/App.java
View file @
0deb90b1
...
@@ -12,6 +12,11 @@ public class App extends GameApplication {
...
@@ -12,6 +12,11 @@ public class App extends GameApplication {
super
.
onCreate
();
super
.
onCreate
();
AppCompatDelegate
.
setCompatVectorFromResourcesEnabled
(
true
);
AppCompatDelegate
.
setCompatVectorFromResourcesEnabled
(
true
);
AppsSettings
.
init
(
this
);
AppsSettings
.
init
(
this
);
if
(
AppsSettings
.
get
().
isSoundEffect
())
{
initSoundEffectPool
();
setInitSoundEffectPool
(
true
);
}
// QbSdk.initX5Environment(this, null);
// QbSdk.initX5Environment(this, null);
// QbSdk.setCurrentID("");
// QbSdk.setCurrentID("");
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
View file @
0deb90b1
...
@@ -37,7 +37,7 @@ public class LogoActivity extends Activity {
...
@@ -37,7 +37,7 @@ public class LogoActivity extends Activity {
finish
();
finish
();
}
}
};
};
handler
.
postDelayed
(
runnable
,
1
5
00
);
handler
.
postDelayed
(
runnable
,
1
0
00
);
Toast
.
makeText
(
LogoActivity
.
this
,
R
.
string
.
logo_text
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
LogoActivity
.
this
,
R
.
string
.
logo_text
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
View file @
0deb90b1
...
@@ -873,6 +873,11 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -873,6 +873,11 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_sort
,
R
.
string
.
sort
,
R
.
drawable
.
sort
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_sort
,
R
.
string
.
sort
,
R
.
drawable
.
sort
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_quit
,
R
.
string
.
quit
,
R
.
drawable
.
quit
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_quit
,
R
.
string
.
quit
,
R
.
drawable
.
quit
);
//设置展开或隐藏的延时。 默认值为 800ms。
menu
.
setDuration
(
150
);
//设置每两个子按钮之间动画的延时(ms为单位)。 比如,如果延时设为0,那么所有子按钮都会同时展开或隐藏,默认值为100ms。
menu
.
setDelay
(
10
);
menu
.
setOnBoomListener
(
new
DefaultOnBoomListener
()
{
menu
.
setOnBoomListener
(
new
DefaultOnBoomListener
()
{
@Override
@Override
public
void
onClicked
(
int
index
,
BoomButton
boomButton
)
{
public
void
onClicked
(
int
index
,
BoomButton
boomButton
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
0deb90b1
...
@@ -400,6 +400,11 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -400,6 +400,11 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_settings
,
R
.
string
.
settings
,
R
.
drawable
.
setting
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_settings
,
R
.
string
.
settings
,
R
.
drawable
.
setting
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
nav_donation
,
R
.
string
.
donation
,
R
.
drawable
.
about
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
nav_donation
,
R
.
string
.
donation
,
R
.
drawable
.
about
);
//设置展开或隐藏的延时。 默认值为 800ms。
menu
.
setDuration
(
220
);
//设置每两个子按钮之间动画的延时(ms为单位)。 比如,如果延时设为0,那么所有子按钮都会同时展开或隐藏,默认值为100ms。
menu
.
setDelay
(
20
);
menu
.
setOnBoomListener
(
new
DefaultOnBoomListener
()
{
menu
.
setOnBoomListener
(
new
DefaultOnBoomListener
()
{
@Override
@Override
public
void
onClicked
(
int
index
,
BoomButton
boomButton
)
{
public
void
onClicked
(
int
index
,
BoomButton
boomButton
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
0deb90b1
...
@@ -59,16 +59,16 @@ public class MainActivity extends HomeActivity{
...
@@ -59,16 +59,16 @@ public class MainActivity extends HomeActivity{
ActivityCompat
.
requestPermissions
(
this
,
PERMISSIONS
,
0
);
ActivityCompat
.
requestPermissions
(
this
,
PERMISSIONS
,
0
);
}
}
@SuppressLint
(
"StringFormatMatches"
)
@SuppressLint
(
{
"StringFormatMatches"
,
"StringFormatInvalid"
}
)
@Override
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
for
(
int
i
=
0
;
i
<
permissions
.
length
;
i
++){
//
for(int i=0;i<permissions.length;i++){
if
(
grantResults
[
i
]
==
PackageManager
.
PERMISSION_DENIED
){
//
if(grantResults[i] == PackageManager.PERMISSION_DENIED){
showToast
(
getString
(
R
.
string
.
tip_no_permission
,
permissions
[
i
]));
//
showToast(getString(R.string.tip_no_permission,permissions[i]));
break
;
//
break;
}
//
}
}
//
}
//资源复制
//资源复制
checkRes
();
checkRes
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCardActivity.java
View file @
0deb90b1
package
cn.garymb.ygomobile.ui.mycard
;
package
cn.garymb.ygomobile.ui.mycard
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.content.ClipData
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Build
;
...
@@ -19,10 +22,12 @@ import android.widget.ProgressBar;
...
@@ -19,10 +22,12 @@ import android.widget.ProgressBar;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
com.tencent.smtt.sdk.ValueCallback
;
import
com.tencent.smtt.sdk.WebChromeClient
;
import
com.tencent.smtt.sdk.WebChromeClient
;
import
com.tencent.smtt.sdk.WebSettings
;
import
com.tencent.smtt.sdk.WebSettings
;
import
com.tencent.smtt.sdk.WebView
;
import
com.tencent.smtt.sdk.WebView
;
import
java.io.File
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.YGOStarter
;
...
@@ -30,10 +35,12 @@ import cn.garymb.ygomobile.lite.BuildConfig;
...
@@ -30,10 +35,12 @@ import cn.garymb.ygomobile.lite.BuildConfig;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.home.MainActivity
;
import
cn.garymb.ygomobile.ui.mycard.mcchat.SplashActivity
;
import
cn.garymb.ygomobile.ui.mycard.mcchat.SplashActivity
;
public
class
MyCardActivity
extends
BaseActivity
implements
MyCard
.
MyCardListener
,
NavigationView
.
OnNavigationItemSelectedListener
{
public
class
MyCardActivity
extends
BaseActivity
implements
MyCard
.
MyCardListener
,
NavigationView
.
OnNavigationItemSelectedListener
{
private
static
final
int
FILECHOOSER_RESULTCODE
=
10
;
private
MyCardWebView
mWebViewPlus
;
private
MyCardWebView
mWebViewPlus
;
private
MyCard
mMyCard
;
private
MyCard
mMyCard
;
protected
DrawerLayout
mDrawerlayout
;
protected
DrawerLayout
mDrawerlayout
;
...
@@ -41,6 +48,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -41,6 +48,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
private
TextView
mNameView
,
mStatusView
;
private
TextView
mNameView
,
mStatusView
;
private
ProgressBar
mProgressBar
;
private
ProgressBar
mProgressBar
;
private
ValueCallback
<
Uri
>
uploadMessage
;
private
ValueCallback
<
Uri
[]>
mUploadCallbackAboveL
;
@Override
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
@@ -89,6 +98,57 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -89,6 +98,57 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
}
}
super
.
onProgressChanged
(
view
,
newProgress
);
super
.
onProgressChanged
(
view
,
newProgress
);
}
}
@Override
public
void
openFileChooser
(
ValueCallback
<
Uri
>
valueCallback
,
String
acceptType
,
String
capture
)
{
uploadMessage
=
valueCallback
;
Intent
i
=
new
Intent
(
Intent
.
ACTION_GET_CONTENT
);
i
.
addCategory
(
Intent
.
CATEGORY_OPENABLE
);
i
.
setType
(
"*/*"
);
startActivityForResult
(
Intent
.
createChooser
(
i
,
"File Browser"
),
FILECHOOSER_RESULTCODE
);
}
@Override
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
valueCallback
,
FileChooserParams
fileChooserParams
)
{
mUploadCallbackAboveL
=
valueCallback
;
Intent
i
=
new
Intent
(
Intent
.
ACTION_GET_CONTENT
);
i
.
addCategory
(
Intent
.
CATEGORY_OPENABLE
);
i
.
setType
(
"*/*"
);
startActivityForResult
(
Intent
.
createChooser
(
i
,
"File Browser"
),
FILECHOOSER_RESULTCODE
);
return
true
;
}
// Android > 4.1.1 调用这个方法
// public void openFileChooser(ValueCallback<Uri> uploadMsg,
// String acceptType, String capture) {
// mUploadMessage = uploadMsg;
// choosePicture();
//
// Intent i = new Intent(Intent.ACTION_GET_CONTENT);
// i.addCategory(Intent.CATEGORY_OPENABLE);
// i.setType("*/*");
// startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
//
// }
//
// // 3.0 + 调用这个方法
// public void openFileChooser(ValueCallback<Uri> uploadMsg,
// String acceptType) {
// mUploadMessage = uploadMsg;
// choosePicture();
//
// }
//
// // Android < 3.0 调用这个方法
// public void openFileChooser(ValueCallback<Uri> uploadMsg) {
// mUploadMessage = uploadMsg;
// choosePicture();
// }
});
});
...
@@ -123,6 +183,49 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -123,6 +183,49 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
}
}
}
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
FILECHOOSER_RESULTCODE
)
{
if
(
null
==
uploadMessage
&&
null
==
mUploadCallbackAboveL
)
return
;
Uri
result
=
data
==
null
||
resultCode
!=
RESULT_OK
?
null
:
data
.
getData
();
if
(
mUploadCallbackAboveL
!=
null
)
{
onActivityResultAboveL
(
requestCode
,
resultCode
,
data
);
}
else
if
(
uploadMessage
!=
null
)
{
uploadMessage
.
onReceiveValue
(
result
);
uploadMessage
=
null
;
}
}
}
@TargetApi
(
Build
.
VERSION_CODES
.
LOLLIPOP
)
private
void
onActivityResultAboveL
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
requestCode
!=
FILECHOOSER_RESULTCODE
||
mUploadCallbackAboveL
==
null
)
{
return
;
}
Uri
[]
results
=
null
;
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
if
(
data
==
null
)
{
}
else
{
String
dataString
=
data
.
getDataString
();
ClipData
clipData
=
data
.
getClipData
();
if
(
clipData
!=
null
)
{
results
=
new
Uri
[
clipData
.
getItemCount
()];
for
(
int
i
=
0
;
i
<
clipData
.
getItemCount
();
i
++)
{
ClipData
.
Item
item
=
clipData
.
getItemAt
(
i
);
results
[
i
]
=
item
.
getUri
();
}
}
if
(
dataString
!=
null
)
results
=
new
Uri
[]{
Uri
.
parse
(
dataString
)};
}
}
mUploadCallbackAboveL
.
onReceiveValue
(
results
);
mUploadCallbackAboveL
=
null
;
return
;
}
/*@Override
/*@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mWebViewPlus != null) {
if (mWebViewPlus != null) {
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
View file @
0deb90b1
...
@@ -109,6 +109,13 @@ public class ServiceDuelAssistant extends Service {
...
@@ -109,6 +109,13 @@ public class ServiceDuelAssistant extends Service {
startClipboardListener
();
startClipboardListener
();
}
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
//关闭悬浮窗时的声明
stopForeground
(
true
);
}
private
void
startClipboardListener
()
{
private
void
startClipboardListener
()
{
final
ClipboardManager
cm
=
(
ClipboardManager
)
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
final
ClipboardManager
cm
=
(
ClipboardManager
)
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
if
(
cm
==
null
)
if
(
cm
==
null
)
...
@@ -209,19 +216,20 @@ public class ServiceDuelAssistant extends Service {
...
@@ -209,19 +216,20 @@ public class ServiceDuelAssistant extends Service {
builder
.
setSmallIcon
(
R
.
drawable
.
ic_icon
);
builder
.
setSmallIcon
(
R
.
drawable
.
ic_icon
);
builder
.
setCustomContentView
(
remoteViews
);
builder
.
setCustomContentView
(
remoteViews
);
startForeground
(
1
,
builder
.
build
());
startForeground
(
1
,
builder
.
build
());
}
else
{
//如果没有通知权限则关闭服务
stopForeground
(
true
);
stopService
(
new
Intent
(
ServiceDuelAssistant
.
this
,
ServiceDuelAssistant
.
class
));
}
}
}
}
}
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
//关闭悬浮窗时的声明
stopForeground
(
true
);
}
@Override
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
if
(
intent
==
null
)
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
String
action
=
intent
.
getAction
();
String
action
=
intent
.
getAction
();
Log
.
d
(
TAG
,
"rev action:"
+
action
);
Log
.
d
(
TAG
,
"rev action:"
+
action
);
if
(
DUEL_ASSISTANT_SERVICE_ACTION
.
equals
(
action
))
{
if
(
DUEL_ASSISTANT_SERVICE_ACTION
.
equals
(
action
))
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
View file @
0deb90b1
...
@@ -33,6 +33,7 @@ import java.io.FileInputStream;
...
@@ -33,6 +33,7 @@ import java.io.FileInputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
...
@@ -96,9 +97,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -96,9 +97,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
addPreferencesFromResource
(
R
.
xml
.
preference_game
);
addPreferencesFromResource
(
R
.
xml
.
preference_game
);
bind
(
PREF_GAME_PATH
,
mSettings
.
getResourcePath
());
bind
(
PREF_GAME_PATH
,
mSettings
.
getResourcePath
());
// bind(PREF_GAME_VERSION, mSettings.getVersionString(mSettings.getGameVersion()));
// bind(PREF_GAME_VERSION, mSettings.getVersionString(mSettings.getGameVersion()));
bind
(
PREF_CHANGE_LOG
,
SystemUtils
.
getVersionName
(
getActivity
())
bind
(
PREF_CHANGE_LOG
,
SystemUtils
.
getVersionName
(
getActivity
())
+
"("
+
SystemUtils
.
getVersion
(
getActivity
())
+
")"
);
+
"("
+
SystemUtils
.
getVersion
(
getActivity
())
+
")"
);
bind
(
PREF_CHECK_UPDATE
,
getString
(
R
.
string
.
settings_about_author_pref
)+
" : "
+
getString
(
R
.
string
.
settings_author
));
bind
(
PREF_CHECK_UPDATE
,
getString
(
R
.
string
.
settings_about_author_pref
)
+
" : "
+
getString
(
R
.
string
.
settings_author
));
bind
(
PREF_SOUND_EFFECT
,
mSettings
.
isSoundEffect
());
bind
(
PREF_SOUND_EFFECT
,
mSettings
.
isSoundEffect
());
bind
(
PREF_LOCK_SCREEN
,
mSettings
.
isLockSreenOrientation
());
bind
(
PREF_LOCK_SCREEN
,
mSettings
.
isLockSreenOrientation
());
bind
(
PREF_FONT_ANTIALIAS
,
mSettings
.
isFontAntiAlias
());
bind
(
PREF_FONT_ANTIALIAS
,
mSettings
.
isFontAntiAlias
());
...
@@ -116,7 +117,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -116,7 +117,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
}
bind
(
PREF_DECK_DELETE_DILAOG
,
mSettings
.
isDialogDelete
());
bind
(
PREF_DECK_DELETE_DILAOG
,
mSettings
.
isDialogDelete
());
//bind(PREF_USE_EXTRA_CARD_CARDS, mSettings.isUseExtraCards());
//bind(PREF_USE_EXTRA_CARD_CARDS, mSettings.isUseExtraCards());
bind
(
SETTINGS_AVATAR
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
());
bind
(
SETTINGS_AVATAR
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
());
bind
(
SETTINGS_COVER
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER
).
getAbsolutePath
());
bind
(
SETTINGS_COVER
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER
).
getAbsolutePath
());
bind
(
SETTINGS_CARD_BG
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
());
bind
(
SETTINGS_CARD_BG
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
());
bind
(
PREF_FONT_SIZE
,
mSettings
.
getFontSize
());
bind
(
PREF_FONT_SIZE
,
mSettings
.
getFontSize
());
...
@@ -158,10 +159,19 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -158,10 +159,19 @@ public class SettingFragment extends PreferenceFragmentPlus {
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
mSharedPreferences
.
edit
().
putBoolean
(
preference
.
getKey
(),
checkBoxPreference
.
isChecked
()).
apply
();
mSharedPreferences
.
edit
().
putBoolean
(
preference
.
getKey
(),
checkBoxPreference
.
isChecked
()).
apply
();
//如果事设置额外卡库的选项
//如果事设置额外卡库的选项
if
(
preference
.
getKey
().
equals
(
PREF_READ_EX
)){
if
(
preference
.
getKey
().
equals
(
PREF_READ_EX
))
{
//设置使用额外卡库后重新加载卡片数据
//设置使用额外卡库后重新加载卡片数据
DataManager
.
get
().
load
(
true
);
DataManager
.
get
().
load
(
true
);
}
}
//如果是音效开关
if
(
preference
.
getKey
().
equals
(
PREF_SOUND_EFFECT
))
{
//如果打勾开启音效
if
(
checkBoxPreference
.
isChecked
())
{
//如果未初始化音效
if
(
App
.
get
().
isInitSoundEffectPool
())
App
.
get
().
initSoundEffectPool
();
}
}
return
true
;
return
true
;
}
}
boolean
rs
=
super
.
onPreferenceChange
(
preference
,
value
);
boolean
rs
=
super
.
onPreferenceChange
(
preference
,
value
);
...
@@ -186,7 +196,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -186,7 +196,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
.
show
();
.
show
();
}
}
if
(
PREF_CHECK_UPDATE
.
equals
(
key
))
{
if
(
PREF_CHECK_UPDATE
.
equals
(
key
))
{
HomeActivity
.
checkPgyerUpdateSilent
(
getActivity
(),
true
,
true
,
true
);
HomeActivity
.
checkPgyerUpdateSilent
(
getActivity
(),
true
,
true
,
true
);
}
}
if
(
PREF_PENDULUM_SCALE
.
equals
(
key
))
{
if
(
PREF_PENDULUM_SCALE
.
equals
(
key
))
{
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
...
@@ -203,14 +213,14 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -203,14 +213,14 @@ public class SettingFragment extends PreferenceFragmentPlus {
View
viewDialog
=
dialog
.
getContentView
();
View
viewDialog
=
dialog
.
getContentView
();
ImageView
avatar1
=
viewDialog
.
findViewById
(
R
.
id
.
me
);
ImageView
avatar1
=
viewDialog
.
findViewById
(
R
.
id
.
me
);
ImageView
avatar2
=
viewDialog
.
findViewById
(
R
.
id
.
opponent
);
ImageView
avatar2
=
viewDialog
.
findViewById
(
R
.
id
.
opponent
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_ME
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_ME
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_OPPONENT
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar2
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_OPPONENT
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar2
);
avatar1
.
setOnClickListener
((
v
)
->
{
avatar1
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
();
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
dialog
.
dismiss
();
dialog
.
dismiss
();
});
});
avatar2
.
setOnClickListener
((
v
)
->
{
avatar2
.
setOnClickListener
((
v
)
->
{
...
@@ -218,10 +228,10 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -218,10 +228,10 @@ public class SettingFragment extends PreferenceFragmentPlus {
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_OPPONENT
).
getAbsolutePath
();
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_OPPONENT
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
dialog
.
dismiss
();
dialog
.
dismiss
();
});
});
}
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
);
...
@@ -230,8 +240,8 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -230,8 +240,8 @@ 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
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_COVER
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
],
cover1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_COVER
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
],
cover1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_COVER2
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
],
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
();
...
@@ -258,9 +268,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -258,9 +268,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
ImageView
bg
=
viewDialog
.
findViewById
(
R
.
id
.
bg
);
ImageView
bg
=
viewDialog
.
findViewById
(
R
.
id
.
bg
);
ImageView
bg_menu
=
viewDialog
.
findViewById
(
R
.
id
.
bg_menu
);
ImageView
bg_menu
=
viewDialog
.
findViewById
(
R
.
id
.
bg_menu
);
ImageView
bg_deck
=
viewDialog
.
findViewById
(
R
.
id
.
bg_deck
);
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
,
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_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
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_BG_DECK
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg_deck
);
bg
.
setOnClickListener
((
v
)
->
{
bg
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
();
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
();
...
@@ -349,13 +359,13 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -349,13 +359,13 @@ public class SettingFragment extends PreferenceFragmentPlus {
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
layoutParams
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
;
layoutParams
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
;
frameLayout
.
addView
(
imageView
,
layoutParams
);
frameLayout
.
addView
(
imageView
,
layoutParams
);
// builder.setContentView(frameLayout);
// builder.setContentView(frameLayout);
//builder.setLeftButtonText(R.string.settings);
//builder.setLeftButtonText(R.string.settings);
//builder.setLeftButtonListener((dlg, s) -> {
//builder.setLeftButtonListener((dlg, s) -> {
showImageCropChooser
(
preference
,
getString
(
R
.
string
.
dialog_select_image
),
outFile
,
showImageCropChooser
(
preference
,
getString
(
R
.
string
.
dialog_select_image
),
outFile
,
isJpeg
,
outWidth
,
outHeight
);
isJpeg
,
outWidth
,
outHeight
);
//dlg.dismiss();
//dlg.dismiss();
// });
// });
// builder.setOnCancelListener((dlg) -> {
// builder.setOnCancelListener((dlg) -> {
// BitmapUtil.destroy(imageView.getDrawable());
// BitmapUtil.destroy(imageView.getDrawable());
// });
// });
...
@@ -369,7 +379,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -369,7 +379,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
}
}
}
public
void
setImage
(
String
outFile
,
int
outWidth
,
int
outHeight
,
ImageView
imageView
)
{
public
void
setImage
(
String
outFile
,
int
outWidth
,
int
outHeight
,
ImageView
imageView
)
{
File
img
=
new
File
(
outFile
);
File
img
=
new
File
(
outFile
);
if
(
img
.
exists
())
{
if
(
img
.
exists
())
{
Glide
.
with
(
this
).
load
(
img
).
signature
(
new
StringSignature
(
img
.
getName
()
+
img
.
lastModified
()))
Glide
.
with
(
this
).
load
(
img
).
signature
(
new
StringSignature
(
img
.
getName
()
+
img
.
lastModified
()))
...
...
mobile/src/main/res/layout/activity_home.xml
View file @
0deb90b1
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<ImageView
<ImageView
android:id=
"@+id/cube"
android:id=
"@+id/cube"
android:layout_width=
"40dp"
android:layout_width=
"40dp"
android:layout_height=
"4
0
dp"
android:layout_height=
"4
1
dp"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
app:srcCompat=
"@drawable/cube"
/>
app:srcCompat=
"@drawable/cube"
/>
</com.nightonke.boommenu.BoomMenuButton>
</com.nightonke.boommenu.BoomMenuButton>
...
...
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