android: Do not use deprecated TwoLineListItem
authorTobias Brunner <tobias@strongswan.org>
Mon, 14 Jul 2014 12:24:31 +0000 (14:24 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 22 Jul 2014 08:41:51 +0000 (10:41 +0200)
src/frontends/android/res/layout/remediation_instruction_item.xml
src/frontends/android/res/layout/two_line_button.xml
src/frontends/android/src/org/strongswan/android/ui/VpnProfileDetailActivity.java

index 30dfb22..c25e6c1 100644 (file)
@@ -13,7 +13,7 @@
     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     for more details.
 -->
-<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:paddingBottom="8dip"
@@ -44,4 +44,4 @@
         android:ellipsize="end"
         android:textIsSelectable="false" />
 
-</TwoLineListItem>
+</RelativeLayout>
index c8c2581..89d0952 100644 (file)
@@ -13,7 +13,7 @@
     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     for more details.
 -->
-<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
@@ -36,4 +36,4 @@
         android:textAppearance="?android:attr/textAppearanceSmall"
         android:textColor="?android:attr/textColorSecondary" />
 
-</TwoLineListItem>
+</RelativeLayout>
index 74158cd..39d3700 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Tobias Brunner
+ * Copyright (C) 2012-2014 Tobias Brunner
  * Copyright (C) 2012 Giuliano Grassi
  * Copyright (C) 2012 Ralf Sager
  * Hochschule fuer Technik Rapperswil
@@ -52,8 +52,9 @@ import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.CompoundButton.OnCheckedChangeListener;
 import android.widget.EditText;
+import android.widget.RelativeLayout;
 import android.widget.Spinner;
-import android.widget.TwoLineListItem;
+import android.widget.TextView;
 
 public class VpnProfileDetailActivity extends Activity
 {
@@ -73,10 +74,10 @@ public class VpnProfileDetailActivity extends Activity
        private EditText mUsername;
        private EditText mPassword;
        private ViewGroup mUserCertificate;
-       private TwoLineListItem mSelectUserCert;
+       private RelativeLayout mSelectUserCert;
        private CheckBox mCheckAuto;
-       private TwoLineListItem mSelectCert;
-       private TwoLineListItem mTncNotice;
+       private RelativeLayout mSelectCert;
+       private RelativeLayout mTncNotice;
 
        @Override
        public void onCreate(Bundle savedInstanceState)
@@ -94,17 +95,17 @@ public class VpnProfileDetailActivity extends Activity
                mName = (EditText)findViewById(R.id.name);
                mGateway = (EditText)findViewById(R.id.gateway);
                mSelectVpnType = (Spinner)findViewById(R.id.vpn_type);
-               mTncNotice = (TwoLineListItem)findViewById(R.id.tnc_notice);
+               mTncNotice = (RelativeLayout)findViewById(R.id.tnc_notice);
 
                mUsernamePassword = (ViewGroup)findViewById(R.id.username_password_group);
                mUsername = (EditText)findViewById(R.id.username);
                mPassword = (EditText)findViewById(R.id.password);
 
                mUserCertificate = (ViewGroup)findViewById(R.id.user_certificate_group);
-               mSelectUserCert = (TwoLineListItem)findViewById(R.id.select_user_certificate);
+               mSelectUserCert = (RelativeLayout)findViewById(R.id.select_user_certificate);
 
                mCheckAuto = (CheckBox)findViewById(R.id.ca_auto);
-               mSelectCert = (TwoLineListItem)findViewById(R.id.select_certificate);
+               mSelectCert = (RelativeLayout)findViewById(R.id.select_certificate);
 
                mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() {
                        @Override
@@ -122,8 +123,8 @@ public class VpnProfileDetailActivity extends Activity
                        }
                });
 
-               mTncNotice.getText1().setText(R.string.tnc_notice_title);
-               mTncNotice.getText2().setText(R.string.tnc_notice_subtitle);
+               ((TextView)mTncNotice.findViewById(android.R.id.text1)).setText(R.string.tnc_notice_title);
+               ((TextView)mTncNotice.findViewById(android.R.id.text2)).setText(R.string.tnc_notice_subtitle);
                mTncNotice.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v)
@@ -247,19 +248,19 @@ public class VpnProfileDetailActivity extends Activity
                {
                        if (mUserCertLoading != null)
                        {
-                               mSelectUserCert.getText1().setText(mUserCertLoading);
-                               mSelectUserCert.getText2().setText(R.string.loading);
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setText(mUserCertLoading);
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text2)).setText(R.string.loading);
                        }
                        else if (mUserCertEntry != null)
                        {       /* clear any errors and set the new data */
-                               mSelectUserCert.getText1().setError(null);
-                               mSelectUserCert.getText1().setText(mUserCertEntry.getAlias());
-                               mSelectUserCert.getText2().setText(mUserCertEntry.getCertificate().getSubjectDN().toString());
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setError(null);
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setText(mUserCertEntry.getAlias());
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text2)).setText(mUserCertEntry.getCertificate().getSubjectDN().toString());
                        }
                        else
                        {
-                               mSelectUserCert.getText1().setText(R.string.profile_user_select_certificate_label);
-                               mSelectUserCert.getText2().setText(R.string.profile_user_select_certificate);
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setText(R.string.profile_user_select_certificate_label);
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text2)).setText(R.string.profile_user_select_certificate);
                        }
                }
        }
@@ -296,13 +297,13 @@ public class VpnProfileDetailActivity extends Activity
 
                        if (mCertEntry != null)
                        {
-                               mSelectCert.getText1().setText(mCertEntry.getSubjectPrimary());
-                               mSelectCert.getText2().setText(mCertEntry.getSubjectSecondary());
+                               ((TextView)mSelectCert.findViewById(android.R.id.text1)).setText(mCertEntry.getSubjectPrimary());
+                               ((TextView)mSelectCert.findViewById(android.R.id.text2)).setText(mCertEntry.getSubjectSecondary());
                        }
                        else
                        {
-                               mSelectCert.getText1().setText(R.string.profile_ca_select_certificate_label);
-                               mSelectCert.getText2().setText(R.string.profile_ca_select_certificate);
+                               ((TextView)mSelectCert.findViewById(android.R.id.text1)).setText(R.string.profile_ca_select_certificate_label);
+                               ((TextView)mSelectCert.findViewById(android.R.id.text2)).setText(R.string.profile_ca_select_certificate);
                        }
                }
                else
@@ -358,7 +359,7 @@ public class VpnProfileDetailActivity extends Activity
                }
                if (mVpnType.getRequiresCertificate() && mUserCertEntry == null)
                {       /* let's show an error icon */
-                       mSelectUserCert.getText1().setError("");
+                       ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setError("");
                        valid = false;
                }
                if (!mCheckAuto.isChecked() && mCertEntry == null)
@@ -546,7 +547,7 @@ public class VpnProfileDetailActivity extends Activity
                        }
                        else
                        {       /* previously selected certificate is not here anymore */
-                               mSelectUserCert.getText1().setError("");
+                               ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setError("");
                                mUserCertEntry = null;
                        }
                        mUserCertLoading = null;