diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-11-17 15:53:32 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-11-26 11:48:15 +0800 |
commit | 9b7bfbc8ac25f1df20b7ed0aa79bf1f36299e981 (patch) | |
tree | 740aa1b58c30aaedb5cc42dccfe976d8cfb0f0b2 /src/com/android/camera/ui/AbstractSettingPopup.java | |
parent | 59ddc8c1add2fcffe523e3877baad1b6cc5ba2fb (diff) | |
download | LegacyCamera-9b7bfbc8ac25f1df20b7ed0aa79bf1f36299e981.zip LegacyCamera-9b7bfbc8ac25f1df20b7ed0aa79bf1f36299e981.tar.gz LegacyCamera-9b7bfbc8ac25f1df20b7ed0aa79bf1f36299e981.tar.bz2 |
Add title and its holo background for settings.
bug:3226752
Change-Id: I10d2430fb2db9283fa080284f9ad6c043d056865
Diffstat (limited to 'src/com/android/camera/ui/AbstractSettingPopup.java')
-rw-r--r-- | src/com/android/camera/ui/AbstractSettingPopup.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/com/android/camera/ui/AbstractSettingPopup.java b/src/com/android/camera/ui/AbstractSettingPopup.java new file mode 100644 index 0000000..314dcab --- /dev/null +++ b/src/com/android/camera/ui/AbstractSettingPopup.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 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.camera.ui; + +import android.content.Context; +import android.content.res.Resources.Theme; +import android.content.res.TypedArray; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.android.camera.R; + +// A popup window that shows one or more camera settings. +abstract public class AbstractSettingPopup extends LinearLayout { + protected ViewGroup mContentPanel; + protected TextView mTitle; + + public AbstractSettingPopup(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + mTitle = (TextView) findViewById(R.id.title); + View topPanel = findViewById(R.id.topPanel); + mContentPanel = (ViewGroup) findViewById(R.id.contentPanel); + + // Use system holo background for now. + // TODO: We need to add alpha to the background. + Context context = getContext(); + Theme dialogTheme = context.getResources().newTheme(); + dialogTheme.applyStyle(android.R.style.Theme_Holo, true); + TypedArray ta = dialogTheme.obtainStyledAttributes(new int[] { + android.R.attr.alertDialogStyle }); + int resourceId = ta.getResourceId(0, 0); + TypedArray ta2 = context.obtainStyledAttributes(resourceId, new int[] { + android.R.attr.topDark, + android.R.attr.bottomDark}); + + topPanel.setBackgroundDrawable(ta2.getDrawable(0)); + mContentPanel.setBackgroundDrawable(ta2.getDrawable(1)); + + ta.recycle(); + ta2.recycle(); + } +} |