Version Bump, changing a lot of minor stuff suggested by Android Studio.

This commit is contained in:
Jan Christian Grünhage 2017-03-29 00:31:10 +02:00
parent 3374b3f8d0
commit 2f17819dbb
Signed by: jcgruenhage
GPG Key ID: 321A67D9EE8BC3E1
16 changed files with 111 additions and 249 deletions

View File

@ -27,7 +27,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.4.0-alpha3'
classpath 'com.android.tools.build:gradle:2.3.0'
}
}

View File

@ -29,6 +29,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -309,9 +310,7 @@ public class FileTools {
}
// Remove all blacklisted paths
for (String blacklistPath : mountPointBlacklist) {
storages.remove(blacklistPath);
}
storages.removeAll(Arrays.asList(mountPointBlacklist));
// Sort the list
Collections.sort(storages);

View File

@ -31,8 +31,8 @@ android {
minSdkVersion 21
targetSdkVersion 25
// TODO Change Version with releases
versionCode 109
versionName '0.9.5.2'
versionCode 110
versionName '0.9.6.0'
vectorDrawables.useSupportLibrary = true
jackOptions {

View File

@ -4,7 +4,6 @@ import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;

View File

@ -25,7 +25,6 @@ import re.jcg.playmusicexporter.settings.PlayMusicExporterPreferences;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.stream.Collectors;
/**
* A {@link PreferenceActivity} that presents a set of application settings. On
@ -47,31 +46,28 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = (preference, value) -> {
String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(
index >= 0
? listPreference.getEntries()[index]
: null);
// Set the summary to reflect the new value.
preference.setSummary(
index >= 0
? listPreference.getEntries()[index]
: null);
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
};
/**
@ -154,19 +150,13 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
setHasOptionsMenu(true);
findPreference("preference_alba_export_path").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivityForResult(new Intent("android.intent.action.OPEN_DOCUMENT_TREE"), REQUEST_CODE_OPEN_DOCUMENT_TREE_ALBA_PATH);
return true;
}
findPreference("preference_alba_export_path").setOnPreferenceClickListener(preference -> {
startActivityForResult(new Intent("android.intent.action.OPEN_DOCUMENT_TREE"), REQUEST_CODE_OPEN_DOCUMENT_TREE_ALBA_PATH);
return true;
});
findPreference("preference_groups_export_path").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivityForResult(new Intent("android.intent.action.OPEN_DOCUMENT_TREE"), REQUEST_CODE_OPEN_DOCUMENT_TREE_GROUPS_PATH);
return true;
}
findPreference("preference_groups_export_path").setOnPreferenceClickListener(preference -> {
startActivityForResult(new Intent("android.intent.action.OPEN_DOCUMENT_TREE"), REQUEST_CODE_OPEN_DOCUMENT_TREE_GROUPS_PATH);
return true;
});
}
@ -240,12 +230,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
private void setupOnClickListeners() {
findPreference(PlayMusicExporterPreferences.AUTO_EXPORT_PATH).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivityForResult(new Intent("android.intent.action.OPEN_DOCUMENT_TREE"), REQUEST_CODE_OPEN_DOCUMENT_TREE_AUTO_PATH);
return true;
}
findPreference(PlayMusicExporterPreferences.AUTO_EXPORT_PATH).setOnPreferenceClickListener(preference -> {
startActivityForResult(new Intent("android.intent.action.OPEN_DOCUMENT_TREE"), REQUEST_CODE_OPEN_DOCUMENT_TREE_AUTO_PATH);
return true;
});
//For every setting that is used to define the export job, setup a listener that
@ -256,12 +243,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
private void setupRescheduler(String preference) {
findPreference(preference).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
ExportAllJob.scheduleExport(getContext());
return false;
}
findPreference(preference).setOnPreferenceClickListener(preference1 -> {
ExportAllJob.scheduleExport(getContext());
return false;
});
}

View File

@ -79,10 +79,7 @@ public class MusicContainerListFragment extends ListFragment {
* A dummy implementation of the {@link Callbacks} interface that does
* nothing. Used only when this fragment is not attached to an activity.
*/
private static Callbacks sDummyCallbacks = new Callbacks() {
@Override
public void onItemSelected(MusicTrackList musicTrackList) {
}
private static Callbacks sDummyCallbacks = musicTrackList -> {
};
private MusicContainerListAdapter mMusicTrackListAdapter;
@ -112,9 +109,7 @@ public class MusicContainerListFragment extends ListFragment {
// Null check
if (list != null) {
// Copy the list
for (MusicTrackList musicTrackList : list) {
newList.add(musicTrackList);
}
newList.addAll(list);
}
// Set the list in the adapter
@ -145,7 +140,8 @@ public class MusicContainerListFragment extends ListFragment {
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
}
}
// DEPRECATED
// DEPRECATED
@Override
public void onAttach(Context context) {
super.onAttach(context);

View File

@ -32,7 +32,6 @@ import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -197,43 +196,36 @@ public class MusicTrackListFragment extends Fragment {
mListView.setAdapter(mMusicTrackAdapter);
// Click on one list item
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// The header is not clicked
if (position > 0) {
// We need to subtract the header view
position -= 1;
mListView.setOnItemClickListener((parent, view, position, id) -> {
// The header is not clicked
if (position > 0) {
// We need to subtract the header view
position -= 1;
// Gets the selected track
MusicTrack musicTrack = mMusicTrackAdapter.getItem(position);
// Gets the selected track
MusicTrack musicTrack = mMusicTrackAdapter.getItem(position);
// Toggle the track
selectTrack(musicTrack, view, TrackSelectionState.Toggle);
}
// Toggle the track
selectTrack(musicTrack, view, TrackSelectionState.Toggle);
}
});
// The floating action button
mFloatingButtonExport = (FloatingActionButton) rootView.findViewById(R.id.floating_button_export);
mFloatingButtonExport.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
m_CPULock.acquire();
// Export all selected tracks
for (SelectedTrack selectedTrack : SelectedTrackList.getInstance().getSelectedItems()) {
selectedTrack.export(getActivity());
}
if ( m_CPULock.isHeld())
{
m_CPULock.release();
}
// Clear the selection
SelectedTrackList.getInstance().clear(true);
mFloatingButtonExport.setOnClickListener(v -> {
m_CPULock.acquire();
// Export all selected tracks
for (SelectedTrack selectedTrack : SelectedTrackList.getInstance().getSelectedItems()) {
selectedTrack.export(getActivity());
}
if ( m_CPULock.isHeld())
{
m_CPULock.release();
}
// Clear the selection
SelectedTrackList.getInstance().clear(true);
});
updateFloatingButton();
}

View File

@ -22,7 +22,6 @@
package re.jcg.playmusicexporter.fragments;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
@ -160,47 +159,24 @@ public class NavigationDrawerFragment extends Fragment {
setViewType(mViewType);
// Click on album
mButtonTypeAlbum.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setViewType(ViewType.Album);
}
});
mButtonTypeAlbum.setOnClickListener(v -> setViewType(ViewType.Album));
// Click on artist
mButtonTypeArtist.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setViewType(ViewType.Artist);
}
});
mButtonTypeArtist.setOnClickListener(v -> setViewType(ViewType.Artist));
// Click on playlist
mButtonTypePlaylist.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setViewType(ViewType.Playlist);
}
});
mButtonTypePlaylist.setOnClickListener(v -> setViewType(ViewType.Playlist));
// Click on rated
mButtonTypeRated.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setViewType(ViewType.Rated);
}
});
mButtonTypeRated.setOnClickListener(v -> setViewType(ViewType.Rated));
// Click on settings
mButtonSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intentSettings = new Intent(getActivity(), SettingsActivity.class);
startActivity(intentSettings);
mButtonSettings.setOnClickListener(v -> {
Intent intentSettings = new Intent(getActivity(), SettingsActivity.class);
startActivity(intentSettings);
// Close the drawer
mDrawerLayout.closeDrawers();
}
// Close the drawer
mDrawerLayout.closeDrawers();
});
// Color the settings button
@ -307,12 +283,7 @@ public class NavigationDrawerFragment extends Fragment {
}
// Defer code dependent on restoration of previous instance state.
mDrawerLayout.post(new Runnable() {
@Override
public void run() {
mDrawerToggle.syncState();
}
});
mDrawerLayout.post(mDrawerToggle::syncState);
mDrawerLayout.setDrawerListener(mDrawerToggle);
}

