Example usage for android.graphics Color argb

List of usage examples for android.graphics Color argb

Introduction

In this page you can find the example usage for android.graphics Color argb.

Prototype

@ColorInt
public static int argb(float alpha, float red, float green, float blue) 

Source Link

Document

Return a color-int from alpha, red, green, blue float components in the range \([0..1]\).

Usage

From source file:com.kanchi.periyava.Fragments.Radio.java

public void setPlaylist(String strPlaylist) {
    if (rootView != null && this.strPlaylist.equalsIgnoreCase(strPlaylist) == false) {
        tvPlayList.setText(strPlaylist + "              " + strPlaylist + "              " + strPlaylist);
        this.strPlaylist = strPlaylist;
        tvPlayList.setSelected(true);/*from w  ww. ja  v a 2 s.  c o  m*/
        tvPlayList.setEllipsize(TextUtils.TruncateAt.MARQUEE);
        tvPlayList.setSingleLine(true);
    }
    Random rnd = new Random();
    int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
    tvPlayList.setTextColor(color);
}

From source file:com.mickledeals.views.SlidingTabLayout.java

/**
 * Sets the associated view pager. Note that the assumption here is that the pager content
 * (number of tabs and tab titles) does not change after this call has been made.
 *///from  w w w  .  j  a v  a 2s.  c  o  m
public void setViewPager(ViewPager viewPager) {
    mTabStrip.removeAllViews();

    mViewPager = viewPager;
    if (viewPager != null) {
        viewPager.setOnPageChangeListener(new InternalViewPagerListener());
        viewPager.setPageTransformer(true, new PageTransformer() {
            @Override
            public void transformPage(View page, float position) {
                View firstView = mTabStrip.getChildAt(0);
                View secondView = mTabStrip.getChildAt(1);
                if (firstView != null && firstView instanceof TextView && position > 0) {
                    position = MIN_TEXT_ALPHA + (1 - MIN_TEXT_ALPHA) * position;
                    ((TextView) firstView).setTextColor(Color.argb((int) (position * 255), 255, 255, 255));
                }
                if (secondView != null && secondView instanceof TextView && position < 0) {
                    position *= -1;
                    position = MIN_TEXT_ALPHA + (1 - MIN_TEXT_ALPHA) * position;
                    ((TextView) secondView).setTextColor(Color.argb((int) (position * 255), 255, 255, 255));
                }
            }
        });
        populateTabStrip();
    }
}

From source file:io.karim.materialtabs.sample.TabsActivity.java

