Reduce dodgy code

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-12-14 14:00:26 +01:00 committed by Alper Öztürk (Rebase PR Action)
parent ec3be74a37
commit 10c564dc86
2 changed files with 19 additions and 9 deletions

View file

@ -60,6 +60,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.view.KeyEvent;
@ -144,6 +145,7 @@ import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.ActionBar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
@ -287,11 +289,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
// Workaround, for fixing a problem with Android Library Support v7 19
//getWindow().requestFeature(Window.FEATURE_NO_TITLE);
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(false);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
}
mIsFirstAuthAttempt = true;
@ -766,9 +769,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private void checkOcServer() {
String uri;
if (accountSetupBinding != null && accountSetupBinding.hostUrlInput.getText() != null &&
!accountSetupBinding.hostUrlInput.getText().toString().isEmpty()) {
uri = accountSetupBinding.hostUrlInput.getText().toString().trim();
Editable hostUrlInput = accountSetupBinding.hostUrlInput.getText();
if (accountSetupBinding != null && hostUrlInput != null &&
!hostUrlInput.toString().isEmpty()) {
uri = hostUrlInput.toString().trim();
} else {
uri = mServerInfo.mBaseUrl;
}

View file

@ -1208,7 +1208,12 @@ public class FileDataStorageManager {
ContentValues contentValues = new ContentValues();
contentValues.put(ProviderTableMeta.OCSHARES_FILE_SOURCE, share.getFileSource());
contentValues.put(ProviderTableMeta.OCSHARES_ITEM_SOURCE, share.getItemSource());
contentValues.put(ProviderTableMeta.OCSHARES_SHARE_TYPE, share.getShareType().getValue());
ShareType shareType = share.getShareType();
if (shareType != null) {
contentValues.put(ProviderTableMeta.OCSHARES_SHARE_TYPE, shareType.getValue());
}
contentValues.put(ProviderTableMeta.OCSHARES_SHARE_WITH, share.getShareWith());
contentValues.put(ProviderTableMeta.OCSHARES_PATH, share.getPath());
contentValues.put(ProviderTableMeta.OCSHARES_PERMISSIONS, share.getPermissions());