mirror of
https://github.com/playmusicexporter/playmusicexporter
synced 2024-05-13 22:36:43 +00:00
Add a floating button to export tracks
Update AppCompat
This commit is contained in:
parent
3a97bbebc1
commit
dac0260f35
|
@ -1,11 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="appcompat-v7-22.1.1">
|
||||
<ANNOTATIONS>
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/annotations.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/framework/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/annotations.zip!/" />
|
||||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/classes.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/res" />
|
||||
<root url="file://$PROJECT_DIR$/framework/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/res" />
|
||||
<root url="jar://$PROJECT_DIR$/framework/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/classes.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
|
|
10
.idea/libraries/appcompat_v7_22_2_1.xml
Normal file
10
.idea/libraries/appcompat_v7_22_2_1.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<component name="libraryTable">
|
||||
<library name="appcompat-v7-22.2.1">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res" />
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/classes.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
10
.idea/libraries/design_22_2_1.xml
Normal file
10
.idea/libraries/design_22_2_1.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<component name="libraryTable">
|
||||
<library name="design-22.2.1">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/design/22.2.1/res" />
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/design/22.2.1/classes.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
11
.idea/libraries/support_annotations_22_2_1.xml
Normal file
11
.idea/libraries/support_annotations_22_2_1.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="support-annotations-22.2.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/android-sdks/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/android-sdks/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,9 +1,9 @@
|
|||
<component name="libraryTable">
|
||||
<library name="support-v4-22.1.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/libs/internal_impl-22.1.1.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/res" />
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/classes.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/framework/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/res" />
|
||||
<root url="jar://$PROJECT_DIR$/framework/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/classes.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/framework/build/intermediates/exploded-aar/com.android.support/support-v4/22.1.1/libs/internal_impl-22.1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
|
|
11
.idea/libraries/support_v4_22_2_1.xml
Normal file
11
.idea/libraries/support_v4_22_2_1.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="support-v4-22.2.1">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/res" />
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/libs/internal_impl-22.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/classes.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
|
@ -55,6 +55,14 @@ public abstract class SelectionList<T> {
|
|||
*/
|
||||
private ActionMode.Callback mActionModeCallback;
|
||||
|
||||
/**
|
||||
* Flag to not close the activity when action mode is closing
|
||||
*/
|
||||
private boolean mDoNotCloseActionMode;
|
||||
|
||||
public boolean getDoNotCloseActionMode() { return mDoNotCloseActionMode; }
|
||||
public void setDoNotCloseActionMode(boolean doNotCloseActionMode) { mDoNotCloseActionMode = doNotCloseActionMode; }
|
||||
|
||||
/**
|
||||
* The colors
|
||||
*/
|
||||
|
@ -168,10 +176,23 @@ public abstract class SelectionList<T> {
|
|||
* Clears the selection
|
||||
*/
|
||||
public void clear() {
|
||||
clear(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the selection
|
||||
* @param doNotCloseActionMode Close the action mode?
|
||||
*/
|
||||
public void clear(boolean doNotCloseActionMode) {
|
||||
mDoNotCloseActionMode = doNotCloseActionMode;
|
||||
|
||||
mItems.clear();
|
||||
|
||||
// Updates the action mode
|
||||
updateActionModeMenu();
|
||||
|
||||
// Reset the flag
|
||||
mDoNotCloseActionMode = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,6 +220,14 @@ public abstract class SelectionList<T> {
|
|||
* Updates the action mode menu
|
||||
*/
|
||||
private void updateActionModeMenu() {
|
||||
updateActionModeMenu(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the action mode menu
|
||||
* @param doNotCloseActivity Prevent the closing of the activity
|
||||
*/
|
||||
private void updateActionModeMenu(boolean doNotCloseActivity) {
|
||||
// Null check
|
||||
if (mActionModeCallback != null && mActivity != null && !mActivity.isFinishing()) {
|
||||
|
||||
|
@ -213,6 +242,7 @@ public abstract class SelectionList<T> {
|
|||
ActionMode actionMode = mActionMode;
|
||||
mActionMode = null;
|
||||
|
||||
|
||||
// Close the action mode
|
||||
actionMode.finish();
|
||||
}
|
||||
|
|
|
@ -45,8 +45,9 @@ android {
|
|||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:22.1.1'
|
||||
compile 'com.android.support:support-v4:22.1.1'
|
||||
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||
compile 'com.android.support:support-v4:22.2.1'
|
||||
compile 'com.android.support:design:22.2.1'
|
||||
compile project(':framework')
|
||||
compile project(':playmusiclib')
|
||||
}
|
||||
|
|
|
@ -88,9 +88,10 @@
|
|||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="design-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
|
||||
<orderEntry type="module" module-name="playmusiclib" exported="" />
|
||||
<orderEntry type="module" module-name="framework" exported="" />
|
||||
</component>
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.view.Menu;
|
|||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import de.arcus.framework.logger.Logger;
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.activities.MusicTrackListActivity;
|
||||
import de.arcus.playmusicexporter2.activities.MusicContainerListActivity;
|
||||
|
@ -48,10 +49,8 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
*/
|
||||
private SelectedTrackList mSelectionList;
|
||||
|
||||
/**
|
||||
* Flag to not close the activity when action mode is closing
|
||||
*/
|
||||
private boolean mDoNotCloseActivity;
|
||||
|
||||
|
||||
|
||||
public ActionModeTitle(Context context, SelectedTrackList selectionList) {
|
||||
mContext = context;
|
||||
|
@ -85,19 +84,6 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_export:
|
||||
|
||||
// Export all selected tracks
|
||||
for(SelectedTrack selectedTrack : SelectedTrackList.getInstance().getSelectedItems()) {
|
||||
selectedTrack.export(mContext);
|
||||
}
|
||||
|
||||
// Do not close the activity
|
||||
mDoNotCloseActivity = true;
|
||||
|
||||
// Clear the selection
|
||||
SelectedTrackList.getInstance().clear();
|
||||
return true;
|
||||
case R.id.action_select_all:
|
||||
// We are in the track list
|
||||
if (mSelectionList.getActivity() instanceof MusicTrackListActivity) {
|
||||
|
@ -108,11 +94,8 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
|
||||
return true;
|
||||
case R.id.action_deselect_all:
|
||||
// Do not close the activity
|
||||
mDoNotCloseActivity = true;
|
||||
|
||||
// Clear the selection
|
||||
SelectedTrackList.getInstance().clear();
|
||||
mSelectionList.clear(true);
|
||||
|
||||
return true;
|
||||
default:
|
||||
|
@ -144,7 +127,7 @@ public class ActionModeTitle implements ActionMode.Callback {
|
|||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
// We are in the music track list
|
||||
if (mSelectionList.getActivity() instanceof MusicTrackListActivity && !mDoNotCloseActivity) {
|
||||
if (mSelectionList.getActivity() instanceof MusicTrackListActivity && !mSelectionList.getDoNotCloseActionMode()) {
|
||||
// Clear the action mode
|
||||
SelectedTrackList.getInstance().clearActionMode();
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import android.support.v7.widget.SearchView;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.EditText;
|
||||
|
||||
import de.arcus.framework.logger.Logger;
|
||||
import de.arcus.framework.crashhandler.CrashHandler;
|
||||
|
@ -268,7 +269,11 @@ public class MusicContainerListActivity extends AppCompatActivity
|
|||
if (mSearchView != null) {
|
||||
// Sets the search listener
|
||||
mSearchView.setOnQueryTextListener(this);
|
||||
mSearchView.setIconifiedByDefault(false);
|
||||
mSearchView.setIconifiedByDefault(true);
|
||||
|
||||
// Hack to change the default placeholder
|
||||
EditText searchEditText = (EditText) mSearchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
|
||||
searchEditText.setHint(R.string.search);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -24,6 +24,7 @@ package de.arcus.playmusicexporter2.fragments;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.TextUtils;
|
||||
|
@ -35,6 +36,7 @@ import android.widget.ImageView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import de.arcus.framework.logger.Logger;
|
||||
import de.arcus.playmusicexporter2.R;
|
||||
import de.arcus.playmusicexporter2.activities.MusicContainerListActivity;
|
||||
import de.arcus.playmusicexporter2.activities.MusicTrackListActivity;
|
||||
|
@ -72,6 +74,8 @@ public class MusicTrackListFragment extends Fragment {
|
|||
*/
|
||||
private ListView mListView;
|
||||
|
||||
private FloatingActionButton mFloatingButtonExport;
|
||||
|
||||
private MusicTrackListAdapter mMusicTrackAdapter;
|
||||
|
||||
/**
|
||||
|
@ -87,6 +91,19 @@ public class MusicTrackListFragment extends Fragment {
|
|||
public void updateListView() {
|
||||
if (mListView != null)
|
||||
mListView.invalidateViews();
|
||||
|
||||
updateFloatingButton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the floating button
|
||||
*/
|
||||
public void updateFloatingButton() {
|
||||
if (SelectedTrackList.getInstance().getSelectedItems().size() > 0) {
|
||||
mFloatingButtonExport.show();
|
||||
} else {
|
||||
mFloatingButtonExport.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,6 +194,22 @@ public class MusicTrackListFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// The floating action button
|
||||
mFloatingButtonExport = (FloatingActionButton)rootView.findViewById(R.id.floating_button_export);
|
||||
mFloatingButtonExport.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Export all selected tracks
|
||||
for(SelectedTrack selectedTrack : SelectedTrackList.getInstance().getSelectedItems()) {
|
||||
selectedTrack.export(getActivity());
|
||||
}
|
||||
|
||||
// Clear the selection
|
||||
SelectedTrackList.getInstance().clear(true);
|
||||
}
|
||||
});
|
||||
updateFloatingButton();
|
||||
}
|
||||
|
||||
return rootView;
|
||||
|
@ -207,12 +240,19 @@ public class MusicTrackListFragment extends Fragment {
|
|||
// Path to the public music folder
|
||||
path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC) + "/" + path;
|
||||
|
||||
// Prevent the closing
|
||||
SelectedTrackList.getInstance().setDoNotCloseActionMode(true);
|
||||
|
||||
if (toggle) {
|
||||
// Toggles the music track
|
||||
SelectedTrackList.getInstance().toggle(new SelectedTrack(musicTrack.getId(), path), view);
|
||||
} else {
|
||||
SelectedTrackList.getInstance().setSelected(new SelectedTrack(musicTrack.getId(), path), true, view);
|
||||
}
|
||||
|
||||
SelectedTrackList.getInstance().setDoNotCloseActionMode(false);
|
||||
}
|
||||
|
||||
updateFloatingButton();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,25 @@
|
|||
~ THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/list_music_track"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list_music_track"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_margin="16dp"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/ic_action_save"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:id="@+id/floating_button_export" />
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -31,19 +31,4 @@
|
|||
android:title="@string/action_deselect_all"
|
||||
android:icon="@drawable/ic_action_select_none"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_export"
|
||||
android:title="@string/action_export"
|
||||
android:icon="@drawable/ic_action_save"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_share"
|
||||
android:title="@string/action_share"
|
||||
android:icon="@drawable/ic_action_share"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_play"
|
||||
android:title="@string/action_play"
|
||||
android:icon="@drawable/ic_action_play"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
|
@ -50,7 +50,7 @@
|
|||
<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>
|
||||
<string name="notification_export_finished_title">Export abgeschlossen!</string>
|
||||
<string name="search">Suchen</string>
|
||||
<string name="search">Suchen…</string>
|
||||
<string name="button_export_group">Alle Titel exportieren</string>
|
||||
<string name="action_export">Exportieren</string>
|
||||
<string name="action_play">Wiedergeben</string>
|
||||
|
@ -60,4 +60,5 @@
|
|||
<string name="settings_export_id3_artwork_size">Maximale Artworkgröße</string>
|
||||
<string name="settings_export_id3_artwork_size_summary">Wenn die Größe des Artworks größer als der eingestellte Wert ist, wird das Artwork auf diesen Wert runter skalliert.</string>
|
||||
<string name="action_mode_track_selection">%d Titel ausgewählt</string>
|
||||
<string name="action_deselect_all">Auswahl aufheben</string>
|
||||
</resources>
|
|
@ -50,7 +50,7 @@
|
|||
<string name="notification_export_finished_summery">%1$d tracks were exported successfully!</string>
|
||||
<string name="notification_export_finished_single_summery">%1$s was exported successfully!</string>
|
||||
|
||||
<string name="search">Search</string>
|
||||
<string name="search">Search…</string>
|
||||
<string name="button_export_group">Export all tracks</string>
|
||||
|
||||
<string name="settings_category_export">Export settings</string>
|
||||
|
|
Loading…
Reference in a new issue