Example usage for android.graphics Color TRANSPARENT

List of usage examples for android.graphics Color TRANSPARENT

Introduction

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

Prototype

int TRANSPARENT

To view the source code for android.graphics Color TRANSPARENT.

Click Source Link

Usage

From source file:com.amap.api.maps2d.heatmaps.HeatmapTileProvider.java

/**
 * Converts a grid of intensity values to a colored Bitmap, using a given
 * color map// ww  w  . ja  v  a2  s  . c  o  m
 * 
 * @param grid the input grid (assumed to be square)
 * @param colorMap color map (created by generateColorMap)
 * @param max Maximum intensity value: maps to 100% on gradient
 * @return the colorized grid in Bitmap form, with same dimensions as grid
 */
static Bitmap colorize(final double[][] grid, final int[] colorMap, final double max) {
    // Maximum color value
    final int maxColor = colorMap[colorMap.length - 1];
    // Multiplier to "scale" intensity values with, to map to appropriate
    // color
    final double colorMapScaling = (colorMap.length - 1) / max;
    // Dimension of the input grid (and dimension of output bitmap)
    final int dim = grid.length;

    int i, j, index, col;
    double val;
    // Array of colors
    final int colors[] = new int[dim * dim];
    for (i = 0; i < dim; i++) {
        for (j = 0; j < dim; j++) {
            // [x][y]
            // need to enter each row of x coordinates sequentially (x
            // first)
            // -> [j][i]
            val = grid[j][i];
            index = i * dim + j;
            col = (int) (val * colorMapScaling);

            if (val != 0) {
                // Make it more resilient: cant go outside colorMap
                if (col < colorMap.length) {
                    colors[index] = colorMap[col];
                } else {
                    colors[index] = maxColor;
                }
            } else {
                colors[index] = Color.TRANSPARENT;
            }
        }
    }

    // Now turn these colors into a bitmap
    final Bitmap tile = Bitmap.createBitmap(dim, dim, Bitmap.Config.ARGB_8888);
    // (int[] pixels, int offset, int stride, int x, int y, int width, int
    // height)
    tile.setPixels(colors, 0, dim, 0, 0, dim, dim);
    return tile;
}

From source file:com.amaze.filemanager.fragments.ProcessViewerFragment.java

/**
 * Initialize chart for the first time//  ww  w.j a v a  2 s. co  m
 * @param totalBytes maximum value for x-axis
 */
private void chartInit(long totalBytes) {
    mLineChart.setBackgroundColor(accentColor);
    mLineChart.getLegend().setEnabled(false);

    // no description text
    mLineChart.getDescription().setEnabled(false);

    XAxis xAxis = mLineChart.getXAxis();
    YAxis yAxisLeft = mLineChart.getAxisLeft();
    mLineChart.getAxisRight().setEnabled(false);
    yAxisLeft.setTextColor(Color.WHITE);
    yAxisLeft.setAxisLineColor(Color.TRANSPARENT);
    yAxisLeft.setTypeface(Typeface.DEFAULT_BOLD);
    yAxisLeft.setGridColor(Utils.getColor(getContext(), R.color.white_translucent));

    xAxis.setAxisMaximum(FileUtils.readableFileSizeFloat(totalBytes));
    xAxis.setAxisMinimum(0.0f);
    xAxis.setAxisLineColor(Color.TRANSPARENT);
    xAxis.setGridColor(Color.TRANSPARENT);
    xAxis.setTextColor(Color.WHITE);
    xAxis.setTypeface(Typeface.DEFAULT_BOLD);
    mLineChart.setData(mLineData);
    mLineChart.invalidate();
}

From source file:com.example.android.displayingbitmaps.imageloader.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView.// w  ww. j a  va 2s .c o  m
 *
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(final ImageView imageView, final Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(new Drawable[] {
                //                            new ColorDrawable(android.R.color.transparent),
                new BitmapDrawable(mResources, mLoadingBitmap), drawable });
        // Set background to loading bitmap
        //            imageView.setBackgroundDrawable(
        //                    new BitmapDrawable(mResources, mLoadingBitmap));
        imageView.setBackgroundColor(Color.TRANSPARENT);

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
        imageView.setBackgroundColor(Color.TRANSPARENT);
    }
}

