diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..c1e2ebc --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4063951 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3321dbd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/framework/src/main/java/de/arcus/framework/utils/SelectionList.java b/framework/src/main/java/de/arcus/framework/utils/SelectionList.java index cd566b0..42d00a8 100644 --- a/framework/src/main/java/de/arcus/framework/utils/SelectionList.java +++ b/framework/src/main/java/de/arcus/framework/utils/SelectionList.java @@ -23,6 +23,7 @@ package de.arcus.framework.utils; import android.support.annotation.ColorRes; +import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.view.ActionMode; import android.view.View; @@ -131,9 +132,9 @@ public abstract class SelectionList { if (view != null) { // Change the background if (state) - view.setBackgroundColor(view.getResources().getColor(mResColorSelected)); + view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorSelected)); else - view.setBackgroundColor(view.getResources().getColor(mResColorNormal)); + view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorNormal)); } } @@ -211,9 +212,9 @@ public abstract class SelectionList { public void initView(T item, View view) { // Change the background if (isSelected(item)) - view.setBackgroundColor(view.getResources().getColor(mResColorSelected)); + view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorSelected)); else - view.setBackgroundColor(view.getResources().getColor(mResColorNormal)); + view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorNormal)); } /** diff --git a/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/activities/SettingsActivity.java b/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/activities/SettingsActivity.java index da166c7..c7ee249 100644 --- a/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/activities/SettingsActivity.java +++ b/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/activities/SettingsActivity.java @@ -25,6 +25,7 @@ package de.arcus.playmusicexporter2.activities; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; @@ -159,6 +160,13 @@ public class SettingsActivity extends PreferenceActivity { Logger.getInstance().logInfo("Uri", uri.toString()); + // Saves the permission + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ) { + getContentResolver().takePersistableUriPermission(uri, + Intent.FLAG_GRANT_READ_URI_PERMISSION | + Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + } + mSettings.setUri(PlayMusicExporterSettings.PREF_EXPORT_URI, uri); // Update the label diff --git a/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/adapter/MusicTrackListAdapter.java b/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/adapter/MusicTrackListAdapter.java index 9eef69f..4a59267 100644 --- a/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/adapter/MusicTrackListAdapter.java +++ b/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/adapter/MusicTrackListAdapter.java @@ -23,6 +23,7 @@ package de.arcus.playmusicexporter2.adapter; import android.content.Context; +import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -108,7 +109,7 @@ public class MusicTrackListAdapter extends ArrayAdapter { else textView.setText(""); - textView.setTextColor(mContext.getResources().getColor(musicTrack.isOfflineAvailable() ? R.color.text_music_number : R.color.text_music_disable_number)); + textView.setTextColor(ContextCompat.getColor(mContext, musicTrack.isOfflineAvailable() ? R.color.text_music_number : R.color.text_music_disable_number)); // Sets the disc number textView = (TextView)view.findViewById(R.id.text_music_track_disc_number); @@ -119,7 +120,7 @@ public class MusicTrackListAdapter extends ArrayAdapter { else textView.setVisibility(View.GONE); - textView.setTextColor(mContext.getResources().getColor(musicTrack.isOfflineAvailable() ? R.color.text_music_disc_number : R.color.text_music_disable_disc_number)); + textView.setTextColor(ContextCompat.getColor(mContext, musicTrack.isOfflineAvailable() ? R.color.text_music_disc_number : R.color.text_music_disable_disc_number)); if (mShowArtworks) { @@ -140,12 +141,12 @@ public class MusicTrackListAdapter extends ArrayAdapter { // Sets the title textView = (TextView)view.findViewById(R.id.text_music_track_title); textView.setText(musicTrack.getTitle()); - textView.setTextColor(mContext.getResources().getColor(musicTrack.isOfflineAvailable() ? R.color.text_music_title : R.color.text_music_disable_title)); + textView.setTextColor(ContextCompat.getColor(mContext, musicTrack.isOfflineAvailable() ? R.color.text_music_title : R.color.text_music_disable_title)); // Sets the artist textView = (TextView)view.findViewById(R.id.text_music_track_artist); textView.setText(musicTrack.getArtist()); - textView.setTextColor(mContext.getResources().getColor(musicTrack.isOfflineAvailable() ? R.color.text_music_description : R.color.text_music_disable_description)); + textView.setTextColor(ContextCompat.getColor(mContext, musicTrack.isOfflineAvailable() ? R.color.text_music_description : R.color.text_music_disable_description)); // Track is available? view.setEnabled(musicTrack.isOfflineAvailable()); diff --git a/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/fragments/NavigationDrawerFragment.java b/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/fragments/NavigationDrawerFragment.java index a4a83a6..01ada8d 100644 --- a/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/fragments/NavigationDrawerFragment.java +++ b/playmusicexporter/src/main/java/de/arcus/playmusicexporter2/fragments/NavigationDrawerFragment.java @@ -28,6 +28,7 @@ import android.content.res.Configuration; import android.graphics.PorterDuff; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.support.v4.content.ContextCompat; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; @@ -211,12 +212,13 @@ public class NavigationDrawerFragment extends Fragment { // Button is active if (active) { // Gets the active color - colorText = getResources().getColor(R.color.button_navigation_drawer_text_active); - colorBackground = getResources().getColor(R.color.button_navigation_drawer_active); + + colorText = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_text_active); + colorBackground = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_active); } else { // Gets the normal color - colorText = getResources().getColor(R.color.button_navigation_drawer_text); - colorBackground = getResources().getColor(R.color.button_navigation_drawer_normal); + colorText = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_text); + colorBackground = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_normal); } // Sets the color