Example usage for android.widget FrameLayout setPadding

List of usage examples for android.widget FrameLayout setPadding

Introduction

In this page you can find the example usage for android.widget FrameLayout setPadding.

Prototype

public void setPadding(int left, int top, int right, int bottom) 

Source Link

Document

Sets the padding.

Usage

From source file:net.bluehack.ui.ChatActivity.java

private void processSelectedOption(int option) {
    if (selectedObject == null) {
        return;//from   w w w .j  a  v  a2s  .com
    }
    switch (option) {
    case 0: {
        if (SendMessagesHelper.getInstance().retrySendMessage(selectedObject, false)) {
            moveScrollToLastMessage();
        }
        break;
    }
    case 1: {
        if (getParentActivity() == null) {
            selectedObject = null;
            return;
        }
        createDeleteMessagesAlert(selectedObject);
        break;
    }
    case 2: {
        forwaringMessage = selectedObject;
        Bundle args = new Bundle();
        args.putBoolean("onlySelect", true);
        args.putInt("dialogsType", 1);
        DialogsActivity fragment = new DialogsActivity(args);
        fragment.setDelegate(this);
        presentFragment(fragment);
        break;
    }
    case 3: {
        AndroidUtilities.addToClipboard(getMessageContent(selectedObject, 0, false));
        break;
    }
    case 4: {
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        if (selectedObject.type == 3 || selectedObject.type == 1) {
            if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(
                    Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                getParentActivity()
                        .requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 4);
                selectedObject = null;
                return;
            }
            MediaController.saveFile(path, getParentActivity(), selectedObject.type == 3 ? 1 : 0, null, null);
        }
        break;
    }
    case 5: {
        File locFile = null;
        if (selectedObject.messageOwner.attachPath != null
                && selectedObject.messageOwner.attachPath.length() != 0) {
            File f = new File(selectedObject.messageOwner.attachPath);
            if (f.exists()) {
                locFile = f;
            }
        }
        if (locFile == null) {
            File f = FileLoader.getPathToMessage(selectedObject.messageOwner);
            if (f.exists()) {
                locFile = f;
            }
        }
        if (locFile != null) {
            if (LocaleController.getInstance().applyLanguageFile(locFile)) {
                presentFragment(new LanguageSelectActivity());
            } else {
                if (getParentActivity() == null) {
                    selectedObject = null;
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setMessage(
                        LocaleController.getString("IncorrectLocalization", R.string.IncorrectLocalization));
                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
                showDialog(builder.create());
            }
        }
        break;
    }
    case 6: {
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType(selectedObject.getDocument().mime_type);
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
        getParentActivity().startActivityForResult(
                Intent.createChooser(intent, LocaleController.getString("ShareFile", R.string.ShareFile)), 500);
        break;
    }
    case 7: {
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(
                Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            getParentActivity().requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE },
                    4);
            selectedObject = null;
            return;
        }
        MediaController.saveFile(path, getParentActivity(), 0, null, null);
        break;
    }
    case 8: {
        showReplyPanel(true, selectedObject, null, null, false, true);
        break;
    }
    case 9: {
        showDialog(new StickersAlert(getParentActivity(), this, selectedObject.getInputStickerSet(), null,
                bottomOverlayChat.getVisibility() != View.VISIBLE ? chatActivityEnterView : null));
        break;
    }
    case 10: {
        if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(
                Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            getParentActivity().requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE },
                    4);
            selectedObject = null;
            return;
        }
        String fileName = FileLoader.getDocumentFileName(selectedObject.getDocument());
        if (fileName == null || fileName.length() == 0) {
            fileName = selectedObject.getFileName();
        }
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        MediaController.saveFile(path, getParentActivity(), selectedObject.isMusic() ? 3 : 2, fileName,
                selectedObject.getDocument() != null ? selectedObject.getDocument().mime_type : "");
        break;
    }
    case 11: {
        TLRPC.Document document = selectedObject.getDocument();
        MessagesController.getInstance().saveGif(document);
        showGifHint();
        chatActivityEnterView.addRecentGif(document);
        break;
    }
    case 12: {
        if (getParentActivity() == null) {
            selectedObject = null;
            return;
        }
        if (searchItem != null && actionBar.isSearchFieldVisible()) {
            actionBar.closeSearchField();
            chatActivityEnterView.setFieldFocused();
        }

        mentionsAdapter.setNeedBotContext(false);
        chatListView.setOnItemLongClickListener(null);
        chatListView.setOnItemClickListener(null);
        chatListView.setClickable(false);
        chatListView.setLongClickable(false);
        chatActivityEnterView.setEditingMessageObject(selectedObject, !selectedObject.isMediaEmpty());
        if (chatActivityEnterView.isEditingCaption()) {
            mentionsAdapter.setAllowNewMentions(false);
        }
        actionModeTitleContainer.setVisibility(View.VISIBLE);
        selectedMessagesCountTextView.setVisibility(View.GONE);
        checkEditTimer();

        chatActivityEnterView.setAllowStickersAndGifs(false, false);
        final ActionBarMenu actionMode = actionBar.createActionMode();
        actionMode.getItem(reply).setVisibility(View.GONE);
        actionMode.getItem(copy).setVisibility(View.GONE);
        actionMode.getItem(forward).setVisibility(View.GONE);
        actionMode.getItem(delete).setVisibility(View.GONE);
        if (editDoneItemAnimation != null) {
            editDoneItemAnimation.cancel();
            editDoneItemAnimation = null;
        }
        editDoneItem.setVisibility(View.VISIBLE);
        showEditDoneProgress(true, false);
        actionBar.showActionMode();
        updatePinnedMessageView(true);
        updateVisibleRows();

        TLRPC.TL_messages_getMessageEditData req = new TLRPC.TL_messages_getMessageEditData();
        req.peer = MessagesController.getInputPeer((int) dialog_id);
        req.id = selectedObject.getId();
        editingMessageObjectReqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
            @Override
            public void run(final TLObject response, TLRPC.TL_error error) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        editingMessageObjectReqId = 0;
                        if (response == null) {
                            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                            builder.setMessage(
                                    LocaleController.getString("EditMessageError", R.string.EditMessageError));
                            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
                            showDialog(builder.create());

                            if (chatActivityEnterView != null) {
                                chatActivityEnterView.setEditingMessageObject(null, false);
                            }
                        } else {
                            showEditDoneProgress(false, true);
                        }
                    }
                });
            }
        });
        break;
    }
    case 13: {
        final int mid = selectedObject.getId();
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(LocaleController.getString("PinMessageAlert", R.string.PinMessageAlert));

        final boolean[] checks = new boolean[] { true };
        FrameLayout frameLayout = new FrameLayout(getParentActivity());
        if (Build.VERSION.SDK_INT >= 21) {
            frameLayout.setPadding(0, AndroidUtilities.dp(8), 0, 0);
        }
        CheckBoxCell cell = new CheckBoxCell(getParentActivity());
        cell.setBackgroundResource(R.drawable.list_selector);
        cell.setText(LocaleController.getString("PinNotify", R.string.PinNotify), "", true, false);
        cell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(8) : 0, 0,
                LocaleController.isRTL ? 0 : AndroidUtilities.dp(8), 0);
        frameLayout.addView(cell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48,
                Gravity.TOP | Gravity.LEFT, 8, 0, 8, 0));
        cell.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CheckBoxCell cell = (CheckBoxCell) v;
                checks[0] = !checks[0];
                cell.setChecked(checks[0], true);
            }
        });
        builder.setView(frameLayout);
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        MessagesController.getInstance().pinChannelMessage(currentChat, mid, checks[0]);
                    }
                });
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        showDialog(builder.create());
        break;
    }
    case 14: {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(LocaleController.getString("UnpinMessageAlert", R.string.UnpinMessageAlert));
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        MessagesController.getInstance().pinChannelMessage(currentChat, 0, false);
                    }
                });
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        showDialog(builder.create());
        break;
    }
    case 15: {
        Bundle args = new Bundle();
        args.putInt("user_id", selectedObject.messageOwner.media.user_id);
        args.putString("phone", selectedObject.messageOwner.media.phone_number);
        args.putBoolean("addContact", true);
        presentFragment(new ContactAddActivity(args));
        break;
    }
    case 16: {
        AndroidUtilities.addToClipboard(selectedObject.messageOwner.media.phone_number);
        break;
    }
    case 17: {
        try {
            Intent intent = new Intent(Intent.ACTION_DIAL,
                    Uri.parse("tel:" + selectedObject.messageOwner.media.phone_number));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            getParentActivity().startActivityForResult(intent, 500);
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
        break;
    }
    }
    selectedObject = null;
}

