List of usage examples for android.graphics Paint ANTI_ALIAS_FLAG
int ANTI_ALIAS_FLAG
To view the source code for android.graphics Paint ANTI_ALIAS_FLAG.
Click Source Link
From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistManagerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mApp = (Common) getActivity().getApplicationContext(); View rootView = (ViewGroup) inflater.inflate(R.layout.fragment_blacklist_manager, container, false); mContext = getActivity().getApplicationContext(); ImageView blacklistImage = (ImageView) rootView.findViewById(R.id.blacklist_image); blacklistImage.setImageResource(UIElementsHelper.getIcon(mContext, "manage_blacklists")); MANAGER_TYPE = getArguments().getString("MANAGER_TYPE"); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Get a cursor with a list of blacklisted elements. if (MANAGER_TYPE.equals("ARTISTS")) { builder.setTitle(R.string.blacklisted_artists); cursor = mApp.getDBAccessHelper().getBlacklistedArtists(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish();/*from ww w . j a va 2 s.com*/ } else { //Load the cursor data into temporary ArrayLists. for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST))); } } } else if (MANAGER_TYPE.equals("ALBUMS")) { builder.setTitle(R.string.blacklisted_albums); cursor = mApp.getDBAccessHelper().getBlacklistedAlbums(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish(); } else { //Load the cursor data into temporary ArrayLists. for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ALBUM))); artistNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST))); } } } else if (MANAGER_TYPE.equals("SONGS")) { builder.setTitle(R.string.blacklisted_songs); cursor = mApp.getDBAccessHelper().getAllBlacklistedSongs(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount() == 0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish(); } else { //Load the cursor data into temporary ArrayLists. for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_TITLE))); artistNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ARTIST))); filePathList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_FILE_PATH))); songIdsList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ID))); } } } else if (MANAGER_TYPE.equals("PLAYLISTS")) { /*builder.setTitle(R.string.blacklisted_playlists); DBAccessHelper playlistsDBHelper = new DBAccessHelper(getActivity()); cursor = playlistsDBHelper.getAllBlacklistedPlaylists(); //Finish the activity if there are no blacklisted elements. if (cursor.getCount()==0) { Toast.makeText(getActivity(), R.string.no_blacklisted_items_found, Toast.LENGTH_LONG).show(); getActivity().finish(); } else { //Load the cursor data into temporary ArrayLists. for (int i=0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); elementNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.PLAYLIST_NAME))); artistNameList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.NUMBER_OF_SONGS))); filePathList.add(cursor.getString(cursor.getColumnIndex(DBAccessHelper.PLAYLIST_FILE_PATH))); } }*/ } else { Toast.makeText(getActivity(), R.string.error_occurred, Toast.LENGTH_LONG).show(); getActivity().finish(); } TextView blacklistManagerInfoText = (TextView) rootView.findViewById(R.id.blacklist_manager_info_text); DragSortListView blacklistManagerListView = (DragSortListView) rootView .findViewById(R.id.blacklist_manager_list); blacklistManagerListView.setRemoveListener(onRemove); blacklistManagerInfoText.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); blacklistManagerInfoText.setPaintFlags( blacklistManagerInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); blacklistManagerListView.setFastScrollEnabled(true); adapter = new BlacklistedElementsAdapter(getActivity(), elementNameList, artistNameList, MANAGER_TYPE); blacklistManagerListView.setAdapter(adapter); return rootView; }
From source file:tw.medfirst.com.project.baseview.CoverFlowView.java
private void init() { setWillNotDraw(false);/*from w w w .ja va2s. c om*/ setClickable(true); mChildTransfromer = new Matrix(); mReflectionTransfromer = new Matrix(); mTouchRect = new RectF(); mTouchRect2 = new ArrayList<RectF>(); for (int i = 0; i < VISIBLE_VIEWS * 2 + 1; i++) { RectF r = new RectF(); mTouchRect2.add(r); } mImageRecorder = new SparseArray<int[]>(); mDrawChildPaint = new Paint(); mDrawChildPaint.setAntiAlias(true); mDrawChildPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mCoverFlowPadding = new Rect(); mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); mScroller = new Scroller(getContext(), new AccelerateDecelerateInterpolator()); mRemoveReflectionPendingArray = new ArrayList<Integer>(); }
From source file:android.support.v7ox.widget.SwitchCompat.java
/** * Construct a new Switch with a default style determined by the given theme attribute, * overriding specific style attributes as requested. * * @param context The Context that will determine this widget's theming. * @param attrs Specification of attributes that should deviate from the default styling. * @param defStyleAttr An attribute in the current theme that contains a * reference to a style resource that supplies default values for * the view. Can be 0 to not look for defaults. *//*from w w w. j av a 2 s .c o m*/ public SwitchCompat(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); final Resources res = getResources(); mTextPaint.density = res.getDisplayMetrics().density; final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.SwitchCompat, defStyleAttr, 0); mThumbDrawable = a.getDrawable(R.styleable.SwitchCompat_android_thumb); if (mThumbDrawable != null) { mThumbDrawable.setCallback(this); } mTrackDrawable = a.getDrawable(R.styleable.SwitchCompat_track); if (mTrackDrawable != null) { mTrackDrawable.setCallback(this); } mTextOn = a.getText(R.styleable.SwitchCompat_android_textOn); mTextOff = a.getText(R.styleable.SwitchCompat_android_textOff); mShowText = a.getBoolean(R.styleable.SwitchCompat_showText, true); mThumbTextPadding = a.getDimensionPixelSize(R.styleable.SwitchCompat_thumbTextPadding, 0); mSwitchMinWidth = a.getDimensionPixelSize(R.styleable.SwitchCompat_switchMinWidth, 0); mSwitchPadding = a.getDimensionPixelSize(R.styleable.SwitchCompat_switchPadding, 0); mSplitTrack = a.getBoolean(R.styleable.SwitchCompat_splitTrack, false); final int appearance = a.getResourceId(R.styleable.SwitchCompat_switchTextAppearance, 0); if (appearance != 0) { setSwitchTextAppearance(context, appearance); } mDrawableManager = AppCompatDrawableManager.get(); a.recycle(); final ViewConfiguration config = ViewConfiguration.get(context); mTouchSlop = config.getScaledTouchSlop(); mMinFlingVelocity = config.getScaledMinimumFlingVelocity(); // Refresh display with current params refreshDrawableState(); setChecked(isChecked()); }
From source file:com.leeon.blank.widget.RangeBarNew.java
private void initPaint() { mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setAntiAlias(true);// w w w . j a v a 2s. com mPaint.setStyle(Style.FILL); mPaint.setTextSize(mTextSize); }
From source file:android.support.v7.widget.SwitchCompat.java
/** * Construct a new Switch with a default style determined by the given theme attribute, * overriding specific style attributes as requested. * * @param context The Context that will determine this widget's theming. * @param attrs Specification of attributes that should deviate from the default styling. * @param defStyleAttr An attribute in the current theme that contains a * reference to a style resource that supplies default values for * the view. Can be 0 to not look for defaults. *//*from w w w .j a v a 2s .com*/ public SwitchCompat(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); final Resources res = getResources(); mTextPaint.density = res.getDisplayMetrics().density; final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.SwitchCompat, defStyleAttr, 0); mThumbDrawable = a.getDrawable(R.styleable.SwitchCompat_android_thumb); if (mThumbDrawable != null) { mThumbDrawable.setCallback(this); } mTrackDrawable = a.getDrawable(R.styleable.SwitchCompat_track); if (mTrackDrawable != null) { mTrackDrawable.setCallback(this); } mTextOn = a.getText(R.styleable.SwitchCompat_android_textOn); mTextOff = a.getText(R.styleable.SwitchCompat_android_textOff); mShowText = a.getBoolean(R.styleable.SwitchCompat_showText, true); mThumbTextPadding = a.getDimensionPixelSize(R.styleable.SwitchCompat_thumbTextPadding, 0); mSwitchMinWidth = a.getDimensionPixelSize(R.styleable.SwitchCompat_switchMinWidth, 0); mSwitchPadding = a.getDimensionPixelSize(R.styleable.SwitchCompat_switchPadding, 0); mSplitTrack = a.getBoolean(R.styleable.SwitchCompat_splitTrack, false); final int appearance = a.getResourceId(R.styleable.SwitchCompat_switchTextAppearance, 0); if (appearance != 0) { setSwitchTextAppearance(context, appearance); } mTintManager = a.getTintManager(); a.recycle(); final ViewConfiguration config = ViewConfiguration.get(context); mTouchSlop = config.getScaledTouchSlop(); mMinFlingVelocity = config.getScaledMinimumFlingVelocity(); // Refresh display with current params refreshDrawableState(); setChecked(isChecked()); }
From source file:edu.winlab.minijarvis.activity.CameraActivity.java
public void setTextPaint() { textPaint = new Paint(); textPaint.setColor(Color.GREEN); textPaint.setFlags(Paint.ANTI_ALIAS_FLAG); textPaint.setTextSize(60);// w ww . ja va 2s. c o m textPaint.setTextAlign(Align.CENTER); }
From source file:com.blestep.sportsbracelet.view.TimelineChartView.java
private void init(Context ctx, AttributeSet attrs, int defStyleAttr) { mUiHandler = new Handler(Looper.getMainLooper(), mMessenger); final Resources res = getResources(); final ViewConfiguration vc = ViewConfiguration.get(ctx); mTouchSlop = vc.getScaledTouchSlop() / 2; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mScroller = new OverScroller(ctx); int footerLabelColor = ContextCompat.getColor(getContext(), R.color.tlcStepsFooterLabelColor); int barItemBg = ContextCompat.getColor(getContext(), R.color.tlcStepsBarItemBg); int highlightBarItemBg = ContextCompat.getColor(getContext(), R.color.tlcStepsHighlightBarItemBg); mBarItemBgPaint = new Paint(); mBarItemBgPaint.setColor(barItemBg); mHighlightBarItemBgPaint = new Paint(); mHighlightBarItemBgPaint.setColor(highlightBarItemBg); mFooterBarHeight = res.getDimension(R.dimen.tlcDefFooterBarHeight); mViewAreaBgPaint = new Paint(); mGraphAreaBgPaint = new Paint(); mGraphAreaBgPaint.setColor(Color.TRANSPARENT); mFooterAreaBgPaint = new Paint(); mFooterAreaBgPaint.setColor(Color.TRANSPARENT); mGraphBottomLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mGraphBottomLinePaint.setColor(Color.WHITE); mGraphBottomLinePaint.setStrokeWidth(1); // //from w w w.ja v a 2s .com mGraphTargetDashedLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mGraphTargetDashedLinePaint.setStyle(Paint.Style.STROKE); mGraphTargetDashedLinePaint.setColor(Color.WHITE); mGraphTargetDashedLinePaint.setStrokeWidth(1); PathEffect pathEffect = new DashPathEffect(new float[] { 9, 3 }, 1); mGraphTargetDashedLinePaint.setPathEffect(pathEffect); // labelPaint?? mLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); mLabelFgPaint.setColor(footerLabelColor); // DisplayMetrics dp = getResources().getDisplayMetrics(); // float labelSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, res.getDimension(R.dimen.tlcDefFooterLabelSize), dp); mLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize)); mHighlightLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); mHighlightLabelFgPaint.setColor(Color.WHITE); mHighlightLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize)); mBarItemWidth = res.getDimension(R.dimen.tlcDefBarItemWidth); mBarItemSpace = res.getDimension(R.dimen.tlcDefBarItemSpace); mTopSpaceHeight = res.getDimension(R.dimen.tlcDefTopSpace); // SurfaceView requires a background if (getBackground() == null) { setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); } // Initialize stuff setupBackgroundHandler(); setupTickLabels(); // Initialize the drawing refs (this will be update when we have // the real size of the canvas) computeBoundAreas(); }
From source file:com.cssn.samplesdk.MainActivity.java
/** * *///from w w w . j a v a 2 s. co m @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Util.LOG_ENABLED) { Utils.appendLog(TAG, "protected void onCreate(Bundle savedInstanceState)"); } // load the model if (savedInstanceState == null) { if (Util.LOG_ENABLED) { Utils.appendLog(TAG, "if (savedInstanceState == null)"); } mainActivityModel = new MainActivityModel(); } else { if (Util.LOG_ENABLED) { Utils.appendLog(TAG, "if (savedInstanceState != null)"); } mainActivityModel = DataContext.getInstance().getMainActivityModel(); // if coming from background and kill the app, restart the model if (mainActivityModel == null) { mainActivityModel = new MainActivityModel(); } } DataContext.getInstance().setContext(getApplicationContext()); String licenseKey = DataContext.getInstance().getLicenseKey(); // load the controller instance acuantAndroidMobileSdkControllerInstance = AcuantAndroidMobileSDKController.getInstance(this, licenseKey); if (!Util.isTablet(this)) { acuantAndroidMobileSdkControllerInstance .setPdf417BarcodeImageDrawable(getResources().getDrawable(R.drawable.barcode)); } acuantAndroidMobileSdkControllerInstance.setWebServiceListener(this); acuantAndroidMobileSdkControllerInstance.setCloudUrl("cssnwebservices.com"); acuantAndroidMobileSdkControllerInstance.setWatermarkText("Powered By Acuant", 0, 0, 30, 0); DisplayMetrics metrics = this.getResources().getDisplayMetrics(); DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int height = displaymetrics.heightPixels; int width = displaymetrics.widthPixels; int minLength = (int) (Math.min(width, height) * 0.9); int maxLength = (int) (minLength * 1.5); int left = minLength / 2 - 50; int top = maxLength / 2 - 100; Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); Typeface currentTypeFace = textPaint.getTypeface(); Typeface bold = Typeface.create(currentTypeFace, Typeface.BOLD); textPaint.setColor(Color.WHITE); textPaint.setTextSize(50); textPaint.setTextAlign(Paint.Align.LEFT); textPaint.setTypeface(bold); Paint.FontMetrics metric = textPaint.getFontMetrics(); acuantAndroidMobileSdkControllerInstance.setInstructionText("Blink Slowly", left, top, textPaint); //acuantAndroidMobileSdkControllerInstance.setShowActionBar(false); //acuantAndroidMobileSdkControllerInstance.setShowStatusBar(false); acuantAndroidMobileSdkControllerInstance.setFlashlight(false); //acuantAndroidMobileSdkControllerInstance.setFlashlight(0,0,50,0); //acuantAndroidMobileSdkControllerInstance.setFlashlightImageDrawable(getResources().getDrawable(R.drawable.lighton), getResources().getDrawable(R.drawable.lightoff)); //acuantAndroidMobileSdkControllerInstance.setShowInitialMessage(true); //acuantAndroidMobileSdkControllerInstance.setCropBarcode(true); //acuantAndroidMobileSdkControllerInstance.setPdf417BarcodeDialogWaitingBarcode("AcuantAndroidMobileSampleSDK","ALIGN AND TAP", 10, "Try Again", "Yes"); acuantAndroidMobileSdkControllerInstance.setCanShowBracketsOnTablet(true); // load several member variables setContentView(R.layout.activity_main); layoutCards = (LinearLayout) findViewById(R.id.cardImagesLayout); layoutBackImage = (RelativeLayout) findViewById(R.id.relativeLayoutBackImage); layoutFrontImage = (RelativeLayout) findViewById(R.id.relativeLayoutFrontImage); frontImageView = (ImageView) findViewById(R.id.frontImageView); backImageView = (ImageView) findViewById(R.id.backImageView); editTextLicense = (EditText) findViewById(R.id.editTextLicenceKey); editTextLicense.setText(DataContext.getInstance().getLicenseKey()); txtTapToCaptureFront = (TextView) findViewById(R.id.txtTapToCaptureFront); txtTapToCaptureBack = (TextView) findViewById(R.id.txtTapToCaptureBack); activateLicenseButton = (Button) findViewById(R.id.activateLicenseButton); processCardButton = (Button) findViewById(R.id.processCardButton); processCardButton.setVisibility(View.INVISIBLE); editTextLicense.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { validateLicenseKey(editTextLicense.getText().toString()); DataContext.getInstance().setLicenseKey(editTextLicense.getText().toString()); return true; } }); // it is necessary to use a post UI call, because of the previous set text on 'editTextLicense' new Handler().post(new Runnable() { @Override public void run() { editTextLicense.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { mainActivityModel.setState(State.NO_VALIDATED); updateActivateLicenseButtonFromModel(); } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { } }); } }); editTextLicense.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { hideVirtualKeyboard(); } } }); // update the UI from the model updateUI(); acuantAndroidMobileSdkControllerInstance.setCardCroppingListener(this); acuantAndroidMobileSdkControllerInstance.setAcuantErrorListener(this); if (Utils.LOG_ENABLED) { Utils.appendLog(TAG, "getScreenOrientation()=" + Util.getScreenOrientation(this)); } }
From source file:cn.edu.zafu.easemob.imagecoverflow.CoverFlowView.java
private void init() { setWillNotDraw(false);//w ww. j a v a2s. c o m setClickable(true); mChildTransformer = new Matrix(); mReflectionTransformer = new Matrix(); mTouchRect = new RectF(); mImageRecorder = new SparseArray<int[]>(); mDrawChildPaint = new Paint(); mDrawChildPaint.setAntiAlias(true); mDrawChildPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mCoverFlowPadding = new Rect(); mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); mScroller = new Scroller(getContext(), new AccelerateDecelerateInterpolator()); }
From source file:com.aniruddhc.acemusic.player.Dialogs.ID3sSongEditorDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mContext = getActivity();/* w w w .j av a2s . c o m*/ parentActivity = getActivity(); dialogFragment = this; rootView = (View) parentActivity.getLayoutInflater().inflate(R.layout.fragment_edit_id3_artist_album_dialog, null); titleText = (TextView) rootView.findViewById(R.id.edit_title_text); artistText = (TextView) rootView.findViewById(R.id.edit_artist_text); albumText = (TextView) rootView.findViewById(R.id.edit_album_text); albumArtistText = (TextView) rootView.findViewById(R.id.edit_album_artist_text); genreText = (TextView) rootView.findViewById(R.id.edit_genre_text); producerText = (TextView) rootView.findViewById(R.id.edit_producer_text); yearText = (TextView) rootView.findViewById(R.id.edit_year_text); trackText = (TextView) rootView.findViewById(R.id.edit_track_text); ofText = (TextView) rootView.findViewById(R.id.text_of); commentsText = (TextView) rootView.findViewById(R.id.edit_comment_text); titleEditText = (EditText) rootView.findViewById(R.id.edit_title_field); artistEditText = (EditText) rootView.findViewById(R.id.edit_artist_field); albumEditText = (EditText) rootView.findViewById(R.id.edit_album_field); albumArtistEditText = (EditText) rootView.findViewById(R.id.edit_album_artist_field); genreEditText = (EditText) rootView.findViewById(R.id.edit_genre_field); producerEditText = (EditText) rootView.findViewById(R.id.edit_producer_field); yearEditText = (EditText) rootView.findViewById(R.id.edit_year_field); trackEditText = (EditText) rootView.findViewById(R.id.edit_track_field); trackTotalEditText = (EditText) rootView.findViewById(R.id.edit_track_total_field); commentsEditText = (EditText) rootView.findViewById(R.id.edit_comment_field); titleCheckbox = (CheckBox) rootView.findViewById(R.id.title_checkbox); artistCheckbox = (CheckBox) rootView.findViewById(R.id.artist_checkbox); albumCheckbox = (CheckBox) rootView.findViewById(R.id.album_checkbox); albumArtistCheckbox = (CheckBox) rootView.findViewById(R.id.album_artist_checkbox); genreCheckbox = (CheckBox) rootView.findViewById(R.id.genre_checkbox); producerCheckbox = (CheckBox) rootView.findViewById(R.id.producer_checkbox); yearCheckbox = (CheckBox) rootView.findViewById(R.id.year_checkbox); trackCheckbox = (CheckBox) rootView.findViewById(R.id.track_checkbox); commentCheckbox = (CheckBox) rootView.findViewById(R.id.comment_checkbox); titleText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); artistText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumArtistText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); genreText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); producerText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); yearText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); ofText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); commentsText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); titleText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); artistText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); albumText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); albumArtistText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); genreText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); producerText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); yearText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); trackText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); ofText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); commentsText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG | Paint.FAKE_BOLD_TEXT_FLAG); titleEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); artistEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); albumArtistEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); genreEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); producerEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); yearEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); trackTotalEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); commentsEditText.setTypeface(TypefaceHelper.getTypeface(parentActivity, "RobotoCondensed-Light")); titleEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); artistEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); albumEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); albumArtistEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); genreEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); producerEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); yearEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); trackEditText.setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); trackTotalEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); commentsEditText .setPaintFlags(titleText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); //Keep all the fields locked by default. titleCheckbox.setChecked(false); artistCheckbox.setChecked(false); albumCheckbox.setChecked(false); albumArtistCheckbox.setChecked(false); genreCheckbox.setChecked(false); producerCheckbox.setChecked(false); yearCheckbox.setChecked(false); trackCheckbox.setChecked(false); commentCheckbox.setChecked(false); //Disable all EditTexts by default. titleEditText.setEnabled(false); artistEditText.setEnabled(false); albumEditText.setEnabled(false); albumArtistEditText.setEnabled(false); genreEditText.setEnabled(false); producerEditText.setEnabled(false); yearEditText.setEnabled(false); trackEditText.setEnabled(false); commentsEditText.setEnabled(false); //Register click registers on each checkbox. titleCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { titleEdited = true; titleEditText.setEnabled(true); } else { titleEdited = false; titleEditText.setEnabled(false); } } }); artistCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { artistEdited = true; artistEditText.setEnabled(true); ; } else { artistEdited = false; artistEditText.setEnabled(false); } } }); albumArtistCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { albumEdited = true; albumEditText.setEnabled(true); ; } else { albumEdited = false; albumEditText.setEnabled(false); } } }); albumCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { albumArtistEdited = true; albumArtistEditText.setEnabled(true); ; } else { albumArtistEdited = false; albumArtistEditText.setEnabled(false); } } }); genreCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { genreEdited = true; genreEditText.setEnabled(true); ; } else { genreEdited = false; genreEditText.setEnabled(false); } } }); producerCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { producerEdited = true; producerEditText.setEnabled(true); ; } else { producerEdited = false; producerEditText.setEnabled(false); } } }); yearCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { yearEdited = true; yearEditText.setEnabled(true); ; } else { yearEdited = false; yearEditText.setEnabled(false); } } }); trackCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { trackEdited = true; trackEditText.setEnabled(true); ; } else { trackEdited = false; trackEditText.setEnabled(false); } } }); commentCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean checked) { if (checked == true) { commentEdited = true; commentsEditText.setEnabled(true); ; } else { commentEdited = false; commentsEditText.setEnabled(false); } } }); //Get the song uri. SONG_URI = getArguments().getString("SONG"); //Get the calling Fragment and retrieve the child view from it. CALLING_FRAGMENT = getArguments().getString("CALLING_FRAGMENT"); if (SONG_URI != null) { //Populate the ArrayLists with the song tags. try { getSongTags(SONG_URI); } catch (CannotReadException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TagException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ReadOnlyFileException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidAudioFrameException e) { // TODO Auto-generated catch block e.printStackTrace(); } } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Set the dialog title. builder.setTitle(R.string.edit_tags); builder.setView(rootView); builder.setPositiveButton(R.string.save, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialogFragment.dismiss(); boolean saveSucceeded = saveSongTags(SONG_URI); //Check if the write operations succeeded. If they didn't, display an error message. if (saveSucceeded == true) { Toast.makeText(getActivity().getApplicationContext(), R.string.song_tags_saved, Toast.LENGTH_SHORT).show(); /* //Reinitialize the calling fragment. if (CALLING_FRAGMENT.equals("SONGS_FRAGMENT")) { } else if (CALLING_FRAGMENT.equals("ARTISTS_FLIPPED_SONGS_FRAGMENT")) { //ArtistsFlippedSongsFragment.getCursor(); ArtistsFlippedSongsFragment.songsListViewAdapter.notifyDataSetChanged(); } else if (CALLING_FRAGMENT.equals("ALBUMS_FLIPPED_FRAGMENT")) { AlbumsFlippedFragment.getCursor(); AlbumsFlippedFragment.albumsFlippedListViewAdapter.notifyDataSetChanged(); } else if (CALLING_FRAGMENT.equals("ALBUM_ARTISTS_FLIPPED_SONGS_FRAGMENT")) { AlbumArtistsFlippedSongsFragment.getCursor(); AlbumArtistsFlippedSongsFragment.songsListViewAdapter.notifyDataSetChanged(); } else if (CALLING_FRAGMENT.equals("GENRES_FLIPPED_SONGS_FRAGMENT")) { GenresFlippedFragment.getCursor(); GenresFlippedFragment.genresFlippedListViewAdapter.notifyDataSetChanged(); }*/ } else { Toast.makeText(parentActivity, R.string.error_occurred_tags, Toast.LENGTH_LONG).show(); } } }); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return builder.create(); }