diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-07-12 01:18:58 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-07-25 18:01:51 +0100 |
commit | 5fe6ee0f9200e1087edc3b9a9e7f1fa472dff139 (patch) | |
tree | e57059516e567d640275ebc4f0195c3eb195f6db /android | |
parent | 8eb2f0ef16d5a12bd2b2251aaa394be90a9eebf3 (diff) |
Modify up navigation.
* Add such type of navigation to the ComputerConnectionActivity.
* Remove NavUtils usage. It is not a really clean solution but it keeps
activities state just right.
Change-Id: I9be70a530c180745fdfb35490b025a683aab6cf5
Diffstat (limited to 'android')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionActivity.java | 23 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java | 7 |
2 files changed, 25 insertions, 5 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionActivity.java index e773f51c2ff4..ac15e2a0f1b3 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionActivity.java @@ -4,6 +4,7 @@ import android.os.Bundle; import android.support.v4.app.FragmentTransaction; import com.actionbarsherlock.app.SherlockFragmentActivity; +import com.actionbarsherlock.view.MenuItem; import org.libreoffice.impressremote.communication.Server; public class ComputerConnectionActivity extends SherlockFragmentActivity { @@ -11,9 +12,15 @@ public class ComputerConnectionActivity extends SherlockFragmentActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setUpHomeButton(); + setUpComputerConnectionFragment(extractReceivedComputer()); } + private void setUpHomeButton() { + getSupportActionBar().setHomeButtonEnabled(true); + } + private void setUpComputerConnectionFragment(Server aComputer) { FragmentTransaction aTransaction = getSupportFragmentManager().beginTransaction(); @@ -25,4 +32,20 @@ public class ComputerConnectionActivity extends SherlockFragmentActivity { private Server extractReceivedComputer() { return getIntent().getParcelableExtra("COMPUTER"); } + + @Override + public boolean onOptionsItemSelected(MenuItem aMenuItem) { + switch (aMenuItem.getItemId()) { + case android.R.id.home: + navigateUp(); + return true; + + default: + return super.onOptionsItemSelected(aMenuItem); + } + } + + private void navigateUp() { + finish(); + } } diff --git a/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java b/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java index ae97c2f4882e..c4511e110d9f 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java @@ -1,9 +1,7 @@ package org.libreoffice.impressremote; import android.content.ContentResolver; -import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.NavUtils; import android.webkit.WebView; import com.actionbarsherlock.app.SherlockActivity; @@ -50,10 +48,9 @@ public class LicensesActivity extends SherlockActivity { default: return super.onOptionsItemSelected(aMenuItem); } - } + } private void navigateUp() { - Intent aIntent = new Intent(this, ComputersActivity.class); - NavUtils.navigateUpTo(this, aIntent); + finish(); } } |