Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitri Lavrentjev
test3
Commits
a378301a
Commit
a378301a
authored
Apr 18, 2023
by
android
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// aaa 006
parent
e1252937
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
app/src/main/java/com/example/test003/MainActivity.java
+81
-0
No files found.
app/src/main/java/com/example/test003/MainActivity.java
0 → 100644
View file @
a378301a
package
com
.
example
.
test003
;
import
android.os.Bundle
;
import
com.google.android.material.snackbar.Snackbar
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.view.View
;
import
androidx.navigation.NavController
;
import
androidx.navigation.Navigation
;
import
androidx.navigation.ui.AppBarConfiguration
;
import
androidx.navigation.ui.NavigationUI
;
import
com.example.test003.databinding.ActivityMainBinding
;
import
android.view.Menu
;
import
android.view.MenuItem
;
public
class
MainActivity
extends
AppCompatActivity
{
private
AppBarConfiguration
appBarConfiguration
;
private
ActivityMainBinding
binding
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
binding
=
ActivityMainBinding
.
inflate
(
getLayoutInflater
());
setContentView
(
binding
.
getRoot
());
setSupportActionBar
(
binding
.
toolbar
);
NavController
navController
=
Navigation
.
findNavController
(
this
,
R
.
id
.
nav_host_fragment_content_main
);
appBarConfiguration
=
new
AppBarConfiguration
.
Builder
(
navController
.
getGraph
()).
build
();
NavigationUI
.
setupActionBarWithNavController
(
this
,
navController
,
appBarConfiguration
);
binding
.
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Snackbar
.
make
(
view
,
"Replace with your own action"
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
"Action"
,
null
).
show
();
}
});
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater
().
inflate
(
R
.
menu
.
menu_main
,
menu
);
return
true
;
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int
id
=
item
.
getItemId
();
//noinspection SimplifiableIfStatement
if
(
id
==
R
.
id
.
action_settings
)
{
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
@Override
public
boolean
onSupportNavigateUp
()
{
NavController
navController
=
Navigation
.
findNavController
(
this
,
R
.
id
.
nav_host_fragment_content_main
);
return
NavigationUI
.
navigateUp
(
navController
,
appBarConfiguration
)
||
super
.
onSupportNavigateUp
();
}
protected
void
DoOne
()
{
// aaa 06
}
}
\ 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