Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: enricocid <enrico2588@gmail.com>
  • Loading branch information
enricocid committed Jun 18, 2018
1 parent 52dbec6 commit f9f970c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.iven.musicplayergo;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
Expand All @@ -23,7 +24,7 @@ public void run() {
});
}

private void inflateLayout(Context context) {
private void inflateLayout(@NonNull final Context context) {
final View v = LayoutInflater.from(context).inflate(R.layout.player_buttons, this, true);
container = v.findViewById(R.id.layout_button_container);
}
Expand Down
4 changes: 2 additions & 2 deletions project/app/src/main/java/com/iven/musicplayergo/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static boolean isMarshmallow() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}

public static Spanned buildSpanned(String res) {
public static Spanned buildSpanned(final String res) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ?
Html.fromHtml(res, Html.FROM_HTML_MODE_LEGACY) :
Html.fromHtml(res);
Expand All @@ -48,7 +48,7 @@ static boolean isThemeInverted(@NonNull final Context context) {
return isThemeInverted;
}

static void setTheme(@NonNull final Activity activity, boolean isThemeInverted, int accent) {
static void setTheme(@NonNull final Activity activity, final boolean isThemeInverted, final int accent) {
final int theme = resolveTheme(isThemeInverted, accent);
activity.setTheme(theme);
if (isMarshmallow()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public void skip(final boolean isNext) {
}

private void getSkipSong(final boolean isNext) {
int currentIndex = mSongs.indexOf(mSelectedSong);
final int currentIndex = mSongs.indexOf(mSelectedSong);

int index;

Expand Down Expand Up @@ -450,7 +450,7 @@ private class NotificationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
String action = intent.getAction();
final String action = intent.getAction();

if (action != null) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class MusicNotificationManager {
mNotificationManager = (NotificationManager) mMusicService.getSystemService(Context.NOTIFICATION_SERVICE);
}

public void setAccentColor(int color) {
public void setAccentColor(final int color) {
mAccent = ContextCompat.getColor(mMusicService, color);
}

Expand Down Expand Up @@ -123,7 +123,7 @@ private NotificationCompat.Action notificationAction(final String action) {
private void createNotificationChannel() {

if (mNotificationManager.getNotificationChannel(CHANNEL_ID) == null) {
NotificationChannel notificationChannel =
final NotificationChannel notificationChannel =
new NotificationChannel(CHANNEL_ID,
mMusicService.getString(R.string.app_name),
NotificationManager.IMPORTANCE_LOW);
Expand Down

0 comments on commit f9f970c

Please sign in to comment.