mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
enable back navigaton in AppManager and Debug activitys ActionBar
This commit is contained in:
parent
6ec1fa9e23
commit
b20aaf59a8
@ -28,7 +28,11 @@
|
|||||||
android:label="@string/title_activity_settings" />
|
android:label="@string/title_activity_settings" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".AppManagerActivity"
|
android:name=".AppManagerActivity"
|
||||||
android:label="App Manager" />
|
android:label="App Manager">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value=".ControlCenter" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".NotificationListener"
|
android:name=".NotificationListener"
|
||||||
@ -90,7 +94,11 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".DebugActivity"
|
android:name=".DebugActivity"
|
||||||
android:label="@string/title_activity_debug" />
|
android:label="@string/title_activity_debug">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value=".ControlCenter" />
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -6,6 +6,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.NavUtils;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@ -54,6 +55,7 @@ public class AppManagerActivity extends Activity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_appmanager);
|
setContentView(R.layout.activity_appmanager);
|
||||||
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
appListView = (ListView) findViewById(R.id.appListView);
|
appListView = (ListView) findViewById(R.id.appListView);
|
||||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(this, appList);
|
mGBDeviceAppAdapter = new GBDeviceAppAdapter(this, appList);
|
||||||
@ -98,6 +100,16 @@ public class AppManagerActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
NavUtils.navigateUpFromSameTask(this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
|
LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
|
||||||
|
@ -122,32 +122,28 @@ public class ControlCenter extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
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
|
switch (item.getItemId()) {
|
||||||
if (id == R.id.action_settings) {
|
case R.id.action_settings:
|
||||||
Intent intent = new Intent(this, SettingsActivity.class);
|
Intent settingsIntent = new Intent(this, SettingsActivity.class);
|
||||||
startActivity(intent);
|
startActivity(settingsIntent);
|
||||||
return true;
|
return true;
|
||||||
} else if (id == R.id.action_debug) {
|
case R.id.action_debug:
|
||||||
Intent intent = new Intent(this, DebugActivity.class);
|
Intent debugIntent = new Intent(this, DebugActivity.class);
|
||||||
startActivity(intent);
|
startActivity(debugIntent);
|
||||||
return true;
|
return true;
|
||||||
} else if (id == R.id.action_quit) {
|
case R.id.action_quit:
|
||||||
Intent stopIntent = new Intent(this, BluetoothCommunicationService.class);
|
Intent stopIntent = new Intent(this, BluetoothCommunicationService.class);
|
||||||
stopService(stopIntent);
|
stopService(stopIntent);
|
||||||
|
|
||||||
Intent quitIntent = new Intent(ControlCenter.ACTION_QUIT);
|
Intent quitIntent = new Intent(ControlCenter.ACTION_QUIT);
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(quitIntent);
|
LocalBroadcastManager.getInstance(this).sendBroadcast(quitIntent);
|
||||||
return true;
|
return true;
|
||||||
} else if (id == R.id.action_refresh) {
|
case R.id.action_refresh:
|
||||||
if (deviceList.isEmpty()) {
|
if (deviceList.isEmpty()) {
|
||||||
refreshPairedDevices();
|
refreshPairedDevices();
|
||||||
mGBDeviceAdapter.notifyDataSetChanged();
|
mGBDeviceAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -7,7 +7,9 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.NavUtils;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@ -38,6 +40,7 @@ public class DebugActivity extends Activity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_debug);
|
setContentView(R.layout.activity_debug);
|
||||||
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
registerReceiver(mReceiver, new IntentFilter(ControlCenter.ACTION_QUIT));
|
registerReceiver(mReceiver, new IntentFilter(ControlCenter.ACTION_QUIT));
|
||||||
|
|
||||||
@ -153,6 +156,16 @@ public class DebugActivity extends Activity {
|
|||||||
nManager.notify((int) System.currentTimeMillis(), ncomp.build());
|
nManager.notify((int) System.currentTimeMillis(), ncomp.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
NavUtils.navigateUpFromSameTask(this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
Loading…
Reference in New Issue
Block a user