aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorPatrik Johansson <patrik@ptjwebben.se>2015-10-20 13:25:47 +0200
committerPatrik Johansson <patrik@ptjwebben.se>2015-10-20 13:25:47 +0200
commit1f665255a4f7e0add218d2596e8ff2f907b4773b (patch)
treecf9767d88be472329499302d717eec0960bb5024 /app/src/main
parent45b9fdd94c778e9aa461d7cadb3cd75d4eacd9da (diff)
parent1d312b4920c5c62425fcb4aedd7b5be4981f5fb7 (diff)
downloaddsub-1f665255a4f7e0add218d2596e8ff2f907b4773b.tar.gz
dsub-1f665255a4f7e0add218d2596e8ff2f907b4773b.tar.bz2
dsub-1f665255a4f7e0add218d2596e8ff2f907b4773b.zip
Merge https://github.com/daneren2005/Subsonic into added-swedish
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java16
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java75
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java8
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--app/src/main/res/values-de/strings.xml21
-rw-r--r--app/src/main/res/values-hu/strings.xml7
-rw-r--r--app/src/main/res/values/strings.xml1
7 files changed, 99 insertions, 30 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
index d67893ef..dc64e9d1 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -954,6 +954,22 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
runnable.run();
} else {
afterServiceAvailable.add(runnable);
+ checkIfServiceAvailable();
+ }
+ }
+ private void checkIfServiceAvailable() {
+ if(getDownloadService() == null) {
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ checkIfServiceAvailable();
+ }
+ }, 50);
+ } else if(afterServiceAvailable.size() > 0) {
+ for(Runnable runnable: afterServiceAvailable) {
+ handler.post(runnable);
+ }
+ afterServiceAvailable.clear();
}
}
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 8d3bf099..0dbb643f 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -32,11 +32,13 @@ import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
@@ -673,6 +675,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
}.execute();
}
private void loadRemotePlayQueue() {
+ if(Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_RESUME_PLAY_QUEUE_NEVER, false)) {
+ return;
+ }
+
final SubsonicActivity context = this;
new SilentBackgroundTask<Void>(this) {
private PlayerQueue playerQueue;
@@ -715,32 +721,57 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
}.execute();
}
private void promptRestoreFromRemoteQueue(final PlayerQueue remoteState) {
- Util.confirmDialog(this, R.string.download_restore_play_queue, Util.formatDate(remoteState.changed), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ String message = getResources().getString(R.string.common_confirm_message, getResources().getString(R.string.download_restore_play_queue).toLowerCase(), Util.formatDate(remoteState.changed));
+ builder.setIcon(android.R.drawable.ic_dialog_alert)
+ .setTitle(R.string.common_confirm)
+ .setMessage(message)
+ .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
@Override
- protected Void doInBackground() throws Throwable {
- DownloadService downloadService = getDownloadService();
- downloadService.clear();
- downloadService.download(remoteState.songs, false, false, false, false, remoteState.currentPlayingIndex, remoteState.currentPlayingPosition);
- return null;
+ public void onClick(DialogInterface dialogInterface, int i) {
+ new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
+ @Override
+ protected Void doInBackground() throws Throwable {
+ DownloadService downloadService = getDownloadService();
+ downloadService.clear();
+ downloadService.download(remoteState.songs, false, false, false, false, remoteState.currentPlayingIndex, remoteState.currentPlayingPosition);
+ return null;
+ }
+ }.execute();
}
- }.execute();
- }
- }, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
+ })
+ .setNeutralButton(R.string.common_cancel, new DialogInterface.OnClickListener() {
@Override
- protected Void doInBackground() throws Throwable {
- DownloadService downloadService = getDownloadService();
- downloadService.serializeQueue(false);
- return null;
+ public void onClick(DialogInterface dialogInterface, int i) {
+ new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
+ @Override
+ protected Void doInBackground() throws Throwable {
+ DownloadService downloadService = getDownloadService();
+ downloadService.serializeQueue(false);
+ return null;
+ }
+ }.execute();
}
- }.execute();
- }
- });
+ })
+ .setNegativeButton(R.string.common_never, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i) {
+ new SilentBackgroundTask<Void>(SubsonicFragmentActivity.this) {
+ @Override
+ protected Void doInBackground() throws Throwable {
+ DownloadService downloadService = getDownloadService();
+ downloadService.serializeQueue(false);
+
+ SharedPreferences.Editor editor = Util.getPreferences(SubsonicFragmentActivity.this).edit();
+ editor.putBoolean(Constants.PREFERENCES_KEY_RESUME_PLAY_QUEUE_NEVER, true);
+ editor.commit();
+ return null;
+ }
+ }.execute();
+ }
+ });
+
+ builder.create().show();
}
private void createAccount() {
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 88489e10..b405211d 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -41,7 +41,9 @@ import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.conn.params.ConnPerRouteBean;
@@ -1902,7 +1904,7 @@ public class RESTMusicService implements MusicService {
while (true) {
attempts++;
HttpContext httpContext = new BasicHttpContext();
- final HttpPost request = new HttpPost(url);
+ final HttpRequestBase request = (url.indexOf("rest") == -1) ? new HttpGet(url) : new HttpPost(url);
if (task != null) {
// Attempt to abort the HTTP request if the task is cancelled.
@@ -1929,12 +1931,12 @@ public class RESTMusicService implements MusicService {
});
}
- if (parameterNames != null) {
+ if (parameterNames != null && request instanceof HttpPost) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
for (int i = 0; i < parameterNames.size(); i++) {
params.add(new BasicNameValuePair(parameterNames.get(i), String.valueOf(parameterValues.get(i))));
}
- request.setEntity(new UrlEncodedFormEntity(params, Constants.UTF_8));
+ ((HttpPost) request).setEntity(new UrlEncodedFormEntity(params, Constants.UTF_8));
}
if (requestParams != null) {
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index 22463d9d..3ac5ee90 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -166,6 +166,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_START_ON_HEADPHONES = "startOnHeadphones";
public static final String PREFERENCES_KEY_COLOR_ACTION_BAR = "colorActionBar";
public static final String PREFERENCES_KEY_SHUFFLE_BY_ALBUM = "shuffleByAlbum";
+ public static final String PREFERENCES_KEY_RESUME_PLAY_QUEUE_NEVER = "neverResumePlayQueue";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 45b89df9..534a0f75 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -294,7 +294,7 @@
<string name="settings.invalid_url">Bitte geben Sie eine gültige URL an.</string>
<string name="settings.invalid_username">Bitte gültigen Nutzernamen angeben (keine führenden Leerzeichen).</string>
<string name="settings.appearance_title">Erscheinung</string>
- <string name="settings.theme_title">Theme</string>
+ <string name="settings.theme_title">Aussehen</string>
<string name="settings.theme_light">Hell</string>
<string name="settings.theme_dark">Dunkel</string>
<string name="settings.theme_black">Schwarz</string>
@@ -382,8 +382,8 @@
<string name="settings.sync_enabled">Synchronisierung aktiv</string>
<string name="settings.sync_enabled_summary">Podcast regelmäßig auf Änderungen prüfen</string>
<string name="settings.sync_interval">Synchronisierungsintervall</string>
- <string name="settings.sync_interval_15">15 Minutes</string>
- <string name="settings.sync_interval_30">30 Minutes</string>
+ <string name="settings.sync_interval_15">15 Minuten</string>
+ <string name="settings.sync_interval_30">30 Minuten</string>
<string name="settings.sync_interval_60">1 Stunde</string>
<string name="settings.sync_interval_120">2 Stunden</string>
<string name="settings.sync_interval_240">4 Stunden</string>
@@ -641,5 +641,20 @@
<string name="settings.keep_played_count_three">3 abgespielte Lieder behalten</string>
<string name="settings.keep_played_count_two">2 abgespielte Lieder behalten</string>
<string name="settings.keep_played_count_title">Abgespielte Lieder behalten</string>
+ <string name="details.updated">Aktualisiert</string>
+ <string name="details.position">Position</string>
+ <string name="details.song">Lied</string>
+ <string name="button_bar.offline">Offline</string>
+ <string name="settings.menu_options.delete_summary">Zeige \"Löschen\" im Menü</string>
+ <string name="settings.menu_options.download_summary">Zeige \"Downloads\" im Menü</string>
+ <string name="settings.menu_options.pin_summary">Zeige \"Permanent Cachen\" im Menü</string>
+ <string name="details.title.artist">Künstlerdetails</string>
+ <string name="common.true">Ja</string>
+ <string name="common.false">Nein</string>
+ <string name="settings.menu_options.play_now_summary">Zeige \"Jetzt wiedergeben\" im Menü</string>
+ <string name="settings.menu_options.play_shuffled_summary">Zeige \"Mischen\" im Menü</string>
+ <string name="settings.shuffle_by_album.false">Alle Titel mischen</string>
+ <string name="settings.shuffle_by_album.true">Albenreihenfolge mischen</string>
+ <string name="settings.shuffle_by_album">Alben mischen</string>
</resources>
diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml
index e3049769..9a1e5519 100644
--- a/app/src/main/res/values-hu/strings.xml
+++ b/app/src/main/res/values-hu/strings.xml
@@ -26,6 +26,8 @@
<string name="common.empty">Nem található!</string>
<string name="common.warning">Figyelem!</string>
<string name="common.close">Bezár</string>
+ <string name="common.false">Nem</string>
+ <string name="common.true">Igen</string>
<string name="button_bar.home">Főoldal</string>
<string name="button_bar.browse">Médiatár</string>
@@ -437,7 +439,7 @@
<string name="settings.browse_by_tags">Böngészés ID3 Tag alapján</string>
<string name="settings.browse_by_tags_summary">ID3 Tag alapú böngészés a mappastruktúra helyett. Subsonic 4.7+ verzió felett!</string>
<string name="settings.disable_exit_prompt">Kilépés megerősítésének tiltása</string>
- <string name="settings.disable_exit_prompt_summary">A Főoldalon állva a vissza gomb megnyomásakor azonnali kilépés az alkalmazásból.</string>
+ <string name="settings.disable_exit_prompt_summary">Főoldalon a vissza gomb megnyomásakor azonnali kilépés az alkalmazásból.</string>
<string name="settings.override_system_language">A rendszer nyelvének felülbírálása</string>
<string name="settings.override_system_language_summary">A Dsub megjelenítése angol nyelven abban az esetben is, ha rendelkezik fordítással. Az alkalmazást törölni kell a memóriából, mert a beállítás csak újraindítás után lép érvénybe!</string>
<string name="settings.drawer_items_title">Oldalsáv elemei</string>
@@ -599,11 +601,12 @@
<string name="details.title.album">Album információi</string>
<string name="details.title.podcast">Podcast információi</string>
<string name="details.title.playlist">Lejátszási lista információi</string>
+ <string name="details.title.artist">Előadó információi</string>
<string name="details.podcast">Podcast</string>
<string name="details.status">Státusz</string>
<string name="details.artist">Előadó</string>
<string name="details.album">Album</string>
- <string name="details.track">Dal</string>
+ <string name="details.track">Dalsorszám</string>
<string name="details.genre">Műfaj</string>
<string name="details.year">Év</string>
<string name="details.server_format">Kiszolgáló formátuma</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7c682930..8f5cec71 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -28,6 +28,7 @@
<string name="common.close">Close</string>
<string name="common.false">No</string>
<string name="common.true">Yes</string>
+ <string name="common.never">Never</string>
<string name="button_bar.home">Home</string>
<string name="button_bar.browse">Library</string>