Skip to content

Commit

Permalink
Update to SDK 28 and migrate to AndroidX
Browse files Browse the repository at this point in the history
  • Loading branch information
dwi336 committed Dec 31, 2018
1 parent ec6c2e2 commit a8c7710
Show file tree
Hide file tree
Showing 649 changed files with 972 additions and 655 deletions.
7 changes: 4 additions & 3 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="app/src/main/java"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="con" path="org.eclipse.andmore.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="org.eclipse.andmore.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="org.eclipse.andmore.DEPENDENCIES"/>
<classpathentry kind="lib" path="/home/didi/Android/Sdk/tools/lib/guava-20.0.jar"/>
<classpathentry kind="output" path="bin/classes"/>
<classpathentry kind="lib" path="/home/didi/Android/Sdk/build-tools/28.0.3/renderscript/lib/renderscript-v8.jar"/>
<classpathentry kind="lib" path="libs/guava-24.1-jre.jar"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Eleven music player (CyanogenMod/LineageOS) - compatible with Android version >1
Copied from https://github.com/LineageOS/android_packages_apps_Eleven/archive/cm-14.1.zip (03.08.2017)

Moved to lineage-15.1 branch.
Merged with upstream project on 06.04.2018
Merged with upstream project on 31.12.2018

Made compatibility changes for android version >14 using as much material design as possible

Expand Down
64 changes: 64 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "org.lineageos.eleven"
targetSdkVersion 28
renderscriptTargetApi 28
renderscriptSupportModeEnabled true
versionCode 3
versionName "3.0"

vectorDrawables.useSupportLibrary = true
}

signingConfigs {
release {
storeFile file("/home/didi/eclipse/DevStore")
storePassword "test123"
keyAlias "TestKey"
keyPassword "1234567890"
}
}

compileOptions {
sourceCompatibility "1.8"
targetCompatibility "1.8"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
signingConfig signingConfigs.release
}
}

lintOptions {
disable 'ExtraTranslation', 'MissingTranslation', 'MissingQuantity'
disable 'ProtectedPermissions'
disable 'AppLinkUrlError', 'StringFormatInvalid'
}

useLibrary 'android.test.runner'

useLibrary 'android.test.base'
useLibrary 'android.test.mock'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.media:media:1.0.0'
implementation 'com.google.guava:guava:24.1-jre'
}

4 changes: 3 additions & 1 deletion AndroidManifest.xml → app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="27" />
android:targetSdkVersion="28" />

<original-package android:name="com.cyanogenmod.eleven" />

Expand All @@ -45,6 +45,8 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- Allows Eleven to modify media files on external storage -->
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
<!-- For Android Pie -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<!-- Audio Visualizer Permissions -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions assets/licenses.html → app/src/main/assets/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ <h3>Notices for files:</h3><ul>
</body></html>

<h3>Notices for file:</h3><ul>
<li>android-support-v4.jar</li>
<li>guava-24.1-jre.jar</li>
</ul>
<pre>
/*
* Copyright (C) 2012 The Android Open Source Project
* Copyright (C) 2010 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.os.Build;
import android.util.Log;
import android.view.KeyEvent;
import androidx.core.content.ContextCompat;
import androidx.legacy.content.WakefulBroadcastReceiver;

public class MediaButtonIntentReceiver extends WakefulBroadcastReceiver {
private static final boolean DEBUG = false;
Expand Down Expand Up @@ -76,6 +78,10 @@ private static void startService(Context context, String command, long timestamp
i.putExtra(MusicPlaybackService.CMDNAME, command);
i.putExtra(MusicPlaybackService.FROM_MEDIA_BUTTON, true);
i.putExtra(MusicPlaybackService.TIMESTAMP, timestamp);
startWakefulService(context, i);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ContextCompat.startForegroundService(context, i);
} else {
startWakefulService(context, i);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.Notification;
import android.support.v4.app.NotificationCompat;
import android.support.v4.media.app.NotificationCompat.MediaStyle;
import android.app.NotificationManager;
import android.app.NotificationChannel;
import android.app.PendingIntent;
Expand All @@ -39,13 +37,8 @@
import android.hardware.SensorManager;
import android.media.AudioManager;
import android.media.AudioManager.OnAudioFocusChangeListener;
import android.support.v4.content.ContextCompat;
import android.support.v4.media.MediaDescriptionCompat;
import android.support.v4.media.MediaMetadataCompat;
import android.media.MediaPlayer;
import android.media.audiofx.AudioEffect;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
Expand All @@ -60,10 +53,17 @@
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.AlbumColumns;
import android.provider.MediaStore.Audio.AudioColumns;
import android.support.v4.media.MediaDescriptionCompat;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.Log;
import android.util.LongSparseArray;
import android.view.KeyEvent;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import androidx.media.app.NotificationCompat.MediaStyle;

import org.lineageos.eleven.Config.IdType;
import org.lineageos.eleven.appwidgets.AppWidgetLarge;
Expand Down Expand Up @@ -100,7 +100,6 @@
public class MusicPlaybackService extends Service {
private static final String TAG = "MusicPlaybackService";
private static final boolean D = false;
public static final String CHANNEL_ID = "eleven_channel_01";

/**
* Indicates that the music has paused or resumed
Expand Down Expand Up @@ -342,6 +341,8 @@ public class MusicPlaybackService extends Service {
*/
public static final int MAX_HISTORY_SIZE = 1000;

