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
a9f6f6b8
Commit
a9f6f6b8
authored
Jul 28, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mycard移除drawer布局,将用户信息和聊天室入口移至可见区域
parent
f96b272f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
118 deletions
+136
-118
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCard.java
...e/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCard.java
+8
-12
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MycardFragment.java
...in/java/cn/garymb/ygomobile/ui/mycard/MycardFragment.java
+13
-53
mobile/src/main/res/layout/fragment_mycard.xml
mobile/src/main/res/layout/fragment_mycard.xml
+112
-45
mobile/src/main/res/menu/nav_mycard_menu.xml
mobile/src/main/res/menu/nav_mycard_menu.xml
+0
-8
mobile/src/main/res/values-ko/strings.xml
mobile/src/main/res/values-ko/strings.xml
+1
-0
mobile/src/main/res/values-zh/strings.xml
mobile/src/main/res/values-zh/strings.xml
+1
-0
mobile/src/main/res/values/strings.xml
mobile/src/main/res/values/strings.xml
+1
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MyCard.java
View file @
a9f6f6b8
...
...
@@ -213,10 +213,6 @@ public class MyCard {
public
interface
MyCardListener
{
void
onLogin
(
String
name
,
String
icon
,
String
statu
);
void
openDrawer
();
void
closeDrawer
();
void
backHome
();
void
share
(
String
text
);
...
...
@@ -281,7 +277,7 @@ public class MyCard {
activity.runOnUiThread(mListener::puzzleMode);
}
}
*/
@JavascriptInterface
public void openDrawer() {
if (mListener != null) {
...
...
@@ -289,6 +285,13 @@ public class MyCard {
}
}
@JavascriptInterface
public void closeDrawer() {
if (mListener != null) {
activity.runOnUiThread(mListener::closeDrawer);
}
}
*/
@JavascriptInterface
public
void
backHome
()
{
if
(
mListener
!=
null
)
{
...
...
@@ -305,13 +308,6 @@ public class MyCard {
}
}
@JavascriptInterface
public
void
closeDrawer
()
{
if
(
mListener
!=
null
)
{
activity
.
runOnUiThread
(
mListener:
:
closeDrawer
);
}
}
@JavascriptInterface
public
void
join
(
String
host
,
int
port
,
String
name
,
String
room
)
{
try
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/MycardFragment.java
View file @
a9f6f6b8
...
...
@@ -40,11 +40,10 @@ import cn.garymb.ygomobile.lite.R;
import
cn.garymb.ygomobile.ui.mycard.mcchat.SplashActivity
;
import
cn.garymb.ygomobile.utils.glide.GlideCompat
;
public
class
MycardFragment
extends
BaseFragemnt
implements
View
.
OnClickListener
,
MyCard
.
MyCardListener
,
NavigationView
.
OnNavigationItemSelectedListener
{
public
class
MycardFragment
extends
BaseFragemnt
implements
View
.
OnClickListener
,
MyCard
.
MyCardListener
{
private
static
final
int
FILECHOOSER_RESULTCODE
=
10
;
private
static
final
int
TYPE_MC_LOGIN
=
0
;
protected
DrawerLayout
mDrawerlayout
;
private
MyCardWebView
mWebViewPlus
;
private
MyCard
mMyCard
;
private
ImageView
mHeadView
;
...
...
@@ -74,10 +73,7 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreateView
(
inflater
,
container
,
savedInstanceState
);
View
view
;
if
(
isHorizontal
)
view
=
inflater
.
inflate
(
R
.
layout
.
mycard_horizontal_fragment
,
container
,
false
);
else
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_mycard
,
container
,
false
);
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_mycard
,
container
,
false
);
initView
(
view
);
return
view
;
}
...
...
@@ -86,21 +82,16 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
YGOStarter
.
onCreated
(
getActivity
());
mMyCard
=
new
MyCard
(
getActivity
());
mWebViewPlus
=
view
.
findViewById
(
R
.
id
.
webbrowser
);
mDrawerlayout
=
view
.
findViewById
(
R
.
id
.
drawer_layout
);
mProgressBar
=
view
.
findViewById
(
R
.
id
.
progressBar
);
tv_back_mc
=
view
.
findViewById
(
R
.
id
.
tv_back_mc
);
mProgressBar
.
setMax
(
100
);
tv_back_mc
=
view
.
findViewById
(
R
.
id
.
tv_back_mc
);
tv_back_mc
.
setOnClickListener
(
this
);
NavigationView
navigationView
=
view
.
findViewById
(
R
.
id
.
nav_main
);
navigationView
.
setNavigationItemSelectedListener
(
this
);
View
navHead
=
navigationView
.
getHeaderView
(
0
);
mHeadView
=
navHead
.
findViewById
(
R
.
id
.
img_head
);
mNameView
=
navHead
.
findViewById
(
R
.
id
.
tv_name
);
mStatusView
=
navHead
.
findViewById
(
R
.
id
.
tv_dp
);
mHeadView
=
view
.
findViewById
(
R
.
id
.
img_head
);
mNameView
=
view
.
findViewById
(
R
.
id
.
tv_name
);
mStatusView
=
view
.
findViewById
(
R
.
id
.
tv_dp
);
//mWebViewPlus.enableHtml5();
tv_back_mc
.
setOnClickListener
(
this
);
WebSettings
settings
=
mWebViewPlus
.
getSettings
();
settings
.
setUserAgentString
(
settings
.
getUserAgentString
()
+
MessageFormat
.
format
(
" YGOMobile/{0} ({1} {2,number,#})"
,
...
...
@@ -218,20 +209,17 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
}
private
boolean
doMenu
(
int
id
)
{
closeDrawer
();
switch
(
id
)
{
case
R
.
id
.
action_home
:
onHome
();
break
;
break
;
/*
case R.id.action_arena:
mWebViewPlus.loadUrl(mMyCard.getArenaUrl());
break;
case R.id.action_bbs:
mWebViewPlus.loadUrl(mMyCard.getBBSUrl());
break
;
case
R
.
id
.
action_chat
:
startActivity
(
new
Intent
(
getActivity
(),
SplashActivity
.
class
));
break
;
break;*/
default
:
return
false
;
}
...
...
@@ -277,18 +265,12 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
@Override
public
void
onBackPressed
()
{
if
(
mDrawerlayout
.
isDrawerOpen
(
Gravity
.
LEFT
))
{
closeDrawer
();
return
;
}
if
(
mWebViewPlus
.
getUrl
().
equals
(
mMyCard
.
getMcMainUrl
()))
{
//finish();
return
;
}
if
(
mWebViewPlus
.
canGoBack
())
{
mWebViewPlus
.
goBack
();
}
else
{
//finish();
}
}
...
...
@@ -303,6 +285,9 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
case
R
.
id
.
tv_back_mc
:
onHome
();
break
;
case
R
.
id
.
rl_chat
:
startActivity
(
new
Intent
(
getActivity
(),
SplashActivity
.
class
));
break
;
}
}
...
...
@@ -314,20 +299,6 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
handler
.
sendMessage
(
message
);
}
@Override
public
void
openDrawer
()
{
if
(!
mDrawerlayout
.
isDrawerOpen
(
Gravity
.
LEFT
))
{
mDrawerlayout
.
openDrawer
(
Gravity
.
LEFT
);
}
}
@Override
public
void
closeDrawer
()
{
if
(
mDrawerlayout
.
isDrawerOpen
(
Gravity
.
LEFT
))
{
mDrawerlayout
.
closeDrawer
(
Gravity
.
LEFT
);
}
}
@Override
public
void
backHome
()
{
...
...
@@ -348,15 +319,4 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
public
void
onHome
()
{
mWebViewPlus
.
loadUrl
(
mMyCard
.
getHomeUrl
());
}
/**
* Called when an item in the navigation menu is selected.
*
* @param item The selected item
* @return true to display the item as the selected item
*/
@Override
public
boolean
onNavigationItemSelected
(
@NonNull
MenuItem
item
)
{
return
false
;
}
}
mobile/src/main/res/layout/fragment_mycard.xml
View file @
a9f6f6b8
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/drawer_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:
clipToPadding=
"false
"
tools:openDrawer=
"left"
>
android:
background=
"@drawable/dialogshort
"
android:weightSum=
"10"
android:orientation=
"vertical"
>
<
Linear
Layout
android:
orientation=
"vertical
"
<
Relative
Layout
android:
id=
"@+id/rl_head
"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
android:paddingLeft=
"20dp"
android:paddingTop=
"10dp"
android:paddingRight=
"20dp"
android:paddingBottom=
"10dp"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/img_head"
android:layout_width=
"@dimen/label_width_50dp"
android:layout_height=
"@dimen/label_width_50dp"
android:src=
"@drawable/avatar"
/>
<androidx.appcompat.widget.AppCompatTextView
android:visibility=
"gone"
android:id=
"@+id/tv_back_mc"
android:background=
"@drawable/click_background"
android:textColor=
"@color/black"
android:layout_width=
"match_parent"
android:text=
"返回萌卡大厅"
android:textSize=
"13sp"
android:textStyle=
"bold"
android:gravity=
"center"
android:paddingTop=
"6dp"
android:paddingBottom=
"6dp"
android:layout_height=
"wrap_content"
/>
<cn.garymb.ygomobile.ui.mycard.MyCardWebView
android:id=
"@+id/webbrowser"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:id=
"@+id/tv_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_toRightOf=
"@id/img_head"
android:text=
"@string/mc_chat"
android:textColor=
"@color/holo_green_bright"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_name"
android:layout_marginTop=
"5dp"
android:layout_toRightOf=
"@id/img_head"
android:ellipsize=
"end"
android:lines=
"1"
android:text=
"account"
android:textColor=
"@color/holo_orange_bright"
android:textSize=
"13sp"
/>
<androidx.appcompat.widget.AppCompatImageButton
android:layout_width=
"@dimen/dp_40"
android:layout_height=
"@dimen/dp_40"
android:nextFocusRight=
"@string/mc_chat"
/>
<ProgressBar
android:id=
"@+id/progressBar"
style=
"@style/StyleProgressBarMini"
android:layout_width=
"match_parent"
android:layout_height=
"5px"
/>
</RelativeLayout>
</cn.garymb.ygomobile.ui.mycard.MyCardWebView>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_back_mc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/list_item_bg"
android:gravity=
"center"
android:paddingTop=
"6dp"
android:paddingBottom=
"6dp"
android:text=
"@string/back_to_mycard_home"
android:textColor=
"@color/holo_green_bright"
android:textSize=
"13sp"
android:textStyle=
"bold"
android:visibility=
"gone"
/>
<cn.garymb.ygomobile.ui.mycard.MyCardWebView
android:id=
"@+id/webbrowser"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"8"
>
<ProgressBar
android:id=
"@+id/progressBar"
style=
"@style/StyleProgressBarMini"
android:layout_width=
"match_parent"
android:layout_height=
"5px"
/>
</
LinearLayout
>
</
cn.garymb.ygomobile.ui.mycard.MyCardWebView
>
<com.google.android.material.navigation.NavigationView
android:id=
"@+id/nav_main"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"left"
android:background=
"@color/white"
app:headerLayout=
"@layout/nav_mycard_head"
app:itemIconTint=
"@color/gold"
app:itemTextColor=
"@color/mediumPurple"
app:menu=
"@menu/nav_mycard_menu"
/>
<RelativeLayout
android:id=
"@+id/rl_chat"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:background=
"@drawable/list_item_bg"
android:orientation=
"vertical"
android:paddingLeft=
"20dp"
android:paddingTop=
"10dp"
android:paddingRight=
"20dp"
android:paddingBottom=
"10dp"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_message_s"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/mc_chat"
android:textColor=
"@color/holo_green_bright"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
</androidx.drawerlayout.widget.DrawerLayout>
\ No newline at end of file
<ProgressBar
android:id=
"@+id/pb_chat_loading"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"5dp"
android:layout_toRightOf=
"@id/tv_message_s"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_message"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_message_s"
android:layout_marginTop=
"5dp"
android:ellipsize=
"end"
android:lines=
"1"
android:text=
""
android:textColor=
"@color/holo_orange_bright"
android:textSize=
"13sp"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/menu/nav_mycard_menu.xml
View file @
a9f6f6b8
...
...
@@ -8,12 +8,4 @@
android:id=
"@+id/action_chat"
android:icon=
"@drawable/ic_send_black_24dp"
android:title=
"@string/mc_chat"
/>
<item
android:id=
"@+id/action_bbs"
android:icon=
"@drawable/ic_forum"
android:title=
"@string/bbs"
/>
<item
android:id=
"@+id/action_arena"
android:icon=
"@drawable/ic_highlight"
android:title=
"@string/arena"
/>
</menu>
mobile/src/main/res/values-ko/strings.xml
View file @
a9f6f6b8
...
...
@@ -328,4 +328,5 @@
<string
name=
"personal"
>
나의
</string>
<string
name=
"login_mycard"
>
로그인
</string>
<string
name=
"logout_mycard"
>
로그아웃\?
</string>
<string
name=
"back_to_mycard_home"
>
return to MyCard homepage
</string>
</resources>
mobile/src/main/res/values-zh/strings.xml
View file @
a9f6f6b8
...
...
@@ -328,4 +328,5 @@
<string
name=
"replay"
>
查看录像
</string>
<string
name=
"bot_mode"
>
人机练习
</string>
<string
name=
"personal"
>
我的
</string>
<string
name=
"back_to_mycard_home"
>
返回萌卡首页
</string>
</resources>
mobile/src/main/res/values/strings.xml
View file @
a9f6f6b8
...
...
@@ -338,4 +338,5 @@
<string
name=
"personal"
>
My
</string>
<string
name=
"login_mycard"
>
login
</string>
<string
name=
"logout_mycard"
>
Logout mycard\?
</string>
<string
name=
"back_to_mycard_home"
>
return to MyCard homepage
</string>
</resources>
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