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
59195fbe
Commit
59195fbe
authored
Nov 23, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加服务器作为serverlist的footerview
parent
4f2ba092
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
22 deletions
+37
-22
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
...n/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
+3
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+12
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
...mb/ygomobile/ui/preference/fragments/SettingFragment.java
+7
-20
mobile/src/main/res/drawable-xhdpi/addserver.png
mobile/src/main/res/drawable-xhdpi/addserver.png
+0
-0
mobile/src/main/res/drawable-xhdpi/reset.png
mobile/src/main/res/drawable-xhdpi/reset.png
+0
-0
mobile/src/main/res/layout/item_ic_add.xml
mobile/src/main/res/layout/item_ic_add.xml
+15
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
View file @
59195fbe
package
cn.garymb.ygomobile.ui.activities
;
import
static
android
.
view
.
View
.
VISIBLE
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
...
...
@@ -127,7 +129,7 @@ public class WebActivity extends BaseActivity {
public
static
void
open
(
Context
context
,
String
title
,
String
url
,
boolean
showButton
)
{
open
(
context
,
title
,
url
);
if
(
showButton
){
btn_download
.
setVisibility
(
V
iew
.
V
ISIBLE
);
btn_download
.
setVisibility
(
VISIBLE
);
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
59195fbe
...
...
@@ -14,6 +14,7 @@ import android.text.TextUtils;
import
android.util.Log
;
import
android.util.SparseArray
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.view.View
;
...
...
@@ -501,7 +502,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_game
,
R
.
string
.
action_game
,
R
.
drawable
.
start
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_help
,
R
.
string
.
help
,
R
.
drawable
.
help
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_reset_game_res
,
R
.
string
.
reset_game_res
,
R
.
drawable
.
downloadimages
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_reset_game_res
,
R
.
string
.
reset_game_res
,
R
.
drawable
.
reset
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_settings
,
R
.
string
.
settings
,
R
.
drawable
.
setting
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
nav_webpage
,
R
.
string
.
donation
,
R
.
drawable
.
about
);
...
...
@@ -696,6 +697,16 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
public
void
initServerlist
()
{
mServerList
=
$
(
R
.
id
.
list_server
);
mServerListAdapter
=
new
ServerListAdapter
(
this
);
LayoutInflater
infla
=
LayoutInflater
.
from
(
this
);
View
footView
=
infla
.
inflate
(
R
.
layout
.
item_ic_add
,
null
);
TextView
add_server
=
footView
.
findViewById
(
R
.
id
.
add_server
);
add_server
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
mServerListManager
.
addServer
();
}
});
mServerListAdapter
.
addFooterView
(
footView
);
//server list
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
this
);
mServerList
.
setLayoutManager
(
linearLayoutManager
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
View file @
59195fbe
...
...
@@ -4,7 +4,11 @@ import android.annotation.SuppressLint;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Matrix
;
import
android.graphics.drawable.BitmapDrawable
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
...
...
@@ -284,17 +288,13 @@ public class SettingFragment extends PreferenceFragmentPlus {
avatar1
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
dialog
.
dismiss
();
});
avatar2
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_OPPONENT
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
dialog
.
dismiss
();
});
}
else
if
(
SETTINGS_COVER
.
equals
(
key
))
{
...
...
@@ -467,26 +467,14 @@ public class SettingFragment extends PreferenceFragmentPlus {
private
void
showImageDialog
(
Preference
preference
,
String
title
,
String
outFile
,
boolean
isJpeg
,
int
outWidth
,
int
outHeight
)
{
int
width
=
getResources
().
getDisplayMetrics
().
widthPixels
;
//DialogPlus builder = new DialogPlus(getActivity());
final
ImageView
imageView
=
new
ImageView
(
getActivity
());
FrameLayout
frameLayout
=
new
FrameLayout
(
getActivity
());
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
FIT_CENTER
);
//builder.setTitle(title);
FrameLayout
.
LayoutParams
layoutParams
=
new
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
layoutParams
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
;
frameLayout
.
addView
(
imageView
,
layoutParams
);
// builder.setContentView(frameLayout);
//builder.setLeftButtonText(R.string.settings);
//builder.setLeftButtonListener((dlg, s) -> {
showImageCropChooser
(
preference
,
getString
(
R
.
string
.
dialog_select_image
),
outFile
,
isJpeg
,
outWidth
,
outHeight
);
//dlg.dismiss();
// });
// builder.setOnCancelListener((dlg) -> {
// BitmapUtil.destroy(imageView.getDrawable());
// });
//builder.show();
showImageCropChooser
(
preference
,
getString
(
R
.
string
.
dialog_select_image
),
outFile
,
isJpeg
,
outWidth
,
outHeight
);
File
img
=
new
File
(
outFile
);
if
(
img
.
exists
())
{
GlideCompat
.
with
(
this
).
load
(
img
).
signature
(
new
MediaStoreSignature
(
"image/*"
,
img
.
lastModified
(),
0
))
...
...
@@ -495,7 +483,6 @@ public class SettingFragment extends PreferenceFragmentPlus {
.
into
(
imageView
);
}
}
public
void
setImage
(
String
outFile
,
int
outWidth
,
int
outHeight
,
ImageView
imageView
)
{
File
img
=
new
File
(
outFile
);
if
(
img
.
exists
())
{
...
...
mobile/src/main/res/drawable-xhdpi/addserver.png
0 → 100644
View file @
59195fbe
12.5 KB
mobile/src/main/res/drawable-xhdpi/reset.png
0 → 100644
View file @
59195fbe
9.64 KB
mobile/src/main/res/layout/item_ic_add.xml
0 → 100644
View file @
59195fbe
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center|top"
>
<TextView
android:id=
"@+id/add_server"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/addserver"
android:gravity=
"center"
android:text=
"@string/action_add_server"
android:textColor=
"@color/selector_text_color_white_gold"
></TextView>
</LinearLayout>
\ No newline at end of file
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