Search in sources :

Example 1 with KeyboardHelper

use of im.actor.sdk.util.KeyboardHelper in project actor-platform by actorapp.

the class SignEmailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_sign_email, container, false);
    TextView buttonCotinueText = (TextView) v.findViewById(R.id.button_continue_text);
    StateListDrawable states = SelectorFactory.get(ActorSDK.sharedActor().style.getMainColor(), getActivity());
    buttonCotinueText.setBackgroundDrawable(states);
    buttonCotinueText.setTypeface(Fonts.medium());
    buttonCotinueText.setTextColor(ActorSDK.sharedActor().style.getTextPrimaryInvColor());
    keyboardHelper = new KeyboardHelper(getActivity());
    initView(v);
    //        Get domain logo
    //        logoActor = ActorSystem.system().actorOf(Props.create(LogoActor.class, new ActorCreator<LogoActor>() {
    //            @Override
    //            public LogoActor create() {
    //                return new LogoActor();
    //            }
    //        }), "actor/logo_actor");
    //
    //        logoActor.send(new LogoActor.AddCallback(new LogoActor.LogoCallBack() {
    //            @Override
    //            public void onDownloaded(final Drawable logoDrawable) {
    //                getActivity().runOnUiThread(new Runnable() {
    //                    @Override
    //                    public void run() {
    //                        if (logoDrawable != null) {
    //                            logo.setImageDrawable(logoDrawable);
    //                            logo.measure(0, 0);
    //                            expand(logo, logo.getMeasuredHeight());
    //                        } else {
    //                            expand(logo, 0);
    //                        }
    //                    }
    //                });
    //            }
    //        }));
    v.findViewById(R.id.divider).setBackgroundColor(style.getDividerColor());
    setTosAndPrivacy((TextView) v.findViewById(R.id.disclaimer));
    return v;
}
Also used : TextView(android.widget.TextView) StateListDrawable(android.graphics.drawable.StateListDrawable) KeyboardHelper(im.actor.sdk.util.KeyboardHelper) TextView(android.widget.TextView) View(android.view.View)

Example 2 with KeyboardHelper

use of im.actor.sdk.util.KeyboardHelper in project actor-platform by actorapp.

the class InputBarFragment method onCreate.

@Override
public void onCreate(Bundle saveInstance) {
    super.onCreate(saveInstance);
    keyboardUtils = new KeyboardHelper(getActivity());
    if (saveInstance != null) {
        isAudioEnabled = saveInstance.getBoolean("isAudioEnabled");
        isDisableOnEmptyText = saveInstance.getBoolean("isDisableOnEmptyText");
        isAudioVisible = saveInstance.getBoolean("isAudioVisible");
    }
}
Also used : KeyboardHelper(im.actor.sdk.util.KeyboardHelper)

Example 3 with KeyboardHelper

use of im.actor.sdk.util.KeyboardHelper in project actor-platform by actorapp.

the class AddContactActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayShowHomeEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setDisplayShowCustomEnabled(false);
    getSupportActionBar().setTitle(R.string.add_contact_title);
    helper = new KeyboardHelper(this);
    setContentView(R.layout.activity_add);
    findViewById(R.id.container).setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
    searchQuery = (EditText) findViewById(R.id.searchField);
    searchQuery.setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
    searchQuery.setHintTextColor(ActorSDK.sharedActor().style.getTextHintColor());
    findViewById(R.id.dividerTop).setBackgroundColor(ActorSDK.sharedActor().style.getDividerColor());
    findViewById(R.id.dividerBot).setBackgroundColor(ActorSDK.sharedActor().style.getDividerColor());
    ((TextView) findViewById(R.id.cancel)).setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
    findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            finish();
        }
    });
    ((TextView) findViewById(R.id.ok)).setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
    findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            final String query = searchQuery.getText().toString();
            if (query.length() == 0) {
                return;
            }
            execute(messenger().findUsers(query), R.string.progress_common, new CommandCallback<UserVM[]>() {

                @Override
                public void onResult(final UserVM[] res) {
                    if (res.length == 0) {
                        new AlertDialog.Builder(AddContactActivity.this).setMessage(getString(R.string.alert_invite_text).replace("{0}", query).replace("{appName}", ActorSDK.sharedActor().getAppName())).setPositiveButton(R.string.alert_invite_yes, new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                String inviteMessage = getString(R.string.invite_message).replace("{inviteUrl}", ActorSDK.sharedActor().getInviteUrl()).replace("{appName}", ActorSDK.sharedActor().getAppName());
                                Intent sendIntent = new Intent(Intent.ACTION_VIEW);
                                sendIntent.setData(Uri.parse("sms:" + query));
                                sendIntent.putExtra("sms_body", inviteMessage);
                                startActivity(sendIntent);
                                finish();
                            }
                        }).setNegativeButton(R.string.dialog_cancel, null).show().setCanceledOnTouchOutside(true);
                    } else {
                        execute(messenger().addContact(res[0].getId()), R.string.progress_common, new CommandCallback<Boolean>() {

                            @Override
                            public void onResult(Boolean res2) {
                                startActivity(Intents.openPrivateDialog(res[0].getId(), true, AddContactActivity.this));
                                finish();
                            }

                            @Override
                            public void onError(Exception e) {
                                startActivity(Intents.openPrivateDialog(res[0].getId(), true, AddContactActivity.this));
                                finish();
                            }
                        });
                    }
                }

                @Override
                public void onError(Exception e) {
                // Never happens
                }
            });
        }
    });
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) UserVM(im.actor.core.viewmodel.UserVM) TextView(android.widget.TextView) KeyboardHelper(im.actor.sdk.util.KeyboardHelper) CommandCallback(im.actor.core.viewmodel.CommandCallback)