private void applyParametersFromIntentExtras() {
    Intent intent = getIntent();//ww  w. j a va2s .c o m
    if (intent != null) {
        Bundle extras = intent.getExtras();
        if (extras != null) {
            Resources resources = getResources();

            int showToolbar = extras.getBoolean(TabsSettingsFragment.SHOW_TOOLBAR) ? View.VISIBLE : View.GONE;
            int indicatorColor = resources.getColor(extras.getInt(TabsSettingsFragment.INDICATOR_COLOR));
            int underlineColor = resources.getColor(extras.getInt(TabsSettingsFragment.UNDERLINE_COLOR));
            int indicatorHeightDp = extras.getInt(TabsSettingsFragment.INDICATOR_HEIGHT);
            int underlineHeightDp = extras.getInt(TabsSettingsFragment.UNDERLINE_HEIGHT);
            int tabPaddingDp = extras.getInt(TabsSettingsFragment.TAB_PADDING);

            mToolbar.setVisibility(showToolbar);

            mMaterialTabs.setIndicatorColor(indicatorColor);
            mMaterialTabs.setUnderlineColor(underlineColor);
            mMaterialTabs.setIndicatorHeight(Utils.dpToPx(resources, indicatorHeightDp));
            mMaterialTabs.setUnderlineHeight(Utils.dpToPx(resources, underlineHeightDp));
            mMaterialTabs.setTabPaddingLeftRight(Utils.dpToPx(resources, tabPaddingDp));

            boolean paddingMiddle = extras.getBoolean(TabsSettingsFragment.PADDING_MIDDLE);
            boolean sameWeightTabs = extras.getBoolean(TabsSettingsFragment.SAME_WEIGHT_TABS);
            boolean textAllCaps = extras.getBoolean(TabsSettingsFragment.TEXT_ALL_CAPS);

            mMaterialTabs.setPaddingMiddle(paddingMiddle);
            mMaterialTabs.setSameWeightTabs(sameWeightTabs);
            mMaterialTabs.setAllCaps(textAllCaps);

            int toolbarColor = resources.getColor(extras.getInt(TabsSettingsFragment.TOOLBAR_BACKGROUND));
            int tabBackgroundColor = resources.getColor(extras.getInt(TabsSettingsFragment.TAB_BACKGROUND));
            mToolbar.setBackgroundColor(toolbarColor);
            mMaterialTabs.setBackgroundColor(tabBackgroundColor);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                Window window = getWindow();
                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                window.setStatusBarColor(Color.argb(Color.alpha(toolbarColor), Color.red(toolbarColor) / 2,
                        Color.green(toolbarColor) / 2, Color.blue(toolbarColor) / 2));
            }

            int textColorSelected = resources.getColor(extras.getInt(TabsSettingsFragment.TEXT_COLOR_SELECTED));
            int textColorUnselected = resources
                    .getColor(extras.getInt(TabsSettingsFragment.TEXT_COLOR_UNSELECTED));
            int tabStyleSelected = extras.getInt(TabsSettingsFragment.TEXT_STYLE_SELECTED);
            int tabStyleUnselected = extras.getInt(TabsSettingsFragment.TEXT_STYLE_UNSELECTED);

            mMaterialTabs.setTextColorSelected(textColorSelected);
            mMaterialTabs.setTextColorUnselected(textColorUnselected);

            mMaterialTabs.setTabTypefaceSelectedStyle(tabStyleSelected);
            mMaterialTabs.setTabTypefaceUnselectedStyle(tabStyleUnselected);

            int rippleDuration = extras.getInt(RippleSettingsFragment.RIPPLE_DURATION);
            float rippleAlphaFloat = extras.getFloat(RippleSettingsFragment.RIPPLE_ALPHA_FLOAT);
            int rippleColor = resources.getColor(extras.getInt(RippleSettingsFragment.RIPPLE_COLOR));
            boolean rippleDelayClick = extras.getBoolean(RippleSettingsFragment.RIPPLE_DELAY_CLICK);
            float rippleDiameterDp = extras.getFloat(RippleSettingsFragment.RIPPLE_DIAMETER);
            int rippleFadeDuration = extras.getInt(RippleSettingsFragment.RIPPLE_FADE_DURATION);
            int rippleHighlightColor = resources
                    .getColor(extras.getInt(RippleSettingsFragment.RIPPLE_HIGHLIGHT_COLOR));
            boolean rippleOverlay = extras.getBoolean(RippleSettingsFragment.RIPPLE_OVERLAY);
            boolean ripplePersistent = extras.getBoolean(RippleSettingsFragment.RIPPLE_PERSISTENT);
            int rippleRoundedCornusRadiusDp = extras
                    .getInt(RippleSettingsFragment.RIPPLE_ROUNDED_CORNERS_RADIUS);

            mMaterialTabs.setRippleDuration(rippleDuration);
            mMaterialTabs.setRippleAlphaFloat(rippleAlphaFloat);
            mMaterialTabs.setRippleColor(rippleColor);
            mMaterialTabs.setRippleDelayClick(rippleDelayClick);
            mMaterialTabs.setRippleDiameterDp(rippleDiameterDp);
            mMaterialTabs.setRippleFadeDuration(rippleFadeDuration);
            mMaterialTabs.setRippleHighlightColor(rippleHighlightColor);
            mMaterialTabs.setRippleInAdapter(false);
            mMaterialTabs.setRippleOverlay(rippleOverlay);
            mMaterialTabs.setRipplePersistent(ripplePersistent);
            mMaterialTabs.setRippleRoundedCornersDp(rippleRoundedCornusRadiusDp);

            mExportableString = createExportableText(showToolbar, indicatorColor, underlineColor,
                    indicatorHeightDp, underlineHeightDp, tabPaddingDp, paddingMiddle, sameWeightTabs,
                    textAllCaps, toolbarColor, tabBackgroundColor, textColorSelected, textColorUnselected,
                    tabStyleSelected, tabStyleUnselected, rippleDuration, rippleAlphaFloat, rippleColor,
                    rippleDelayClick, rippleDiameterDp, rippleFadeDuration, rippleHighlightColor, rippleOverlay,
                    ripplePersistent, rippleRoundedCornusRadiusDp);
        }
    }
}

