android: Do not use deprecated TwoLineListItem

This commit is contained in:
Tobias Brunner
2014-07-22 10:41:51 +02:00
parent 7073bfe4e9
commit d4bf6bfb15
3 changed files with 28 additions and 27 deletions
@@ -13,7 +13,7 @@
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details. 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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="8dip" android:paddingBottom="8dip"
@@ -44,4 +44,4 @@
android:ellipsize="end" android:ellipsize="end"
android:textIsSelectable="false" /> android:textIsSelectable="false" />
</TwoLineListItem> </RelativeLayout>
@@ -13,7 +13,7 @@
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details. 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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
@@ -36,4 +36,4 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary" />
</TwoLineListItem> </RelativeLayout>
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Tobias Brunner * Copyright (C) 2012-2014 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi * Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager * Copyright (C) 2012 Ralf Sager
* Hochschule fuer Technik Rapperswil * Hochschule fuer Technik Rapperswil
@@ -52,8 +52,9 @@ import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TwoLineListItem; import android.widget.TextView;
public class VpnProfileDetailActivity extends Activity public class VpnProfileDetailActivity extends Activity
{ {
@@ -73,10 +74,10 @@ public class VpnProfileDetailActivity extends Activity
private EditText mUsername; private EditText mUsername;
private EditText mPassword; private EditText mPassword;
private ViewGroup mUserCertificate; private ViewGroup mUserCertificate;
private TwoLineListItem mSelectUserCert; private RelativeLayout mSelectUserCert;
private CheckBox mCheckAuto; private CheckBox mCheckAuto;
private TwoLineListItem mSelectCert; private RelativeLayout mSelectCert;
private TwoLineListItem mTncNotice; private RelativeLayout mTncNotice;
@Override @Override
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
@@ -94,17 +95,17 @@ public class VpnProfileDetailActivity extends Activity
mName = (EditText)findViewById(R.id.name); mName = (EditText)findViewById(R.id.name);
mGateway = (EditText)findViewById(R.id.gateway); mGateway = (EditText)findViewById(R.id.gateway);
mSelectVpnType = (Spinner)findViewById(R.id.vpn_type); 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); mUsernamePassword = (ViewGroup)findViewById(R.id.username_password_group);
mUsername = (EditText)findViewById(R.id.username); mUsername = (EditText)findViewById(R.id.username);
mPassword = (EditText)findViewById(R.id.password); mPassword = (EditText)findViewById(R.id.password);
mUserCertificate = (ViewGroup)findViewById(R.id.user_certificate_group); 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); 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() { mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override @Override
@@ -122,8 +123,8 @@ public class VpnProfileDetailActivity extends Activity
} }
}); });
mTncNotice.getText1().setText(R.string.tnc_notice_title); ((TextView)mTncNotice.findViewById(android.R.id.text1)).setText(R.string.tnc_notice_title);
mTncNotice.getText2().setText(R.string.tnc_notice_subtitle); ((TextView)mTncNotice.findViewById(android.R.id.text2)).setText(R.string.tnc_notice_subtitle);
mTncNotice.setOnClickListener(new OnClickListener() { mTncNotice.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) public void onClick(View v)
@@ -247,19 +248,19 @@ public class VpnProfileDetailActivity extends Activity
{ {
if (mUserCertLoading != null) if (mUserCertLoading != null)
{ {
mSelectUserCert.getText1().setText(mUserCertLoading); ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setText(mUserCertLoading);
mSelectUserCert.getText2().setText(R.string.loading); ((TextView)mSelectUserCert.findViewById(android.R.id.text2)).setText(R.string.loading);
} }
else if (mUserCertEntry != null) else if (mUserCertEntry != null)
{ /* clear any errors and set the new data */ { /* clear any errors and set the new data */
mSelectUserCert.getText1().setError(null); ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setError(null);
mSelectUserCert.getText1().setText(mUserCertEntry.getAlias()); ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setText(mUserCertEntry.getAlias());
mSelectUserCert.getText2().setText(mUserCertEntry.getCertificate().getSubjectDN().toString()); ((TextView)mSelectUserCert.findViewById(android.R.id.text2)).setText(mUserCertEntry.getCertificate().getSubjectDN().toString());
} }
else else
{ {
mSelectUserCert.getText1().setText(R.string.profile_user_select_certificate_label); ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setText(R.string.profile_user_select_certificate_label);
mSelectUserCert.getText2().setText(R.string.profile_user_select_certificate); ((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) if (mCertEntry != null)
{ {
mSelectCert.getText1().setText(mCertEntry.getSubjectPrimary()); ((TextView)mSelectCert.findViewById(android.R.id.text1)).setText(mCertEntry.getSubjectPrimary());
mSelectCert.getText2().setText(mCertEntry.getSubjectSecondary()); ((TextView)mSelectCert.findViewById(android.R.id.text2)).setText(mCertEntry.getSubjectSecondary());
} }
else else
{ {
mSelectCert.getText1().setText(R.string.profile_ca_select_certificate_label); ((TextView)mSelectCert.findViewById(android.R.id.text1)).setText(R.string.profile_ca_select_certificate_label);
mSelectCert.getText2().setText(R.string.profile_ca_select_certificate); ((TextView)mSelectCert.findViewById(android.R.id.text2)).setText(R.string.profile_ca_select_certificate);
} }
} }
else else
@@ -358,7 +359,7 @@ public class VpnProfileDetailActivity extends Activity
} }
if (mVpnType.getRequiresCertificate() && mUserCertEntry == null) if (mVpnType.getRequiresCertificate() && mUserCertEntry == null)
{ /* let's show an error icon */ { /* let's show an error icon */
mSelectUserCert.getText1().setError(""); ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setError("");
valid = false; valid = false;
} }
if (!mCheckAuto.isChecked() && mCertEntry == null) if (!mCheckAuto.isChecked() && mCertEntry == null)
@@ -546,7 +547,7 @@ public class VpnProfileDetailActivity extends Activity
} }
else else
{ /* previously selected certificate is not here anymore */ { /* previously selected certificate is not here anymore */
mSelectUserCert.getText1().setError(""); ((TextView)mSelectUserCert.findViewById(android.R.id.text1)).setError("");
mUserCertEntry = null; mUserCertEntry = null;
} }
mUserCertLoading = null; mUserCertLoading = null;