From source file:com.javielinux.adapters.TweetsAdapter.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {

    InfoTweet infoTweet = getItem(position);
    ViewHolder viewHolder = null;//from  w w  w  . j  a v a 2s. c  o  m
    if (null == convertView) {
        convertView = activity.getLayoutInflater().inflate(R.layout.tweet_list_view_item, parent, false);
        //view = (RelativeLayout) View.inflate(getContext(), R.layout.tweet_list_view_item, null);
        viewHolder = generateViewHolder(convertView);
        convertView.setTag(viewHolder);
        loadLinks(position);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }

    int typeBackground = -1;

    if (selected_id == position) {
        typeBackground = 2;
        if (infoTweet.isRead())
            typeBackground++;
        if (viewHolder.typeBackground != typeBackground) {
            convertView.setBackgroundDrawable(ImageUtils.createGradientDrawableSelected(getContext(),
                    infoTweet.isRead() ? 0 : color_line));
        }
    } else if (column == TweetTopicsUtils.COLUMN_TIMELINE
            && infoTweet.getText().toLowerCase().contains("@" + usernameColumn.toLowerCase())) {
        typeBackground = 4;
        if (infoTweet.isRead())
            typeBackground++;
        if (viewHolder.typeBackground != typeBackground) {
            convertView.setBackgroundDrawable(ImageUtils.createGradientDrawableMention(getContext(),
                    infoTweet.isRead() ? 0 : color_line));
        }
    } else if ((column == TweetTopicsUtils.COLUMN_MENTIONS || column == TweetTopicsUtils.COLUMN_TIMELINE)
            && infoTweet.isFavorited()) {
        typeBackground = 6;
        if (infoTweet.isRead())
            typeBackground++;
        if (viewHolder.typeBackground != typeBackground) {
            convertView.setBackgroundDrawable(ImageUtils.createGradientDrawableFavorite(getContext(),
                    infoTweet.isRead() ? 0 : color_line));
        }
    } else {

        if (hashColorUsers.containsKey(infoTweet.getUsername())) {
            typeBackground = 8 + (hashColorUsersPosition.get(infoTweet.getUsername()) * 2);
            if (infoTweet.isRead())
                typeBackground++;
            if (viewHolder.typeBackground != typeBackground) {
                convertView.setBackgroundDrawable(ImageUtils.createStateListDrawable(getContext(),
                        hashColorUsers.get(infoTweet.getUsername()), infoTweet.isRead() ? 0 : color_line));
            }
        } else {
            typeBackground = 0;
            if (infoTweet.isRead())
                typeBackground++;
            if (viewHolder.typeBackground != typeBackground) {
                convertView.setBackgroundDrawable(ImageUtils.createStateListDrawable(getContext(),
                        hashThemeColors.get("list_background_row_color"), infoTweet.isRead() ? 0 : color_line));
            }
        }
    }

    viewHolder.typeBackground = typeBackground;

    AQuery aQuery = listAQuery.recycle(convertView);

    // ponerla barra naranja
    if (infoTweet.isMoreTweetDown()) {
        viewHolder.loadMoreBreakListItem.setBackgroundDrawable(ImageUtils.createStateListDrawable(getContext(),
                themeManager.getColor("color_load_more_break")));
        viewHolder.loadMoreBreakListItem.showText();
        try {
            final InfoTweet next = getItem(position + 1);
            if (next != null) {
                viewHolder.loadMoreBreakListItem.showText(Utils.diffDate(infoTweet.getDate(), next.getDate()));
                viewHolder.loadMoreBreakListItem.setTag(infoTweet);
                viewHolder.loadMoreBreakListItem.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        loadMoreBreakTweets((InfoTweet) view.getTag(), next, position);
                    }
                });
            }
        } catch (RuntimeException e) {
        } catch (Exception e) {
        }
        viewHolder.loadMoreBreakListItem.setVisibility(View.VISIBLE);
    } else {
        viewHolder.loadMoreBreakListItem.setVisibility(View.GONE);
    }

    String html = "";

    if (infoTweet.getTextHTMLFinal().equals("")) {
        String[] in = Utils.toHTMLTyped(activity, infoTweet.getText(), infoTweet.getTextURLs());
        html = in[1];
        infoTweet.setTextFinal(in[0]);
        infoTweet.setTextHTMLFinal(in[1]);
    } else {
        html = infoTweet.getTextHTMLFinal();
    }

    viewHolder.statusText.setTextColor(hashThemeColors.get("color_tweet_text"));
    viewHolder.sourceText.setTextColor(hashThemeColors.get("color_tweet_source"));
    viewHolder.retweetUser.setTextColor(hashThemeColors.get("color_tweet_retweet"));
    viewHolder.screenName.setTextColor(hashThemeColors.get("color_tweet_usename"));
    viewHolder.dateText.setTextColor(hashThemeColors.get("color_tweet_date"));

    if (infoTweet.isLastRead()) {
        BitmapDrawable bmp = (BitmapDrawable) getContext().getResources()
                .getDrawable(R.drawable.readafter_tile);
        bmp.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        viewHolder.lastReadLayout.setBackgroundDrawable(bmp);
    } else {
        viewHolder.lastReadLayout.setBackgroundColor(Color.TRANSPARENT);
    }

    // TODO mostrar el numero de retweets
    /*
      if (TweetTopicsCore.isTypeList(TweetTopicsCore.TYPE_LIST_RETWEETS)) {
      if (infoTweet.getRetweetCount()>0) {
          viewHolder.tagAvatar.setImageBitmap(Utils.getBitmapNumber(cnt, (int)infoTweet.getRetweetCount(), Color.RED, Utils.TYPE_BUBBLE, 12));
      } else {
          viewHolder.tagAvatar.setImageBitmap(null);
      }
      }
       */
    if (infoTweet.hasGeoLocation()) {
        viewHolder.tagMap.setVisibility(View.VISIBLE);
    } else {
        viewHolder.tagMap.setVisibility(View.GONE);
    }

    if (infoTweet.hasConversation()) {
        viewHolder.tagConversation.setVisibility(View.VISIBLE);
    } else {
        viewHolder.tagConversation.setVisibility(View.GONE);
    }

    aQuery.id(viewHolder.statusText).text(Html.fromHtml(html));
    viewHolder.statusText.setTextSize(PreferenceUtils.getSizeText(getContext()));

    int typeInfo = Integer.parseInt(preference.getString("prf_username_right", "2"));
    String data = "";
    if (typeInfo == 2) {
        if (infoTweet.isRetweet()) {
            data = Html.fromHtml(infoTweet.getSourceRetweet()).toString();
        } else {
            data = Html.fromHtml(infoTweet.getSource()).toString();
        }
    } else if (typeInfo == 3) {
        data = infoTweet.getFullname();
    }
    aQuery.id(viewHolder.sourceText).text(data);
    viewHolder.sourceText.setTextSize(PreferenceUtils.getSizeTitles(getContext()) - 1);

    if (infoTweet.isRetweet()) {
        viewHolder.retweetLayout.setVisibility(View.VISIBLE);
        aQuery.id(viewHolder.screenName).text(infoTweet.getUsernameRetweet());
        aQuery.id(viewHolder.retweetUser).text(infoTweet.getUsername());
        aQuery.id(viewHolder.retweetText).text(R.string.retweet_by);
        viewHolder.retweetAvatar.setVisibility(View.VISIBLE);
    } else {
        aQuery.id(viewHolder.screenName).text(infoTweet.getUsername());
        viewHolder.retweetLayout.setVisibility(View.GONE);
    }

    // si es un DM usamos el layout de retweet para poner el nombre al que le escribimos
    if (infoTweet.isDm()) {
        if (!infoTweet.getToUsername().equals("") && !infoTweet.getToUsername().equals(usernameColumn)) {
            viewHolder.retweetLayout.setVisibility(View.VISIBLE);
            aQuery.id(viewHolder.retweetUser).text(infoTweet.getUsername());
            aQuery.id(viewHolder.retweetText).text(R.string.sent_to);
            viewHolder.retweetAvatar.setVisibility(View.GONE);
        }
    }

    viewHolder.screenName.setTextSize(PreferenceUtils.getSizeTitles(getContext()));

    aQuery.id(viewHolder.dateText).text(infoTweet.getTime(getContext()));
    viewHolder.dateText.setTextSize(PreferenceUtils.getSizeTitles(getContext()) - 4);

    String mUrlAvatar = infoTweet.getUrlAvatar();
    String mRetweetUrlAvatar = infoTweet.getUrlAvatarRetweet();

    boolean isRetweet = infoTweet.isRetweet();

    if (isRetweet) {

        Bitmap retweetAvatar = aQuery.getCachedImage(mUrlAvatar);
        if (retweetAvatar != null) {
            aQuery.id(viewHolder.retweetAvatar).image(retweetAvatar);
        } else {
            aQuery.id(viewHolder.retweetAvatar).image(mUrlAvatar, true, true, 0, R.drawable.avatar_small);
        }

        Bitmap avatar = aQuery.getCachedImage(mRetweetUrlAvatar);
        if (avatar != null) {
            aQuery.id(viewHolder.avatarView).image(avatar);
        } else {
            aQuery.id(viewHolder.avatarView).image(mRetweetUrlAvatar, true, true, 0, R.drawable.avatar,
                    aQuery.getCachedImage(R.drawable.avatar), 0);
        }

        viewHolder.avatarView.setTag(infoTweet.getUsernameRetweet());

    } else {

        Bitmap avatar = aQuery.getCachedImage(mUrlAvatar);
        if (avatar != null) {
            aQuery.id(viewHolder.avatarView).image(avatar);
        } else {
            aQuery.id(viewHolder.avatarView).image(mUrlAvatar, true, true, 0, R.drawable.avatar,
                    aQuery.getCachedImage(R.drawable.avatar), 0);
        }

        viewHolder.avatarView.setTag(infoTweet.getUsername());
    }

    viewHolder.avatarView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (getActivity() instanceof BaseLayersActivity) {
                Bundle bundle = new Bundle();
                bundle.putString(UserActivity.KEY_EXTRAS_USER, v.getTag().toString());
                ((BaseLayersActivity) getActivity()).startAnimationActivity(UserActivity.class, bundle);
            }
        }

    });

    viewHolder.statusText.setTag(infoTweet);
    // buscar imagenes de los tweets

    //ArrayList<String> links = LinksUtils.pullLinks(infoTweet.getText(), infoTweet.getContentURLs());

    String linkForImage = infoTweet.getBestLink();

    if (linkForImage.equals("")) {
        viewHolder.tweetPhotoImgContainer.setVisibility(View.GONE);
    } else {
        viewHolder.tweetPhotoImgContainer.setTag(infoTweet);
        viewHolder.tweetPhotoImgContainer.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                callLinksIfIsPossible(view);
            }
        });

        viewHolder.tweetPhotoImgContainer.setVisibility(View.VISIBLE);

        if (infoTweet.getLinksCount() > 1) {
            viewHolder.tweetPhotoImgContainer.setBackgroundResource(R.drawable.container_image_multiple);
        } else {
            viewHolder.tweetPhotoImgContainer.setBackgroundResource(R.drawable.container_image_simple);
        }

        InfoLink infoLink = null;

        if (CacheData.getInstance().existCacheInfoLink(linkForImage)) {
            infoLink = CacheData.getInstance().getCacheInfoLink(linkForImage);
        }

        int typeResource = getTypeResource(linkForImage);

        if (infoLink != null) {

            String thumb = infoLink.getLinkImageThumb();

            if (thumb.equals("")) {
                aQuery.id(viewHolder.tweetPhotoImg).image(typeResource);
            } else {
                Bitmap image = aQuery.getCachedImage(infoLink.getLinkImageThumb());
                if (image != null) {
                    aQuery.id(viewHolder.tweetPhotoImg).image(image);
                } else {
                    aQuery.id(viewHolder.tweetPhotoImg).image(infoLink.getLinkImageThumb(), true, true, 0,
                            typeResource, aQuery.getCachedImage(typeResource), 0);
                }
            }

        } else { // si no tenemos InfoLink en cache

            aQuery.id(viewHolder.tweetPhotoImg).image(typeResource);
        }
    }

    return convertView;

}

