diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 4e8ef578826..59b562d9341 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1579,6 +1579,17 @@ android:resource="@id/security_settings" /> + + + + + + + + + android:layout_width="match_parent" + android:layout_height="match_parent"> Choose photo from Gallery + + diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml index 03f1e7857b2..07abe41a6ac 100644 --- a/res/xml/device_info_settings.xml +++ b/res/xml/device_info_settings.xml @@ -89,8 +89,11 @@ --> - + + + 2 + && d.getIntrinsicHeight() > 2); + } catch (Resources.NotFoundException ignored) { + regulatoryInfoDrawableExists = false; + } + + CharSequence regulatoryText = resources.getText(R.string.regulatory_info_text); + + if (regulatoryInfoDrawableExists) { + builder.setView(getLayoutInflater().inflate(R.layout.regulatory_info, null)); + builder.show(); + } else if (regulatoryText.length() > 0) { + builder.setMessage(regulatoryText); + AlertDialog dialog = builder.show(); + // we have to show the dialog first, or the setGravity() call will throw a NPE + TextView messageText = (TextView) dialog.findViewById(android.R.id.message); + messageText.setGravity(Gravity.CENTER); + } else { + // neither drawable nor text resource exists, finish activity + finish(); + } + } + + @Override + public void onDismiss(DialogInterface dialog) { + finish(); // close the activity + } +} diff --git a/src/com/android/settings/RegulatoryInfoPreference.java b/src/com/android/settings/RegulatoryInfoPreference.java deleted file mode 100644 index f1a6b77e1b9..00000000000 --- a/src/com/android/settings/RegulatoryInfoPreference.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings; - -import android.content.Context; -import android.preference.DialogPreference; -import android.util.AttributeSet; - -/** - * {@link DialogPreference} that displays regulatory information. "About phone" - * will show a "Regulatory information" preference if - * R.bool.config_show_regulatory_info is true. - */ -public class RegulatoryInfoPreference extends DialogPreference { - - public RegulatoryInfoPreference(Context context, AttributeSet attrs) { - super(context, attrs, com.android.internal.R.attr.preferenceStyle); - setDialogLayoutResource(R.layout.regulatory_info); - } -}