From source file:kr.wdream.ui.ChatActivity.java

private void processSelectedOption(int option) {
    if (selectedObject == null) {
        return;//ww w  . j  a v  a2s  .  co m
    }
    switch (option) {
    case 0: {
        if (SendMessagesHelper.getInstance().retrySendMessage(selectedObject, false)) {
            moveScrollToLastMessage();
        }
        break;
    }
    case 1: {
        if (getParentActivity() == null) {
            selectedObject = null;
            return;
        }
        createDeleteMessagesAlert(selectedObject);
        break;
    }
    case 2: {
        forwaringMessage = selectedObject;
        Bundle args = new Bundle();
        args.putBoolean("onlySelect", true);
        args.putInt("dialogsType", 1);
        DialogsActivity fragment = new DialogsActivity(args);
        fragment.setDelegate(this);
        presentFragment(fragment);
        break;
    }
    case 3: {
        AndroidUtilities.addToClipboard(getMessageContent(selectedObject, 0, false));
        break;
    }
    case 4: {
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        if (selectedObject.type == 3 || selectedObject.type == 1) {
            if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(
                    Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                getParentActivity()
                        .requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 4);
                selectedObject = null;
                return;
            }
            MediaController.saveFile(path, getParentActivity(), selectedObject.type == 3 ? 1 : 0, null, null);
        }
        break;
    }
    case 5: {
        File locFile = null;
        if (selectedObject.messageOwner.attachPath != null
                && selectedObject.messageOwner.attachPath.length() != 0) {
            File f = new File(selectedObject.messageOwner.attachPath);
            if (f.exists()) {
                locFile = f;
            }
        }
        if (locFile == null) {
            File f = FileLoader.getPathToMessage(selectedObject.messageOwner);
            if (f.exists()) {
                locFile = f;
            }
        }
        if (locFile != null) {
            if (LocaleController.getInstance().applyLanguageFile(locFile)) {
                presentFragment(new LanguageSelectActivity());
            } else {
                if (getParentActivity() == null) {
                    selectedObject = null;
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", kr.wdream.storyshop.R.string.AppName));
                builder.setMessage(LocaleController.getString("IncorrectLocalization",
                        kr.wdream.storyshop.R.string.IncorrectLocalization));
                builder.setPositiveButton(LocaleController.getString("OK", kr.wdream.storyshop.R.string.OK),
                        null);
                showDialog(builder.create());
            }
        }
        break;
    }
    case 6: {
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType(selectedObject.getDocument().mime_type);
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
        getParentActivity().startActivityForResult(Intent.createChooser(intent,
                LocaleController.getString("ShareFile", kr.wdream.storyshop.R.string.ShareFile)), 500);
        break;
    }
    case 7: {
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(
                Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            getParentActivity().requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE },
                    4);
            selectedObject = null;
            return;
        }
        MediaController.saveFile(path, getParentActivity(), 0, null, null);
        break;
    }
    case 8: {
        showReplyPanel(true, selectedObject, null, null, false, true);
        break;
    }
    case 9: {
        showDialog(new StickersAlert(getParentActivity(), this, selectedObject.getInputStickerSet(), null,
                bottomOverlayChat.getVisibility() != View.VISIBLE ? chatActivityEnterView : null));
        break;
    }
    case 10: {
        if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(
                Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            getParentActivity().requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE },
                    4);
            selectedObject = null;
            return;
        }
        String fileName = FileLoader.getDocumentFileName(selectedObject.getDocument());
        if (fileName == null || fileName.length() == 0) {
            fileName = selectedObject.getFileName();
        }
        String path = selectedObject.messageOwner.attachPath;
        if (path != null && path.length() > 0) {
            File temp = new File(path);
            if (!temp.exists()) {
                path = null;
            }
        }
        if (path == null || path.length() == 0) {
            path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
        }
        MediaController.saveFile(path, getParentActivity(), selectedObject.isMusic() ? 3 : 2, fileName,
                selectedObject.getDocument() != null ? selectedObject.getDocument().mime_type : "");
        break;
    }
    case 11: {
        TLRPC.Document document = selectedObject.getDocument();
        MessagesController.getInstance().saveGif(document);
        showGifHint();
        chatActivityEnterView.addRecentGif(document);
        break;
    }
    case 12: {
        if (getParentActivity() == null) {
            selectedObject = null;
            return;
        }
        if (searchItem != null && actionBar.isSearchFieldVisible()) {
            actionBar.closeSearchField();
            chatActivityEnterView.setFieldFocused();
        }

        mentionsAdapter.setNeedBotContext(false);
        chatListView.setOnItemLongClickListener(null);
        chatListView.setOnItemClickListener(null);
        chatListView.setClickable(false);
        chatListView.setLongClickable(false);
        chatActivityEnterView.setEditingMessageObject(selectedObject, !selectedObject.isMediaEmpty());
        if (chatActivityEnterView.isEditingCaption()) {
            mentionsAdapter.setAllowNewMentions(false);
        }
        actionModeTitleContainer.setVisibility(View.VISIBLE);
        selectedMessagesCountTextView.setVisibility(View.GONE);
        checkEditTimer();

        chatActivityEnterView.setAllowStickersAndGifs(false, false);
        final ActionBarMenu actionMode = actionBar.createActionMode();
        actionMode.getItem(reply).setVisibility(View.GONE);
        actionMode.getItem(copy).setVisibility(View.GONE);
        actionMode.getItem(forward).setVisibility(View.GONE);
        actionMode.getItem(delete).setVisibility(View.GONE);
        if (editDoneItemAnimation != null) {
            editDoneItemAnimation.cancel();
            editDoneItemAnimation = null;
        }
        editDoneItem.setVisibility(View.VISIBLE);
        showEditDoneProgress(true, false);
        actionBar.showActionMode();
        updatePinnedMessageView(true);
        updateVisibleRows();

        TLRPC.TL_messages_getMessageEditData req = new TLRPC.TL_messages_getMessageEditData();
        req.peer = MessagesController.getInputPeer((int) dialog_id);
        req.id = selectedObject.getId();
        editingMessageObjectReqId = ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
            @Override
            public void run(final TLObject response, TLRPC.TL_error error) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        editingMessageObjectReqId = 0;
                        if (response == null) {
                            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                            builder.setTitle(LocaleController.getString("AppName",
                                    kr.wdream.storyshop.R.string.AppName));
                            builder.setMessage(LocaleController.getString("EditMessageError",
                                    kr.wdream.storyshop.R.string.EditMessageError));
                            builder.setPositiveButton(
                                    LocaleController.getString("OK", kr.wdream.storyshop.R.string.OK), null);
                            showDialog(builder.create());

                            if (chatActivityEnterView != null) {
                                chatActivityEnterView.setEditingMessageObject(null, false);
                            }
                        } else {
                            showEditDoneProgress(false, true);
                        }
                    }
                });
            }
        });
        break;
    }
    case 13: {
        final int mid = selectedObject.getId();
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(
                LocaleController.getString("PinMessageAlert", kr.wdream.storyshop.R.string.PinMessageAlert));

        final boolean[] checks = new boolean[] { true };
        FrameLayout frameLayout = new FrameLayout(getParentActivity());
        if (Build.VERSION.SDK_INT >= 21) {
            frameLayout.setPadding(0, AndroidUtilities.dp(8), 0, 0);
        }
        CheckBoxCell cell = new CheckBoxCell(getParentActivity());
        cell.setBackgroundResource(kr.wdream.storyshop.R.drawable.list_selector);
        cell.setText(LocaleController.getString("PinNotify", kr.wdream.storyshop.R.string.PinNotify), "", true,
                false);
        cell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(8) : 0, 0,
                LocaleController.isRTL ? 0 : AndroidUtilities.dp(8), 0);
        frameLayout.addView(cell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48,
                Gravity.TOP | Gravity.LEFT, 8, 0, 8, 0));
        cell.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CheckBoxCell cell = (CheckBoxCell) v;
                checks[0] = !checks[0];
                cell.setChecked(checks[0], true);
            }
        });
        builder.setView(frameLayout);
        builder.setPositiveButton(LocaleController.getString("OK", kr.wdream.storyshop.R.string.OK),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        MessagesController.getInstance().pinChannelMessage(currentChat, mid, checks[0]);
                    }
                });
        builder.setTitle(LocaleController.getString("AppName", kr.wdream.storyshop.R.string.AppName));
        builder.setNegativeButton(LocaleController.getString("Cancel", kr.wdream.storyshop.R.string.Cancel),
                null);
        showDialog(builder.create());
        break;
    }
    case 14: {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(LocaleController.getString("UnpinMessageAlert",
                kr.wdream.storyshop.R.string.UnpinMessageAlert));
        builder.setPositiveButton(LocaleController.getString("OK", kr.wdream.storyshop.R.string.OK),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        MessagesController.getInstance().pinChannelMessage(currentChat, 0, false);
                    }
                });
        builder.setTitle(LocaleController.getString("AppName", kr.wdream.storyshop.R.string.AppName));
        builder.setNegativeButton(LocaleController.getString("Cancel", kr.wdream.storyshop.R.string.Cancel),
                null);
        showDialog(builder.create());
        break;
    }
    case 15: {
        Bundle args = new Bundle();
        args.putInt("user_id", selectedObject.messageOwner.media.user_id);
        args.putString("phone", selectedObject.messageOwner.media.phone_number);
        args.putBoolean("addContact", true);
        presentFragment(new ContactAddActivity(args));
        break;
    }
    case 16: {
        AndroidUtilities.addToClipboard(selectedObject.messageOwner.media.phone_number);
        break;
    }
    case 17: {
        try {
            Intent intent = new Intent(Intent.ACTION_DIAL,
                    Uri.parse("tel:" + selectedObject.messageOwner.media.phone_number));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            getParentActivity().startActivityForResult(intent, 500);
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
        break;
    }
    }
    selectedObject = null;
}