]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Replace deprecated ProgressDialog during profile import
authorTobias Brunner <tobias@strongswan.org>
Thu, 7 Jun 2018 12:42:40 +0000 (14:42 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 3 Jul 2018 09:31:33 +0000 (11:31 +0200)
src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileImportActivity.java
src/frontends/android/app/src/main/res/layout/profile_import_view.xml

index 43c0035cf920c03832d539bb753bbde92c552f02..d3b7bb471271d124b4ebf441fae1d7c1eb7e1913 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Tobias Brunner
+ * Copyright (C) 2016-2018 Tobias Brunner
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -17,11 +17,9 @@ package org.strongswan.android.ui;
 
 import android.app.Activity;
 import android.app.LoaderManager;
-import android.app.ProgressDialog;
 import android.content.AsyncTaskLoader;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.Loader;
 import android.net.Uri;
@@ -96,7 +94,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
        private TrustedCertificateEntry mUserCertEntry;
        private String mUserCertLoading;
        private boolean mHideImport;
-       private ProgressDialog mProgress;
+       private android.support.v4.widget.ContentLoadingProgressBar mProgressBar;
        private TextView mExistsWarning;
        private ViewGroup mBasicDataGroup;
        private TextView mName;
@@ -167,6 +165,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
 
                setContentView(R.layout.profile_import_view);
 
+               mProgressBar = findViewById(R.id.progress_bar);
                mExistsWarning = (TextView)findViewById(R.id.exists_warning);
                mBasicDataGroup = (ViewGroup)findViewById(R.id.basic_data_group);
                mName = (TextView)findViewById(R.id.name);
@@ -300,14 +299,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
 
        private void loadProfile(Uri uri)
        {
-               mProgress = ProgressDialog.show(this, null, getString(R.string.loading),
-                               true, true, new DialogInterface.OnCancelListener() {
-                                       @Override
-                                       public void onCancel(DialogInterface dialog)
-                                       {
-                                               finish();
-                                       }
-                               });
+               mProgressBar.show();
 
                Bundle args = new Bundle();
                args.putParcelable(PROFILE_URI, uri);
@@ -316,7 +308,7 @@ public class VpnProfileImportActivity extends AppCompatActivity
 
        public void handleProfile(ProfileLoadResult data)
        {
-               mProgress.dismiss();
+               mProgressBar.hide();
 
                mProfile = null;
                if (data != null && data.ThrownException == null)
index fc06aa5d4ad30ffc179136042839aab1e59289dc..cabfd2944deb7f79392b3762fa9b0d9a41a222f9 100644 (file)
         android:padding="10dp"
         android:animateLayoutChanges="true" >
 
+        <android.support.v4.widget.ContentLoadingProgressBar
+            style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+            android:id="@+id/progress_bar"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:indeterminate="true" />
+
         <TextView
             android:id="@+id/exists_warning"
             android:background="@drawable/state_background"