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
3e6b2f2f
Commit
3e6b2f2f
authored
Aug 02, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webactivity页内关键词查找
parent
96486a0b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
155 additions
and
25 deletions
+155
-25
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
...n/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
+70
-13
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
.../main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
+5
-6
mobile/src/main/res/drawable/baseline_keyboard_arrow_down_24.xml
...src/main/res/drawable/baseline_keyboard_arrow_down_24.xml
+5
-0
mobile/src/main/res/drawable/baseline_keyboard_arrow_up_24.xml
...e/src/main/res/drawable/baseline_keyboard_arrow_up_24.xml
+5
-0
mobile/src/main/res/layout/activity_webbrowser.xml
mobile/src/main/res/layout/activity_webbrowser.xml
+51
-1
mobile/src/main/res/layout/content_toolbar.xml
mobile/src/main/res/layout/content_toolbar.xml
+12
-1
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
mobile/src/main/res/values/styles.xml
mobile/src/main/res/values/styles.xml
+3
-3
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
View file @
3e6b2f2f
...
...
@@ -12,15 +12,24 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.util.Log
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.inputmethod.EditorInfo
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.widget.Toolbar
;
import
com.tencent.smtt.export.external.interfaces.IX5WebViewBase
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
...
...
@@ -32,7 +41,6 @@ import cn.garymb.ygomobile.AppsSettings;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.bean.ServerList
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.home.MainActivity
;
import
cn.garymb.ygomobile.ui.home.ServerListManager
;
...
...
@@ -49,12 +57,17 @@ import cn.garymb.ygomobile.utils.YGOUtil;
import
ocgcore.DataManager
;
import
ocgcore.data.Card
;
public
class
WebActivity
extends
BaseActivity
{
public
class
WebActivity
extends
BaseActivity
implements
View
.
OnClickListener
{
private
static
String
TAG
=
"WebActivity"
;
/* 全局存储了扩展卡版本号,会被其他activity使用 */
private
static
String
exCardVer
;
private
WebViewPlus
mWebViewPlus
;
private
String
mUrl
;
private
String
mTitle
;
private
ImageButton
btn_context_search
;
private
LinearLayout
find_in_page
;
private
EditText
et_context_keyword
;
private
ImageButton
btn_context_search_close
,
btn_context_search_last
,
btn_context_search_next
;
private
Button
btn_download
;
private
List
<
ServerInfo
>
serverInfos
;
private
ServerInfo
mServerInfo
;
...
...
@@ -118,6 +131,8 @@ public class WebActivity extends BaseActivity {
setSupportActionBar
(
toolbar
);
enableBackHome
();
mWebViewPlus
=
$
(
R
.
id
.
webbrowser
);
find_in_page
=
$
(
R
.
id
.
find_in_page
);
et_context_keyword
=
$
(
R
.
id
.
context_keyword
);
serverInfos
=
new
ArrayList
<>();
xmlFile
=
new
File
(
this
.
getFilesDir
(),
Constants
.
SERVER_FILE
);
initButton
();
...
...
@@ -141,6 +156,16 @@ public class WebActivity extends BaseActivity {
btn_download
.
setVisibility
(
View
.
GONE
);
}
}
TextView
.
OnEditorActionListener
searchListener
=
(
v
,
actionId
,
event
)
->
{
if
(
actionId
==
EditorInfo
.
IME_ACTION_SEARCH
)
{
InputMethodManager
imm
=
(
InputMethodManager
)
this
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
hideSoftInputFromWindow
(
v
.
getWindowToken
(),
0
);
mWebViewPlus
.
findAllAsync
(
et_context_keyword
.
getText
().
toString
());
return
true
;
}
return
false
;
};
et_context_keyword
.
setOnEditorActionListener
(
searchListener
);
}
@Override
...
...
@@ -165,6 +190,7 @@ public class WebActivity extends BaseActivity {
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
find_in_page
.
setVisibility
(
View
.
GONE
);
if
(
item
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
onBackHome
();
return
true
;
...
...
@@ -213,6 +239,47 @@ public class WebActivity extends BaseActivity {
super
.
onDestroy
();
}
@Override
public
void
onClick
(
View
v
)
{
switch
(
v
.
getId
())
{
case
R
.
id
.
web_text_search
:
find_in_page
.
setVisibility
(
View
.
VISIBLE
);
break
;
case
R
.
id
.
ib_last
:
mWebViewPlus
.
findNext
(
false
);
//为false时表示上一项
break
;
case
R
.
id
.
ib_next
:
mWebViewPlus
.
findNext
(
true
);
//为true时表示下一项
break
;
case
R
.
id
.
web_text_search_close
:
find_in_page
.
setVisibility
(
View
.
GONE
);
et_context_keyword
.
getText
().
clear
();
//清除输入内容
mWebViewPlus
.
clearMatches
();
//清除页面上的高亮项:
break
;
case
R
.
id
.
web_btn_download_prerelease
:
downloadfromWeb
(
URL_YGO233_FILE
);
break
;
}
}
public
void
initButton
()
{
btn_context_search
=
$
(
R
.
id
.
web_text_search
);
btn_context_search
.
setOnClickListener
(
this
);
btn_context_search_last
=
$
(
R
.
id
.
ib_last
);
btn_context_search_last
.
setOnClickListener
(
this
);
btn_context_search_next
=
$
(
R
.
id
.
ib_next
);
btn_context_search_next
.
setOnClickListener
(
this
);
btn_context_search_close
=
$
(
R
.
id
.
web_text_search_close
);
btn_context_search_close
.
setOnClickListener
(
this
);
btn_download
=
$
(
R
.
id
.
web_btn_download_prerelease
);
btn_download
.
setOnClickListener
(
this
);
}
public
static
void
open
(
Context
context
,
String
title
,
String
url
)
{
Intent
intent
=
new
Intent
(
context
,
WebActivity
.
class
);
intent
.
putExtra
(
Intent
.
EXTRA_STREAM
,
url
);
...
...
@@ -225,16 +292,6 @@ public class WebActivity extends BaseActivity {
WebActivity
.
open
(
context
,
cardInfo
.
Name
,
uri
);
}
public
void
initButton
()
{
btn_download
=
$
(
R
.
id
.
web_btn_download_prerelease
);
btn_download
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
downloadfromWeb
(
URL_YGO233_FILE
);
}
});
}
public
void
AddServer
(
String
name
,
String
Addr
,
int
port
,
String
playername
)
{
mServerInfo
=
new
ServerInfo
();
mServerInfo
.
setName
(
name
);
...
...
@@ -303,7 +360,7 @@ public class WebActivity extends BaseActivity {
if
(
files
.
getName
().
contains
(
"-"
)
&&
files
.
getName
().
contains
(
" new cards"
))
files
.
delete
();
}
UnzipUtils
.
upZipSelectFile
(
file
,
AppsSettings
.
get
().
getResourcePath
(),
".ypk"
);
UnzipUtils
.
upZipSelectFile
(
file
,
AppsSettings
.
get
().
getResourcePath
(),
".ypk"
);
}
catch
(
Exception
e
)
{
message
.
what
=
UnzipUtils
.
ZIP_UNZIP_EXCEPTION
;
}
finally
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
View file @
3e6b2f2f
...
...
@@ -121,7 +121,7 @@ public class CardSearcher implements View.OnClickListener {
resetButton
.
setOnClickListener
(
this
);
mCardLoader
=
dataLoader
;
// setCodeSpinner.setFirstIndex(1);
//输入即时搜索
OnEditorActionListener
searchListener
=
(
v
,
actionId
,
event
)
->
{
if
(
actionId
==
EditorInfo
.
IME_ACTION_SEARCH
)
{
InputMethodManager
imm
=
(
InputMethodManager
)
mContext
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
View file @
3e6b2f2f
...
...
@@ -153,12 +153,8 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
//添加服务器
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
();
}
});
add_server
.
setOnClickListener
(
this
);
mServerListAdapter
.
addFooterView
(
footView
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
getContext
());
mServerList
.
setLayoutManager
(
linearLayoutManager
);
...
...
@@ -766,6 +762,9 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
openGame
();
}
break
;
case
R
.
id
.
add_server
:
mServerListManager
.
addServer
();
break
;
case
R
.
id
.
tv_banner_loading
:
if
(
isMcNewsLoadException
)
findMcNews
();
...
...
mobile/src/main/res/drawable/baseline_keyboard_arrow_down_24.xml
0 → 100644
View file @
3e6b2f2f
<vector
android:height=
"24dp"
android:tint=
"#04D7F8"
android:viewportHeight=
"24"
android:viewportWidth=
"24"
android:width=
"24dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"@android:color/white"
android:pathData=
"M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6 1.41,-1.41z"
/>
</vector>
mobile/src/main/res/drawable/baseline_keyboard_arrow_up_24.xml
0 → 100644
View file @
3e6b2f2f
<vector
android:height=
"24dp"
android:tint=
"#04D7F8"
android:viewportHeight=
"24"
android:viewportWidth=
"24"
android:width=
"24dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"@android:color/white"
android:pathData=
"M7.41,15.41L12,10.83l4.59,4.58L18,14l-6,-6 -6,6z"
/>
</vector>
mobile/src/main/res/layout/activity_webbrowser.xml
View file @
3e6b2f2f
...
...
@@ -10,11 +10,61 @@
<include
layout=
"@layout/content_toolbar"
/>
<LinearLayout
android:id=
"@+id/find_in_page"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:weightSum=
"10"
android:orientation=
"horizontal"
android:visibility=
"gone"
>
<EditText
android:id=
"@+id/context_keyword"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"7"
android:hint=
"@string/find_in_page"
android:imeOptions=
"actionSearch"
android:inputType=
"textNoSuggestions"
android:maxLines=
"1"
/>
<ImageButton
android:id=
"@+id/ib_last"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@color/transparent"
android:src=
"@drawable/baseline_keyboard_arrow_up_24"
/>
<ImageButton
android:id=
"@+id/ib_next"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@color/transparent"
android:src=
"@drawable/baseline_keyboard_arrow_down_24"
/>
<ImageButton
android:id=
"@+id/web_text_search_close"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"@color/transparent"
android:src=
"@drawable/ic_close_black_24dp"
/>
</LinearLayout>
<cn.garymb.ygomobile.ui.widget.WebViewPlus
android:id=
"@+id/webbrowser"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/web_btn_bar"
android:layout_width=
"match_parent"
...
...
@@ -28,7 +78,7 @@
android:layout_height=
"wrap_content"
android:background=
"@drawable/button_bg"
android:text=
"@string/Download"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
</LinearLayout>
...
...
mobile/src/main/res/layout/content_toolbar.xml
View file @
3e6b2f2f
...
...
@@ -11,5 +11,16 @@
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
app:popupTheme=
"@style/AppTheme.PopupOverlay"
app:theme=
"@style/AppTheme.AppBarOverlay"
/>
app:theme=
"@style/AppTheme.AppBarOverlay"
>
<ImageButton
android:id=
"@+id/web_text_search"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"right"
android:layout_marginRight=
"20dp"
android:src=
"@drawable/ic_search"
android:background=
"@color/transparent"
>
</ImageButton>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
\ No newline at end of file
mobile/src/main/res/values-ko/strings.xml
View file @
3e6b2f2f
...
...
@@ -347,4 +347,5 @@
<string
name=
"reChatJoining"
>
다시 로그인 중\.\.\.
</string>
<string
name=
"settings_data_language"
>
언어
</string>
<string
name=
"settings_data_language_about"
>
게임 데이터 언어를 변경합니다.
</string>
<string
name=
"find_in_page"
>
" 발견:"
</string>
</resources>
mobile/src/main/res/values-zh/strings.xml
View file @
3e6b2f2f
...
...
@@ -102,6 +102,7 @@
<string
name=
"deck_manager"
>
卡组
</string>
<string
name=
"category_manager"
>
卡组分类选择
</string>
<string
name=
"search"
>
搜索
</string>
<string
name=
"find_in_page"
>
输入要查找的词:
</string>
<string
name=
"search_open"
>
过滤
</string>
<string
name=
"search_close"
>
关闭
</string>
<string
name=
"reset"
>
重置
</string>
...
...
mobile/src/main/res/values/strings.xml
View file @
3e6b2f2f
...
...
@@ -357,4 +357,5 @@
<string
name=
"settings_data_language_about"
>
change language of YGOPro UI and card database
</string>
<!-- TODO: Remove or change this placeholder text -->
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"find_in_page"
>
find:
</string>
</resources>
mobile/src/main/res/values/styles.xml
View file @
3e6b2f2f
...
...
@@ -16,9 +16,9 @@
</style>
<style
name=
"AppTheme.Mycard"
parent=
"AppBaseTheme"
>
<item
name=
"colorPrimary"
>
@color/
mediumPurpleLight
</item>
<item
name=
"colorPrimaryDark"
>
@color/
mediumPurple
</item>
<item
name=
"colorAccent"
>
@color/color
Primary
</item>
<item
name=
"colorPrimary"
>
@color/
colorPrimary
</item>
<item
name=
"colorPrimaryDark"
>
@color/
colorNavy
</item>
<item
name=
"colorAccent"
>
@color/color
Accent
</item>
<item
name=
"android:windowActionBar"
>
false
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"windowActionBar"
>
false
</item>
...
...
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