From source file:kr.wdream.storyshop.AndroidUtilities.java

public static int[] calcDrawableColor(Drawable drawable) {
    int bitmapColor = 0xff000000;
    int result[] = new int[2];
    try {/*  ww  w.j a va 2s.c o m*/
        if (drawable instanceof BitmapDrawable) {
            Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
            if (bitmap != null) {
                Bitmap b = Bitmaps.createScaledBitmap(bitmap, 1, 1, true);
                if (b != null) {
                    bitmapColor = b.getPixel(0, 0);
                    b.recycle();
                }
            }
        } else if (drawable instanceof ColorDrawable) {
            bitmapColor = ((ColorDrawable) drawable).getColor();
        }
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }

    double[] hsv = rgbToHsv((bitmapColor >> 16) & 0xff, (bitmapColor >> 8) & 0xff, bitmapColor & 0xff);
    hsv[1] = Math.min(1.0, hsv[1] + 0.05 + 0.1 * (1.0 - hsv[1]));
    hsv[2] = Math.max(0, hsv[2] * 0.65);
    int rgb[] = hsvToRgb(hsv[0], hsv[1], hsv[2]);
    result[0] = Color.argb(0x66, rgb[0], rgb[1], rgb[2]);
    result[1] = Color.argb(0x88, rgb[0], rgb[1], rgb[2]);
    return result;
}

From source file:com.discord.chipsview.ChipsView.java

private void init() {
    mDensity = getResources().getDisplayMetrics().density;

    mChipsContainer = new RelativeLayout(getContext());
    addView(mChipsContainer);// w w w .  j  ava 2  s .c  o  m

    // Dummy item to prevent AutoCompleteTextView from receiving focus
    LinearLayout linearLayout = new LinearLayout(getContext());
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(0, 0);
    linearLayout.setLayoutParams(params);
    linearLayout.setFocusable(true);
    linearLayout.setFocusableInTouchMode(true);

    mChipsContainer.addView(linearLayout);

    mEditText = new ChipsEditText(getContext(), this);

    final int chipHeightWithPadding = (int) ((CHIP_HEIGHT * mDensity) + mVerticalSpacing);

    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, chipHeightWithPadding);
    layoutParams.leftMargin = (int) (5 * mDensity);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    mEditText.setLayoutParams(layoutParams);
    mEditText.setPadding(0, 0, 0, mVerticalSpacing);
    mEditText.setBackgroundColor(Color.argb(0, 0, 0, 0));
    mEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    mEditText.setInputType(InputType.TYPE_CLASS_TEXT);
    mEditText.setTextColor(mChipsSearchTextColor);
    mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mChipsSearchTextSize);

    mChipsContainer.addView(mEditText);

    mRootChipsLayout = new ChipsVerticalLinearLayout(getContext(), chipHeightWithPadding);
    mRootChipsLayout.setOrientation(LinearLayout.VERTICAL);
    mRootChipsLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    mRootChipsLayout.setPadding(0, (int) (SPACING_TOP * mDensity), 0, 0);
    mChipsContainer.addView(mRootChipsLayout);

    initListener();
    onChipsChanged(false);
}

