package fr.neamar.kiss.result;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import fr.neamar.kiss.R;
import fr.neamar.kiss.pojo.PhonePojo;

public class PhoneResult extends Result {
    private final PhonePojo phonePojo;

    public PhoneResult(PhonePojo phonePojo) {
        super();
        this.pojo = this.phonePojo = phonePojo;
    }

    @Override
    public View display(Context context, int position, View v) {
        if (v == null)
            v = inflateFromId(context, R.layout.item_phone);

        TextView appName = (TextView) v.findViewById(R.id.item_phone_text);
        String text = context.getString(R.string.ui_item_phone);
        appName.setText(enrichText(String.format(text, "{" + phonePojo.phone + "}")));

        return v;
    }

    @Override
    public void doLaunch(Context context, View v) {
        Intent phone = new Intent(Intent.ACTION_CALL);
        phone.setData(Uri.parse("tel:" + Uri.encode(phonePojo.phone)));

        phone.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        context.startActivity(phone);
    }

}

@@ -88,16 +88,59 @@
 Intent;%0A
+import android.graphics.drawable.Drawable;%0A
 import a
@@ -1191,10 +1191,165 @@
 %0A    %7D%0A%0A
+    @Override%0A    public Drawable getDrawable(Context context) %7B%0A        return context.getResources().getDrawable(android.R.drawable.ic_menu_call);%0A    %7D%0A
 %7D%0A

Fix #204