use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class TabletStatusBar method addPanelWindows.
protected void addPanelWindows() {
final Context context = mContext;
final Resources res = mContext.getResources();
// Notification Panel
mNotificationPanel = (NotificationPanel) View.inflate(context, R.layout.system_bar_notification_panel, null);
mNotificationPanel.setBar(this);
mNotificationPanel.show(false, false);
mNotificationPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL, mNotificationPanel));
mHaloButton = (ImageView) mNotificationPanel.findViewById(R.id.halo_button);
if (mHaloButton != null) {
mHaloButton.setOnClickListener(mHaloButtonListener);
mHaloButtonVisible = true;
updateHaloButton();
}
// Add QuickSettings
mNotificationPanel.setupQuickSettings(this, mNetworkController, mBluetoothController, mBatteryController, mLocationController);
mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel);
WindowManager.LayoutParams lp = mNotificationPanelParams = new WindowManager.LayoutParams(res.getDimensionPixelSize(R.dimen.notification_panel_width), getNotificationPanelHeight(), WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.END;
lp.setTitle("NotificationPanel");
lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
// == no animation
lp.windowAnimations = com.android.internal.R.style.Animation;
// lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade
mWindowManager.addView(mNotificationPanel, lp);
// Search Panel
mStatusBarView.setBar(this);
mHomeButton.setOnTouchListener(mHomeSearchActionListener);
updateSearchPanel();
// Input methods Panel
mInputMethodsPanel = (InputMethodsPanel) View.inflate(context, R.layout.system_bar_input_methods_panel, null);
mInputMethodsPanel.setHardKeyboardEnabledChangeListener(this);
mInputMethodsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_INPUT_METHODS_PANEL, mInputMethodsPanel));
mInputMethodsPanel.setImeSwitchButton(mInputMethodSwitchButton);
mStatusBarView.setIgnoreChildren(2, mInputMethodSwitchButton, mInputMethodsPanel);
lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.END;
lp.setTitle("InputMethodsPanel");
lp.windowAnimations = R.style.Animation_RecentPanel;
mWindowManager.addView(mInputMethodsPanel, lp);
// Compatibility mode selector panel
mCompatModePanel = (CompatModePanel) View.inflate(context, R.layout.system_bar_compat_mode_panel, null);
mCompatModePanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_COMPAT_MODE_PANEL, mCompatModePanel));
mCompatModePanel.setTrigger(mCompatModeButton);
mCompatModePanel.setVisibility(View.GONE);
mStatusBarView.setIgnoreChildren(3, mCompatModeButton, mCompatModePanel);
lp = new WindowManager.LayoutParams(250, ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.END;
lp.setTitle("CompatModePanel");
lp.windowAnimations = android.R.style.Animation_Dialog;
mWindowManager.addView(mCompatModePanel, lp);
mRecentButton.setOnTouchListener(mRecentsPreloadOnTouchListener);
mPile = (NotificationRowLayout) mNotificationPanel.findViewById(R.id.content);
mPile.removeAllViews();
mPile.setLongPressListener(getNotificationLongClicker());
ScrollView scroller = (ScrollView) mPile.getParent();
scroller.setFillViewport(true);
SettingsObserver settingsObserver = new SettingsObserver(new Handler());
settingsObserver.observe();
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class TabletStatusBar method addStatusBarWindow.
private void addStatusBarWindow() {
final View sb = makeStatusBarView();
final Resources res = mContext.getResources();
mShowSearchHoldoff = res.getInteger(R.integer.config_show_search_delay);
mBackIcon = res.getDrawable(R.drawable.ic_sysbar_back);
mBackAltIcon = res.getDrawable(R.drawable.ic_sysbar_back_ime);
mRecentsIcon = res.getDrawable(R.drawable.ic_sysbar_recent);
mRecentsAltIcon = res.getDrawable(R.drawable.ic_sysbar_recent_clear);
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_NAVIGATION_BAR, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, PixelFormat.TRANSLUCENT);
if (ActivityManager.isHighEndGfx()) {
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
}
lp.gravity = getStatusBarGravity();
lp.setTitle("SystemBar");
lp.packageName = mContext.getPackageName();
mStatusBarContainer.addView(sb);
mWindowManager.addView(mStatusBarContainer, lp);
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class KeyButtonView method setInfo.
public void setInfo(String itemKey, boolean isVertical) {
ButtonInfo item = NavbarEditor.buttonMap.get(itemKey);
setTag(itemKey);
final Resources res = getResources();
setContentDescription(res.getString(item.contentDescription));
mCode = item.keyCode;
boolean isSmallButton = ArrayUtils.contains(NavbarEditor.smallButtonIds, getId());
Drawable keyD;
if (isSmallButton) {
keyD = res.getDrawable(item.sideResource);
} else if (!isVertical) {
keyD = res.getDrawable(item.portResource);
} else {
keyD = res.getDrawable(item.landResource);
}
//Reason for setImageDrawable vs setImageResource is because setImageResource calls relayout() w/o
//any checks. setImageDrawable performs size checks and only calls relayout if necessary. We rely on this
//because otherwise the setX/setY attributes which are post layout cause it to mess up the layout.
setImageDrawable(keyD);
if (itemKey.equals(NavbarEditor.NAVBAR_EMPTY)) {
if (isSmallButton) {
setVisibility(NavigationBarView.getEditMode() ? View.VISIBLE : View.INVISIBLE);
} else {
setVisibility(NavigationBarView.getEditMode() ? View.VISIBLE : View.GONE);
}
} else if (itemKey.equals(NavbarEditor.NAVBAR_CONDITIONAL_MENU)) {
setVisibility(NavigationBarView.getEditMode() ? View.VISIBLE : View.INVISIBLE);
} else if (itemKey.equals(NavbarEditor.NAVBAR_HOME)) {
mSupportsLongpress = false;
}
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class QuickSettingsContainerView method updateResources.
void updateResources() {
Resources r = getContext().getResources();
mCellGap = r.getDimension(R.dimen.quick_settings_cell_gap);
mNumColumns = r.getInteger(R.integer.quick_settings_num_columns);
requestLayout();
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class QuickSettingsModel method refreshSettingsTile.
void refreshSettingsTile() {
Resources r = mContext.getResources();
mSettingsState.label = r.getString(R.string.quick_settings_settings_label);
mSettingsCallback.refreshView(mSettingsTile, mSettingsState);
}
Aggregations