use of im.actor.sdk.util.KeyboardHelper in project actor-platform by actorapp.
the class EditAboutFragment 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_about, container, false);
res.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
aboutEdit = (EditText) res.findViewById(R.id.nameEdit);
aboutEdit.setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
hintTv = (TextView) res.findViewById(R.id.hint);
hintTv.setTextColor(ActorSDK.sharedActor().style.getTextHintColor());
if (type == EditAboutActivity.TYPE_ME) {
UserVM userModel = users().get(myUid());
aboutEdit.setText(userModel.getAbout().get());
aboutEdit.setHint(getString(R.string.edit_about_edittext_hint));
} else if (type == EditAboutActivity.TYPE_GROUP) {
GroupVM group = groups().get(id);
aboutEdit.setText(group.getAbout().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 about = aboutEdit.getText().toString().trim();
if (about.length() == 0) {
about = null;
}
if (type == EditAboutActivity.TYPE_ME) {
execute(messenger().editMyAbout(about), R.string.progress_common, 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();
}
});
//TODO: set group about
}
}
});
((TextView) res.findViewById(R.id.ok)).setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor());
return res;
}
Aggregations