From source file:com.acceleratedio.pac_n_zoom.AnimActivity.java

private void anim_svg(String svg_fil) {

    Toast.makeText(this, "Parsing and Drawing Animation", Toast.LENGTH_SHORT).show();
    loadSVG = new LoadSVG();
    svg_data = loadSVG.LoadSVG(svg_fil);
    Log.d("anim_svg", "Return from LoadSVG");
    RelativeLayout rel_anm_lo = (RelativeLayout) findViewById(R.id.activity_anm_lo);

    RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
            RelativeLayout.LayoutParams.MATCH_PARENT);

    DrawSVG drw_svg = new DrawSVG();
    anmViews = drw_svg.DrawSVG(crt_ctx, orgnlImageView, rel_anm_lo);
    initScl = svg_data.svg.initScl;/*  w ww . j a  v  a  2 s  . c  o  m*/

    /*
    try {
     android.os.Debug.dumpHprofData("/sdcard/dump.hprof");
    } catch (IOException e) {
       e.printStackTrace();
    }   
    */

    // - Loop through the views
    int vw_nmbr = anmViews.size();

    for (int vw_mbr = 1; vw_mbr < vw_nmbr; vw_mbr += 1) {

        anim_view = anmViews.get(vw_mbr);
        anim_view.setLayoutParams(rlp);
        anim_view.setBackgroundColor(Color.TRANSPARENT);
        rel_anm_lo.addView(anim_view);
        disableClipOnParents(anim_view);
    }

    setContentView(rel_anm_lo);
    frm_mbr = -1;
    mainAnmLoop();
}

From source file:com.sonymobile.android.media.testmediaplayer.MainActivity.java

public void init() {
    if (mMediaPlayer == null) {
        mMediaPlayer = new MediaPlayer(getApplicationContext());
        mMediaPlayer.setScreenOnWhilePlaying(true);
    }/*  w w w . j a  v  a 2 s  . c  o m*/
    mHandler = new Handler();
    mDecorView = getWindow().getDecorView();
    mSeekbar = (SeekBar) findViewById(R.id.activity_main_seekbar);
    mSeekbar.setMax(1000);
    mPlayPauseButton = (ImageView) findViewById(R.id.activity_main_playpause_button);
    mSeekBarUpdater = new SeekbarUpdater(mSeekbar, mMediaPlayer);
    mTopLayout = (RelativeLayout) findViewById(R.id.activity_main_mainlayout);
    mTrackDialog = new AudioSubtitleTrackDialog(this);
    mAudioPos = mSubPos = 0;
    mTimeView = (TextView) findViewById(R.id.activity_main_time);
    mDurationView = (TextView) findViewById(R.id.activity_main_duration);
    mTimeLayout = (LinearLayout) findViewById(R.id.activity_main_timelayout);
    mTimeTracker = new TimeTracker(mMediaPlayer, mTimeView);
    mSubtitleView = (TextView) findViewById(R.id.activity_main_subtitleView);
    mSubtitleRenderer = new SubtitleRenderer(mSubtitleView, Looper.myLooper(), mMediaPlayer);
    mSubtitleLayoutAboveTimeView = (RelativeLayout.LayoutParams) mSubtitleView.getLayoutParams();
    mSubtitleLayoutBottom = (RelativeLayout.LayoutParams) ((TextView) findViewById(
            R.id.activity_main_subtitleView_params)).getLayoutParams();
    mTimeSeekView = (TextView) findViewById(R.id.activity_main_time_seek);
    mMediaPlayer.setOnInfoListener(this);
    RelativeLayout browsingL = (RelativeLayout) findViewById(R.id.activity_main_browsing_layout);
    ExpandableListView elv = (ExpandableListView) browsingL.findViewById(R.id.file_browsing_exp_list_view);
    ListView lv = (ListView) browsingL.findViewById(R.id.file_browsing_listview);
    RelativeLayout debugLayout = (RelativeLayout) findViewById(R.id.activity_main_debug_view);
    LinearLayout debugLinearLayout = (LinearLayout) debugLayout.findViewById(R.id.activity_main_debug_linear);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setScrimColor(Color.TRANSPARENT);
    mDrawerLayout.setDrawerListener(this);
    mFileBrowser = new MediaBrowser(this, elv, lv, mMediaPlayer, (MainActivity) this, mDrawerLayout,
            debugLinearLayout);
    mIsFileBrowsing = false;
    mPreview = (SurfaceView) findViewById(R.id.mSurfaceView);
    mPreview.setOnTouchListener(this);
    mTopLayout.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPreview.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    mSubtitleTracker = new HashMap<Integer, Integer>();
    mAudioTracker = new HashMap<Integer, Integer>();
    findViewById(R.id.activity_main_loading_panel).bringToFront();
    findViewById(R.id.activity_main_browsing_layout).bringToFront();
    mUpperControls = (RelativeLayout) findViewById(R.id.UpperButtonLayout);
    mBottomControls = (RelativeLayout) findViewById(R.id.ButtonLayout);
    mSlideInAnimation = AnimationUtils.loadAnimation(this, R.anim.in_top);
    mSlideInAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mUpperControls.setVisibility(View.VISIBLE);
            Runnable r = new Runnable() {
                @Override
                public void run() {
                    mBottomControls.setVisibility(View.INVISIBLE);
                }
            };
            mHandler.postDelayed(r, 3500);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
            mBottomControls.setVisibility(View.INVISIBLE);
        }
    });
    mHolder = mPreview.getHolder();
    mHolder.addCallback(this);
    mFadeOutRunnable = new Runnable() {
        @Override
        public void run() {
            mSeekbar.setEnabled(false);
            Animation fadeoutBottom = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.out_bottom);
            fadeoutBottom.setAnimationListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    if (mOngoingAnimation) {
                        mOngoingAnimation = false;
                        mBottomControls.setVisibility(View.INVISIBLE);
                        mUpperControls.setVisibility(View.INVISIBLE);
                        mSeekbar.setVisibility(View.GONE);
                        mTimeLayout.setVisibility(View.GONE);
                        mSubtitleView.setLayoutParams(mSubtitleLayoutBottom);
                    }
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationStart(Animation animation) {
                    mOngoingAnimation = true;
                }
            });
            Animation fadeoutTop = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.out_top);
            mBottomControls.startAnimation(fadeoutBottom);
            mUpperControls.startAnimation(fadeoutTop);
            mSeekbar.startAnimation(fadeoutBottom);
            mTimeLayout.startAnimation(fadeoutBottom);
        }
    };
    mHideNavigationRunnable = new Runnable() {
        @Override
        public void run() {
            mPreview.setSystemUiVisibility(mUiOptions);
        }
    };

    mDecorView.setOnSystemUiVisibilityChangeListener(this);
    mSeekbar.setOnSeekBarChangeListener(new OwnOnSeekBarChangeListener(mMediaPlayer));
    mMediaPlayer.setOnCompletionListener(this);
    mMediaPlayer.setOnPreparedListener(this);
    mMediaPlayer.setOnSeekCompleteListener(this);
    mMediaPlayer.setOnErrorListener(this);
    mMediaPlayer.setOnSubtitleDataListener(this);

    RelativeLayout browsingLayout = (RelativeLayout) findViewById(R.id.activity_main_browsing_layout);
    DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) browsingLayout.getLayoutParams();
    Resources resources = getResources();
    int top = 0;
    int bottom = 0;
    RelativeLayout.LayoutParams tempParams;
    int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        top = resources.getDimensionPixelSize(resourceId);
    }
    resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    if (resourceId > 0) {
        bottom = resources.getDimensionPixelSize(resourceId);
    }
    if (navigationBarAtBottom()) {
        tempParams = (RelativeLayout.LayoutParams) mBottomControls.getLayoutParams();
        tempParams.bottomMargin += bottom;
        mBottomControls.setLayoutParams(tempParams);
        tempParams = (RelativeLayout.LayoutParams) mSeekbar.getLayoutParams();
        tempParams.bottomMargin += bottom;
        mSeekbar.setLayoutParams(tempParams);
        params.setMargins(0, top, 0, bottom);
    } else {
        tempParams = (RelativeLayout.LayoutParams) mBottomControls.getLayoutParams();
        tempParams.rightMargin += bottom;
        mBottomControls.setLayoutParams(tempParams);
        params.setMargins(0, top, 0, 0);
    }
    browsingLayout.setLayoutParams(params);
    mDrawerLayout.openDrawer(Gravity.START);

    mMediaPlayer.setOnOutputControlListener(this);
}

