use of com.github.moko256.twitlatte.view.DialogContent in project twicalico by moko256.
the class OAuthActivity method onStartMastodonAuthClick.
public void onStartMastodonAuthClick(View view) {
initType(CLIENT_TYPE_MASTODON);
isUrlEnterDialogShown = true;
compositeDisposable.add(EditTextsDialogShowerKt.createEditTextsDialog(this, getString(R.string.instance_domain), true, (dialog) -> isUrlEnterDialogShown = false, new DialogContent("e.g. mastodon.social", lastUrl, EditorInfo.TYPE_TEXT_VARIATION_URI, url -> {
lastUrl = url;
return Unit.INSTANCE;
})).subscribe(() -> {
isUrlEnterDialogShown = false;
startAuthAndOpenDialogIfNeeded(lastUrl);
}));
}
use of com.github.moko256.twitlatte.view.DialogContent in project twicalico by moko256.
the class OAuthActivity method startAuthAndOpenDialogIfNeeded.
private void startAuthAndOpenDialogIfNeeded(@NonNull String url) {
String callbackUrl;
if (requirePin) {
showPinDialog();
callbackUrl = null;
} else {
callbackUrl = getString(R.string.app_name) + "://OAuthActivity";
}
if (useAnotherConsumerToken && authClientType == CLIENT_TYPE_TWITTER) {
compositeDisposable.add(EditTextsDialogShowerKt.createEditTextsDialog(this, "Consumer key/secret", true, null, new DialogContent("consumer key", enteringConsumerKey, EditorInfo.TYPE_CLASS_TEXT, ck -> {
enteringConsumerKey = ck;
return Unit.INSTANCE;
}), new DialogContent("consumer secret", enteringConsumerSecret, EditorInfo.TYPE_CLASS_TEXT, cs -> {
enteringConsumerSecret = cs;
return Unit.INSTANCE;
})).subscribe(() -> startAuth(url, callbackUrl, enteringConsumerKey, enteringConsumerSecret)));
} else {
startAuth(url, callbackUrl, null, null);
}
}
Aggregations