Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Campus Hack 19
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kd1u18
Campus Hack 19
Commits
2c693c9e
Commit
2c693c9e
authored
6 years ago
by
za1g18
Browse files
Options
Downloads
Patches
Plain Diff
UI Skeleton
parent
a8b07c86
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
MainActivity.java
+101
-0
101 additions, 0 deletions
MainActivity.java
with
101 additions
and
0 deletions
MainActivity.java
0 → 100644
+
101
−
0
View file @
2c693c9e
package
com.example.uni_study
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.view.View
;
import
android.support.design.widget.NavigationView
;
import
android.support.v4.view.GravityCompat
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v7.app.ActionBarDrawerToggle
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.view.Menu
;
import
android.view.MenuItem
;
public
class
MainActivity
extends
AppCompatActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar
);
setSupportActionBar
(
toolbar
);
FloatingActionButton
fab
=
(
FloatingActionButton
)
findViewById
(
R
.
id
.
fab
);
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
();
}
});
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
ActionBarDrawerToggle
toggle
=
new
ActionBarDrawerToggle
(
this
,
drawer
,
toolbar
,
R
.
string
.
navigation_drawer_open
,
R
.
string
.
navigation_drawer_close
);
drawer
.
addDrawerListener
(
toggle
);
toggle
.
syncState
();
NavigationView
navigationView
=
(
NavigationView
)
findViewById
(
R
.
id
.
nav_view
);
navigationView
.
setNavigationItemSelectedListener
(
this
);
}
@Override
public
void
onBackPressed
()
{
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
if
(
drawer
.
isDrawerOpen
(
GravityCompat
.
START
))
{
drawer
.
closeDrawer
(
GravityCompat
.
START
);
}
else
{
super
.
onBackPressed
();
}
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater
().
inflate
(
R
.
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
);
}
@SuppressWarnings
(
"StatementWithEmptyBody"
)
@Override
public
boolean
onNavigationItemSelected
(
MenuItem
item
)
{
// Handle navigation view item clicks here.
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
nav_camera
)
{
// Handle the camera action
}
else
if
(
id
==
R
.
id
.
nav_gallery
)
{
}
else
if
(
id
==
R
.
id
.
nav_slideshow
)
{
}
else
if
(
id
==
R
.
id
.
nav_manage
)
{
}
else
if
(
id
==
R
.
id
.
nav_share
)
{
}
else
if
(
id
==
R
.
id
.
nav_send
)
{
}
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
drawer
.
closeDrawer
(
GravityCompat
.
START
);
return
true
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment