mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-22 17:02:21 -05:00
ServersActivity: added "exit" to the menu
This commit is contained in:
parent
51d5fcc97b
commit
47d8d43d49
@ -32,4 +32,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about_menu"
|
||||
android:icon="@android:drawable/ic_menu_help" />
|
||||
<item
|
||||
android:id="@+id/exit"
|
||||
android:title="@string/exit_menu"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
</menu>
|
@ -3,6 +3,7 @@
|
||||
<string name="add_server_menu">Add server</string>
|
||||
<string name="settings_menu">Settings</string>
|
||||
<string name="about_menu">About</string>
|
||||
<string name="exit_menu">Exit</string>
|
||||
|
||||
<string name="add_server_label">Add new server</string>
|
||||
<string name="server_title">Title</string>
|
||||
|
@ -20,6 +20,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.yaaic.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ListActivity;
|
||||
import android.content.ComponentName;
|
||||
@ -242,6 +244,16 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
case R.id.settings:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.exit:
|
||||
ArrayList<Server> mServers = Yaaic.getInstance().getServersAsArrayList();
|
||||
for (Server server : mServers) {
|
||||
if (binder.getService().hasConnection(server.getId())) {
|
||||
binder.getService().getConnection(server.getId()).quitServer();
|
||||
}
|
||||
}
|
||||
// ugly
|
||||
binder.getService().stopForegroundCompat(R.string.app_name);
|
||||
finish();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user