Updated notes icons colors

This commit is contained in:
Denis 2015-03-05 15:45:42 +02:00
parent f1ecdea03f
commit bf73d4cc49
2 changed files with 14 additions and 7 deletions

View file

@ -15,7 +15,9 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -101,7 +103,8 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.note, null, false); View view = inflater.inflate(R.layout.note, null, false);
getNoteView(recording, view, getActivity()); Drawable icon =getNoteView(recording, view, getActivity());
icon.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
view.setBackgroundColor(Color.TRANSPARENT); view.setBackgroundColor(Color.TRANSPARENT);
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() { view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -125,7 +128,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
} }
} }
public static void getNoteView(final AudioVideoNotesPlugin.Recording recording, View view, public static Drawable getNoteView(final AudioVideoNotesPlugin.Recording recording, View view,
final Context ctx) { final Context ctx) {
String name = recording.getName(ctx); String name = recording.getName(ctx);
TextView nameText = ((TextView) view.findViewById(R.id.name)); TextView nameText = ((TextView) view.findViewById(R.id.name));
@ -133,14 +136,16 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(ctx)); ((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(ctx));
ImageView icon = (ImageView) view.findViewById(R.id.icon); ImageView icon = (ImageView) view.findViewById(R.id.icon);
Drawable iconDrawable;
if (recording.isAudio()) { if (recording.isAudio()) {
icon.setImageResource(R.drawable.ic_type_audio); iconDrawable = ctx.getResources().getDrawable(R.drawable.ic_type_audio);
} else if (recording.isVideo()) { } else if (recording.isVideo()) {
icon.setImageResource(R.drawable.ic_type_video); iconDrawable = ctx.getResources().getDrawable(R.drawable.ic_type_audio);
} else { } else {
icon.setImageResource(R.drawable.ic_type_img); iconDrawable = ctx.getResources().getDrawable(R.drawable.ic_type_audio);
} }
icon.setImageDrawable(iconDrawable);
return iconDrawable;
} }
} }

View file

@ -4,6 +4,7 @@ import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
@ -92,7 +93,8 @@ public class NotesFragment extends ListFragment {
} }
final AudioVideoNotesPlugin.Recording recording = getItem(position); final AudioVideoNotesPlugin.Recording recording = getItem(position);
DashAudioVideoNotesFragment.getNoteView(recording, row, getActivity()); Drawable icon = DashAudioVideoNotesFragment.getNoteView(recording, row, getActivity());
icon.setColorFilter(getResources().getColor(R.color.color_distance), Mode.MULTIPLY);
row.findViewById(R.id.play).setVisibility(View.GONE); row.findViewById(R.id.play).setVisibility(View.GONE);
ImageButton options = (ImageButton) row.findViewById(R.id.options); ImageButton options = (ImageButton) row.findViewById(R.id.options);
options.setOnClickListener(new View.OnClickListener() { options.setOnClickListener(new View.OnClickListener() {