diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-10-13 14:52:12 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-10-13 14:52:12 -0700 |
commit | ff5e91853f50349706943bf4f80431bd1d0cab37 (patch) | |
tree | 6095443bb7713d3e4a0058404a6780d0acc5a4b1 | |
parent | 08a434690ee25320a256242ee9c9f34926ece4f9 (diff) | |
download | dsub-ff5e91853f50349706943bf4f80431bd1d0cab37.tar.gz dsub-ff5e91853f50349706943bf4f80431bd1d0cab37.tar.bz2 dsub-ff5e91853f50349706943bf4f80431bd1d0cab37.zip |
#386 Start of adding ability to toggle offline from Tasker
-rw-r--r-- | res/layout/edit_play_action.xml | 19 | ||||
-rw-r--r-- | res/values/arrays.xml | 6 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/activity/EditPlayActionActivity.java | 18 |
4 files changed, 40 insertions, 5 deletions
diff --git a/res/layout/edit_play_action.xml b/res/layout/edit_play_action.xml index 6eb3b651..1043e2e2 100644 --- a/res/layout/edit_play_action.xml +++ b/res/layout/edit_play_action.xml @@ -23,4 +23,23 @@ android:longClickable="true" /> </LinearLayout> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + + <TextView + android:id="@+id/edit_offline_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="4dp" + android:textSize="20dp" + android:text="@string/tasker.edit_server_offline"/> + + <Spinner + android:id="@+id/edit_offline_spinner" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + </LinearLayout> </LinearLayout>
\ No newline at end of file diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 3e85c982..19758562 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -235,4 +235,10 @@ <item>@string/settings.replay_gain_type.album</item> <item>@string/settings.replay_gain_type.track</item> </string-array> + + <string-array name="editServerOptions"> + <item>@string/tasker.edit_do_nothing</item> + <item>@string/main.online</item> + <item>@string/main.offline</item> + </string-array> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 0fdb2361..15dc020d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -559,6 +559,8 @@ <string name="tasker.start_playing_shuffled">Start playing in Shuffle Mode</string>
<string name="tasker.start_playing_title">Tasker -> Start DSub</string>
<string name="tasker.edit_shuffle_mode">Start in shuffle mode: </string>
+ <string name="tasker.edit_server_offline">Toggle offline: </string>
+ <string name="tasker.edit_do_nothing">Do Nothing</string>
<plurals name="select_album_n_songs">
<item quantity="zero">No songs</item>
diff --git a/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java b/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java index b7f9de94..c59b679f 100644 --- a/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java +++ b/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java @@ -22,13 +22,16 @@ import android.support.v4.widget.DrawerLayout; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.widget.ArrayAdapter; import android.widget.CheckBox; +import android.widget.Spinner; import github.daneren2005.dsub.R; import github.daneren2005.dsub.util.Constants; public class EditPlayActionActivity extends SubsonicActivity { - private CheckBox checkBox; + private CheckBox shuffleCheckbox; + private Spinner offlineSpinner; @Override public void onCreate(Bundle savedInstanceState) { @@ -36,11 +39,16 @@ public class EditPlayActionActivity extends SubsonicActivity { setTitle(R.string.tasker_start_playing_title); setContentView(R.layout.edit_play_action); - checkBox = (CheckBox) findViewById(R.id.edit_shuffle_checkbox); + shuffleCheckbox = (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); + shuffleCheckbox.setChecked(true); } + offlineSpinner = (Spinner) findViewById(R.id.edit_offline_spinner); + ArrayAdapter<CharSequence> offlineAdapter = ArrayAdapter.createFromResource(this, R.array.editServerOptions, android.R.layout.simple_spinner_item); + offlineAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + offlineSpinner.setAdapter(offlineAdapter); + drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } @@ -70,11 +78,11 @@ public class EditPlayActionActivity extends SubsonicActivity { private void accept() { Intent intent = new Intent(); - String blurb = getResources().getString(checkBox.isChecked() ? R.string.tasker_start_playing_shuffled : R.string.tasker_start_playing); + String blurb = getResources().getString(shuffleCheckbox.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()); + data.putBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, shuffleCheckbox.isChecked()); intent.putExtra(Constants.TASKER_EXTRA_BUNDLE, data); setResult(Activity.RESULT_OK, intent); |