private static final String CHANNEL_NAME = "eleven_playback";

public interface TrackErrorExtra {
/**
* Name of the track that was unable to play
Expand Down Expand Up @@ -628,13 +629,6 @@ public void onCreate() {

mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence channelName = "Eleven";
// Create channel to show notifications.
mNotificationManager.createNotificationChannel(new NotificationChannel(CHANNEL_ID,
channelName, NotificationManager.IMPORTANCE_LOW));
}

// Initialize the favorites and recents databases
mRecentsCache = RecentStore.getInstance(this);

Expand Down Expand Up @@ -916,7 +910,7 @@ private void handleHeadsetHookClick(long timestamp) {
if (mHeadsetHookWakeLock == null) {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mHeadsetHookWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"Eleven headset button");
"Eleven:headset button");
mHeadsetHookWakeLock.setReferenceCounted(false);
}
// Make sure we don't indefinitely hold the wake lock under any circumstances
Expand Down Expand Up @@ -1659,7 +1653,7 @@ private Notification buildNotification() {
mNotificationPostTime = System.currentTimeMillis();
}

android.support.v4.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_NAME)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(artwork.getBitmap())
.setContentIntent(clickIntent)
Expand All @@ -1680,6 +1674,25 @@ private Notification buildNotification() {

builder.setColor(artwork.getVibrantDarkColor());


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = mNotificationManager
.getNotificationChannel(CHANNEL_NAME);

if (channel == null) {
String name = getString(R.string.channel_music);

channel = new NotificationChannel(CHANNEL_NAME, name,
mNotificationManager.IMPORTANCE_DEFAULT);
channel.setShowBadge(false);
channel.enableVibration(false);
channel.setSound(null, null);
mNotificationManager.createNotificationChannel(channel);
}

builder.setChannelId(channel.getId());
}

return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import org.lineageos.eleven.MusicPlaybackService;
import org.lineageos.eleven.R;
Expand All @@ -40,7 +40,7 @@
import java.util.LinkedList;

/**
* A {@link android.support.v4.app.FragmentStatePagerAdapter} class for swiping between album art
* A {@link androidx.fragment.app.FragmentStatePagerAdapter} class for swiping between album art
*/
public class AlbumArtPagerAdapter extends FragmentStatePagerAdapter {
private static boolean DEBUG = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.view.View;
import android.widget.TextView;
import androidx.loader.content.Loader;

import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

import android.app.Activity;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import androidx.core.content.ContextCompat;

import org.lineageos.eleven.R;
import org.lineageos.eleven.cache.ImageFetcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;
import androidx.recyclerview.widget.RecyclerView;

import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import android.app.Activity;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.content.Loader;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.loader.content.Loader;

import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.lineageos.eleven.adapters;

import android.app.Activity;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -11,6 +9,8 @@
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;

import org.lineageos.eleven.Config;
import org.lineageos.eleven.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.SparseArray;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import org.lineageos.eleven.R;
import org.lineageos.eleven.ui.fragments.AlbumFragment;
Expand Down
Loading

0 comments on commit a8c7710

Please sign in to comment.