Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01612207 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "T9 Dialer: View contact on long press on T9 results" into gingerbread

parents 5ad7538b 12d0a17e
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ import android.widget.ImageButton;
public class TwelveKeyDialer extends Activity implements View.OnClickListener,
        View.OnLongClickListener, View.OnKeyListener,
        View.OnTouchListener,
        AdapterView.OnItemLongClickListener,
        AdapterView.OnItemClickListener, TextWatcher {
    private static final String EMPTY_NUMBER = "";
    private static final String TAG = "TwelveKeyDialer";
@@ -264,10 +265,12 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
        mT9List = (ListView) findViewById(R.id.t9list);
        if (mT9List != null) {
            mT9List.setOnItemClickListener(this);
            mT9List.setOnItemLongClickListener(this);
        }
        mT9ListTop = (ListView) findViewById(R.id.t9listtop);
        if (mT9ListTop != null) {
            mT9ListTop.setOnItemClickListener(this);
            mT9ListTop.setOnItemLongClickListener(this);
            mT9ListTop.setTag(new ContactItem());
        }
        mT9Toggle = (ToggleButton) findViewById(R.id.t9toggle);
@@ -1407,6 +1410,26 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener,
        }
    }

    /**
     * Handle long clicks from mT9List and mT9ListTop
     */
    @Override
    public boolean onItemLongClick(AdapterView parent, View v, int position, long id) {
        long contactId;
        if (parent == mT9List) {
            contactId = mT9Adapter.getItem(position).id;
        } else if (mT9Toggle.getTag() == null) {
            contactId = mT9AdapterTop.getItem(position).id;
        } else {
            return false;
        }
        Intent intent = new Intent(Intent.ACTION_VIEW);
        Uri uri = Uri.withAppendedPath(Contacts.CONTENT_URI, String.valueOf(contactId));
        intent.setData(uri);
        startActivity(intent);
        return true;
    }

    /**
     * Returns to the in-call UI (where there's presumably a call in
     * progress) in response to the user selecting "use touch tone keypad"