aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-22 19:16:52 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-22 19:16:52 -0700
commita6bdf0783d252174d7fe8ed9b9ab4e85d64dee3a (patch)
tree10c6335005f89c8aba43c4b4ba26110706bd716c /src/github/daneren2005
parent856e2829ea93294447bf47a215b8db2c24708142 (diff)
downloaddsub-a6bdf0783d252174d7fe8ed9b9ab4e85d64dee3a.tar.gz
dsub-a6bdf0783d252174d7fe8ed9b9ab4e85d64dee3a.tar.bz2
dsub-a6bdf0783d252174d7fe8ed9b9ab4e85d64dee3a.zip
More work on adding a custom tasker plugin
Diffstat (limited to 'src/github/daneren2005')
-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() {