aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--subsonic-android/res/raw/changelog.xml4
-rw-r--r--subsonic-android/res/values/themes.xml10
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java44
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java13
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java20
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/view/ChangeLog.java23
6 files changed, 69 insertions, 45 deletions
diff --git a/subsonic-android/res/raw/changelog.xml b/subsonic-android/res/raw/changelog.xml
index 94192a2f..5d78be23 100644
--- a/subsonic-android/res/raw/changelog.xml
+++ b/subsonic-android/res/raw/changelog.xml
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
- <release version="4.0.0" versioncode="46" >
+ <release version="4.0.0" versioncode="46" releasedate="5/16/2013">
<change>Converted everything to fragments!</change>
<change>Swipe to switch tabs</change>
<change>Breadcrumb trail when going down several levels</change>
+ <change>Require double tapping back to exit app</change>
<change>Change log dialog for new versions</change>
<change>Endless loading on album lists (ie: Random, Recently Added, etc...) instead of pressing more</change>
<change>Look at what is now playing from main tabs</change>
@@ -11,5 +12,6 @@
<change>When clicking on a album in search, the parent is also added to the back stack</change>
<change>Added total time to playlist/album headers</change>
<change>Fixed a lot of the menu items not working when using search</change>
+ <change>Update to Light/Dark themes</change>
</release>
</changelog> \ No newline at end of file
diff --git a/subsonic-android/res/values/themes.xml b/subsonic-android/res/values/themes.xml
index 510ff977..2389365f 100644
--- a/subsonic-android/res/values/themes.xml
+++ b/subsonic-android/res/values/themes.xml
@@ -49,11 +49,11 @@
<item name="android:windowFullscreen">true</item>
</style>
- <style name="Widget.DSub.ActionBarStyle.Light" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
- <item name="background">@drawable/menubar_button_normal</item>
- <item name="android:background">@drawable/actionbar_background</item>
- <item name="backgroundStacked">@drawable/actionbar_background</item>
- <item name="android:backgroundStacked">@drawable/actionbar_background</item>
+ <style name="Widget.DSub.ActionBarStyle.Light" parent="Widget.Sherlock.Light.ActionBar.Solid">
+ <item name="background">@android:color/transparent</item>
+ <item name="android:background">@android:color/transparent</item>
+ <item name="backgroundStacked">@android:color/transparent</item>
+ <item name="android:backgroundStacked">@android:color/transparent</item>
</style>
<style name="Widget.DSub.ActionBarStyle.Dark" parent="Widget.Sherlock.ActionBar.Solid">
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
index 8ca0fdac..d0eb86ef 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
@@ -5,8 +5,12 @@ import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
+import android.preference.PreferenceManager;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import android.support.v4.view.ViewPager;
@@ -23,7 +27,9 @@ import github.daneren2005.dsub.fragments.SelectArtistFragment;
import github.daneren2005.dsub.fragments.SelectPlaylistFragment;
import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.service.DownloadServiceImpl;
+import github.daneren2005.dsub.updates.Updater;
import github.daneren2005.dsub.util.Constants;
+import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.view.ChangeLog;
@@ -54,6 +60,7 @@ public class MainActivity extends SubsonicActivity {
startActivity(intent);
}
setContentView(R.layout.main);
+ loadSettings();
View bottomBar = findViewById(R.id.bottom_bar);
bottomBar.setOnClickListener(new View.OnClickListener() {
@@ -159,6 +166,7 @@ public class MainActivity extends SubsonicActivity {
super.onPostCreate(bundle);
showInfoDialog();
+ checkUpdates();
ChangeLog changeLog = new ChangeLog(this, Util.getPreferences(this));
if(changeLog.isFirstRun()) {
@@ -222,12 +230,46 @@ public class MainActivity extends SubsonicActivity {
trackView.setText(song.getTitle());
artistView.setText(song.getArtist());
getImageLoader().loadImage(coverArtView, song, false, false);
- startButton.setImageResource((getDownloadService().getPlayerState() == PlayerState.STARTED) ? R.drawable.media_pause : R.drawable.media_start);
+ int[] attrs = new int[] {(getDownloadService().getPlayerState() == PlayerState.STARTED) ? R.attr.media_button_pause : R.attr.media_button_start};
+ TypedArray typedArray = this.obtainStyledAttributes(attrs);
+ Drawable drawable = typedArray.getDrawable(0);
+ startButton.setImageDrawable(drawable);
+ typedArray.recycle();
+ }
+
+ public void checkUpdates() {
+ try {
+ String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
+ int ver = Integer.parseInt(version.replace(".", ""));
+ Updater updater = new Updater(ver);
+ updater.checkUpdates(this);
+ }
+ catch(Exception e) {
+
+ }
+ }
+
+ private void loadSettings() {
+ PreferenceManager.setDefaultValues(this, R.xml.settings, false);
+ SharedPreferences prefs = Util.getPreferences(this);
+ if (!prefs.contains(Constants.PREFERENCES_KEY_CACHE_LOCATION)) {
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory().getPath());
+ editor.commit();
+ }
+
+ if (!prefs.contains(Constants.PREFERENCES_KEY_OFFLINE)) {
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(Constants.PREFERENCES_KEY_OFFLINE, false);
+ editor.putInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, 1);
+ editor.commit();
+ }
}
private void showInfoDialog() {
if (!infoDialogDisplayed) {
infoDialogDisplayed = true;
+ Log.i(TAG, Util.getRestUrl(this, null));
if (Util.getRestUrl(this, null).contains("demo.subsonic.org")) {
Util.info(this, R.string.main_welcome_title, R.string.main_welcome_text);
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index f8d0019b..15b8421f 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -30,7 +30,6 @@ import github.daneren2005.dsub.R;
import github.daneren2005.dsub.fragments.SubsonicFragment;
import github.daneren2005.dsub.service.DownloadService;
import github.daneren2005.dsub.service.DownloadServiceImpl;
-import github.daneren2005.dsub.updates.Updater;
import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.ImageLoader;
import github.daneren2005.dsub.util.Util;
@@ -331,18 +330,6 @@ public class SubsonicActivity extends SherlockFragmentActivity implements OnItem
return pagerAdapter;
}
- public void checkUpdates() {
- try {
- String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
- int ver = Integer.parseInt(version.replace(".", ""));
- Updater updater = new Updater(ver);
- updater.checkUpdates(SubsonicActivity.this);
- }
- catch(Exception e) {
-
- }
- }
-
public static String getThemeName() {
return theme;
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java
index ec938ca9..3ccd8a0b 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/MainFragment.java
@@ -2,11 +2,9 @@ package github.daneren2005.dsub.fragments;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.os.StatFs;
-import android.preference.PreferenceManager;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
@@ -48,7 +46,6 @@ public class MainFragment extends SubsonicFragment {
this.inflater = inflater;
rootView = inflater.inflate(R.layout.home, container, false);
- loadSettings();
createLayout();
return rootView;
@@ -202,23 +199,6 @@ public class MainFragment extends SubsonicFragment {
});
}
- private void loadSettings() {
- PreferenceManager.setDefaultValues(context, R.xml.settings, false);
- SharedPreferences prefs = Util.getPreferences(context);
- if (!prefs.contains(Constants.PREFERENCES_KEY_CACHE_LOCATION)) {
- SharedPreferences.Editor editor = prefs.edit();
- editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory().getPath());
- editor.commit();
- }
-
- if (!prefs.contains(Constants.PREFERENCES_KEY_OFFLINE)) {
- SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(Constants.PREFERENCES_KEY_OFFLINE, false);
- editor.putInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, 1);
- editor.commit();
- }
- }
-
private void setActiveServer(int instance) {
if (Util.getActiveServer(context) != instance) {
DownloadService service = getDownloadService();
diff --git a/subsonic-android/src/github/daneren2005/dsub/view/ChangeLog.java b/subsonic-android/src/github/daneren2005/dsub/view/ChangeLog.java
index 630fb021..b847733e 100644
--- a/subsonic-android/src/github/daneren2005/dsub/view/ChangeLog.java
+++ b/subsonic-android/src/github/daneren2005/dsub/view/ChangeLog.java
@@ -80,7 +80,8 @@ public class ChangeLog {
* Default CSS styles used to format the change log.
*/
private static final String DEFAULT_CSS =
- "h1 { margin-left: 0px; font-size: 1.2em;}" +
+ "div.title { margin-left: 0px; font-size: 1.2em; text-align: center;}" +
+ "div.subtitle {margin-left: 0px; font-size: .8em; text-align: center;}" +
"li { margin-left: 0px;}" +
"ul { padding-left: 2em;}";
@@ -125,6 +126,7 @@ public class ChangeLog {
static final String NAME = "release";
static final String ATTRIBUTE_VERSION = "version";
static final String ATTRIBUTE_VERSION_CODE = "versioncode";
+ static final String ATTRIBUTE_RELEASE_DATE = "releasedate";
}
/**
@@ -406,9 +408,15 @@ public class ChangeLog {
// if necessary.
ReleaseItem release = changelog.get(key, defaultChangelog.get(key));
- sb.append("<h1>");
+ sb.append("<div class='title'>");
sb.append(String.format(versionFormat, release.versionName));
- sb.append("</h1><ul>");
+ sb.append("</div>");
+ if(release.releaseDate != null) {
+ sb.append("<div class='subtitle'>");
+ sb.append(release.releaseDate);
+ sb.append("</div>");
+ }
+ sb.append("<ul>");
for (String change : release.changes) {
sb.append("<li>");
sb.append(change);
@@ -489,6 +497,8 @@ public class ChangeLog {
} catch (NumberFormatException e) {
versionCode = NO_VERSION;
}
+
+ String releaseDate = xml.getAttributeValue(null, ReleaseTag.ATTRIBUTE_RELEASE_DATE);
if (!full && versionCode <= mLastVersionCode) {
return true;
@@ -505,7 +515,7 @@ public class ChangeLog {
eventType = xml.next();
}
- ReleaseItem release = new ReleaseItem(versionCode, version, changes);
+ ReleaseItem release = new ReleaseItem(versionCode, version, releaseDate, changes);
changelog.put(versionCode, release);
return false;
@@ -524,15 +534,18 @@ public class ChangeLog {
* Version name of the release.
*/
public final String versionName;
+
+ public final String releaseDate;
/**
* List of changes introduced with that release.
*/
public final List<String> changes;
- ReleaseItem(int versionCode, String versionName, List<String> changes) {
+ ReleaseItem(int versionCode, String versionName, String releaseDate, List<String> changes) {
this.versionCode = versionCode;
this.versionName = versionName;
+ this.releaseDate = releaseDate;
this.changes = changes;
}
}