aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/EditPlayActionActivity.java43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java b/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java
index 3ae62f5f..b7f9de94 100644
--- a/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java
+++ b/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java
@@ -18,29 +18,66 @@ package github.daneren2005.dsub.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v4.widget.DrawerLayout;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.widget.CheckBox;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.util.Constants;
public class EditPlayActionActivity extends SubsonicActivity {
+ private CheckBox checkBox;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setTitle(R.string.tasker_start_playing_title);
setContentView(R.layout.edit_play_action);
+
+ checkBox = (CheckBox) findViewById(R.id.edit_shuffle_checkbox);
+ if(getIntent().getBundleExtra(Constants.TASKER_EXTRA_BUNDLE) != null && getIntent().getBundleExtra(Constants.TASKER_EXTRA_BUNDLE).getBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE)) {
+ checkBox.setChecked(true);
+ }
+
+ drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater menuInflater = getMenuInflater();
+ menuInflater.inflate(R.menu.tasker_configuration, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if(item.getItemId() == android.R.id.home) {
+ cancel();
+ return true;
+ } else if(item.getItemId() == R.id.menu_accept) {
+ accept();
+ return true;
+ } else if(item.getItemId() == R.id.menu_cancel) {
+ cancel();
+ return true;
+ }
+
+ return false;
}
private void accept() {
Intent intent = new Intent();
- intent.putExtra("com.twofortyfouram.locale.intent.extra.BLURB", "Start DSub");
- CheckBox checkBox = (CheckBox) findViewById(R.id.edit_shuffle_checkbox);
+ String blurb = getResources().getString(checkBox.isChecked() ? R.string.tasker_start_playing_shuffled : R.string.tasker_start_playing);
+ intent.putExtra("com.twofortyfouram.locale.intent.extra.BLURB", blurb);
Bundle data = new Bundle();
data.putBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, checkBox.isChecked());
intent.putExtra(Constants.TASKER_EXTRA_BUNDLE, data);
- setResult(Activity.RESULT_OK);
+ setResult(Activity.RESULT_OK, intent);
finish();
}
private void cancel() {