Continue multi-selection develop
Continue the settings develop Add the directory browser to the framework project Group support (playlist or artist)
|
@ -1,9 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id="PlayMusicExporterGit" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
<option name="BUILDABLE" value="false" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
|
@ -16,4 +17,3 @@
|
|||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="PlayMusicExporterGit" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id=":framework" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="PlayMusicExporterGit" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
|
@ -12,8 +12,9 @@
|
|||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
|
@ -91,4 +92,3 @@
|
|||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
@ -25,7 +25,11 @@
|
|||
|
||||
<application android:allowBackup="true" >
|
||||
<activity
|
||||
android:name="de.arcus.framework.crashhandler.CrashActivity"
|
||||
android:name=".activities.CrashActivity"
|
||||
android:launchMode="singleInstance" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="de.arcus.framework.activities.DirectoryBrowserActivity"
|
||||
android:launchMode="singleInstance" >
|
||||
</activity>
|
||||
</application>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.framework.crashhandler;
|
||||
package de.arcus.framework.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2015 David Schulte
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.framework.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import de.arcus.framework.R;
|
||||
|
||||
/**
|
||||
* Activity to browse for a directory
|
||||
*/
|
||||
public class DirectoryBrowserActivity extends ActionBarActivity {
|
||||
// The intent extra names
|
||||
public final static String EXTRA_PATH = "path";
|
||||
public final static String EXTRA_TITLE = "title";
|
||||
|
||||
/**
|
||||
* The title
|
||||
*/
|
||||
private String mTitle = "";
|
||||
|
||||
/**
|
||||
* The current path
|
||||
*/
|
||||
private String mPath = "/";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Set the layout
|
||||
setContentView(R.layout.activity_directory_browser);
|
||||
|
||||
// Gets the bundle data
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
if (bundle != null) {
|
||||
// Reads the title
|
||||
if (bundle.containsKey(EXTRA_TITLE))
|
||||
mTitle = bundle.getString(EXTRA_TITLE);
|
||||
|
||||
// Reads the start path
|
||||
if (bundle.containsKey(EXTRA_PATH))
|
||||
mPath = bundle.getString(EXTRA_PATH);
|
||||
}
|
||||
|
||||
// Set the title
|
||||
getSupportActionBar().setTitle(mTitle);
|
||||
getSupportActionBar().setSubtitle(mPath);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_directory_browser, menu);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2015 David Schulte
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.framework.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import de.arcus.framework.R;
|
||||
import de.arcus.framework.items.FileSystemItem;
|
||||
|
||||
/**
|
||||
* Adapter for directories
|
||||
*/
|
||||
public class DirectoryAdapter extends ArrayAdapter<FileSystemItem> {
|
||||
/**
|
||||
* The context of the app
|
||||
*/
|
||||
private Context mContext;
|
||||
|
||||
/**
|
||||
* Create a new directory adapter
|
||||
* @param context The app context
|
||||
*/
|
||||
public DirectoryAdapter(Context context) {
|
||||
super(context, R.layout.adapter_directory);
|
||||
mContext = context;
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ package de.arcus.framework.crashhandler;
|
|||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
||||
import de.arcus.framework.activities.CrashActivity;
|
||||
import de.arcus.framework.logger.Logger;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,29 +20,28 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.playmusicexporter2.activitys;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.settings.PlayMusicExporterSettings;
|
||||
package de.arcus.framework.items;
|
||||
|
||||
/**
|
||||
* The preference activity
|
||||
* Item for directory adapter
|
||||
*/
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
public class FileSystemItem {
|
||||
/**
|
||||
* File system types (directory or file)
|
||||
*/
|
||||
public enum FileSystemType { File, Directory }
|
||||
|
||||
// Setup the default shared preference
|
||||
PreferenceManager prefMgr = getPreferenceManager();
|
||||
prefMgr.setSharedPreferencesName(PlayMusicExporterSettings.DEFAULT_SETTINGS_FILENAME);
|
||||
prefMgr.setSharedPreferencesMode(MODE_WORLD_READABLE);
|
||||
/**
|
||||
* The type of the entry
|
||||
*/
|
||||
private FileSystemType mFileType;
|
||||
|
||||
// Loads the preference xml
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
/**
|
||||
* @return Gets the file system type
|
||||
*/
|
||||
public FileSystemType getFileType() {
|
||||
return mFileType;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -30,6 +30,6 @@ public interface SuperUserCommandCallback {
|
|||
* Callback event
|
||||
* @param command The command that finished
|
||||
*/
|
||||
public abstract void onFinished(SuperUserCommand command);
|
||||
void onFinished(SuperUserCommand command);
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import de.arcus.framework.logger.Logger;
|
||||
|
@ -253,7 +254,7 @@ public class FileTools {
|
|||
List<String> storages = new ArrayList<>();
|
||||
|
||||
// Hard coded mount points
|
||||
final String[] mountPointBlacklist = new String[] { "/mnt/tmp", "/mnt/factory", "/mnt/obb", "/mnt/asec", "/mnt/secure", "/mnt/media_rw", "/mnt/shell" };
|
||||
final String[] mountPointBlacklist = new String[] { "/mnt/tmp", "/mnt/factory", "/mnt/obb", "/mnt/asec", "/mnt/secure", "/mnt/media_rw", "/mnt/shell", "/storage/emulated" };
|
||||
final String[] mountPointDirectories = new String[] { "/mnt", "/storage" };
|
||||
final String[] mountPoints = new String[] { "/sdcard", "/external_sd" };
|
||||
|
||||
|
@ -268,7 +269,7 @@ public class FileTools {
|
|||
for (File subDir : files) {
|
||||
subDir = getRootCanonicalFile(subDir);
|
||||
// Is directory
|
||||
if (subDir.isDirectory()) {
|
||||
if (subDir.isDirectory() && subDir.canRead()) {
|
||||
// Add mount point to list
|
||||
if (!storages.contains(subDir.getAbsolutePath()))
|
||||
storages.add(subDir.getAbsolutePath());
|
||||
|
@ -278,10 +279,10 @@ public class FileTools {
|
|||
}
|
||||
}
|
||||
|
||||
// Adds all direct moint points
|
||||
for(String mointPoint : mountPoints) {
|
||||
File file = getRootCanonicalFile(mointPoint);
|
||||
if (file.isDirectory()) {
|
||||
// Adds all direct mount points
|
||||
for(String mountPoint : mountPoints) {
|
||||
File file = getRootCanonicalFile(mountPoint);
|
||||
if (file.isDirectory() && file.canRead()) {
|
||||
if (!storages.contains(file.getAbsolutePath()))
|
||||
storages.add(file.getAbsolutePath());
|
||||
}
|
||||
|
@ -292,6 +293,9 @@ public class FileTools {
|
|||
storages.remove(blacklistPath);
|
||||
}
|
||||
|
||||
// Sort the list
|
||||
Collections.sort(storages);
|
||||
|
||||
// Returns the array
|
||||
return storages.toArray(new String[storages.size()]);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||
/**
|
||||
* Selection list
|
||||
*/
|
||||
public class SelectionList<T> {
|
||||
public abstract class SelectionList<T> {
|
||||
/**
|
||||
* The selected items
|
||||
*/
|
||||
|
@ -61,6 +61,14 @@ public class SelectionList<T> {
|
|||
private @ColorRes int mResColorNormal;
|
||||
private @ColorRes int mResColorSelected;
|
||||
|
||||
/**
|
||||
* Gets the activity
|
||||
* @return Returns the activity
|
||||
*/
|
||||
public ActionBarActivity getActivity() {
|
||||
return mActivity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the colors of the view.
|
||||
* Use @SuppressWarnings("ResourceAsColor") to prevent Lint errors
|
||||
|
@ -76,9 +84,9 @@ public class SelectionList<T> {
|
|||
* Sets up the action mode for this selection list
|
||||
* @param activity The activity
|
||||
*/
|
||||
public void setupActionMode(ActionBarActivity activity, ActionMode.Callback callback) {
|
||||
public void setupActionMode(ActionBarActivity activity) {
|
||||
mActivity = activity;
|
||||
mActionModeCallback = callback;
|
||||
mActionModeCallback = createActionMode(activity);
|
||||
|
||||
// Updates the action mode
|
||||
updateActionModeMenu();
|
||||
|
@ -202,11 +210,20 @@ public class SelectionList<T> {
|
|||
|
||||
// Set the text
|
||||
if (mActionMode != null) {
|
||||
mActionMode.setTitle("TEST: " + mItems.size());
|
||||
// Update the action mode
|
||||
mActionMode.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called every time a new activity opens.
|
||||
* This method has to create a action mode callback
|
||||
* @param activity The new activity
|
||||
* @return Returns the action mode callback
|
||||
*/
|
||||
protected abstract ActionMode.Callback createActionMode(ActionBarActivity activity);
|
||||
|
||||
/**
|
||||
* Gets whether the item is selected
|
||||
* @param item The selected item
|
||||
|
|
BIN
framework/src/main/res/drawable-hdpi/ic_action_accept.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
framework/src/main/res/drawable-hdpi/ic_action_back.png
Normal file
After Width: | Height: | Size: 301 B |
BIN
framework/src/main/res/drawable-hdpi/ic_action_cancel.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
framework/src/main/res/drawable-mdpi/ic_action_accept.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
framework/src/main/res/drawable-mdpi/ic_action_back.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
framework/src/main/res/drawable-mdpi/ic_action_cancel.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
framework/src/main/res/drawable-xhdpi/ic_action_accept.png
Normal file
After Width: | Height: | Size: 475 B |
BIN
framework/src/main/res/drawable-xhdpi/ic_action_back.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
framework/src/main/res/drawable-xhdpi/ic_action_cancel.png
Normal file
After Width: | Height: | Size: 415 B |
BIN
framework/src/main/res/drawable-xxhdpi/ic_action_accept.png
Normal file
After Width: | Height: | Size: 619 B |
BIN
framework/src/main/res/drawable-xxhdpi/ic_action_back.png
Normal file
After Width: | Height: | Size: 449 B |
BIN
framework/src/main/res/drawable-xxhdpi/ic_action_cancel.png
Normal file
After Width: | Height: | Size: 574 B |
|
@ -24,7 +24,7 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="de.arcus.framework.crashhandler.CrashActivity">
|
||||
tools:context="de.arcus.framework.activities.CrashActivity">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
|
|
32
framework/src/main/res/layout/activity_directory_browser.xml
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 David Schulte
|
||||
~
|
||||
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
~ of this software and associated documentation files (the "Software"), to deal
|
||||
~ in the Software without restriction, including without limitation the rights
|
||||
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
~ copies of the Software, and to permit persons to whom the Software is
|
||||
~ furnished to do so, subject to the following conditions:
|
||||
~
|
||||
~ The above copyright notice and this permission notice shall be included in
|
||||
~ all copies or substantial portions of the Software.
|
||||
~
|
||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
~ THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/listView" />
|
||||
</LinearLayout>
|
28
framework/src/main/res/layout/adapter_directory.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 David Schulte
|
||||
~
|
||||
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
~ of this software and associated documentation files (the "Software"), to deal
|
||||
~ in the Software without restriction, including without limitation the rights
|
||||
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
~ copies of the Software, and to permit persons to whom the Software is
|
||||
~ furnished to do so, subject to the following conditions:
|
||||
~
|
||||
~ The above copyright notice and this permission notice shall be included in
|
||||
~ all copies or substantial portions of the Software.
|
||||
~
|
||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
~ THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools" tools:context="de.arcus.framework.crashhandler.CrashActivity">
|
||||
xmlns:tools="http://schemas.android.com/tools" tools:context="de.arcus.framework.activities.CrashActivity">
|
||||
<item android:id="@+id/action_restart" android:title="@string/crashhandler_action_restart"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
<item android:id="@+id/action_email" android:title="@string/crashhandler_action_email_log"
|
||||
|
|
43
framework/src/main/res/menu/menu_directory_browser.xml
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 David Schulte
|
||||
~
|
||||
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
~ of this software and associated documentation files (the "Software"), to deal
|
||||
~ in the Software without restriction, including without limitation the rights
|
||||
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
~ copies of the Software, and to permit persons to whom the Software is
|
||||
~ furnished to do so, subject to the following conditions:
|
||||
~
|
||||
~ The above copyright notice and this permission notice shall be included in
|
||||
~ all copies or substantial portions of the Software.
|
||||
~
|
||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
~ THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
||||
<item
|
||||
android:id="@+id/action_move_up"
|
||||
android:title="@string/directory_browser_action_move_up"
|
||||
android:icon="@drawable/ic_action_back"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_accept"
|
||||
android:title="@string/directory_browser_action_accept"
|
||||
android:icon="@drawable/ic_action_accept"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_cancel"
|
||||
android:title="@string/directory_browser_action_cancel"
|
||||
android:icon="@drawable/ic_action_cancel"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 David Schulte
|
||||
~
|
||||
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
~ of this software and associated documentation files (the "Software"), to deal
|
||||
~ in the Software without restriction, including without limitation the rights
|
||||
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
~ copies of the Software, and to permit persons to whom the Software is
|
||||
~ furnished to do so, subject to the following conditions:
|
||||
~
|
||||
~ The above copyright notice and this permission notice shall be included in
|
||||
~ all copies or substantial portions of the Software.
|
||||
~
|
||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
~ THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="directory_browser_action_move_up">Zurück</string>
|
||||
<string name="directory_browser_action_accept">Bestätigen</string>
|
||||
<string name="directory_browser_action_cancel">Abbrechen</string>
|
||||
</resources>
|
28
framework/src/main/res/values/strings_directory_browser.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015 David Schulte
|
||||
~
|
||||
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
~ of this software and associated documentation files (the "Software"), to deal
|
||||
~ in the Software without restriction, including without limitation the rights
|
||||
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
~ copies of the Software, and to permit persons to whom the Software is
|
||||
~ furnished to do so, subject to the following conditions:
|
||||
~
|
||||
~ The above copyright notice and this permission notice shall be included in
|
||||
~ all copies or substantial portions of the Software.
|
||||
~
|
||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
~ THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="directory_browser_action_move_up">Move up</string>
|
||||
<string name="directory_browser_action_accept">Accept</string>
|
||||
<string name="directory_browser_action_cancel">Cancel</string>
|
||||
</resources>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="PlayMusicExporterGit" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id=":playmusicexporter" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="PlayMusicExporterGit" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
|
@ -12,8 +12,9 @@
|
|||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
|
@ -92,4 +93,3 @@
|
|||
<orderEntry type="module" module-name="framework" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name=".activitys.MusicTrackListActivity"
|
||||
android:name=".activities.MusicTrackListActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -42,20 +42,20 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activitys.MusicTrackDetailActivity"
|
||||
android:name=".activities.MusicTrackDetailActivity"
|
||||
android:label="@string/title_track_detail"
|
||||
android:parentActivityName=".activitys.MusicTrackListActivity" >
|
||||
android:parentActivityName=".activities.MusicTrackListActivity" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activitys.MusicTrackListActivity" />
|
||||
android:value=".activities.MusicTrackListActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activitys.SettingsActivity"
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:label="@string/title_settings"
|
||||
android:parentActivityName=".activitys.MusicTrackListActivity" >
|
||||
android:parentActivityName=".activities.MusicTrackListActivity" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activitys.MusicTrackListActivity" />
|
||||
android:value=".activities.MusicTrackListActivity" />
|
||||
</activity>
|
||||
<service android:name="de.arcus.playmusicexporter2.services.ExportService"/>
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@ import android.view.MenuInflater;
|
|||
import android.view.MenuItem;
|
||||
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.activities.MusicTrackDetailActivity;
|
||||
import de.arcus.playmusicexporter2.activities.MusicTrackListActivity;
|
||||
import de.arcus.playmusicexporter2.items.SelectedTrack;
|
||||
import de.arcus.playmusicexporter2.items.SelectedTrackList;
|
||||
|
||||
/**
|
||||
* Action mode for selected tracks
|
||||
|
@ -40,8 +43,14 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
*/
|
||||
private Context mContext;
|
||||
|
||||
public ActionModeTitle(Context context) {
|
||||
/**
|
||||
* The selection list
|
||||
*/
|
||||
private SelectedTrackList mSelectionList;
|
||||
|
||||
public ActionModeTitle(Context context, SelectedTrackList selectionList) {
|
||||
mContext = context;
|
||||
mSelectionList = selectionList;
|
||||
}
|
||||
|
||||
// Called when the action mode is created; startActionMode() was called
|
||||
|
@ -57,6 +66,8 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
// may be called multiple times if the mode is invalidated.
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
updateViews();
|
||||
|
||||
return false; // Return false if nothing is done
|
||||
}
|
||||
|
||||
|
@ -67,7 +78,7 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
case R.id.action_export:
|
||||
|
||||
// Export all selected tracks
|
||||
for(SelectedTrack selectedTrack : SelectedTrack.getSelectionList().getSelectedItems()) {
|
||||
for(SelectedTrack selectedTrack : SelectedTrackList.getInstance().getSelectedItems()) {
|
||||
selectedTrack.export(mContext);
|
||||
}
|
||||
|
||||
|
@ -78,11 +89,33 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all views
|
||||
*/
|
||||
private void updateViews()
|
||||
{
|
||||
// We are in the album list
|
||||
if (mSelectionList.getActivity() instanceof MusicTrackListActivity) {
|
||||
MusicTrackListActivity trackListActivity = (MusicTrackListActivity)mSelectionList.getActivity();
|
||||
|
||||
trackListActivity.updateLists();
|
||||
}
|
||||
|
||||
// We are in the track list
|
||||
if (mSelectionList.getActivity() instanceof MusicTrackDetailActivity) {
|
||||
MusicTrackDetailActivity trackDetailActivity = (MusicTrackDetailActivity)mSelectionList.getActivity();
|
||||
|
||||
trackDetailActivity.updateLists();
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the user exits the action mode
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
// Clears the selection
|
||||
SelectedTrack.getSelectionList().clear();
|
||||
SelectedTrackList.getInstance().clear();
|
||||
|
||||
updateViews();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.playmusicexporter2.activitys;
|
||||
package de.arcus.playmusicexporter2.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -114,4 +114,15 @@ public class MusicTrackDetailActivity extends ActionBarActivity {
|
|||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all view lists
|
||||
*/
|
||||
public void updateLists() {
|
||||
// Gets the music list fragment
|
||||
MusicTrackDetailFragment musicTrackDetailFragment = (MusicTrackDetailFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.track_detail_container);
|
||||
|
||||
musicTrackDetailFragment.updateListView();
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.playmusicexporter2.activitys;
|
||||
package de.arcus.playmusicexporter2.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -158,6 +158,23 @@ public class MusicTrackListActivity extends ActionBarActivity
|
|||
loadList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all view lists
|
||||
*/
|
||||
public void updateLists() {
|
||||
// Gets the music list fragment
|
||||
MusicTrackListFragment musicTrackListFragment = (MusicTrackListFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.track_list);
|
||||
|
||||
musicTrackListFragment.updateListView();
|
||||
|
||||
// Gets the music list fragment
|
||||
MusicTrackDetailFragment musicTrackDetailFragment = (MusicTrackDetailFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.track_detail_container);
|
||||
|
||||
musicTrackDetailFragment.updateListView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the music list with the current view type
|
||||
*/
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* Copyright (c) 2015 David Schulte
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.playmusicexporter2.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import de.arcus.framework.activities.DirectoryBrowserActivity;
|
||||
import de.arcus.framework.utils.FileTools;
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.settings.PlayMusicExporterSettings;
|
||||
|
||||
/**
|
||||
* The preference activity
|
||||
*/
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
private final static int REQUEST_EXPORT_PATH = 1;
|
||||
|
||||
// App settings
|
||||
private PlayMusicExporterSettings mSettings;
|
||||
|
||||
// Preferences
|
||||
private ListPreference mPrefExportPath;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Create the settings
|
||||
mSettings = new PlayMusicExporterSettings(this);
|
||||
|
||||
// Setup the default shared preference
|
||||
PreferenceManager prefMgr = getPreferenceManager();
|
||||
prefMgr.setSharedPreferencesName(PlayMusicExporterSettings.DEFAULT_SETTINGS_FILENAME);
|
||||
prefMgr.setSharedPreferencesMode(MODE_WORLD_READABLE);
|
||||
|
||||
// Loads the preference xml
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
// The export path preference
|
||||
mPrefExportPath = (ListPreference)findPreference("preference_export_path");
|
||||
mPrefExportPath.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
// The new value
|
||||
String selectedPath = newValue.toString();
|
||||
|
||||
boolean ret = true;
|
||||
|
||||
// Empty = custom
|
||||
if (TextUtils.isEmpty(selectedPath)) {
|
||||
// Opens the directory browser
|
||||
Intent intent = new Intent(getApplicationContext(), DirectoryBrowserActivity.class);
|
||||
|
||||
// The current path
|
||||
intent.putExtra(DirectoryBrowserActivity.EXTRA_PATH, mSettings.getString(PlayMusicExporterSettings.PREF_EXPORT_PATH, ""));
|
||||
intent.putExtra(DirectoryBrowserActivity.EXTRA_TITLE, getString(R.string.settings_export_path));
|
||||
|
||||
// Starts the activity
|
||||
startActivityForResult(intent, REQUEST_EXPORT_PATH);
|
||||
|
||||
// Do not apply the empty value.
|
||||
// We wait vor the activity result instead.
|
||||
ret = false;
|
||||
} else {
|
||||
// Saves the path
|
||||
mSettings.setString(PlayMusicExporterSettings.PREF_EXPORT_PATH, selectedPath);
|
||||
}
|
||||
|
||||
// Update the entry
|
||||
updatePrefExportPath();
|
||||
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
updatePrefExportPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the entry for the export path
|
||||
*/
|
||||
private void updatePrefExportPath() {
|
||||
// Get the path from the settings
|
||||
String selectedPath = mSettings.getString(PlayMusicExporterSettings.PREF_EXPORT_PATH, "");
|
||||
|
||||
// Get all storage
|
||||
String[] storage = FileTools.getStorages();
|
||||
String[] storageValues = new String[storage.length + 1];
|
||||
String[] storageNames = new String[storage.length + 1];
|
||||
int storageSelected = storage.length;
|
||||
|
||||
for(int i=0; i<storage.length; i++) {
|
||||
String path = storage[i] + "/Music";
|
||||
storageValues[i] = path;
|
||||
storageNames[i] = path;
|
||||
|
||||
// Is storage selected?
|
||||
if (selectedPath.equals(path)) {
|
||||
storageSelected = i;
|
||||
}
|
||||
}
|
||||
|
||||
// If the path is not set, we use the first default value.
|
||||
// This should not happen, because we set the default value in the
|
||||
// PlayMusicExporterSettings constructor, but i want to be sure.
|
||||
if (selectedPath.equals("") && storageValues.length > 0) {
|
||||
selectedPath = storageValues[0];
|
||||
storageSelected = 0;
|
||||
}
|
||||
|
||||
// Custom entry
|
||||
storageValues[storage.length] = "";
|
||||
storageNames[storage.length] = getString(R.string.settings_export_path_custom);
|
||||
|
||||
// Custom is selected
|
||||
if (storageSelected == storage.length) {
|
||||
// Adds the custom path to the label
|
||||
storageNames[storage.length] += "\n" + selectedPath;
|
||||
}
|
||||
|
||||
mPrefExportPath.setEntries(storageNames);
|
||||
mPrefExportPath.setEntryValues(storageValues);
|
||||
mPrefExportPath.setValueIndex(storageSelected);
|
||||
mPrefExportPath.setSummary(selectedPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns from a result activity
|
||||
* @param requestCode The request code
|
||||
* @param resultCode The result code
|
||||
* @param data The data
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
// Result is ok
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Export path was changed
|
||||
if (requestCode == REQUEST_EXPORT_PATH) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,7 @@ import java.util.List;
|
|||
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.items.SelectedTrack;
|
||||
import de.arcus.playmusicexporter2.items.SelectedTrackList;
|
||||
import de.arcus.playmusicexporter2.utils.ImageViewLoader;
|
||||
import de.arcus.playmusiclib.items.MusicTrack;
|
||||
|
||||
|
@ -152,7 +153,7 @@ public class MusicTrackAdapter extends ArrayAdapter<MusicTrack> {
|
|||
view.setEnabled(musicTrack.isOfflineAvailable());
|
||||
|
||||
// Selected state
|
||||
SelectedTrack.getSelectionList().initView(new SelectedTrack(musicTrack.getId()), view);
|
||||
SelectedTrackList.getInstance().initView(new SelectedTrack(musicTrack.getId()), view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.os.Bundle;
|
|||
import android.os.Environment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -35,9 +36,9 @@ import android.widget.ListView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.actionmode.ActionModeTitle;
|
||||
import de.arcus.playmusicexporter2.adapter.MusicTrackAdapter;
|
||||
import de.arcus.playmusicexporter2.items.SelectedTrack;
|
||||
import de.arcus.playmusicexporter2.items.SelectedTrackList;
|
||||
import de.arcus.playmusicexporter2.utils.ImageViewLoader;
|
||||
import de.arcus.playmusicexporter2.utils.MusicPathBuilder;
|
||||
import de.arcus.playmusiclib.PlayMusicManager;
|
||||
|
@ -47,8 +48,8 @@ import de.arcus.playmusiclib.items.MusicTrackList;
|
|||
|
||||
/**
|
||||
* A fragment representing a single Track detail screen.
|
||||
* This fragment is either contained in a {@link de.arcus.playmusicexporter2.activitys.MusicTrackListActivity}
|
||||
* in two-pane mode (on tablets) or a {@link de.arcus.playmusicexporter2.activitys.MusicTrackDetailActivity}
|
||||
* This fragment is either contained in a {@link de.arcus.playmusicexporter2.activities.MusicTrackListActivity}
|
||||
* in two-pane mode (on tablets) or a {@link de.arcus.playmusicexporter2.activities.MusicTrackDetailActivity}
|
||||
* on handsets.
|
||||
*/
|
||||
public class MusicTrackDetailFragment extends Fragment {
|
||||
|
@ -64,6 +65,11 @@ public class MusicTrackDetailFragment extends Fragment {
|
|||
*/
|
||||
private MusicTrackList mMusicTrackList;
|
||||
|
||||
/**
|
||||
* The list view
|
||||
*/
|
||||
private ListView mListView;
|
||||
|
||||
/**
|
||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||
* fragment (e.g. upon screen orientation changes).
|
||||
|
@ -71,6 +77,13 @@ public class MusicTrackDetailFragment extends Fragment {
|
|||
public MusicTrackDetailFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the list view
|
||||
*/
|
||||
public void updateListView() {
|
||||
mListView.invalidateViews();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -90,7 +103,7 @@ public class MusicTrackDetailFragment extends Fragment {
|
|||
}
|
||||
|
||||
// Setup the selection list for this activity
|
||||
SelectedTrack.getSelectionList().setupActionMode((ActionBarActivity)getActivity(), new ActionModeTitle(getActivity()));
|
||||
SelectedTrackList.getInstance().setupActionMode((ActionBarActivity)getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,12 +113,12 @@ public class MusicTrackDetailFragment extends Fragment {
|
|||
|
||||
// Show the dummy content as text in a TextView.
|
||||
if (mMusicTrackList != null) {
|
||||
final ListView listView = (ListView)rootView.findViewById(R.id.list_music_track);
|
||||
mListView = (ListView)rootView.findViewById(R.id.list_music_track);
|
||||
final MusicTrackAdapter musicTrackAdapter = new MusicTrackAdapter(getActivity());
|
||||
|
||||
musicTrackAdapter.setShowArtworks(mMusicTrackList.getShowArtworkInTrack());
|
||||
|
||||
View headerView = inflater.inflate(R.layout.header_music_track_list, listView, false);
|
||||
View headerView = inflater.inflate(R.layout.header_music_track_list, mListView, false);
|
||||
headerView.setEnabled(false);
|
||||
|
||||
TextView textView;
|
||||
|
@ -127,18 +140,18 @@ public class MusicTrackDetailFragment extends Fragment {
|
|||
textView = (TextView)headerView.findViewById(R.id.text_music_track_list_description);
|
||||
textView.setText(mMusicTrackList.getDescription());
|
||||
|
||||
listView.addHeaderView(headerView);
|
||||
mListView.addHeaderView(headerView);
|
||||
|
||||
musicTrackAdapter.setList(mMusicTrackList.getMusicTrackList());
|
||||
|
||||
listView.setAdapter(musicTrackAdapter);
|
||||
mListView.setAdapter(musicTrackAdapter);
|
||||
//listView.setDrawSelectorOnTop(false);
|
||||
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
listView.setItemsCanFocus(false);
|
||||
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
mListView.setItemsCanFocus(false);
|
||||
|
||||
|
||||
// Click on one list item
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
// The header is not clicked
|
||||
|
@ -152,14 +165,23 @@ public class MusicTrackDetailFragment extends Fragment {
|
|||
// Track is available
|
||||
if (musicTrack.isOfflineAvailable()) {
|
||||
|
||||
// Default structure
|
||||
String pathStructure = "{album-artist}/{album}/{disc=CD $}/{no=$$.} {title}.mp3";
|
||||
|
||||
// Track is exported from a group (playlist or artist)
|
||||
if (!TextUtils.isEmpty(musicTrack.getContainerName()))
|
||||
{
|
||||
pathStructure = "{group}/{group-no=$$.} {title}.mp3";
|
||||
}
|
||||
|
||||
// Build the path
|
||||
String path = MusicPathBuilder.Build(musicTrack, "{album-artist}/{album}/{disc=CD $}/{no=$$.} {title}.mp3");
|
||||
String path = MusicPathBuilder.Build(musicTrack, pathStructure);
|
||||
|
||||
// Path to the public music folder
|
||||
path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC) + "/" + path;
|
||||
|
||||
// Toggles the music track
|
||||
SelectedTrack.getSelectionList().toggle(new SelectedTrack(musicTrack.getId(), path), view);
|
||||
SelectedTrackList.getInstance().toggle(new SelectedTrack(musicTrack.getId(), path), view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class MusicTrackListFragment extends ListFragment {
|
|||
/**
|
||||
* Callback for when an item has been selected.
|
||||
*/
|
||||
public void onItemSelected(MusicTrackList musicTrackList);
|
||||
void onItemSelected(MusicTrackList musicTrackList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,6 +94,13 @@ public class MusicTrackListFragment extends ListFragment {
|
|||
public MusicTrackListFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the list view
|
||||
*/
|
||||
public void updateListView() {
|
||||
getListView().invalidateViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list Set the list
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.Button;
|
||||
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.activitys.SettingsActivity;
|
||||
import de.arcus.playmusicexporter2.activities.SettingsActivity;
|
||||
import de.arcus.playmusicexporter2.settings.PlayMusicExporterSettings;
|
||||
|
||||
/**
|
||||
|
@ -371,7 +371,7 @@ public class NavigationDrawerFragment extends Fragment {
|
|||
/**
|
||||
* Callbacks interface that all activities using this fragment must implement.
|
||||
*/
|
||||
public static interface NavigationDrawerCallbacks {
|
||||
public interface NavigationDrawerCallbacks {
|
||||
/**
|
||||
* Called when an item in the navigation drawer is selected.
|
||||
*/
|
||||
|
|
|
@ -25,37 +25,12 @@ package de.arcus.playmusicexporter2.items;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.services.ExportService;
|
||||
import de.arcus.framework.utils.SelectionList;
|
||||
|
||||
/**
|
||||
* The selected track
|
||||
*/
|
||||
public class SelectedTrack {
|
||||
/**
|
||||
* The instance of the selection
|
||||
*/
|
||||
private static SelectionList<SelectedTrack> selectionList;
|
||||
|
||||
/**
|
||||
* Gets the latest instance of the track selection.
|
||||
* Creates a new one if it doesn't exist.
|
||||
* @return The instance
|
||||
*/
|
||||
@SuppressWarnings("ResourceAsColor")
|
||||
public static SelectionList<SelectedTrack> getSelectionList() {
|
||||
// Create a new instance
|
||||
if (selectionList == null) {
|
||||
selectionList = new SelectionList<>();
|
||||
|
||||
// Sets the color resources
|
||||
selectionList.setColor(R.color.button_navigation_drawer_normal, R.color.button_navigation_drawer_selected);
|
||||
}
|
||||
|
||||
return selectionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the track
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (c) 2015 David Schulte
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package de.arcus.playmusicexporter2.items;
|
||||
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.view.ActionMode;
|
||||
|
||||
import de.arcus.framework.utils.SelectionList;
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.actionmode.ActionModeTitle;
|
||||
|
||||
/**
|
||||
* The selection manager for music tracks
|
||||
*/
|
||||
public class SelectedTrackList extends SelectionList<SelectedTrack> {
|
||||
/**
|
||||
* The instance of the selection
|
||||
*/
|
||||
private static SelectedTrackList instance;
|
||||
|
||||
/**
|
||||
* Gets the latest instance of the track selection.
|
||||
* Creates a new one if it doesn't exist.
|
||||
* @return The instance
|
||||
*/
|
||||
@SuppressWarnings("ResourceAsColor")
|
||||
public static SelectedTrackList getInstance() {
|
||||
// Create a new instance
|
||||
if (instance == null) {
|
||||
instance = new SelectedTrackList();
|
||||
|
||||
// Sets the color resources
|
||||
instance.setColor(R.color.button_navigation_drawer_normal, R.color.button_navigation_drawer_selected);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the action mode callback
|
||||
* @param activity The activity
|
||||
* @return The new action mode callback
|
||||
*/
|
||||
@Override
|
||||
protected ActionMode.Callback createActionMode(ActionBarActivity activity) {
|
||||
return new ActionModeTitle(activity, this);
|
||||
}
|
||||
}
|
|
@ -137,7 +137,7 @@ public class ExportService extends IntentService {
|
|||
mNotificationBuilder.setContentTitle(getString(R.string.notification_export_finished_title));
|
||||
|
||||
if (mTracksTotal == 1) {
|
||||
mNotificationBuilder.setContentText(getString(R.string.notification_export_finished_single_summery));
|
||||
mNotificationBuilder.setContentText(getString(R.string.notification_export_finished_single_summery, mTrackCurrent.getTitle()));
|
||||
} else {
|
||||
mNotificationBuilder.setContentText(getString(R.string.notification_export_finished_summery, mTracksDone, mTracksTotal));
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class ExportService extends IntentService {
|
|||
if (mTracksTotal == 1) {
|
||||
mNotificationBuilder.setContentText(getString(R.string.notification_export_working_single_summery));
|
||||
} else {
|
||||
mNotificationBuilder.setContentText(getString(R.string.notification_export_working_summery, mTracksDone, mTracksTotal));
|
||||
mNotificationBuilder.setContentText(getString(R.string.notification_export_working_summery, mTracksDone + 1, mTracksTotal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,10 @@ public class MusicPathBuilder {
|
|||
if (musicTrack.getTrackNumber() > 0)
|
||||
value = String.valueOf(musicTrack.getTrackNumber());
|
||||
break;
|
||||
case "group-no":
|
||||
if (musicTrack.getContainerPosition() > 0)
|
||||
value = String.valueOf(musicTrack.getContainerPosition());
|
||||
break;
|
||||
case "year":
|
||||
if (!TextUtils.isEmpty(musicTrack.getYear()))
|
||||
value = musicTrack.getYear();
|
||||
|
|
After Width: | Height: | Size: 435 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 361 B |
After Width: | Height: | Size: 551 B |
|
@ -92,7 +92,7 @@
|
|||
android:id="@+id/text_music_track_title"
|
||||
android:layout_alignParentTop="true"
|
||||
android:maxLines="2"
|
||||
android:textSize="16dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/text_music_title" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:maxLines="2"
|
||||
android:textSize="16dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/text_music_title" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto/">
|
||||
<item android:id="@+id/action_select_all"
|
||||
android:title="@string/action_select_all"
|
||||
android:icon="@drawable/ic_action_select_all"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_export"
|
||||
android:title="@string/action_export"
|
||||
android:icon="@drawable/ic_action_save"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<string name="settings_export_id3_disabled">Ohne Metadaten</string>
|
||||
<string name="settings_export_id3_with_cover">Metadaten mit Bild</string>
|
||||
<string name="settings_export_id3_without_cover">Metadaten ohne Bild</string>
|
||||
<string name="notification_export_finished_single_summery">Der Titel wurde erfolgreich exportiert!</string>
|
||||
<string name="notification_export_finished_single_summery">%1$s wurde erfolgreich exportiert!</string>
|
||||
<string name="notification_export_working_single_summery">Titel wird exportiert…</string>
|
||||
<string name="notification_export_working_summery">Titel %1$d von %2$d wird exportiert…</string>
|
||||
<string name="notification_export_finished_summery">%1$d Titel wurden erfolgreich exportiert!</string>
|
||||
|
@ -55,4 +55,6 @@
|
|||
<string name="action_export">Exportieren</string>
|
||||
<string name="action_play">Wiedergeben</string>
|
||||
<string name="action_share">Teilen</string>
|
||||
<string name="action_select_all">Alles markieren</string>
|
||||
<string name="settings_export_path_custom">Benutzerdefinierter Pfad</string>
|
||||
</resources>
|
|
@ -26,6 +26,7 @@
|
|||
<string name="app_name">Play Music Exporter</string>
|
||||
<string name="title_track_detail">Track Detail</string>
|
||||
|
||||
<string name="action_select_all">Select all</string>
|
||||
<string name="action_export">Export</string>
|
||||
<string name="action_play">Play</string>
|
||||
<string name="action_share">Share</string>
|
||||
|
@ -46,7 +47,7 @@
|
|||
|
||||
<string name="notification_export_finished_title">Export finished!</string>
|
||||
<string name="notification_export_finished_summery">%1$d tracks were exported successfully!</string>
|
||||
<string name="notification_export_finished_single_summery">Track was exported successfully!</string>
|
||||
<string name="notification_export_finished_single_summery">%1$s was exported successfully!</string>
|
||||
|
||||
<string name="search">Search</string>
|
||||
<string name="button_export_group">Export all tracks</string>
|
||||
|
@ -65,12 +66,13 @@
|
|||
<string name="settings_export_id3_without_cover">Metadata without cover</string>
|
||||
<string name="settings_export_id3_disabled">No metadata</string>
|
||||
|
||||
<string name="settings_export_path_custom">Custom path</string>
|
||||
<string-array name="settings_export_id3_value_names">
|
||||
<item>@string/settings_export_id3_with_cover</item>
|
||||
<item>@string/settings_export_id3_without_cover</item>
|
||||
<item>@string/settings_export_id3_disabled</item>
|
||||
</string-array>
|
||||
<string-array name="settings_export_id3_values">
|
||||
<string-array name="settings_export_id3_values" translatable="false">
|
||||
<item>id3_with_cover</item>
|
||||
<item>id3_without_cover</item>
|
||||
<item>id3_disabled</item>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<!-- Export settings -->
|
||||
<PreferenceCategory android:title="@string/settings_category_export">
|
||||
<!-- Export path -->
|
||||
<Preference android:title="@string/settings_export_path"
|
||||
<ListPreference android:title="@string/settings_export_path"
|
||||
android:key="preference_export_path"/>
|
||||
|
||||
<!-- Path structure for albums -->
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="PlayMusicExporterGit" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id=":playmusiclib" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="PlayMusicExporterGit" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
|
@ -12,8 +12,9 @@
|
|||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
|
@ -91,4 +92,3 @@
|
|||
<orderEntry type="module" module-name="framework" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
@ -148,6 +148,6 @@ public class PlaylistDataSource extends DataSource<Playlist> {
|
|||
* @return Returns all playlists
|
||||
*/
|
||||
public List<Playlist> getAll() {
|
||||
return getItems(TABLE_LIST, COLUMNS_ALL, prepareWhere(COLUMN_LIST_TYPE + " != " + Playlist.TYPE_QUEUE), COLUMN_LIST_TYPE + ", " + COLUMN_NAME);
|
||||
return getItems(TABLE_LIST, COLUMNS_ALL, prepareWhere(COLUMN_LIST_TYPE + " != " + Playlist.TYPE_QUEUE), COLUMN_LIST_TYPE + " DESC, " + COLUMN_NAME);
|
||||
}
|
||||
}
|
||||
|
|