Some fixes

This commit is contained in:
Thomas 2020-10-02 07:03:36 +02:00
parent e08d9805f1
commit 4d53612adc
2 changed files with 9 additions and 4 deletions

View File

@ -91,12 +91,14 @@ public class MainActivity extends AppCompatActivity {
new Thread(() -> {
try {
Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams);
if (token == null) {
Helper.logoutCurrentUser(MainActivity.this, account);
if( token == null) {
runOnUiThread(() -> {
Helper.logoutCurrentUser(MainActivity.this, account);
});
return;
}
UserMe userMe = new RetrofitPeertubeAPI(MainActivity.this, instance, token.getAccess_token()).verifyCredentials();
if (userMe != null && userMe.getAccount() != null) {
if( userMe != null && userMe.getAccount() != null) {
new AccountDAO(MainActivity.this.getApplicationContext(), db).updateAccount(userMe.getAccount());
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.PREF_KEY_ID, account.getId());

View File

@ -898,7 +898,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(PeertubeActivity.this, android.R.layout.select_dialog_item);
for (File file : peertube.getFiles()) {
if (file.getResolutions() != null) {
arrayAdapter.add(file.getResolutions().getLabel() + "p");
if( file.getResolutions().getLabel().compareTo("0p") != 0) {
arrayAdapter.add(file.getResolutions().getLabel());
}
}
}
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
@ -996,6 +998,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
private void initResolution() {
//TODO: add in settings a way to pick up the lower/medium/Highest resolution and init it there
PlayerControlView controlView = playerView.findViewById(R.id.exo_controller);
resolution = controlView.findViewById(R.id.resolution);
resolution.setText(String.format("%s", peertube.getFiles().get(0).getResolutions().getLabel()));