Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
Pluggable Transports
Snowflake Mobile
Commits
cddbc2b4
Verified
Commit
cddbc2b4
authored
Jul 24, 2020
by
HashikD
Browse files
Added up(back) button
parent
6a19850c
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/torproject/snowflake/MainActivity.java
View file @
cddbc2b4
...
...
@@ -8,8 +8,11 @@ import android.graphics.Color;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.Button
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.fragment.app.Fragment
;
...
...
@@ -72,8 +75,10 @@ public class MainActivity extends AppCompatActivity implements MainFragmentCallb
private
void
startFragment
(
Fragment
fragment
)
{
if
(
fragment
instanceof
MainFragment
)
{
currentFragment
=
FragmentConstants
.
MAIN_FRAGMENT
;
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
false
);
}
else
{
currentFragment
=
FragmentConstants
.
APP_SETTINGS_FRAGMENT
;
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
}
Log
.
d
(
TAG
,
"startFragment: "
+
currentFragment
);
...
...
@@ -170,4 +175,15 @@ public class MainActivity extends AppCompatActivity implements MainFragmentCallb
else
return
0
;
}
@Override
public
boolean
onOptionsItemSelected
(
@NonNull
MenuItem
item
)
{
if
(
item
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
onBackPressed
();
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
}
Write
Preview
Supports
Markdown
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