use of com.auth0.sharelock.widget.ShareEditText in project sharelock-android by auth0.
the class LinkFragment method onViewCreated.
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final EventBus bus = this.bus;
TextView secretText = (TextView) view.findViewById(R.id.link_secret_text);
secretText.setText(secret.getSecret());
ShareEditText shareEditText = (ShareEditText) view.findViewById(R.id.link_share_list);
shareEditText.setFocusable(false);
shareEditText.allowDuplicates(false);
for (String viewer : secret.getAllowedViewers()) {
shareEditText.addObject(viewer);
}
linkText = (TextView) view.findViewById(R.id.link_text);
progressBar = (ProgressBar) view.findViewById(R.id.link_progress);
retryButton = (Button) view.findViewById(R.id.link_retry_button);
shareButton = (ImageButton) view.findViewById(R.id.link_share_button);
newButton = (ImageButton) view.findViewById(R.id.link_new_button);
buttons = (ViewGroup) view.findViewById(R.id.link_buttons);
retryButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bus.post(new RequestLinkEvent(secret));
}
});
shareButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, link.toString());
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_link_chooser_title)));
}
});
newButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog dialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.new_link_prompt_title).setMessage(R.string.new_link_prompt_message).setCancelable(true).setPositiveButton(R.string.ok_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
bus.post(new RequestNewSecretEvent());
}
}).setNegativeButton(R.string.cancel_button, null).create();
dialog.show();
}
});
ImageView craftedBy = (ImageView) view.findViewById(R.id.crafted_by);
craftedBy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(getString(R.string.crafted_by_url)));
startActivity(intent);
}
});
}
use of com.auth0.sharelock.widget.ShareEditText in project sharelock-android by auth0.
the class ShareFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
nextButton = (Button) view.findViewById(R.id.next_button);
shareField = (ShareEditText) view.findViewById(R.id.share_input);
shareField.setSplitChar(new char[] { ' ', ',' });
shareField.setTokenListener(new TokenCompleteTextView.TokenListener() {
@Override
public void onTokenAdded(Object o) {
nextButton.setVisibility(View.VISIBLE);
}
@Override
public void onTokenRemoved(Object o) {
nextButton.setVisibility(shareField.getObjects().size() > 0 ? View.VISIBLE : View.INVISIBLE);
}
});
nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bus.post(new AllowedViewersModifiedEvent(shareField.getObjects()));
}
});
ImageView craftedBy = (ImageView) view.findViewById(R.id.crafted_by);
craftedBy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(getString(R.string.crafted_by_url)));
startActivity(intent);
}
});
}
Aggregations