From source file:jayen.library.rbgcolorpicker.ColorPickerSupportDialogFrag.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater layoutInflater = getActivity().getLayoutInflater();
    View view = layoutInflater.inflate(R.layout.color_picker, null);
    builder.setView(view);/* ww  w.j  ava2 s  . c o  m*/
    builder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            //user confirmed
            alphaValue = alphaPickerBar.getColorValue();
            redValue = redPickerBar.getColorValue();
            greenValue = greenPickerBar.getColorValue();
            blueValue = bluePickerBar.getColorValue();
            mListener.onColorConfirmed(ColorPickerSupportDialogFrag.this, alphaValue, redValue, greenValue,
                    blueValue);
        }
    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // User cancelled
            mListener.onCancelled(ColorPickerSupportDialogFrag.this);
        }
    });

    currentColorTV = (TextView) view.findViewById(R.id.currentColorTV);

    alphaPickerBar = (AlphaPickerBar) view.findViewById(R.id.alphaBar);
    redPickerBar = (RedPickerBar) view.findViewById(R.id.redBar);
    greenPickerBar = (GreenPickerBar) view.findViewById(R.id.greenBar);
    bluePickerBar = (BluePickerBar) view.findViewById(R.id.blueBar);

    alphaPickerBar.register(this);
    alphaPickerBar.register(redPickerBar);
    alphaPickerBar.register(greenPickerBar);
    alphaPickerBar.register(bluePickerBar);

    redPickerBar.register(this);
    redPickerBar.register(alphaPickerBar);
    redPickerBar.register(greenPickerBar);
    redPickerBar.register(bluePickerBar);

    greenPickerBar.register(this);
    greenPickerBar.register(alphaPickerBar);
    greenPickerBar.register(redPickerBar);
    greenPickerBar.register(bluePickerBar);

    bluePickerBar.register(this);
    bluePickerBar.register(alphaPickerBar);
    bluePickerBar.register(redPickerBar);
    bluePickerBar.register(greenPickerBar);

    Dialog dialog = builder.create();

    if (savedInstanceState != null) {
        alphaValue = savedInstanceState.getInt("alpha");
        redValue = savedInstanceState.getInt("red");
        greenValue = savedInstanceState.getInt("green");
        blueValue = savedInstanceState.getInt("blue");
        alphaPickerBar.setColor(alphaValue, redValue, greenValue, blueValue);
        redPickerBar.setColor(alphaValue, redValue, greenValue, blueValue);
        greenPickerBar.setColor(alphaValue, redValue, greenValue, blueValue);
        bluePickerBar.setColor(alphaValue, redValue, greenValue, blueValue);

        currentColorTV.setBackgroundColor(Color.argb(alphaValue, redValue, greenValue, blueValue));
        currentColorTV.setText("#" + Integer.toHexString(alphaValue) + Integer.toHexString(redValue)
                + Integer.toHexString(greenValue) + Integer.toHexString(blueValue));
    }
    return dialog;
}

From source file:com.hannesdorfmann.adaptercommands.example.MainActivity.java

@ColorInt
private int randomColor() {
    return Color.argb(255, random.nextInt(256), random.nextInt(256), random.nextInt(256));
}

From source file:com.pac.performance.MainActivity.java

private void selectItem(int position) {
    if (currentPage != position && ViewPagerFragment.mViewPager != null)
        ViewPagerFragment.mViewPager.setCurrentItem(position);

    currentPage = position;/*  w  w  w.  j  ava  2  s .c o m*/

    mDrawerList.setItemChecked(position, true);
    mDrawerLayout.closeDrawer(mDrawerList);

    Random rnd = new Random();
    int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));

    if (ViewPagerFragment.mPagerTabStrip != null)
        ViewPagerFragment.mPagerTabStrip.setBackgroundColor(color);
    mDrawerList.setBackgroundColor(color);
}

From source file:cw.kop.autobackground.sources.SourceInfoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Bundle arguments = getArguments();//w  w  w.j  a  v  a2  s. c om
    sourcePosition = (Integer) arguments.get("position");
    int colorFilterInt = AppSettings.getColorFilterInt(appContext);

    View view = inflater.inflate(R.layout.source_info_fragment, container, false);
    headerView = inflater.inflate(R.layout.source_info_header, null, false);

    settingsContainer = (RelativeLayout) headerView.findViewById(R.id.source_settings_container);

    sourceImage = (ImageView) headerView.findViewById(R.id.source_image);
    sourceTitle = (EditText) headerView.findViewById(R.id.source_title);
    sourcePrefix = (EditText) headerView.findViewById(R.id.source_data_prefix);
    sourceData = (EditText) headerView.findViewById(R.id.source_data);
    sourceSuffix = (EditText) headerView.findViewById(R.id.source_data_suffix);
    sourceNum = (EditText) headerView.findViewById(R.id.source_num);

    ViewGroup.LayoutParams params = sourceImage.getLayoutParams();
    params.height = (int) ((container.getWidth()
            - 2f * getResources().getDimensionPixelSize(R.dimen.side_margin)) / 16f * 9);
    sourceImage.setLayoutParams(params);

    cancelButton = (Button) view.findViewById(R.id.cancel_button);
    saveButton = (Button) view.findViewById(R.id.save_button);

    sourcePrefix.setTextColor(colorFilterInt);
    sourceSuffix.setTextColor(colorFilterInt);
    cancelButton.setTextColor(colorFilterInt);
    saveButton.setTextColor(colorFilterInt);

    // Adjust alpha to get faded hint color from regular text color
    int hintColor = Color.argb(0x88, Color.red(colorFilterInt), Color.green(colorFilterInt),
            Color.blue(colorFilterInt));

    sourceTitle.setHintTextColor(hintColor);
    sourceData.setHintTextColor(hintColor);
    sourceNum.setHintTextColor(hintColor);

    sourceData.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (type) {

            case AppSettings.FOLDER:
                selectSource(getPositionOfType(AppSettings.FOLDER));
                break;
            case AppSettings.GOOGLE_ALBUM:
                selectSource(getPositionOfType(AppSettings.GOOGLE_ALBUM));
                break;

            }
            Log.i(TAG, "Data launched folder fragment");
        }
    });

    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    saveButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            saveSource();
        }
    });

    sourceSpinnerText = (TextView) headerView.findViewById(R.id.source_spinner_text);
    sourceSpinner = (Spinner) headerView.findViewById(R.id.source_spinner);

    timePref = (CustomSwitchPreference) findPreference("source_time");
    timePref.setChecked(arguments.getBoolean("use_time"));
    timePref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {

            if (!(Boolean) newValue) {
                return true;
            }

            DialogFactory.TimeDialogListener startTimeListener = new DialogFactory.TimeDialogListener() {

                @Override
                public void onTimeSet(TimePicker view, int hour, int minute) {
                    startHour = hour;
                    startMinute = minute;

                    DialogFactory.TimeDialogListener endTimeListener = new DialogFactory.TimeDialogListener() {
                        @Override
                        public void onTimeSet(TimePicker view, int hour, int minute) {
                            endHour = hour;
                            endMinute = minute;

                            timePref.setSummary(String.format("Time active: %02d:%02d - %02d:%02d", startHour,
                                    startMinute, endHour, endMinute));

                        }
                    };

                    DialogFactory.showTimeDialog(appContext, "End time?", endTimeListener, startHour,
                            startMinute);

                }
            };

            DialogFactory.showTimeDialog(appContext, "Start time?", startTimeListener, startHour, startMinute);

            return true;
        }
    });

    if (savedInstanceState != null) {

        if (sourcePosition == -1) {
            sourceSpinner
                    .setSelection(getPositionOfType(savedInstanceState.getString("type", AppSettings.WEBSITE)));
        }

    }

    if (sourcePosition == -1) {
        sourceImage.setVisibility(View.GONE);
        sourceSpinnerText.setVisibility(View.VISIBLE);
        sourceSpinner.setVisibility(View.VISIBLE);

        SourceSpinnerAdapter adapter = new SourceSpinnerAdapter(appContext, R.layout.spinner_row,
                Arrays.asList(getResources().getStringArray(R.array.source_menu)));
        sourceSpinner.setAdapter(adapter);
        sourceSpinner.setSelection(0);
        sourceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

                selectSource(position);
                Log.i(TAG, "Spinner launched folder fragment");
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        type = AppSettings.WEBSITE;
        hint = "URL";
        prefix = "";
        suffix = "";

        startHour = 0;
        startMinute = 0;
        endHour = 0;
        endMinute = 0;
    } else {
        sourceImage.setVisibility(View.VISIBLE);
        sourceSpinnerText.setVisibility(View.GONE);
        sourceSpinner.setVisibility(View.GONE);

        type = arguments.getString("type");

        folderData = arguments.getString("data");
        String data = folderData;

        hint = AppSettings.getSourceDataHint(type);
        prefix = AppSettings.getSourceDataPrefix(type);
        suffix = "";

        switch (type) {
        case AppSettings.GOOGLE_ALBUM:
            sourceTitle.setFocusable(false);
            sourceData.setFocusable(false);
            sourceNum.setFocusable(false);
        case AppSettings.FOLDER:
            data = Arrays.toString(folderData.split(AppSettings.DATA_SPLITTER));
            break;
        case AppSettings.TUMBLR_BLOG:
            suffix = ".tumblr.com";
            break;

        }

        sourceTitle.setText(arguments.getString("title"));
        sourceNum.setText("" + arguments.getInt("num"));
        sourceData.setText(data);

        if (imageDrawable != null) {
            sourceImage.setImageDrawable(imageDrawable);
        }

        boolean showPreview = arguments.getBoolean("preview");
        if (showPreview) {
            sourceImage.setVisibility(View.VISIBLE);
        }

        ((CustomSwitchPreference) findPreference("source_show_preview")).setChecked(showPreview);

        String[] timeArray = arguments.getString("time").split(":|[ -]+");

        try {
            startHour = Integer.parseInt(timeArray[0]);
            startMinute = Integer.parseInt(timeArray[1]);
            endHour = Integer.parseInt(timeArray[2]);
            endMinute = Integer.parseInt(timeArray[3]);
            timePref.setSummary(String.format("Time active: %02d:%02d - %02d:%02d", startHour, startMinute,
                    endHour, endMinute));
        } catch (NumberFormatException e) {
            e.printStackTrace();
            startHour = 0;
            startMinute = 0;
            endHour = 0;
            endMinute = 0;
        }

    }

    setDataWrappers();

    sourceUse = (Switch) headerView.findViewById(R.id.source_use_switch);
    sourceUse.setChecked(arguments.getBoolean("use"));

    if (AppSettings.getTheme().equals(AppSettings.APP_LIGHT_THEME)) {
        view.setBackgroundColor(getResources().getColor(R.color.LIGHT_THEME_BACKGROUND));
    } else {
        view.setBackgroundColor(getResources().getColor(R.color.DARK_THEME_BACKGROUND));
    }

    ListView listView = (ListView) view.findViewById(android.R.id.list);
    listView.addHeaderView(headerView);

    if (savedInstanceState != null) {
        sourceTitle.setText(savedInstanceState.getString("title", ""));
        sourceData.setText(savedInstanceState.getString("data", ""));
        sourceNum.setText(savedInstanceState.getString("num", ""));
    }

    return view;
}

