<commit_before>package im.actor.sdk.controllers.dialogs;

import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;

import android.widget.Toast;
import im.actor.core.entity.Dialog;
import im.actor.core.entity.PeerType;
import im.actor.core.viewmodel.CommandCallback;
import im.actor.core.viewmodel.GroupVM;
import im.actor.sdk.ActorSDK;
import im.actor.sdk.R;
import im.actor.sdk.controllers.Intents;
import im.actor.sdk.controllers.activity.ActorMainActivity;

import static im.actor.sdk.util.ActorSDKMessenger.groups;
import static im.actor.sdk.util.ActorSDKMessenger.messenger;

public class DialogsFragment extends BaseDialogFragment {

    protected void onItemClick(Dialog item) {
        ((ActorMainActivity) getActivity()).onDialogClicked(item);
    }

    protected boolean onItemLongClick(final Dialog dialog) {
        if (dialog.getPeer().getPeerType() == PeerType.PRIVATE) {

            new AlertDialog.Builder(getActivity())
                    .setItems(new CharSequence[]{
                            getString(R.string.dialogs_menu_contact_view),
                            getString(R.string.dialogs_menu_contact_rename),
                            getString(R.string.dialogs_menu_conversation_delete)
                    }, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface d, int which) {
                            if (which == 0) {

                                // View profile
                                ActorSDK.sharedActor().startProfileActivity(getActivity(), dialog.getPeer().getPeerId());

                            } else if (which == 1) {

                                // Rename user
                                startActivity(Intents.editUserName(dialog.getPeer().getPeerId(), getActivity()));

                            } else if (which == 2) {

                                // Delete chat
                                new AlertDialog.Builder(getActivity())
                                        .setMessage(getString(R.string.alert_delete_chat_message, dialog.getDialogTitle()))
                                        .setNegativeButton(R.string.dialog_cancel, null)
                                        .setPositiveButton(R.string.alert_delete_chat_yes, new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface d, int which) {
                                                execute(messenger().deleteChat(dialog.getPeer()));
                                            }
                                        })
                                        .show();
                            }
                        }
                    })
                    .show();

            return true;
        } else if (dialog.getPeer().getPeerType() == PeerType.GROUP) {
            GroupVM groupVM = groups().get(dialog.getPeer().getPeerId());<commit_msg>feat(android): error message in clear private chat<commit_after>package im.actor.sdk.controllers.dialogs;

import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;

import android.widget.Toast;
import im.actor.core.entity.Dialog;
import im.actor.core.entity.PeerType;
import im.actor.core.viewmodel.CommandCallback;
import im.actor.core.viewmodel.GroupVM;
import im.actor.sdk.ActorSDK;
import im.actor.sdk.R;
import im.actor.sdk.controllers.Intents;
import im.actor.sdk.controllers.activity.ActorMainActivity;

import static im.actor.sdk.util.ActorSDKMessenger.groups;
import static im.actor.sdk.util.ActorSDKMessenger.messenger;

public class DialogsFragment extends BaseDialogFragment {

    protected void onItemClick(Dialog item) {
        ((ActorMainActivity) getActivity()).onDialogClicked(item);
    }

    protected boolean onItemLongClick(final Dialog dialog) {
        if (dialog.getPeer().getPeerType() == PeerType.PRIVATE) {

            new AlertDialog.Builder(getActivity())
                    .setItems(new CharSequence[]{
                            getString(R.string.dialogs_menu_contact_view),
                            getString(R.string.dialogs_menu_contact_rename),
                            getString(R.string.dialogs_menu_conversation_delete)
                    }, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface d, int which) {
                            if (which == 0) {

                                // View profile
                                ActorSDK.sharedActor().startProfileActivity(getActivity(), dialog.getPeer().getPeerId());

                            } else if (which == 1) {

                                // Rename user
                                startActivity(Intents.editUserName(dialog.getPeer().getPeerId(), getActivity()));

                            } else if (which == 2) {

                                // Delete chat
                                new AlertDialog.Builder(getActivity())
                                        .setMessage(getString(R.string.alert_delete_chat_message, dialog.getDialogTitle()))
                                        .setNegativeButton(R.string.dialog_cancel, null)
                                        .setPositiveButton(R.string.alert_delete_chat_yes, new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface d, int which) {
                                                execute(messenger().deleteChat(dialog.getPeer()), R.string.progress_common,
                                                        new CommandCallback<Boolean>() {
                                                            @Override
                                                            public void onResult(Boolean res) {

                                                            }

                                                            @Override
                                                            public void onError(Exception e) {
                                                                Toast.makeText(getActivity(), R.string.toast_unable_delete_chat, Toast.LENGTH_LONG).show();                                                                }
                                                        });
                                            }
                                        })
                                        .show();
                            }
                        }
                    })
                    .show();

            return true;
        } else if (dialog.getPeer().getPeerType() == PeerType.GROUP) {
            GroupVM groupVM = groups().get(dialog.getPeer().getPeerId());
{'fraction_non_alphanumeric': 0.0856317689530686, 'fraction_numerical': 0.0011552346570397113, 'mean_word_length': 1.2508937276568086, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2376701', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1417, 'n_words': 249}