android: Switch to Loaders from the support library
They are officially deprecated as of API 28 (recommended replacement is a combination of ViewModels and LiveData, maybe something to look into later).
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ public class SelectedApplicationsListFragment extends ListFragment implements Lo
|
|||||||
}
|
}
|
||||||
mSelection = new TreeSet<>(selection);
|
mSelection = new TreeSet<>(selection);
|
||||||
|
|
||||||
getLoaderManager().initLoader(0, null, this);
|
LoaderManager.getInstance(this).initLoader(0, null, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-1
@@ -18,6 +18,7 @@ package org.strongswan.android.ui;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.ListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||||
import android.support.v4.content.AsyncTaskLoader;
|
import android.support.v4.content.AsyncTaskLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
@@ -79,7 +80,7 @@ public class TrustedCertificateListFragment extends ListFragment implements Load
|
|||||||
mSource = (TrustedCertificateSource)arguments.getSerializable(EXTRA_CERTIFICATE_SOURCE);
|
mSource = (TrustedCertificateSource)arguments.getSerializable(EXTRA_CERTIFICATE_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLoaderManager().initLoader(0, null, this);
|
LoaderManager.getInstance(this).initLoader(0, null, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+7
-7
@@ -16,19 +16,19 @@
|
|||||||
package org.strongswan.android.ui;
|
package org.strongswan.android.ui;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.LoaderManager;
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.AsyncTaskLoader;
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.Loader;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.security.KeyChain;
|
import android.security.KeyChain;
|
||||||
import android.security.KeyChainAliasCallback;
|
import android.security.KeyChainAliasCallback;
|
||||||
import android.security.KeyChainException;
|
import android.security.KeyChainException;
|
||||||
|
import android.support.v4.app.LoaderManager;
|
||||||
|
import android.support.v4.content.AsyncTaskLoader;
|
||||||
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -229,7 +229,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
|
|||||||
mUserCertLoading = savedInstanceState.getString(VpnProfileDataSource.KEY_USER_CERTIFICATE);
|
mUserCertLoading = savedInstanceState.getString(VpnProfileDataSource.KEY_USER_CERTIFICATE);
|
||||||
if (mUserCertLoading != null)
|
if (mUserCertLoading != null)
|
||||||
{
|
{
|
||||||
getLoaderManager().initLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
|
LoaderManager.getInstance(this).initLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
|
||||||
}
|
}
|
||||||
mImportUserCert.setEnabled(!savedInstanceState.getBoolean(PKCS12_INSTALLED));
|
mImportUserCert.setEnabled(!savedInstanceState.getBoolean(PKCS12_INSTALLED));
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
|
|||||||
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable(PROFILE_URI, uri);
|
args.putParcelable(PROFILE_URI, uri);
|
||||||
getLoaderManager().initLoader(PROFILE_LOADER, args, mProfileLoaderCallbacks);
|
LoaderManager.getInstance(this).initLoader(PROFILE_LOADER, args, mProfileLoaderCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleProfile(ProfileLoadResult data)
|
public void handleProfile(ProfileLoadResult data)
|
||||||
@@ -400,7 +400,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
|
|||||||
if (mUserCertLoading == null)
|
if (mUserCertLoading == null)
|
||||||
{
|
{
|
||||||
mUserCertLoading = getString(R.string.profile_cert_alias, mProfile.getName());
|
mUserCertLoading = getString(R.string.profile_cert_alias, mProfile.getName());
|
||||||
getLoaderManager().initLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
|
LoaderManager.getInstance(this).initLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
|
||||||
}
|
}
|
||||||
updateUserCertView();
|
updateUserCertView();
|
||||||
}
|
}
|
||||||
@@ -902,7 +902,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
|
|||||||
updateUserCertView();
|
updateUserCertView();
|
||||||
if (alias != null)
|
if (alias != null)
|
||||||
{ /* otherwise the dialog was canceled, the request denied */
|
{ /* otherwise the dialog was canceled, the request denied */
|
||||||
getLoaderManager().restartLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
|
LoaderManager.getInstance(VpnProfileImportActivity.this).restartLoader(USER_CERT_LOADER, null, mUserCertificateLoaderCallbacks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user