Example 4 with KeyboardHelper

use of im.actor.sdk.util.KeyboardHelper in project actor-platform by actorapp.

the class EditNameFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    type = getArguments().getInt("EXTRA_TYPE");
    id = getArguments().getInt("EXTRA_ID");
    helper = new KeyboardHelper(getActivity());
    View res = inflater.inflate(R.layout.fragment_edit_name, container, false);
    res.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
    nameEdit = (EditText) res.findViewById(R.id.nameEdit);
    nameEdit.setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
    hintTv = (TextView) res.findViewById(R.id.hint);
    hintTv.setTextColor(ActorSDK.sharedActor().style.getTextHintColor());
    if (type == EditNameActivity.TYPE_ME) {
        UserVM userModel = users().get(myUid());
        nameEdit.setText(userModel.getName().get());
    } else if (type == EditNameActivity.TYPE_NICK) {
        UserVM userModel = users().get(myUid());
        nameEdit.setText(userModel.getNick().get());
        nameEdit.setHint(getString(R.string.nickname_edittext_hint));
        hintTv.setText(getString(R.string.nickname_hint).replace("{appName}", ActorSDK.sharedActor().getAppName()));
    } else if (type == EditNameActivity.TYPE_USER) {
        UserVM userModel = users().get(id);
        nameEdit.setText(userModel.getName().get());
    } else if (type == EditNameActivity.TYPE_GROUP) {
        GroupVM group = groups().get(id);
        nameEdit.setText(group.getName().get());
    } else if (type == EditNameActivity.TYPE_GROUP_THEME) {
        GroupVM group = groups().get(id);
        nameEdit.setText(group.getTheme().get());
    }
    res.findViewById(R.id.dividerTop).setBackgroundColor(ActorSDK.sharedActor().style.getDividerColor());
    res.findViewById(R.id.dividerBot).setBackgroundColor(ActorSDK.sharedActor().style.getDividerColor());
    res.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().finish();
        }
    });
    ((TextView) res.findViewById(R.id.cancel)).setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
    res.findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String name = nameEdit.getText().toString().trim();
            if (name.length() == 0) {
                Toast.makeText(getActivity(), R.string.toast_empty_name, Toast.LENGTH_SHORT).show();
                return;
            }
            if (type == EditNameActivity.TYPE_ME) {
                execute(messenger().editMyName(name), R.string.edit_name_process, new CommandCallback<Boolean>() {

                    @Override
                    public void onResult(Boolean res) {
                        getActivity().finish();
                    }

                    @Override
                    public void onError(Exception e) {
                        Toast.makeText(getActivity(), R.string.toast_unable_change, Toast.LENGTH_SHORT).show();
                    }
                });
            } else if (type == EditNameActivity.TYPE_NICK) {
                execute(messenger().editMyNick(name), R.string.edit_nick_process, new CommandCallback<Boolean>() {

                    @Override
                    public void onResult(Boolean res) {
                        getActivity().finish();
                    }

                    @Override
                    public void onError(Exception e) {
                        Toast.makeText(getActivity(), R.string.toast_unable_change_nick, Toast.LENGTH_SHORT).show();
                    }
                });
            } else if (type == EditNameActivity.TYPE_USER) {
                execute(messenger().editName(id, name), R.string.edit_name_process, new CommandCallback<Boolean>() {

                    @Override
                    public void onResult(Boolean res) {
                        getActivity().finish();
                    }

                    @Override
                    public void onError(Exception e) {
                        Toast.makeText(getActivity(), R.string.toast_unable_change, Toast.LENGTH_SHORT).show();
                    }
                });
            } else if (type == EditNameActivity.TYPE_GROUP_THEME) {
                execute(messenger().editGroupTheme(id, name), R.string.edit_theme_process, new CommandCallback<Void>() {

                    @Override
                    public void onResult(Void res) {
                        getActivity().finish();
                    }

                    @Override
                    public void onError(Exception e) {
                        Toast.makeText(getActivity(), R.string.toast_unable_change, Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    });
    ((TextView) res.findViewById(R.id.ok)).setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
    return res;
}
Also used : GroupVM(im.actor.core.viewmodel.GroupVM) TextView(android.widget.TextView) View(android.view.View) UserVM(im.actor.core.viewmodel.UserVM) TextView(android.widget.TextView) KeyboardHelper(im.actor.sdk.util.KeyboardHelper) CommandCallback(im.actor.core.viewmodel.CommandCallback) Void(im.actor.runtime.actors.messages.Void)

Example 5 with KeyboardHelper

use of im.actor.sdk.util.KeyboardHelper in project actor-platform by actorapp.

the class SignUpFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_sign_up, container, false);
    v.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
    keyboardHelper = new KeyboardHelper(getActivity());
    TextView buttonConfirm = (TextView) v.findViewById(R.id.button_confirm_sms_code_text);
    buttonConfirm.setTypeface(Fonts.medium());
    StateListDrawable states = SelectorFactory.get(ActorSDK.sharedActor().style.getMainColor(), getActivity());
    buttonConfirm.setBackgroundDrawable(states);
    buttonConfirm.setTextColor(ActorSDK.sharedActor().style.getTextPrimaryInvColor());
    firstNameEditText = (EditText) v.findViewById(R.id.et_first_name_enter);
    firstNameEditText.setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
    firstNameEditText.setHintTextColor(ActorSDK.sharedActor().style.getTextHintColor());
    final View sendConfirmCodeButton = v.findViewById(R.id.button_confirm_sms_code);
    firstNameEditText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    ((TextView) v.findViewById(R.id.sign_up_hint)).setTextColor(ActorSDK.sharedActor().style.getTextSecondaryColor());
    sendConfirmCodeButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!firstNameEditText.getText().toString().isEmpty()) {
                startAuth(firstNameEditText.getText().toString().trim());
            }
        }
    });
    v.findViewById(R.id.divider).setBackgroundColor(style.getDividerColor());
    return v;
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) TextView(android.widget.TextView) KeyboardHelper(im.actor.sdk.util.KeyboardHelper) StateListDrawable(android.graphics.drawable.StateListDrawable) TextView(android.widget.TextView) View(android.view.View)

Aggregations

KeyboardHelper (im.actor.sdk.util.KeyboardHelper)11 View (android.view.View)10 TextView (android.widget.TextView)9 StateListDrawable (android.graphics.drawable.StateListDrawable)5 Editable (android.text.Editable)3 TextWatcher (android.text.TextWatcher)3 CommandCallback (im.actor.core.viewmodel.CommandCallback)3 UserVM (im.actor.core.viewmodel.UserVM)3 DialogInterface (android.content.DialogInterface)2 GroupVM (im.actor.core.viewmodel.GroupVM)2 AlertDialog (android.app.AlertDialog)1 Intent (android.content.Intent)1 SpannableString (android.text.SpannableString)1 KeyEvent (android.view.KeyEvent)1 Button (android.widget.Button)1 NumberParseException (com.google.i18n.phonenumbers.NumberParseException)1 Phonenumber (com.google.i18n.phonenumbers.Phonenumber)1 Void (im.actor.runtime.actors.messages.Void)1 Country (im.actor.sdk.util.country.Country)1 AvatarView (im.actor.sdk.view.avatar.AvatarView)1