List of usage examples for android.graphics Color TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics Color TRANSPARENT.
Click Source Link
From source file:com.aniruddhc.acemusic.player.NowPlayingQueueActivity.NowPlayingQueueFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Inflate the correct layout based on the selected theme. mContext = getActivity().getApplicationContext(); mApp = (Common) mContext;// ww w. j av a2 s . com nowPlayingQueueFragment = this; sharedPreferences = mContext.getSharedPreferences("com.aniruddhc.acemusic.player", Context.MODE_PRIVATE); mCursor = mApp.getService().getCursor(); View rootView = (ViewGroup) inflater.inflate(R.layout.now_playing_queue_layout, container, false); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { updateSongInfo(); } }; //Notify the application that this fragment is now visible. sharedPreferences.edit().putBoolean("NOW_PLAYING_QUEUE_VISIBLE", true).commit(); //Get the screen's parameters. displayMetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); screenWidth = displayMetrics.widthPixels; screenHeight = displayMetrics.heightPixels; noMusicPlaying = (TextView) rootView.findViewById(R.id.now_playing_queue_no_music_playing); nowPlayingAlbumArt = (ImageView) rootView.findViewById(R.id.now_playing_queue_album_art); nowPlayingSongTitle = (TextView) rootView.findViewById(R.id.now_playing_queue_song_title); nowPlayingSongArtist = (TextView) rootView.findViewById(R.id.now_playing_queue_song_artist); nowPlayingSongContainer = (RelativeLayout) rootView .findViewById(R.id.now_playing_queue_current_song_container); noMusicPlaying.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingSongTitle.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingSongArtist.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingQueueListView = (DragSortListView) rootView.findViewById(R.id.now_playing_queue_list_view); progressBar = (ProgressBar) rootView.findViewById(R.id.now_playing_queue_progressbar); playPauseButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_play); nextButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_next); previousButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_previous); //Apply the card layout's background based on the color theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("LIGHT_CARDS_THEME")) { rootView.setBackgroundColor(0xFFEEEEEE); nowPlayingQueueListView.setDivider(getResources().getDrawable(R.drawable.transparent_drawable)); nowPlayingQueueListView.setDividerHeight(3); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.setMargins(7, 3, 7, 3); nowPlayingQueueListView.setLayoutParams(layoutParams); } else if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { rootView.setBackgroundColor(0xFF000000); nowPlayingQueueListView.setDivider(getResources().getDrawable(R.drawable.transparent_drawable)); nowPlayingQueueListView.setDividerHeight(3); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.setMargins(7, 3, 7, 3); nowPlayingQueueListView.setLayoutParams(layoutParams); } //Set the Now Playing container layout's background. nowPlayingSongContainer.setBackgroundColor(UIElementsHelper.getNowPlayingQueueBackground(mContext)); //Loop through the service's cursor and retrieve the current queue's information. if (sharedPreferences.getBoolean("SERVICE_RUNNING", false) == false || mApp.getService().getCurrentMediaPlayer() == null) { //No audio is currently playing. noMusicPlaying.setVisibility(View.VISIBLE); nowPlayingAlbumArt.setImageBitmap(mApp.decodeSampledBitmapFromResource(R.drawable.default_album_art, screenWidth / 3, screenWidth / 3)); nowPlayingQueueListView.setVisibility(View.GONE); nowPlayingSongTitle.setVisibility(View.GONE); nowPlayingSongArtist.setVisibility(View.GONE); progressBar.setVisibility(View.GONE); } else { //Set the current play/pause conditions. try { //Hide the progressBar and display the controls. progressBar.setVisibility(View.GONE); playPauseButton.setVisibility(View.VISIBLE); nextButton.setVisibility(View.VISIBLE); previousButton.setVisibility(View.VISIBLE); if (mApp.getService().getCurrentMediaPlayer().isPlaying()) { playPauseButton.setImageResource(R.drawable.pause_holo_light); } else { playPauseButton.setImageResource(R.drawable.play_holo_light); } } catch (Exception e) { /* The mediaPlayer hasn't been initialized yet, so let's just keep the controls * hidden for now. Once the mediaPlayer is initialized and it starts playing, * updateSongInfo() will be called, and we can show the controls/hide the progressbar * there. For now though, we'll display the progressBar. */ progressBar.setVisibility(View.VISIBLE); playPauseButton.setVisibility(View.GONE); nextButton.setVisibility(View.GONE); previousButton.setVisibility(View.GONE); } //Retrieve and set the current title/artist/artwork. mCursor.moveToPosition( mApp.getService().getPlaybackIndecesList().get(mApp.getService().getCurrentSongIndex())); String currentTitle = mCursor.getString(mCursor.getColumnIndex(DBAccessHelper.SONG_TITLE)); String currentArtist = mCursor.getString(mCursor.getColumnIndex(DBAccessHelper.SONG_ARTIST)); nowPlayingSongTitle.setText(currentTitle); nowPlayingSongArtist.setText(currentArtist); File file = new File(mContext.getExternalCacheDir() + "/current_album_art.jpg"); Bitmap bm = null; if (file.exists()) { bm = mApp.decodeSampledBitmapFromFile(file, screenWidth, screenHeight); nowPlayingAlbumArt.setScaleX(1.0f); nowPlayingAlbumArt.setScaleY(1.0f); } else { int defaultResource = UIElementsHelper.getIcon(mContext, "default_album_art"); bm = mApp.decodeSampledBitmapFromResource(defaultResource, screenWidth, screenHeight); nowPlayingAlbumArt.setScaleX(0.5f); nowPlayingAlbumArt.setScaleY(0.5f); } nowPlayingAlbumArt.setImageBitmap(bm); noMusicPlaying.setPaintFlags( noMusicPlaying.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); nowPlayingSongTitle.setPaintFlags(nowPlayingSongTitle.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.SUBPIXEL_TEXT_FLAG); nowPlayingSongArtist.setPaintFlags( nowPlayingSongArtist.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); /* Set the adapter. We'll pass in playbackIndecesList as the adapter's data backend. * The array can then be manipulated (reordered, items removed, etc) with no restrictions. * Each integer element in the array will be used as a pointer to a specific cursor row, * so there's no need to fiddle around with the actual cursor itself. */ nowPlayingQueueListViewAdapter = new NowPlayingQueueListViewAdapter(getActivity(), mApp.getService().getPlaybackIndecesList()); nowPlayingQueueListView.setAdapter(nowPlayingQueueListViewAdapter); nowPlayingQueueListView.setFastScrollEnabled(true); nowPlayingQueueListView.setDropListener(onDrop); nowPlayingQueueListView.setRemoveListener(onRemove); SimpleFloatViewManager simpleFloatViewManager = new SimpleFloatViewManager(nowPlayingQueueListView); simpleFloatViewManager.setBackgroundColor(Color.TRANSPARENT); nowPlayingQueueListView.setFloatViewManager(simpleFloatViewManager); //Scroll down to the current song. nowPlayingQueueListView.setSelection(mApp.getService().getCurrentSongIndex()); nowPlayingQueueListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int index, long arg3) { mApp.getService().skipToTrack(index); } }); playPauseButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mApp.getService().togglePlaybackState(); } }); nextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mApp.getService().skipToNextTrack(); } }); previousButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mApp.getService().skipToPreviousTrack(); } }); } return rootView; }
From source file:co.ceryle.radiorealbutton.library.RadioRealButtonGroup.java
private void getAttributes(AttributeSet attrs) { TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.RadioRealButtonGroup); bottomLineColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_bottomLineColor, Color.GRAY); bottomLineSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_bottomLineSize, 0); bottomLineBringToFront = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_bottomLineBringToFront, false); bottomLineRadius = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_bottomLineRadius, 0); selectorColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_selectorColor, Color.GRAY); selectorBringToFront = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorBringToFront, false); selectorAboveOfBottomLine = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorAboveOfBottomLine, false);//w ww. j a va 2 s.com selectorSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorSize, 12); selectorRadius = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorRadius, 0); animateSelector = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateSelector, 0); animateSelectorDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateSelector_duration, 500); animateSelectorDelay = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateSelector_delay, 0); dividerSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_dividerSize, 0); boolean hasDividerSize = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_dividerSize); dividerRadius = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_dividerRadius, 0); dividerPadding = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_dividerPadding, 30); dividerColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_dividerColor, Color.TRANSPARENT); dividerBackgroundColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_dividerBackgroundColor, Color.WHITE); hasDividerBackgroundColor = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_dividerBackgroundColor); selectorDividerSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerSize, dividerSize); if (!hasDividerSize) { dividerSize = selectorDividerSize; } selectorDividerRadius = ta .getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerRadius, 0); selectorDividerPadding = ta .getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerPadding, 0); selectorDividerColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerColor, Color.TRANSPARENT); radius = ta.getDimension(R.styleable.RadioRealButtonGroup_rrbg_radius, 0); animateImages = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_enter, 0); hasAnimateImages = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_enter); animateImagesExit = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_exit, 0); animateImagesDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_enterDuration, 500); animateImagesExitDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_exitDuration, 100); animateImagesScale = ta.getFloat(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_scale, 1.2f); animateTexts = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_enter, 0); hasAnimateTexts = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_enter); animateTextsExit = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_exit, 0); animateTextsDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_enterDuration, 500); animateTextsExitDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_exitDuration, 100); animateTextsScale = ta.getFloat(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_scale, 1.2f); lastPosition = initialPosition = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_checkedPosition, -1); checkedButtonId = ta.getResourceId(R.styleable.RadioRealButtonGroup_rrbg_checkedButton, NO_ID); buttonPadding = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPadding, 0); buttonPaddingLeft = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingLeft, 0); buttonPaddingRight = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingRight, 0); buttonPaddingTop = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingTop, 0); buttonPaddingBottom = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingBottom, 0); hasPadding = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPadding); hasPaddingLeft = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingLeft); hasPaddingRight = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingRight); hasPaddingTop = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingTop); hasPaddingBottom = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingBottom); groupBackgroundColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_backgroundColor, Color.WHITE); selectorTop = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorTop, false); selectorBottom = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorBottom, true); borderSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_borderSize, ConversionHelper.dpToPx(getContext(), 1)); borderColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_borderColor, Color.BLACK); boolean hasBorderSize = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_borderSize); boolean hasBorderColor = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_borderColor); hasBorder = hasBorderColor || hasBorderSize; clickable = ta.getBoolean(R.styleable.RadioRealButtonGroup_android_clickable, true); hasClickable = ta.hasValue(R.styleable.RadioRealButtonGroup_android_clickable); enabled = ta.getBoolean(R.styleable.RadioRealButtonGroup_android_enabled, true); hasEnabled = ta.hasValue(R.styleable.RadioRealButtonGroup_android_enabled); animationType = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_selectorAnimationType, 0); enableDeselection = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_enableDeselection, false); hasAnimation = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_animate, true); selectorFullSize = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorFullSize, false); ta.recycle(); }
From source file:com.saphion.stencilweather.activities.MainActivity.java
private void initialiseThings() { line_divider = findViewById(R.id.line_divider); edit_text_search = (EditText) findViewById(R.id.edit_text_search); image_search_back = (ImageView) findViewById(R.id.image_search_back); clearSearch = (ImageView) findViewById(R.id.clearSearch); listView = (ListView) findViewById(R.id.listView); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefresh_common); card_search = (CardView) findViewById(R.id.card_search); actionsContainer = findViewById(R.id.container_actions); actionsContainer.setVisibility(View.INVISIBLE); findViewById(R.id.fab_graph).setOnClickListener(this); findViewById(R.id.fab_map).setOnClickListener(this); findViewById(R.id.fab_share).setOnClickListener(this); pb = findViewById(R.id.progressSearch); findViewById(R.id.flActionsFab).setOnClickListener(new View.OnClickListener() { @Override/*from w ww .j a v a2 s . co m*/ public void onClick(View view) { if (!hidden) initiateActions(true); } }); swipeRefreshLayout.setColorSchemeResources(R.color.main_button_red_normal, R.color.main_button_green_normal, R.color.main_button_blue_normal); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { swipeRefreshLayout.setRefreshing(false); } }, 3000); } }); findViewById(R.id.llSettings).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getBaseContext(), SettingsActivity.class)); overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); finish(); } }); //sliding pane slidingLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout); slidingLayout.setCoveredFadeColor(Color.TRANSPARENT); slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); slidingLayout.setTouchEnabled(false); slidingLayout.setShadowHeight(0); InitiateSearch(); HandleSearch(); IsAdapterEmpty(); initiateGraph(); }
From source file:com.facebook.react.views.scroll.ReactScrollView.java
@Override public void draw(Canvas canvas) { if (mEndFillColor != Color.TRANSPARENT) { final View content = getChildAt(0); if (mEndBackground != null && content != null && content.getBottom() < getHeight()) { mEndBackground.setBounds(0, content.getBottom(), getWidth(), getHeight()); mEndBackground.draw(canvas); }/*from w w w. j av a2s . c om*/ } getDrawingRect(mRect); switch (mOverflow) { case ViewProps.VISIBLE: break; default: canvas.clipRect(mRect); break; } super.draw(canvas); }
From source file:com.simas.vc.nav_drawer.NavDrawerFragment.java
/** * Users of this fragment must call this method to set up the navigation drawer interactions. * @param fragmentId The android:id of this fragment in its activity's layout. * @param drawerLayout The DrawerLayout containing this fragment's UI. *//* w w w .j av a 2 s . c om*/ public void setUp(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout; // Set a custom shadow that overlays the main content when the drawer opens getDrawerLayout().setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // Unlock the drawer getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); // Enable drawer arrow ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the navigation drawer and the action bar app icon. mDrawerToggle = new ActionBarDrawerToggle(getActivity(), getDrawerLayout(), getToolbar(), R.string.navigation_drawer_open, R.string.navigation_drawer_close) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); mDrawerState = DrawerState.CLOSED; for (DrawerLayout.DrawerListener listener : mDrawerStateListeners) { listener.onDrawerClosed(drawerView); } getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); // Set the choice mode ONLY IF IT'S NOT SINGLE // Otherwise, will cause the AbsListView to reset its mCheckState array!!! if (getListView().getChoiceMode() != ListView.CHOICE_MODE_SINGLE) { getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); } if (!isAdded()) { return; } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); mDrawerState = DrawerState.OPEN; for (DrawerLayout.DrawerListener listener : mDrawerStateListeners) { listener.onDrawerOpened(drawerView); } if (!isAdded()) { return; } if (!mUserLearnedDrawer) { // The user manually opened the drawer; store this flag to prevent auto-showing // the navigation drawer automatically in the future. mUserLearnedDrawer = true; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } @Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); for (DrawerLayout.DrawerListener listener : mDrawerStateListeners) { listener.onDrawerSlide(drawerView, slideOffset); } } @Override public void onDrawerStateChanged(int newState) { super.onDrawerStateChanged(newState); for (DrawerLayout.DrawerListener listener : mDrawerStateListeners) { listener.onDrawerStateChanged(newState); } } }; // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, // per the navigation drawer design guidelines. if (!mUserLearnedDrawer && !mFromSavedInstanceState) { setDrawerOpen(true); } // Defer code dependent on restoration of previous instance state. getDrawerLayout().post(new Runnable() { @Override public void run() { mDrawerToggle.syncState(); } }); getDrawerLayout().setDrawerListener(mDrawerToggle); // The adapter needs a reference to the list its connected to mAdapter = new NavAdapter(getActivity(), getListView()); getListView().setAdapter(mAdapter); // Select either the default item (0) or the last selected item. if (mPreviousSelection != ListView.INVALID_POSITION) { selectItem(mPreviousSelection); } if (mNavCAB == null) { // Newly created CAB mNavCAB = new NavCAB(this); } else { // Previous CAB mNavCAB.mNavDrawerFragment = this; getListView().post(new Runnable() { @Override public void run() { // Update list if CAB has checked items if (mNavCAB.checkedPositions != null && mNavCAB.checkedPositions.size() > 0) { // Copy the array, because it will be modified when checking the LV items List<Integer> positions = new ArrayList<>(); positions.addAll(mNavCAB.checkedPositions); // Update the LV's item checked state getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); for (Integer position : positions) { getListView().setItemChecked(position, true); } } } }); } getListView().setMultiChoiceModeListener(mNavCAB); // Click listeners getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Make sure it's not the header if (position != 0) { selectItem(position); // Change the item's background based on its checked state if (getListView().isItemChecked(position)) { view.setBackgroundColor(Color.DKGRAY); } else { view.setBackgroundColor(Color.TRANSPARENT); } } else { ((MainActivity) getActivity()).showFileChooser(false); } } }); getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { // Make sure it's not the header that's been clicked if (position == 0) { return false; } else { // Make sure a valid item has been clicked boolean valid = (mAdapter.getItem(position - 1).getState() == NavItem.State.VALID); if (!valid) return false; // Need to enable multiple mode and force-check manually, so CAB is called getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); getListView().setItemChecked(position, true); return true; } } }); // // Scroll to previous ScrollY // Log.e(TAG, "selection: " + mPreviousSelection); // if (mFromSavedInstanceState && mPreviousSelection != ListView.INVALID_POSITION) { // getListView().setSelection(mPreviousSelection); // } }
From source file:com.cs528.style.style.weather.WeatherActivity.java
private void aboutDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Style"); final WebView webView = new WebView(this); String about = "<p>Developed by KuangXIONG, Tengyang Jia, ZhaojunYang</p>" + "<p>A cloth suggestion application</p>" + "<p>Data provided by <a href='http://openweathermap.org/'>OpenWeatherMap</a>, under the <a href='http://creativecommons.org/licenses/by-sa/2.0/'>Creative Commons license</a>" + "<p>Weather Icons are <a href='https://erikflowers.github.io/weather-icons/'>Weather Icons</a>, by <a href='http://www.twitter.com/artill'>Lukas Bischoff</a> and <a href='http://www.twitter.com/Erik_UX'>Erik Flowers</a>, under the <a href='http://scripts.sil.org/OFL'>SIL OFL 1.1</a> licence." + "<p>Cloth Icons are <a href='http://pictofoundry.com/'>PictoFoundry Font Pack 2</a>, bought by TengyangJia</p>"; if (darkTheme) { // Style text color for dark theme about = "<style media=\"screen\" type=\"text/css\">" + "body {\n" + " color:white;\n" + "}\n" + "a:link {color:cyan}\n" + "</style>" + about; }/*www. j a v a 2 s . c o m*/ webView.setBackgroundColor(Color.TRANSPARENT); webView.loadData(about, "text/html", "UTF-8"); alert.setView(webView, 32, 0, 32, 0); alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }
From source file:com.musenkishi.atelier.Atelier.java
private static void applyColorToView(final ImageView imageView, int color, boolean fromCache, boolean shouldMask) { if (fromCache) { if (shouldMask) { if (imageView.getDrawable() != null) { imageView.getDrawable().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY); } else if (imageView.getBackground() != null) { imageView.getBackground().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY); }//from w w w . ja v a 2 s.c o m } else { imageView.setBackgroundColor(color); } } else { if (shouldMask) { Integer colorFrom; ValueAnimator.AnimatorUpdateListener imageAnimatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { if (imageView.getDrawable() != null) { imageView.getDrawable().mutate().setColorFilter( (Integer) valueAnimator.getAnimatedValue(), PorterDuff.Mode.MULTIPLY); } else if (imageView.getBackground() != null) { imageView.getBackground().mutate().setColorFilter( (Integer) valueAnimator.getAnimatedValue(), PorterDuff.Mode.MULTIPLY); } } }; ValueAnimator.AnimatorUpdateListener animatorUpdateListener; PaletteTag paletteTag = (PaletteTag) imageView.getTag(viewTagKey); animatorUpdateListener = imageAnimatorUpdateListener; colorFrom = paletteTag.getColor(); imageView.setTag(viewTagKey, new PaletteTag(paletteTag.getId(), color)); Integer colorTo = color; ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.addUpdateListener(animatorUpdateListener); colorAnimation.setDuration(300); colorAnimation.start(); } else { Drawable preDrawable; if (imageView.getBackground() == null) { preDrawable = new ColorDrawable(Color.TRANSPARENT); } else { preDrawable = imageView.getBackground(); } TransitionDrawable transitionDrawable = new TransitionDrawable( new Drawable[] { preDrawable, new ColorDrawable(color) }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { imageView.setBackground(transitionDrawable); } else { imageView.setBackgroundDrawable(transitionDrawable); } transitionDrawable.startTransition(300); } } }
From source file:com.albedinsky.android.ui.navigation.NavigationLayout.java
/** * Called from one of constructors of this view to perform its initialization. * <p>/*ww w. j av a 2 s . c o m*/ * Initialization is done via parsing of the specified <var>attrs</var> set and obtaining for * this view specific data from it that can be used to configure this new view instance. The * specified <var>defStyleAttr</var> and <var>defStyleRes</var> are used to obtain default data * from the current theme provided by the specified <var>context</var>. */ @SuppressWarnings("ResourceType") private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { mLayoutInflater = LayoutInflater.from(context); int initialLayout = 0; /** * Process attributes. */ final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Ui_NavigationLayout, defStyleAttr, defStyleRes); if (typedArray != null) { final int n = typedArray.getIndexCount(); for (int i = 0; i < n; i++) { int index = typedArray.getIndex(i); if (index == R.styleable.Ui_NavigationLayout_android_initialLayout) { initialLayout = typedArray.getResourceId(index, initialLayout); } else if (index == R.styleable.Ui_NavigationLayout_uiNavigationDrawerShadow) { final int resId = typedArray.getResourceId(index, -1); if (resId != -1) setDrawerShadow(resId, NAVIGATION_DRAWER_GRAVITY); } else if (index == R.styleable.Ui_NavigationLayout_uiColorScrim) { setScrimColor(typedArray.getColor(index, Color.TRANSPARENT)); } } typedArray.recycle(); } if (initialLayout != 0) { mLayoutInflater.inflate(initialLayout, this); this.handleInflationFinished(); } }
From source file:com.appsimobile.appsii.module.weather.WeatherActivity.java
void showDrawable(Drawable drawable, boolean isImmediate) { mBackgroundImage.setLayerType(View.LAYER_TYPE_SOFTWARE, null); if (isImmediate) { int w = drawable.getIntrinsicWidth(); int viewWidth = mBackgroundImage.getWidth(); float factor = viewWidth / (float) w; int h = (int) (drawable.getIntrinsicHeight() * factor); drawable.setBounds(0, 0, w, h);/* w w w .j a va2 s . co m*/ mBackgroundImage.setImageDrawable(drawable); } else { Drawable current = mBackgroundImage.getDrawable(); if (current == null) current = new ColorDrawable(Color.TRANSPARENT); TransitionDrawable transitionDrawable = new TransitionDrawable(new Drawable[] { current, drawable }); transitionDrawable.setCrossFadeEnabled(true); mBackgroundImage.setImageDrawable(transitionDrawable); transitionDrawable.startTransition(500); } }
From source file:com.saphion.stencilweather.activities.MainActivity.java
public void setToolBarColor(int color) { try {// ww w.ja v a2s .co m // findViewById(R.id.appbar).setBackgroundColor(color); toolbar.setBackgroundColor(Color.TRANSPARENT); Integer colorFrom = Color.TRANSPARENT; Drawable background = findViewById(R.id.appbar).getBackground(); if (background instanceof ColorDrawable) colorFrom = ((ColorDrawable) background).getColor(); Integer colorTo = color; ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { findViewById(R.id.appbar).setBackgroundColor((Integer) animator.getAnimatedValue()); findViewById(R.id.appbarGraph).setBackgroundColor((Integer) animator.getAnimatedValue()); } }); colorAnimation.setDuration(350); colorAnimation.start(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); color = (color & 0xfefefefe) >> 1; window.setStatusBarColor(color); } } catch (Exception ignored) { } }