Fixed artwork loading size

Fixed action mode
Add deselect button
This commit is contained in:
David Schulte 2015-08-09 21:08:01 +02:00
parent ea84b5f685
commit c6fc6493ef
22 changed files with 79 additions and 38 deletions

View file

@ -1,9 +0,0 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright (c) &amp;#36;today.year David Schulte&#10;&#10;Permission is hereby granted, free of charge, to any person obtaining a copy&#10;of this software and associated documentation files (the &quot;Software&quot;), to deal&#10;in the Software without restriction, including without limitation the rights&#10;to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&#10;copies of the Software, and to permit persons to whom the Software is&#10;furnished to do so, subject to the following conditions:&#10;&#10;The above copyright notice and this permission notice shall be included in&#10;all copies or substantial portions of the Software.&#10;&#10;THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&#10;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&#10;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&#10;AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&#10;LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&#10;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN&#10;THE SOFTWARE." />
<option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="" />
<option name="myName" value="Mit" />
<option name="myLocal" value="true" />
</copyright>
</component>

View file

@ -1,11 +1,11 @@
<component name="libraryTable">
<library name="appcompat-v7-22.1.1">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/framework/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/annotations.zip!/" />
<root url="jar://$PROJECT_DIR$/playmusicexporter/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.1.1/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<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!/" />
<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" />
</CLASSES>
<JAVADOC />
<SOURCES>

View file

@ -1,9 +1,9 @@
<component name="libraryTable">
<library name="support-v4-22.1.1">
<CLASSES>
<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!/" />
<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!/" />
</CLASSES>
<JAVADOC />
<SOURCES>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View file

@ -8,7 +8,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />

View file

@ -12,10 +12,12 @@
<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="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" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>generateDebugTestSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@ -25,7 +27,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />

View file

@ -12,10 +12,12 @@
<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="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" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>generateDebugTestSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@ -24,7 +26,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />

View file

@ -60,8 +60,7 @@ public class ActionModeTitle implements ActionMode.Callback {
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.action_mode_selection, menu);
//mode.setSubtitle("TEST");
mode.setTitleOptionalHint(true);
return true;
}
@ -71,6 +70,9 @@ public class ActionModeTitle implements ActionMode.Callback {
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
updateViews();
// Update the title
mode.setTitle(mContext.getString(R.string.action_mode_track_selection, mSelectionList.getSelectedItems().size()));
return false; // Return false if nothing is done
}
@ -85,8 +87,16 @@ public class ActionModeTitle implements ActionMode.Callback {
selectedTrack.export(mContext);
}
// Clear the selection
SelectedTrackList.getInstance().clear();
// Close the action mode
mode.finish();
//mode.finish();
return true;
case R.id.action_deselect_all:
// Clear the selection
SelectedTrackList.getInstance().clear();
return true;
default:
return false;

View file