From source file:com.albedinsky.android.ui.widget.BaseProgressBar.java

/**
 * Called from one of constructors of this view to perform its initialization.
 * <p>/*from   w w  w .j a va 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>.
 */
@SuppressLint("NewApi")
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    this.mUiThreadId = Thread.currentThread().getId();
    // Use software layer that is required for proper drawing work of progress drawables.
    if (ProgressDrawable.REQUIRES_SOFTWARE_LAYER) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    onAttachDrawable();
    if (mDrawable == null) {
        throw new IllegalArgumentException("No progress drawable has been attached.");
    }
    /**
     * Process attributes.
     */
    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Ui_ProgressBar,
            defStyleAttr, defStyleRes);
    if (typedArray != null) {
        this.processTintValues(context, typedArray);
        final int n = typedArray.getIndexCount();
        for (int i = 0; i < n; i++) {
            final int index = typedArray.getIndex(i);
            if (index == R.styleable.Ui_ProgressBar_android_max) {
                setMax(typedArray.getInt(index, getMax()));
            } else if (index == R.styleable.Ui_ProgressBar_android_progress) {
                setProgress(typedArray.getInt(index, mProgress));
            } else if (index == R.styleable.Ui_ProgressBar_uiColorProgress) {
                mDrawable.setColor(typedArray.getColor(index, mDrawable.getColor()));
            } else if (index == R.styleable.Ui_ProgressBar_uiColorsProgress) {
                final int colorsResId = typedArray.getResourceId(index, -1);
                if (colorsResId > 0 && !isInEditMode()) {
                    mDrawable.setColors(context.getResources().getIntArray(colorsResId));
                }
            } else if (index == R.styleable.Ui_ProgressBar_uiMultiColored) {
                mDrawable.setMultiColored(typedArray.getBoolean(index, mDrawable.isMultiColored()));
            } else if (index == R.styleable.Ui_ProgressBar_uiColorProgressBackground) {
                mDrawable.setBackgroundColor(typedArray.getInt(index, Color.TRANSPARENT));
            } else if (index == R.styleable.Ui_ProgressBar_android_thickness) {
                mDrawable.setThickness(typedArray.getDimensionPixelSize(index, 0));
            } else if (index == R.styleable.Ui_ProgressBar_uiRounded) {
                mDrawable.setRounded(!isInEditMode() && typedArray.getBoolean(index, mDrawable.isRounded()));
            } else if (index == R.styleable.Ui_ProgressBar_uiIndeterminateSpeed) {
                mDrawable.setIndeterminateSpeed(typedArray.getFloat(index, 1));
            }
        }
    }
    mDrawable.setInEditMode(isInEditMode());

    this.applyProgressTint();
    this.applyIndeterminateTint();
    this.applyProgressBackgroundTint();
}