From source file:com.doubleTwist.drawerlib.exampleapp.ExampleFragment.java

private void updateDrawerValues(int drawer, ADrawerLayout adl, View v) {
    SeekBar seek1 = (SeekBar) v.findViewById(R.id.progress1);
    SeekBar seek2 = (SeekBar) v.findViewById(R.id.progress2);
    SeekBar seek3 = (SeekBar) v.findViewById(R.id.progress3);
    SeekBar seek4 = (SeekBar) v.findViewById(R.id.progress4);

    if (drawer == ADrawerLayout.NO_DRAWER) {
        float paralaxX = (seek1.getProgress() - 500f) / 500.f;
        float paralaxY = (seek2.getProgress() - 500f) / 500.f;
        float dimFraction = (seek3.getProgress() / 1000.f);
        int dimColor = Color.argb(Math.round(0xff * dimFraction), 0x00, 0x00, 0x00);
        adl.setParalaxFactorX(paralaxX);
        adl.setParalaxFactorY(paralaxY);
        adl.setDimmingColor(dimColor);//from  www  . ja v a  2 s .c  o  m
    } else {
        ADrawerLayout.AnimationParameters params = adl.getAnimationParameters(drawer);
        float scale = seek1.getProgress() / 1000.f * .5f;
        float alpha = seek2.getProgress() / 1000.f * 1.f;
        float rotX = seek3.getProgress() / 1000.f * 1f - .5f;
        float rotY = seek4.getProgress() / 1000.f * 1f - .5f;
        params.mScale = scale;
        params.mAlpha = alpha;
        params.mRotX = rotX;
        params.mRotY = rotY;
    }
}