Config option to set filebrowser start

This commit is contained in:
Adrian Ulrich 2013-01-02 19:10:09 +01:00
parent d814daed31
commit 85efbd7573
4 changed files with 23 additions and 2 deletions

View File

@ -150,5 +150,6 @@ THE SOFTWARE.
<activity <activity
android:name="TabOrderActivity" android:name="TabOrderActivity"
android:theme="@style/BackActionBar" /> android:theme="@style/BackActionBar" />
<activity android:name="FilebrowserStartActivity" />
</application> </application>
</manifest> </manifest>

View File

@ -47,5 +47,12 @@ THE SOFTWARE.
android:entries="@array/default_playlist_action_entries" android:entries="@array/default_playlist_action_entries"
android:entryValues="@array/entry_values" android:entryValues="@array/entry_values"
android:defaultValue="3" /> android:defaultValue="3" />
<PreferenceScreen
android:title="@string/filebrowser_start"
android:summary="@string/customize_filebrowser_start">
<intent
android:targetPackage="ch.blinkenlights.android.vanilla"
android:targetClass="ch.blinkenlights.android.vanilla.FilebrowserStartActivity" />
</PreferenceScreen>
<ch.blinkenlights.android.vanilla.ScanPreference /> <ch.blinkenlights.android.vanilla.ScanPreference />
</PreferenceScreen> </PreferenceScreen>

View File

@ -134,7 +134,7 @@ public class FileSystemAdapter
mFolderIcon = activity.getResources().getDrawable(R.drawable.folder); mFolderIcon = activity.getResources().getDrawable(R.drawable.folder);
mInflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (limiter == null) { if (limiter == null) {
limiter = buildLimiter(Environment.getExternalStorageDirectory()); limiter = buildLimiter( activity.getFilesystemBrowseStart() );
} }
setLimiter(limiter); setLimiter(limiter);
} }

View File

@ -22,6 +22,7 @@
package ch.blinkenlights.android.vanilla; package ch.blinkenlights.android.vanilla;
import java.io.File;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -33,6 +34,7 @@ import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.os.Process; import android.os.Process;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.Environment;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -279,7 +281,18 @@ public abstract class PlaybackActivity extends Activity
} }
}); });
} }
/**
* Called by FileSystem adapter to get the start folder
* for browsing directories
*/
protected File getFilesystemBrowseStart() {
SharedPreferences prefs = PlaybackService.getSettings(this);
String folder = prefs.getString("filesystem_browse_start", "");
File fs_start = new File( folder.equals("") ? Environment.getExternalStorageDirectory().getAbsolutePath() : folder );
return fs_start;
}
/** /**
* Called by PlaybackService to update the current song. * Called by PlaybackService to update the current song.
*/ */