Fix bug #15730311 Checkboxes on R side should update to Quantum/Material on/off switch
Per UX request, convert Trusted Credentials CheckBoxes to Switches Change-Id: If878e8c10454a212ba9052280e3cbb17c0fdeeca
This commit is contained in:
@@ -45,8 +45,8 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<!-- checkbox is invisible and not gone so that the height is consistent between tabs -->
|
<!-- Switch is invisible and not gone so that the height is consistent between tabs -->
|
||||||
<CheckBox
|
<Switch
|
||||||
android:id="@+id/trusted_credential_status"
|
android:id="@+id/trusted_credential_status"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@@ -43,12 +43,12 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.BaseExpandableListAdapter;
|
import android.widget.BaseExpandableListAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
import android.widget.Switch;
|
||||||
import android.widget.TabHost;
|
import android.widget.TabHost;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -90,17 +90,17 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
private final int mProgress;
|
private final int mProgress;
|
||||||
private final int mList;
|
private final int mList;
|
||||||
private final int mExpandableList;
|
private final int mExpandableList;
|
||||||
private final boolean mCheckbox;
|
private final boolean mSwitch;
|
||||||
|
|
||||||
private Tab(String tag, int label, int view, int progress, int list, int expandableList,
|
private Tab(String tag, int label, int view, int progress, int list, int expandableList,
|
||||||
boolean checkbox) {
|
boolean withSwitch) {
|
||||||
mTag = tag;
|
mTag = tag;
|
||||||
mLabel = label;
|
mLabel = label;
|
||||||
mView = view;
|
mView = view;
|
||||||
mProgress = progress;
|
mProgress = progress;
|
||||||
mList = list;
|
mList = list;
|
||||||
mExpandableList = expandableList;
|
mExpandableList = expandableList;
|
||||||
mCheckbox = checkbox;
|
mSwitch = withSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ParcelableString> getAliases(IKeyChainService service) throws RemoteException {
|
private List<ParcelableString> getAliases(IKeyChainService service) throws RemoteException {
|
||||||
@@ -148,7 +148,7 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
}
|
}
|
||||||
private void postOperationUpdate(boolean ok, CertHolder certHolder) {
|
private void postOperationUpdate(boolean ok, CertHolder certHolder) {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
if (certHolder.mTab.mCheckbox) {
|
if (certHolder.mTab.mSwitch) {
|
||||||
certHolder.mDeleted = !certHolder.mDeleted;
|
certHolder.mDeleted = !certHolder.mDeleted;
|
||||||
} else {
|
} else {
|
||||||
certHolder.mAdapter.remove(certHolder);
|
certHolder.mAdapter.remove(certHolder);
|
||||||
@@ -586,7 +586,7 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
convertView.findViewById(R.id.trusted_credential_subject_primary);
|
convertView.findViewById(R.id.trusted_credential_subject_primary);
|
||||||
holder.mSubjectSecondaryView = (TextView)
|
holder.mSubjectSecondaryView = (TextView)
|
||||||
convertView.findViewById(R.id.trusted_credential_subject_secondary);
|
convertView.findViewById(R.id.trusted_credential_subject_secondary);
|
||||||
holder.mCheckBox = (CheckBox) convertView.findViewById(
|
holder.mSwitch = (Switch) convertView.findViewById(
|
||||||
R.id.trusted_credential_status);
|
R.id.trusted_credential_status);
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
} else {
|
} else {
|
||||||
@@ -594,9 +594,9 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
}
|
}
|
||||||
holder.mSubjectPrimaryView.setText(certHolder.mSubjectPrimary);
|
holder.mSubjectPrimaryView.setText(certHolder.mSubjectPrimary);
|
||||||
holder.mSubjectSecondaryView.setText(certHolder.mSubjectSecondary);
|
holder.mSubjectSecondaryView.setText(certHolder.mSubjectSecondary);
|
||||||
if (mTab.mCheckbox) {
|
if (mTab.mSwitch) {
|
||||||
holder.mCheckBox.setChecked(!certHolder.mDeleted);
|
holder.mSwitch.setChecked(!certHolder.mDeleted);
|
||||||
holder.mCheckBox.setVisibility(View.VISIBLE);
|
holder.mSwitch.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
@@ -604,7 +604,7 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
private static class ViewHolder {
|
private static class ViewHolder {
|
||||||
private TextView mSubjectPrimaryView;
|
private TextView mSubjectPrimaryView;
|
||||||
private TextView mSubjectSecondaryView;
|
private TextView mSubjectSecondaryView;
|
||||||
private CheckBox mCheckBox;
|
private Switch mSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showCertDialog(final CertHolder certHolder) {
|
private void showCertDialog(final CertHolder certHolder) {
|
||||||
|
Reference in New Issue
Block a user