Search in sources :

Example 31 with Resources

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();
}
Also used : Context(android.content.Context) ScrollView(android.widget.ScrollView) Handler(android.os.Handler) Resources(android.content.res.Resources) WindowManager(android.view.WindowManager)

Example 32 with Resources

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);
}
Also used : MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) LayoutParams(android.view.ViewGroup.LayoutParams) Resources(android.content.res.Resources) ImageView(android.widget.ImageView) QuickSettingsContainerView(com.android.systemui.statusbar.phone.QuickSettingsContainerView) View(android.view.View) TextView(android.widget.TextView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) ScrollView(android.widget.ScrollView) WindowManager(android.view.WindowManager)

Example 33 with Resources

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;
    }
}
Also used : Drawable(android.graphics.drawable.Drawable) ButtonInfo(com.android.systemui.statusbar.phone.NavbarEditor.ButtonInfo) Resources(android.content.res.Resources)

Example 34 with Resources

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();
}
Also used : Resources(android.content.res.Resources)

Example 35 with Resources

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);
}
Also used : Resources(android.content.res.Resources)

Aggregations

Resources (android.content.res.Resources)3195 Context (android.content.Context)292 Intent (android.content.Intent)280 View (android.view.View)236 TextView (android.widget.TextView)214 IOException (java.io.IOException)209 PackageManager (android.content.pm.PackageManager)206 Drawable (android.graphics.drawable.Drawable)197 Paint (android.graphics.Paint)178 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)176 Bitmap (android.graphics.Bitmap)174 DisplayMetrics (android.util.DisplayMetrics)165 Configuration (android.content.res.Configuration)151 Point (android.graphics.Point)151 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)137 ArrayList (java.util.ArrayList)134 XmlResourceParser (android.content.res.XmlResourceParser)132 TypedArray (android.content.res.TypedArray)129 Test (org.junit.Test)126 PendingIntent (android.app.PendingIntent)122