Fix issue #127
This commit is contained in:
parent
efd6b0088f
commit
88b5a83fb1
|
@ -157,18 +157,23 @@ public class ShowChannelActivity extends AppCompatActivity {
|
||||||
account_follow.setOnClickListener(v -> {
|
account_follow.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ShowChannelActivity.this);
|
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ShowChannelActivity.this);
|
||||||
builderSingle.setTitle(getString(R.string.list_of_accounts));
|
builderSingle.setTitle(getString(R.string.list_of_accounts));
|
||||||
if (accounts != null) {
|
if (accounts != null && accounts.size() > 0) {
|
||||||
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(ShowChannelActivity.this, accounts);
|
if (accounts.size() > 1) {
|
||||||
builderSingle.setAdapter(accountsListAdapter, (dialog, which) -> {
|
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(ShowChannelActivity.this, accounts);
|
||||||
new Thread(() -> {
|
builderSingle.setAdapter(accountsListAdapter, (dialog, which) -> {
|
||||||
try {
|
new Thread(() -> {
|
||||||
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(which).getHost(), accounts.get(which).getToken());
|
try {
|
||||||
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(which).getHost(), accounts.get(which).getToken());
|
||||||
} catch (Exception e) {
|
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
||||||
e.printStackTrace();
|
} catch (Exception e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
}).start();
|
}
|
||||||
});
|
}).start();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
RetrofitPeertubeAPI peertubeAPI = new RetrofitPeertubeAPI(ShowChannelActivity.this, accounts.get(0).getHost(), accounts.get(0).getToken());
|
||||||
|
peertubeAPI.post(FOLLOW, channel.getAcct(), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
|
|
Loading…
Reference in New Issue