1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 03:11:30 +00:00

Add ActionBar back button to repo/node settings Activities.

This commit is contained in:
Felix Ableitner 2014-06-30 01:15:56 +02:00
parent 505ec379b6
commit 0a4121e6cf
3 changed files with 10 additions and 2 deletions

View file

@ -6,6 +6,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
@ -69,6 +70,10 @@ public class NodeSettingsActivity extends PreferenceActivity implements
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
if (getIntent().getAction().equals(ACTION_CREATE)) { if (getIntent().getAction().equals(ACTION_CREATE)) {
addPreferencesFromResource(R.xml.node_settings_create); addPreferencesFromResource(R.xml.node_settings_create);
} }

View file

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.IBinder; import android.os.IBinder;
@ -80,6 +81,10 @@ public class RepoSettingsActivity extends PreferenceActivity
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
if (getIntent().getAction().equals(ACTION_CREATE)) { if (getIntent().getAction().equals(ACTION_CREATE)) {
addPreferencesFromResource(R.xml.repo_settings_create); addPreferencesFromResource(R.xml.repo_settings_create);
} }

View file

@ -110,8 +110,6 @@ public class SettingsActivity extends PreferenceActivity
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// There is currently no way to get ActionBar in PreferenceActivity on pre-honeycomb with
// compatibility library, so we'll have to do a version check.
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true);
} }