From source file:com.pseudosudostudios.jdd.views.Grid.java

public boolean isReadyToPlay() {
    try {/*from  ww w.j a v  a 2s. c o m*/
        for (Tile[] row : tiles)
            for (Tile t : row)
                for (int c : t.toIntArray())
                    if (c == Color.TRANSPARENT)
                        return false;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

From source file:com.saulcintero.moveon.fragments.Summary4.java

private void lineChartView() {
    TypedValue outValue1 = new TypedValue();
    TypedValue outValue2 = new TypedValue();
    TypedValue outValue3 = new TypedValue();
    TypedValue outValue4 = new TypedValue();
    mContext.getResources().getValue(R.dimen.line_axis_title_text_size_value, outValue1, true);
    mContext.getResources().getValue(R.dimen.line_chart_title_text_size_value, outValue2, true);
    mContext.getResources().getValue(R.dimen.line_labels_text_size_value, outValue3, true);
    mContext.getResources().getValue(R.dimen.line_legend_text_size_value, outValue4, true);
    float lineAxisTitleTextSizeValue = outValue1.getFloat();
    float lineCharTitleTextSizeValue = outValue2.getFloat();
    float lineLabelsTextSizeValue = outValue3.getFloat();
    float lineLegendTextSizeValue = outValue4.getFloat();

    XYMultipleSeriesDataset mDataset = getDataset();

    XYMultipleSeriesRenderer mRenderer = getRenderer();
    mRenderer.setApplyBackgroundColor(true);
    mRenderer.setBackgroundColor(Color.TRANSPARENT);
    mRenderer.setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));
    mRenderer.setAxisTitleTextSize(lineAxisTitleTextSizeValue);
    mRenderer.setChartTitleTextSize(lineCharTitleTextSizeValue);
    mRenderer.setLabelsTextSize(lineLabelsTextSizeValue);
    mRenderer.setLegendTextSize(lineLegendTextSizeValue);
    mRenderer.setMargins(new int[] { 12, 25, 12, 12 });
    mRenderer.setZoomButtonsVisible(true);
    mRenderer.setPointSize(10);// w  ww  . j av  a  2  s .co  m
    mRenderer.setClickEnabled(true);

    mChartView = ChartFactory.getLineChartView(getActivity(), mDataset, mRenderer);

    mChartView.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
            if (seriesSelection != null) {
                UIFunctionUtils.showMessage(mContext, true,
                        (int) seriesSelection.getValue() + " " + getString(R.string.beats_per_minute));
            }
        }
    });

    layout.addView(mChartView);
}

From source file:com.gosuncn.core.util.view.StatusBarUtils.java

/**
 * ?/*  www .j a  v  a 2s. c om*/
 */
private static void setTransparentForWindow(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
        activity.getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
}