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
7ebe0de5
Commit
7ebe0de5
authored
Jul 26, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化switchSettingFragment
parent
2ce502cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+8
-4
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
7ebe0de5
...
@@ -123,7 +123,6 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -123,7 +123,6 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
fragment_settings
=
new
SettingFragment
();
fragment_settings
=
new
SettingFragment
();
mFragment
=
fragment_home
;
mFragment
=
fragment_home
;
getSupportFragmentManager
().
beginTransaction
().
add
(
R
.
id
.
fragment_content
,
fragment_home
).
commit
();
getSupportFragmentManager
().
beginTransaction
().
add
(
R
.
id
.
fragment_content
,
fragment_home
).
commit
();
getFragmentManager
().
beginTransaction
().
add
(
R
.
id
.
fragment_content
,
fragment_settings
).
hide
(
fragment_settings
).
commit
();
getSupportActionBar
().
hide
();
getSupportActionBar
().
hide
();
}
}
...
@@ -151,7 +150,14 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -151,7 +150,14 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
public
void
switchSettingFragment
()
{
public
void
switchSettingFragment
()
{
bottomNavigationBar
.
setFirstSelectedPosition
(
4
).
initialise
();
bottomNavigationBar
.
setFirstSelectedPosition
(
4
).
initialise
();
getSupportFragmentManager
().
beginTransaction
().
hide
(
mFragment
).
commit
();
getSupportFragmentManager
().
beginTransaction
().
hide
(
mFragment
).
commit
();
getFragmentManager
().
beginTransaction
().
show
(
fragment_settings
).
commit
();
if
(
fragment_settings
.
isAdded
())
{
if
(
fragment_settings
.
isHidden
())
{
getFragmentManager
().
beginTransaction
().
show
(
fragment_settings
).
commit
();
}
}
else
{
getFragmentManager
().
beginTransaction
().
add
(
R
.
id
.
fragment_content
,
fragment_settings
).
commit
();
}
}
}
public
void
switchFragment
(
Fragment
fragment
,
int
page
,
boolean
replace
)
{
public
void
switchFragment
(
Fragment
fragment
,
int
page
,
boolean
replace
)
{
...
@@ -159,8 +165,6 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -159,8 +165,6 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
getFragmentManager
().
beginTransaction
().
hide
(
fragment_settings
).
commit
();
getFragmentManager
().
beginTransaction
().
hide
(
fragment_settings
).
commit
();
//用于intent到指定fragment时底部图标也跟着设置为选中状态
//用于intent到指定fragment时底部图标也跟着设置为选中状态
bottomNavigationBar
.
setFirstSelectedPosition
(
page
).
initialise
();
bottomNavigationBar
.
setFirstSelectedPosition
(
page
).
initialise
();
//
//FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
if
(
mFragment
.
isHidden
())
if
(
mFragment
.
isHidden
())
getSupportFragmentManager
().
beginTransaction
().
show
(
mFragment
).
commit
();
getSupportFragmentManager
().
beginTransaction
().
show
(
mFragment
).
commit
();
//判断当前显示的Fragment是不是切换的Fragment
//判断当前显示的Fragment是不是切换的Fragment
...
...
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