mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-22 12:56:02 +03:00
Fix build
Signed-off-by: Stefan Niedermann <info@niedermann.it>
This commit is contained in:
parent
ef993ca0d8
commit
491ccd57da
3 changed files with 12 additions and 12 deletions
|
@ -1,15 +1,11 @@
|
|||
package it.niedermann.owncloud.notes.manageaccounts;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.net.Uri;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.util.Consumer;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -17,17 +13,19 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import it.niedermann.nextcloud.sso.glide.SingleSignOnUrl;
|
||||
import it.niedermann.owncloud.notes.R;
|
||||
import it.niedermann.owncloud.notes.databinding.ItemAccountChooseBinding;
|
||||
import it.niedermann.owncloud.notes.persistence.entity.Account;
|
||||
import it.niedermann.owncloud.notes.shared.model.ApiVersion;
|
||||
import it.niedermann.owncloud.notes.shared.util.ApiVersionUtil;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static it.niedermann.owncloud.notes.branding.BrandingUtil.applyBrandToLayerDrawable;
|
||||
import static it.niedermann.owncloud.notes.shared.util.ApiVersionUtil.getPreferredApiVersion;
|
||||
|
||||
public class ManageAccountViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
|
@ -58,7 +56,8 @@ public class ManageAccountViewHolder extends RecyclerView.ViewHolder {
|
|||
binding.accountContextMenu.setOnClickListener((v) -> {
|
||||
final PopupMenu popup = new PopupMenu(itemView.getContext(), v);
|
||||
popup.inflate(R.menu.menu_account);
|
||||
if (!localAccount.getPreferredApiVersion().supportsSettings()) {
|
||||
final ApiVersion preferredApiVersion = getPreferredApiVersion(localAccount.getApiVersion());
|
||||
if (preferredApiVersion != null && !preferredApiVersion.supportsSettings()) {
|
||||
final Menu menu = popup.getMenu();
|
||||
Stream.of(
|
||||
R.id.notes_path,
|
||||
|
|
|
@ -36,6 +36,7 @@ import retrofit2.Response;
|
|||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.os.Build.VERSION_CODES.LOLLIPOP_MR1;
|
||||
import static it.niedermann.owncloud.notes.shared.util.ApiVersionUtil.getPreferredApiVersion;
|
||||
|
||||
public class ManageAccountsActivity extends LockedActivity {
|
||||
|
||||
|
@ -123,7 +124,7 @@ public class ManageAccountsActivity extends LockedActivity {
|
|||
.setNeutralButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.action_edit_save, (v, d) -> new Thread(() -> {
|
||||
try {
|
||||
final Call<NotesSettings> putSettingsCall = repository.putServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), new NotesSettings(editText.getText().toString(), null), localAccount.getPreferredApiVersion());
|
||||
final Call<NotesSettings> putSettingsCall = repository.putServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), new NotesSettings(editText.getText().toString(), null), getPreferredApiVersion(localAccount.getApiVersion()));
|
||||
putSettingsCall.enqueue(new Callback<NotesSettings>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<NotesSettings> call, @NonNull Response<NotesSettings> response) {
|
||||
|
@ -146,7 +147,7 @@ public class ManageAccountsActivity extends LockedActivity {
|
|||
}).start())
|
||||
.show();
|
||||
try {
|
||||
repository.getServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), localAccount.getPreferredApiVersion())
|
||||
repository.getServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), getPreferredApiVersion(localAccount.getApiVersion()))
|
||||
.enqueue(new Callback<NotesSettings>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<NotesSettings> call, @NonNull Response<NotesSettings> response) {
|
||||
|
@ -190,7 +191,7 @@ public class ManageAccountsActivity extends LockedActivity {
|
|||
.setNeutralButton(android.R.string.cancel, null)
|
||||
.setPositiveButton("Save", (v, d) -> new Thread(() -> {
|
||||
try {
|
||||
final Call<NotesSettings> putSettingsCall = repository.putServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), new NotesSettings(null, spinner.getSelectedItem().toString()), localAccount.getPreferredApiVersion());
|
||||
final Call<NotesSettings> putSettingsCall = repository.putServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), new NotesSettings(null, spinner.getSelectedItem().toString()), getPreferredApiVersion(localAccount.getApiVersion()));
|
||||
putSettingsCall.enqueue(new Callback<NotesSettings>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<NotesSettings> call, @NonNull Response<NotesSettings> response) {
|
||||
|
@ -213,7 +214,7 @@ public class ManageAccountsActivity extends LockedActivity {
|
|||
}).start())
|
||||
.show();
|
||||
try {
|
||||
repository.getServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), localAccount.getPreferredApiVersion())
|
||||
repository.getServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), getPreferredApiVersion(localAccount.getApiVersion()))
|
||||
.enqueue(new Callback<NotesSettings>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<NotesSettings> call, @NonNull Response<NotesSettings> response) {
|
||||
|
|
|
@ -911,11 +911,11 @@ public class NotesRepository {
|
|||
}
|
||||
|
||||
public Call<NotesSettings> getServerSettings(@NonNull SingleSignOnAccount ssoAccount, @Nullable ApiVersion preferredApiVersion) {
|
||||
return ApiProvider.getNotesAPI(context, ssoAccount, preferredApiVersion).getSettings();
|
||||
return ApiProvider.getInstance().getNotesAPI(context, ssoAccount, preferredApiVersion).getSettings();
|
||||
}
|
||||
|
||||
public Call<NotesSettings> putServerSettings(@NonNull SingleSignOnAccount ssoAccount, @NonNull NotesSettings settings, @Nullable ApiVersion preferredApiVersion) {
|
||||
return ApiProvider.getNotesAPI(context, ssoAccount, preferredApiVersion).putSettings(settings);
|
||||
return ApiProvider.getInstance().getNotesAPI(context, ssoAccount, preferredApiVersion).putSettings(settings);
|
||||
}
|
||||
|
||||
public void updateDisplayName(long id, @Nullable String displayName) {
|
||||
|
|
Loading…
Reference in a new issue