View File

@ -7,11 +7,6 @@ import android.net.Uri;
import android.os.PowerManager;
import android.util.Log;
import com.mpatric.mp3agic.InvalidDataException;
import com.mpatric.mp3agic.NotSupportedException;
import com.mpatric.mp3agic.UnsupportedTagException;
import java.io.IOException;
import java.util.List;
import ly.count.android.sdk.Countly;

View File

@ -30,12 +30,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import com.mpatric.mp3agic.InvalidDataException;
import com.mpatric.mp3agic.NotSupportedException;
import com.mpatric.mp3agic.UnsupportedTagException;
import java.io.IOException;
import de.arcus.framework.logger.Logger;
import ly.count.android.sdk.Countly;
import re.jcg.playmusicexporter.R;

View File

@ -22,14 +22,12 @@
package re.jcg.playmusicexporter.utils;
import android.graphics.Bitmap;
import android.widget.ImageView;
import java.lang.ref.WeakReference;
import re.jcg.playmusicexporter.R;
import de.arcus.playmusiclib.ArtworkLoader;
import de.arcus.playmusiclib.ArtworkLoaderCallback;
import de.arcus.playmusiclib.items.ArtworkEntry;
/**
@ -121,13 +119,10 @@ public class ArtworkViewLoader {
maximalArtworkSize = imageViewDefault.getContext().getResources().getDimensionPixelSize(R.dimen.music_track_artwork_loading_size);
// Sets the bitmap in the UI thread
Runnable runnable = new Runnable() {
@Override
public void run() {
// Default icon
imageViewDefault.setImageResource(mDefaultImage);
Runnable runnable = () -> {
// Default icon
imageViewDefault.setImageResource(mDefaultImage);
}
};
imageViewDefault.post(runnable);
}
@ -138,36 +133,30 @@ public class ArtworkViewLoader {
mIsLoading = true;
// Load the artwork
ArtworkLoader.loadArtworkAsync(mArtworkEntry, maximalArtworkSize, new ArtworkLoaderCallback() {
@Override
public void onFinished(final Bitmap bitmap) {
final ImageView imageView = mImageView.get();
ArtworkLoader.loadArtworkAsync(mArtworkEntry, maximalArtworkSize, bitmap -> {
final ImageView imageView = mImageView.get();
if (imageViewDefault != null) {
// Sets the bitmap in the UI thread
Runnable runnable = new Runnable() {
@Override
public void run() {
// Bitmap is valid
if (bitmap != null)
imageView.setImageBitmap(bitmap);
else
imageView.setImageResource(mDefaultImage);
}
};
imageView.post(runnable);
}
if (imageViewDefault != null) {
// Sets the bitmap in the UI thread
Runnable runnable = () -> {
// Bitmap is valid
if (bitmap != null)
imageView.setImageBitmap(bitmap);
else
imageView.setImageResource(mDefaultImage);
};
imageView.post(runnable);
}
// Loading is done
mIsLoading = false;
// Loading is done
mIsLoading = false;
// Loads the next image
if (mNewArtworkEntry != null) {
mArtworkEntry = mNewArtworkEntry;
mNewArtworkEntry = null;
// Loads the next image
if (mNewArtworkEntry != null) {
mArtworkEntry = mNewArtworkEntry;
mNewArtworkEntry = null;
loadImage();
}
loadImage();
}
});
}

View File

@ -1,31 +0,0 @@
<?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.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_navigation_drawer_hover">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/button_navigation_drawer_normal"/>
</shape>
</item>
</ripple>

View File

@ -1,31 +0,0 @@
<?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.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_navigation_drawer_hover">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/button_navigation_drawer_selected"/>
</shape>
</item>
</ripple>

View File

@ -21,7 +21,11 @@
~ THE SOFTWARE.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/button_navigation_drawer_normal"/>
</shape>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_navigation_drawer_hover">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/button_navigation_drawer_normal"/>
</shape>
</item>
</ripple>

View File

@ -21,7 +21,11 @@
~ THE SOFTWARE.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/button_navigation_drawer_selected"/>
</shape>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_navigation_drawer_hover">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/button_navigation_drawer_selected"/>
</shape>
</item>
</ripple>

View File

@ -25,7 +25,6 @@ package de.arcus.playmusiclib;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
@ -33,10 +32,8 @@ import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.support.v4.content.FileProvider;
import android.support.v4.provider.DocumentFile;
import android.text.TextUtils;
import android.util.Log;
import com.mpatric.mp3agic.ID3v1Genres;
import com.mpatric.mp3agic.ID3v1Tag;
@ -557,7 +554,7 @@ public class PlayMusicManager {
DocumentFile document = DocumentFile.fromTreeUri(mContext, uri);
// Creates the subdirectories
String[] directories = path.split("\\/");
String[] directories = path.split("/");
for (int i = 0; i < directories.length - 1; i++) {
String directoryName = directories[i];
boolean found = false;