@ -41,6 +41,7 @@ import de.arcus.playmusicexporter2.R;
import de.arcus.playmusicexporter2.fragments.MusicTrackListFragment;
import de.arcus.playmusicexporter2.fragments.MusicContainerListFragment;
import de.arcus.playmusicexporter2.fragments.NavigationDrawerFragment;
import de.arcus.playmusicexporter2.items.SelectedTrackList;
import de.arcus.playmusiclib.PlayMusicManager;
import de.arcus.playmusiclib.datasources.AlbumDataSource;
import de.arcus.playmusiclib.datasources.ArtistDataSource;
@ -160,6 +161,9 @@ public class MusicContainerListActivity extends AppCompatActivity
// Loads the list
mViewType = mNavigationDrawerFragment.getViewType();
loadList();
// Setup the selection list for this activity
SelectedTrackList.getInstance().setupActionMode(this);
}
/**

View file

@ -32,6 +32,7 @@ import android.view.MenuItem;
import de.arcus.framework.crashhandler.CrashHandler;
import de.arcus.playmusicexporter2.R;
import de.arcus.playmusicexporter2.fragments.MusicTrackListFragment;
import de.arcus.playmusicexporter2.items.SelectedTrackList;
import de.arcus.playmusiclib.PlayMusicManager;
import de.arcus.playmusiclib.items.MusicTrackList;
@ -102,6 +103,9 @@ public class MusicTrackListActivity extends AppCompatActivity {
.add(R.id.track_detail_container, fragment)
.commit();
}
// Setup the selection list for this activity
SelectedTrackList.getInstance().setupActionMode(this);
}
@Override
@ -129,6 +133,7 @@ public class MusicTrackListActivity extends AppCompatActivity {
MusicTrackListFragment musicTrackDetailFragment = (MusicTrackListFragment) getSupportFragmentManager()
.findFragmentById(R.id.track_detail_container);
musicTrackDetailFragment.updateListView();
if (musicTrackDetailFragment != null)
musicTrackDetailFragment.updateListView();
}
}

View file

@ -25,6 +25,7 @@ package de.arcus.playmusicexporter2.fragments;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ListView;
@ -33,6 +34,7 @@ import java.util.ArrayList;
import java.util.List;
import de.arcus.playmusicexporter2.adapter.MusicContainerListAdapter;
import de.arcus.playmusicexporter2.items.SelectedTrackList;
import de.arcus.playmusiclib.items.MusicTrackList;
/**
@ -130,7 +132,7 @@ public class MusicContainerListFragment extends ListFragment {
mMusicTrackListAdapter = new MusicContainerListAdapter(getActivity());
// Setup the list view
setListAdapter(mMusicTrackListAdapter);
}

View file

@ -104,9 +104,6 @@ public class MusicTrackListFragment extends Fragment {
mMusicTrackList = MusicTrackList.deserialize(playMusicManager, id, type);
}
}
// Setup the selection list for this activity
SelectedTrackList.getInstance().setupActionMode((AppCompatActivity)getActivity());
}
@Override
@ -146,10 +143,6 @@ public class MusicTrackListFragment extends Fragment {
musicTrackAdapter.setList(mMusicTrackList.getMusicTrackList());
mListView.setAdapter(musicTrackAdapter);
//listView.setDrawSelectorOnTop(false);
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
mListView.setItemsCanFocus(false);
// Click on one list item
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

View file

@ -27,6 +27,8 @@ import android.widget.ImageView;
import java.lang.ref.WeakReference;
import de.arcus.framework.logger.Logger;
import de.arcus.playmusicexporter2.R;
import de.arcus.playmusiclib.ArtworkLoader;
import de.arcus.playmusiclib.ArtworkLoaderCallback;
import de.arcus.playmusiclib.items.ArtworkEntry;
@ -74,6 +76,11 @@ public class ArtworkViewLoader {
* @param defaultImage The default image in case the image could not be loaded
*/
public static void loadImage(ArtworkEntry artworkEntry, ImageView imageView, int defaultImage) {
// No artwork
if (artworkEntry.getArtworkLocation() == null) {
return;
}
// Checks for an old artwork loader on this image view
ArtworkViewLoader imageViewLoader = (ArtworkViewLoader)imageView.getTag();
@ -112,7 +119,7 @@ public class ArtworkViewLoader {
int maximalArtworkSize = 0;
if (imageViewDefault != null) {
// The maximum artwork size
maximalArtworkSize = imageViewDefault.getWidth();
maximalArtworkSize = imageViewDefault.getContext().getResources().getDimensionPixelSize(R.dimen.music_track_artwork_loading_size);
// Sets the bitmap in the UI thread
Runnable runnable = new Runnable() {
@ -126,6 +133,8 @@ public class ArtworkViewLoader {
imageViewDefault.post(runnable);
}
// Start loading
mIsLoading = true;

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

View file

@ -27,6 +27,11 @@
android:icon="@drawable/ic_action_select_all"
app:showAsAction="ifRoom" />
<item android:id="@+id/action_deselect_all"
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"

View file

@ -59,4 +59,5 @@
<string name="settings_export_path_custom">Benutzerdefinierter Pfad</string>
<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>
</resources>

View file

@ -25,6 +25,7 @@
<dimen name="music_track_list_artwork_size">86dp</dimen>
<dimen name="music_track_list_header_artwork_size">128dp</dimen>
<dimen name="music_track_artwork_size">86dp</dimen>
<dimen name="music_track_artwork_loading_size">86dp</dimen>
<dimen name="navigation_drawer_width">280dp</dimen>
</resources>

View file

@ -27,6 +27,7 @@
<string name="title_track_detail">Track Detail</string>
<string name="action_select_all">Select all</string>
<string name="action_deselect_all">Deselect all</string>
<string name="action_export">Export</string>
<string name="action_play">Play</string>
<string name="action_share">Share</string>
@ -110,4 +111,5 @@
<string name="settings_donation_title">Support me</string>
<string name="settings_donation_summery">Donate to me via PayPal</string>
<string name="settings_donation_url" translatable="false"><![CDATA[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A2VD24Z5E32RU]]></string>
<string name="action_mode_track_selection">%d tracks selected</string>
</resources>

View file

@ -12,10 +12,12 @@
<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="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" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>generateDebugTestSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@ -25,7 +27,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />