Example usage for android.graphics Paint ANTI_ALIAS_FLAG

List of usage examples for android.graphics Paint ANTI_ALIAS_FLAG

Introduction

In this page you can find the example usage for android.graphics Paint ANTI_ALIAS_FLAG.

Prototype

int ANTI_ALIAS_FLAG

To view the source code for android.graphics Paint ANTI_ALIAS_FLAG.

Click Source Link

Document

Paint flag that enables antialiasing when drawing.

Usage

From source file:com.dongdong.wheel.WheelView.java

/**
 * Initializes resources/*from ww w. j  a va  2s .co m*/
 */
private void initResourcesIfNecessary() {
    if (mItemsPaint == null) {
        mItemsPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG);
        //mItemsPaint.density = getResources().getDisplayMetrics().density;
        mItemsPaint.setTextSize(TEXT_SIZE);
    }

    if (mValuePaint == null) {
        mValuePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.DITHER_FLAG);
        //mValuePaint.density = getResources().getDisplayMetrics().density;
        mValuePaint.setTextSize(TEXT_SIZE);
        mValuePaint.setShadowLayer(0.1f, 0, 0.1f, 0xFFC0C0C0);
    }

    if (mCenterDrawable == null) {
        mCenterDrawable = ContextCompat.getDrawable(getContext(), R.drawable.wheel_val);
    }

    if (mTopShadow == null) {
        mTopShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (mBottomShadow == null) {
        mBottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}

From source file:de.uni.stuttgart.informatik.ToureNPlaner.UI.Activities.MapScreen.MapScreen.java

private void setupWayOverlay() {
    Path p = new Path();
    p.moveTo(4.f, 0.f);/*from  w w  w  . j  a v a2 s  . c o  m*/
    p.lineTo(0.f, -4.f);
    p.lineTo(8.f, -4.f);
    p.lineTo(12.f, 0.f);
    p.lineTo(8.f, 4.f);
    p.lineTo(0.f, 4.f);

    Paint fastWayOverlayColor = new Paint(Paint.ANTI_ALIAS_FLAG);
    fastWayOverlayColor.setStyle(Paint.Style.STROKE);
    fastWayOverlayColor.setColor(Color.BLUE);
    fastWayOverlayColor.setAlpha(160);
    fastWayOverlayColor.setStrokeWidth(5.f);
    fastWayOverlayColor.setStrokeJoin(Paint.Join.ROUND);
    fastWayOverlayColor.setPathEffect(new ComposePathEffect(
            new PathDashPathEffect(p, 12.f, 0.f, PathDashPathEffect.Style.ROTATE), new CornerPathEffect(30.f)));

    // create the WayOverlay and add the ways
    this.fastWayOverlay = new FastWayOverlay(session, fastWayOverlayColor);
    mapView.getOverlays().add(this.fastWayOverlay);
    Result result = session.getResult();
    if (result != null) {
        addPathToMap(result.getWay());
    }
}

From source file:com.Duo.music.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;/*from  ww w .j a va2 s . com*/
    nowPlayingQueueFragment = this;
    sharedPreferences = mContext.getSharedPreferences("com.jams.music.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:com.jelly.music.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;/* w  ww  . j  a v a 2s  .  c o m*/
    nowPlayingQueueFragment = this;
    sharedPreferences = mContext.getSharedPreferences("com.jelly.music.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: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;//from   ww w  .  ja va2s  .c  o m
    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:com.abhinavjhanwar.android.egg.neko.Cat.java

public Bitmap createLargeBitmap(Context context) {
    final Resources res = context.getResources();
    final int w = res.getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
    final int h = res.getDimensionPixelSize(android.R.dimen.notification_large_icon_height);

    Bitmap result = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(result);
    final Paint pt = new Paint();
    float[] hsv = new float[3];
    Color.colorToHSV(mBodyColor, hsv);
    hsv[2] = (hsv[2] > 0.5f) ? (hsv[2] - 0.25f) : (hsv[2] + 0.25f);
    pt.setColor(Color.HSVToColor(hsv));
    pt.setFlags(Paint.ANTI_ALIAS_FLAG);
    float r = w / 2;
    canvas.drawCircle(r, r, r, pt);/*w  ww .  ja  v  a2 s.c o  m*/
    int m = w / 10;

    slowDraw(canvas, m, m, w - m - m, h - m - m);

    return result;
}

From source file:com.aniruddhc.acemusic.player.EqualizerActivity.EqualizerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    //Context./* www  . ja v  a  2s  . com*/
    mContext = getApplicationContext();
    mApp = (Common) mContext.getApplicationContext();
    mFragment = this;

    setTheme();
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_equalizer);

    //Equalizer container elements.
    mScrollView = (ScrollView) findViewById(R.id.equalizerScrollView);
    mScrollView.setBackgroundColor(UIElementsHelper.getBackgroundColor(mContext));

    //50Hz equalizer controls.
    equalizer50HzSeekBar = (VerticalSeekBar) findViewById(R.id.equalizer50Hz);
    text50HzGainTextView = (TextView) findViewById(R.id.text50HzGain);
    text50Hz = (TextView) findViewById(R.id.text50Hz);

    //130Hz equalizer controls.
    equalizer130HzSeekBar = (VerticalSeekBar) findViewById(R.id.equalizer130Hz);
    text130HzGainTextView = (TextView) findViewById(R.id.text130HzGain);
    text130Hz = (TextView) findViewById(R.id.text130Hz);

    //320Hz equalizer controls.
    equalizer320HzSeekBar = (VerticalSeekBar) findViewById(R.id.equalizer320Hz);
    text320HzGainTextView = (TextView) findViewById(R.id.text320HzGain);
    text320Hz = (TextView) findViewById(R.id.text320Hz);

    //800Hz equalizer controls.
    equalizer800HzSeekBar = (VerticalSeekBar) findViewById(R.id.equalizer800Hz);
    text800HzGainTextView = (TextView) findViewById(R.id.text800HzGain);
    text800Hz = (TextView) findViewById(R.id.text800Hz);

    //2kHz equalizer controls.
    equalizer2kHzSeekBar = (VerticalSeekBar) findViewById(R.id.equalizer2kHz);
    text2kHzGainTextView = (TextView) findViewById(R.id.text2kHzGain);
    text2kHz = (TextView) findViewById(R.id.text2kHz);

    //5kHz equalizer controls.
    equalizer5kHzSeekBar = (VerticalSeekBar) findViewById(R.id.equalizer5kHz);
    text5kHzGainTextView = (TextView) findViewById(R.id.text5kHzGain);
    text5kHz = (TextView) findViewById(R.id.text5kHz);

    //12.5kHz equalizer controls.
    equalizer12_5kHzSeekBar = (VerticalSeekBar) findViewById(R.id.equalizer12_5kHz);
    text12_5kHzGainTextView = (TextView) findViewById(R.id.text12_5kHzGain);
    text12_5kHz = (TextView) findViewById(R.id.text12_5kHz);

    //Equalizer preset controls.
    loadPresetButton = (RelativeLayout) findViewById(R.id.loadPresetButton);
    saveAsPresetButton = (RelativeLayout) findViewById(R.id.saveAsPresetButton);
    resetAllButton = (RelativeLayout) findViewById(R.id.resetAllButton);
    loadPresetText = (TextView) findViewById(R.id.load_preset_text);
    savePresetText = (TextView) findViewById(R.id.save_as_preset_text);
    resetAllText = (TextView) findViewById(R.id.reset_all_text);

    //Audio FX elements.
    virtualizerSeekBar = (SeekBar) findViewById(R.id.virtualizer_seekbar);
    bassBoostSeekBar = (SeekBar) findViewById(R.id.bass_boost_seekbar);
    reverbSpinner = (Spinner) findViewById(R.id.reverb_spinner);
    virtualizerTitle = (TextView) findViewById(R.id.virtualizer_title_text);
    bassBoostTitle = (TextView) findViewById(R.id.bass_boost_title_text);
    reverbTitle = (TextView) findViewById(R.id.reverb_title_text);

    text50HzGainTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text130HzGainTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text320HzGainTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text800HzGainTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text2kHzGainTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text5kHzGainTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text12_5kHzGainTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text50Hz.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text130Hz.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text320Hz.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text800Hz.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text2kHz.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text5kHz.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    text12_5kHz.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));

    loadPresetText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Bold"));
    savePresetText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Bold"));
    resetAllText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Bold"));

    text50HzGainTextView.setPaintFlags(
            text50HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text130HzGainTextView.setPaintFlags(
            text130HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text320HzGainTextView.setPaintFlags(
            text320HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text800HzGainTextView.setPaintFlags(
            text130HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text2kHzGainTextView.setPaintFlags(
            text320HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text5kHzGainTextView.setPaintFlags(
            text130HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text12_5kHzGainTextView.setPaintFlags(
            text320HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text50Hz.setPaintFlags(text50Hz.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text130Hz.setPaintFlags(text130Hz.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text320Hz.setPaintFlags(text320Hz.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text800Hz.setPaintFlags(text800Hz.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text2kHz.setPaintFlags(text2kHz.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text5kHz.setPaintFlags(text5kHz.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    text12_5kHz.setPaintFlags(text12_5kHz.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    loadPresetText.setPaintFlags(
            text50HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    savePresetText.setPaintFlags(
            text50HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    resetAllText.setPaintFlags(
            text50HzGainTextView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

    text50HzGainTextView.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text130HzGainTextView.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text320HzGainTextView.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text800HzGainTextView.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text2kHzGainTextView.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text5kHzGainTextView.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text12_5kHzGainTextView.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text50Hz.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text130Hz.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text320Hz.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text800Hz.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text2kHz.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text5kHz.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    text12_5kHz.setTextColor(UIElementsHelper.getSmallTextColor(mContext));

    //Init reverb presets.
    ArrayList<String> reverbPresets = new ArrayList<String>();
    reverbPresets.add("None");
    reverbPresets.add("Large Hall");
    reverbPresets.add("Large Room");
    reverbPresets.add("Medium Hall");
    reverbPresets.add("Medium Room");
    reverbPresets.add("Small Room");
    reverbPresets.add("Plate");

    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            reverbPresets);
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    reverbSpinner.setAdapter(dataAdapter);

    //Set the max values for the seekbars.
    virtualizerSeekBar.setMax(1000);
    bassBoostSeekBar.setMax(1000);

    virtualizerTitle.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    virtualizerTitle.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    virtualizerTitle
            .setPaintFlags(virtualizerTitle.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    bassBoostTitle.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    bassBoostTitle.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    bassBoostTitle
            .setPaintFlags(bassBoostTitle.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    reverbTitle.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Regular"));
    reverbTitle.setTextColor(UIElementsHelper.getSmallTextColor(mContext));
    reverbTitle.setPaintFlags(reverbTitle.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    resetAllButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            //Reset all sliders to 0.
            equalizer50HzSeekBar.setProgressAndThumb(16);
            equalizer130HzSeekBar.setProgressAndThumb(16);
            equalizer320HzSeekBar.setProgressAndThumb(16);
            equalizer800HzSeekBar.setProgressAndThumb(16);
            equalizer2kHzSeekBar.setProgressAndThumb(16);
            equalizer5kHzSeekBar.setProgressAndThumb(16);
            equalizer12_5kHzSeekBar.setProgressAndThumb(16);
            virtualizerSeekBar.setProgress(0);
            bassBoostSeekBar.setProgress(0);
            reverbSpinner.setSelection(0, false);

            //Apply the new setings to the service.
            applyCurrentEQSettings();

            //Show a confirmation toast.
            Toast.makeText(mContext, R.string.eq_reset, Toast.LENGTH_SHORT).show();

        }

    });

    loadPresetButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            buildLoadPresetDialog().show();

        }

    });

    saveAsPresetButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            buildSavePresetDialog().show();

        }

    });

    equalizer50HzSeekBar.setOnSeekBarChangeListener(equalizer50HzListener);
    equalizer130HzSeekBar.setOnSeekBarChangeListener(equalizer130HzListener);
    equalizer320HzSeekBar.setOnSeekBarChangeListener(equalizer320HzListener);
    equalizer800HzSeekBar.setOnSeekBarChangeListener(equalizer800HzListener);
    equalizer2kHzSeekBar.setOnSeekBarChangeListener(equalizer2kHzListener);
    equalizer5kHzSeekBar.setOnSeekBarChangeListener(equalizer5kHzListener);
    equalizer12_5kHzSeekBar.setOnSeekBarChangeListener(equalizer12_5kHzListener);

    virtualizerSeekBar.setOnSeekBarChangeListener(virtualizerListener);
    bassBoostSeekBar.setOnSeekBarChangeListener(bassBoostListener);
    reverbSpinner.setOnItemSelectedListener(reverbListener);

    //Get the saved equalizer settings and apply them to the UI elements.
    new AsyncInitSlidersTask().execute();

}

From source file:com.chrynan.guitarchords.view.GuitarChordView.java

private void initPaint() {
    bridgeNutPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    bridgeNutColor = DEFAULT_COLOR;/*from   w  w w .  j a  v a2s.c o  m*/
    bridgeNutPaint.setColor(bridgeNutColor);
    bridgeNutPaint.setStyle(Paint.Style.STROKE);
    bridgeNutPaint.setStrokeCap(Paint.Cap.BUTT);
    fretMarkerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    fretMarkerColor = DEFAULT_COLOR;
    fretMarkerPaint.setColor(fretMarkerColor);
    fretMarkerPaint.setStyle(Paint.Style.STROKE);
    fretMarkerPaint.setStrokeCap(Paint.Cap.ROUND);
    stringPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    stringColor = DEFAULT_COLOR;
    stringPaint.setColor(stringColor);
    stringPaint.setStyle(Paint.Style.STROKE);
    stringPaint.setStrokeCap(Paint.Cap.BUTT);
    fretNumberPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    fretNumberColor = DEFAULT_COLOR;
    fretNumberPaint.setColor(fretNumberColor);
    fretNumberPaint.setTextAlign(Paint.Align.CENTER);
    stringMarkerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    stringMarkerColor = DEFAULT_COLOR;
    stringMarkerPaint.setColor(stringMarkerColor);
    stringMarkerPaint.setTextAlign(Paint.Align.CENTER);
    notePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    noteColor = DEFAULT_COLOR;
    notePaint.setColor(noteColor);
    noteNumberPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    noteNumberColor = WHITE;
    noteNumberPaint.setColor(noteNumberColor);
    noteNumberPaint.setTextAlign(Paint.Align.CENTER);
    barLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    barLineColor = DEFAULT_COLOR;
    barLinePaint.setColor(barLineColor);
    barLinePaint.setStyle(Paint.Style.STROKE);
}

From source file:com.lovely3x.eavlibrary.EasyAdapterView.java

public EasyAdapterView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    this.mDebugPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    this.mDebugPaint.setColor(Color.RED);
    this.mDebugPaint.setStrokeWidth(5);
    this.mDebugPaint.setTextSize(
            TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics()));

    ViewConfiguration config = ViewConfiguration.get(context);
    mTouchSlop = config.getScaledTouchSlop() / 2;
    this.mVelocity = VelocityTracker.obtain();

    mMinimumVelocity = config.getScaledMinimumFlingVelocity();
    mMaximumVelocity = config.getScaledMaximumFlingVelocity();

    this.mTopEdgeEffect = new EdgeEffect(getContext());
    this.mBottomEdgeEffect = new EdgeEffect(getContext());

    this.mLeftEdgeEffect = new EdgeEffect(getContext());
    this.mRightEdgeEffect = new EdgeEffect(getContext());

    mDividerHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f,
            getResources().getDisplayMetrics());
    mDivider = new ColorDrawable(Color.LTGRAY);

    if (attrs != null)
        initAttrs(attrs);/*  w  w  w  .  ja v a2  s .  c om*/

    setWillNotDraw(false);

    previewInEditMode();
}

From source file:com.lovejjfg.demo.TouchCircleView.java

private void initPaintPath() {

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    paint.setAntiAlias(true);//from   ww w .  j  a  v  a2s.  c  o m
    paint.setStrokeWidth(20);
    paint.setColor(Color.RED);
    paint.setStrokeCap(Paint.Cap.SQUARE);

    secPaint = new Paint(paint);
    secPaint.setColor(Color.GREEN);

    mixPaint = new Paint(paint);
    innerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    innerPaint.setStyle(Paint.Style.STROKE);
    innerPaint.setAntiAlias(true);
    innerPaint.setColor(Color.WHITE);
    innerPaint.setStrokeWidth(mBorderWidth);

    mHookPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mHookPaint.setStyle(Paint.Style.STROKE);
    mHookPaint.setStrokeCap(Paint.Cap.ROUND);
    mHookPaint.setStrokeWidth(mBorderWidth);
    mHookPaint.setColor(Color.WHITE);

    path = new Path();
    mArrow = new Path();
    mHook = new Path();
    mError = new Path();
}