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.jams.music.player.LauncherActivity.LauncherActivity.java
@SuppressLint("NewApi") @Override/*from w ww. jav a 2 s. c om*/ public void onCreate(Bundle savedInstanceState) { setTheme(R.style.AppThemeNoActionBar); super.onCreate(savedInstanceState); setContentView(R.layout.activity_launcher); mContext = this; mActivity = this; mApp = (Common) mContext.getApplicationContext(); mHandler = new Handler(); //Increment the start count. This value will be used to determine when the library should be rescanned. int startCount = mApp.getSharedPreferences().getInt("START_COUNT", 1); mApp.getSharedPreferences().edit().putInt("START_COUNT", startCount + 1).commit(); //Save the dimensions of the layout for later use on KitKat devices. final RelativeLayout launcherRootView = (RelativeLayout) findViewById(R.id.launcher_root_view); launcherRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { try { int screenDimens[] = new int[2]; int screenHeight = 0; int screenWidth = 0; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { //API levels 14, 15 and 16. screenDimens = getTrueDeviceResolution(); screenWidth = screenDimens[0]; screenHeight = screenDimens[1]; } else { //API levels 17+. Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getRealMetrics(metrics); screenHeight = metrics.heightPixels; screenWidth = metrics.widthPixels; } int layoutHeight = launcherRootView.getHeight(); int layoutWidth = launcherRootView.getWidth(); int extraHeight = screenHeight - layoutHeight; int extraWidth = screenWidth = layoutWidth; mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT", layoutHeight).commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH", layoutWidth).commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT_LAND", layoutWidth - extraHeight) .commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH_LAND", screenHeight).commit(); } catch (Exception e) { e.printStackTrace(); } } }); //Build the music library based on the user's scan frequency preferences. int scanFrequency = mApp.getSharedPreferences().getInt("SCAN_FREQUENCY", 5); int updatedStartCount = mApp.getSharedPreferences().getInt("START_COUNT", 1); //Launch the appropriate activity based on the "FIRST RUN" flag. if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true) { //Create the default Playlists directory if it doesn't exist. File playlistsDirectory = new File(Environment.getExternalStorageDirectory() + "/Playlists/"); if (!playlistsDirectory.exists() || !playlistsDirectory.isDirectory()) { playlistsDirectory.mkdir(); } //Disable equalizer for HTC devices by default. if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true && Build.PRODUCT.contains("HTC")) { mApp.getSharedPreferences().edit().putBoolean("EQUALIZER_ENABLED", false).commit(); } //Send out a test broadcast to initialize the homescreen/lockscreen widgets. sendBroadcast(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); Intent intent = new Intent(this, WelcomeActivity.class); startActivity(intent); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } else if (mApp.isBuildingLibrary()) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setText(R.string.jams_is_building_library); buildingLibraryLayout.setVisibility(View.VISIBLE); //Initialize the runnable that will fire once the scan process is complete. mHandler.post(scanFinishedCheckerRunnable); } else if (mApp.getSharedPreferences().getBoolean("RESCAN_ALBUM_ART", false) == true) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setText(R.string.jams_is_caching_artwork); initScanProcess(0); } else if ((mApp.getSharedPreferences().getBoolean("REBUILD_LIBRARY", false) == true) || (scanFrequency == 0 && mApp.isScanFinished() == false) || (scanFrequency == 1 && mApp.isScanFinished() == false && updatedStartCount % 3 == 0) || (scanFrequency == 2 && mApp.isScanFinished() == false && updatedStartCount % 5 == 0) || (scanFrequency == 3 && mApp.isScanFinished() == false && updatedStartCount % 10 == 0) || (scanFrequency == 4 && mApp.isScanFinished() == false && updatedStartCount % 20 == 0)) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); initScanProcess(1); } else { //Check if this activity was called from Settings. if (getIntent().hasExtra("UPGRADE")) { if (getIntent().getExtras().getBoolean("UPGRADE") == true) { mExplicitShowTrialFragment = true; } else { mExplicitShowTrialFragment = false; } } //initInAppBilling(); launchMainActivity(); } //Fire away a report to Google Analytics. try { if (mApp.isGoogleAnalyticsEnabled() == true) { EasyTracker easyTracker = EasyTracker.getInstance(this); easyTracker.send(MapBuilder.createEvent("Genesis Music startup.", // Event category (required) "User started Genesis Music.", // Event action (required) "User started Genesis Music.", // Event label null) // Event value .build()); } } catch (Exception e) { e.printStackTrace(); } }
From source file:info.bartowski.easteregg.MLand.java
public MLand(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); setFocusable(true);// w w w . ja v a2 s.co m PARAMS = new Params(getResources()); mTimeOfDay = irand(0, SKIES.length - 1); mScene = irand(0, SCENE_COUNT); mTouchPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTouchPaint.setColor(0x80FFFFFF); mTouchPaint.setStyle(Paint.Style.FILL); mPlayerTracePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPlayerTracePaint.setColor(0x80FFFFFF); mPlayerTracePaint.setStyle(Paint.Style.STROKE); mPlayerTracePaint.setStrokeWidth(2 * dp); // we assume everything will be laid out left|top setLayoutDirection(LAYOUT_DIRECTION_LTR); setupPlayers(DEFAULT_PLAYERS); }
From source file:com.jelly.music.player.LauncherActivity.LauncherActivity.java
@SuppressLint("NewApi") @Override//from www.j av a 2s . c o m public void onCreate(Bundle savedInstanceState) { Parse.initialize(this, "aZiGV1G02m1Mj3SaaD9riuyrucDclK7abpc2Ibz3", "eCPoMrWrFnnHPVmBbDDIAFAMTA5EJLgtHLS2U9St"); Map<String, String> dimensions = new HashMap<String, String>(); // What type of news is this? dimensions.put("category", "politics"); // Is it a weekday or the weekend? dimensions.put("dayType", "weekday"); // Send the dimensions to Parse along with the 'read' event ParseAnalytics.trackEvent("read", dimensions); setTheme(R.style.AppThemeNoActionBar); super.onCreate(savedInstanceState); setContentView(R.layout.activity_launcher); mContext = this; mActivity = this; mApp = (Common) mContext.getApplicationContext(); mHandler = new Handler(); //Increment the start count. This value will be used to determine when the library should be rescanned. int startCount = mApp.getSharedPreferences().getInt("START_COUNT", 1); mApp.getSharedPreferences().edit().putInt("START_COUNT", startCount + 1).commit(); //Save the dimensions of the layout for later use on KitKat devices. final RelativeLayout launcherRootView = (RelativeLayout) findViewById(R.id.launcher_root_view); launcherRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { try { int screenDimens[] = new int[2]; int screenHeight = 0; int screenWidth = 0; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { //API levels 14, 15 and 16. screenDimens = getTrueDeviceResolution(); screenWidth = screenDimens[0]; screenHeight = screenDimens[1]; } else { //API levels 17+. Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getRealMetrics(metrics); screenHeight = metrics.heightPixels; screenWidth = metrics.widthPixels; } int layoutHeight = launcherRootView.getHeight(); int layoutWidth = launcherRootView.getWidth(); int extraHeight = screenHeight - layoutHeight; int extraWidth = screenWidth = layoutWidth; mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT", layoutHeight).commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH", layoutWidth).commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT_LAND", layoutWidth - extraHeight) .commit(); mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH_LAND", screenHeight).commit(); } catch (Exception e) { e.printStackTrace(); } } }); //Build the music library based on the user's scan frequency preferences. int scanFrequency = mApp.getSharedPreferences().getInt("SCAN_FREQUENCY", 5); int updatedStartCount = mApp.getSharedPreferences().getInt("START_COUNT", 1); //Launch the appropriate activity based on the "FIRST RUN" flag. if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true) { //Create the default Playlists directory if it doesn't exist. File playlistsDirectory = new File(Environment.getExternalStorageDirectory() + "/Playlists/"); if (!playlistsDirectory.exists() || !playlistsDirectory.isDirectory()) { playlistsDirectory.mkdir(); } //Disable equalizer for HTC devices by default. if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true && Build.PRODUCT.contains("HTC")) { mApp.getSharedPreferences().edit().putBoolean("EQUALIZER_ENABLED", false).commit(); } //Send out a test broadcast to initialize the homescreen/lockscreen widgets. sendBroadcast(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); Intent intent = new Intent(this, WelcomeActivity.class); startActivity(intent); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } else if (mApp.isBuildingLibrary()) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setText(R.string.jams_is_building_library); buildingLibraryLayout.setVisibility(View.VISIBLE); //Initialize the runnable that will fire once the scan process is complete. mHandler.post(scanFinishedCheckerRunnable); } else if (mApp.getSharedPreferences().getBoolean("RESCAN_ALBUM_ART", false) == true) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setText(R.string.jams_is_caching_artwork); initScanProcess(0); } else if ((mApp.getSharedPreferences().getBoolean("REBUILD_LIBRARY", false) == true) || (scanFrequency == 0 && mApp.isScanFinished() == false) || (scanFrequency == 1 && mApp.isScanFinished() == false && updatedStartCount % 3 == 0) || (scanFrequency == 2 && mApp.isScanFinished() == false && updatedStartCount % 5 == 0) || (scanFrequency == 3 && mApp.isScanFinished() == false && updatedStartCount % 10 == 0) || (scanFrequency == 4 && mApp.isScanFinished() == false && updatedStartCount % 20 == 0)) { buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text); buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info); buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout); buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryInfoText.setPaintFlags( buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); buildingLibraryMainText.setPaintFlags( buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); initScanProcess(1); } else { //Check if this activity was called from Settings. if (getIntent().hasExtra("UPGRADE")) { if (getIntent().getExtras().getBoolean("UPGRADE") == true) { mExplicitShowTrialFragment = true; } else { mExplicitShowTrialFragment = false; } } //initInAppBilling(); launchMainActivity(); } //Fire away a report to Google Analytics. try { if (mApp.isGoogleAnalyticsEnabled() == true) { EasyTracker easyTracker = EasyTracker.getInstance(this); easyTracker.send(MapBuilder.createEvent("Jelly startup.", // Event category (required) "User started Jelly.", // Event action (required) "User started Jelly.", // Event label null) // Event value .build()); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.dalol.orthodoxmezmurmedia.utilities.widgets.RecyclerViewFastIndexer.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setColor(Color.parseColor("#2099FF")); paint.setStyle(Paint.Style.FILL); //handle.getLeft() + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()) int bubbleRight = bubble.getRight(); int center = (getWidth() - bubbleRight) / 2; canvas.drawRect(/*from w w w.java 2 s. c om*/ bubbleRight + center, 0, center + bubbleRight + TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0.6f, getResources().getDisplayMetrics()), getHeight(), paint); }
From source file:com.mixiaoxiao.support.widget.SmoothSwitch.java
/** * Construct a new Switch with a default style determined by the given theme * attribute, overriding specific style attributes as requested. * /*from w w w .ja v a2 s . c om*/ * @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. */ public SmoothSwitch(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); final Resources res = getResources(); final float density = res.getDisplayMetrics().density; mTextPaint.density = density;//res.getDisplayMetrics().density; final int thumbSize = (int) (Default.DEFAULT_SIZE_DP * density + 0.5f);// truckSize = 15dp final int thumbWidth = thumbSize;//a.getDimensionPixelSize(R.styleable.SwitchCompat_thumbWidth, thumbSize); mThumbColorOn = Default.DEFAULT_THUMB_ON_COLOR;//a.getColor(R.styleable.SwitchCompat_colorOn, Default.DEFAULT_THUMB_ON_COLOR); mThumbColorOff = Default.DEFAULT_THUMB_OFF_COLOR;//a.getColor(R.styleable.SwitchCompat_colorOff, Default.DEFAULT_THUMB_OFF_COLOR); mTrackColorOn = Default.DEFAULT_TRACK_ON_COLOR;//a.getColor(R.styleable.SwitchCompat_trackColorOn, Default.DEFAULT_TRACK_ON_COLOR); mTrackColorOff = Default.DEFAULT_TRACK_OFF_COLOR;//a.getColor(R.styleable.SwitchCompat_trackColorOff, Default.DEFAULT_TRACK_OFF_COLOR); final float radius = thumbSize * Default.DEFAULT_RADIUS_PERCENT_OF_SIZE;//a.getFloat(R.styleable.SwitchCompat_radiusPercentOfThumbSize, // Default.DEFAULT_RADIUS_PERCENT_OF_SIZE); final int thumbPadding = (int) (thumbSize * Default.DEFAULT_THUMB_PADDING_PERCENT_OF_SIZE + 0.5f);//thumbSize * a.getFloat(R.styleable.SwitchCompat_thumbPaddingPercentOfThumbSize, // Default.DEFAULT_THUMB_PADDING_PERCENT_OF_SIZE) + 0.5f); final int trackPadding = (int) (thumbSize * Default.DEFAULT_TRACK_PADDING_PERCENT_OF_SIZE + 0.5f);//thumbSize * a.getFloat(R.styleable.SwitchCompat_trackPaddingPercentOfThumbSize, // Default.DEFAULT_TRACK_PADDING_PERCENT_OF_SIZE) + 0.5f); final int curThumbColor = isChecked() ? mThumbColorOn : mThumbColorOff; final int curTrackColor = isChecked() ? mTrackColorOn : mTrackColorOff; mThumbDrawable = makeThumbDrawable(curThumbColor, thumbWidth, thumbSize, radius, thumbPadding); mTrackDrawable = makeTrackDrawable(curTrackColor, thumbWidth, thumbSize, radius, trackPadding); // final int onDisableColor = getDisableColor(onColor); // final int offDisableColor = getDisableColor(offColor); // final StateListDrawable thumbDrawable = new StateListDrawable(); // thumbDrawable.addState(new int[] { -android.R.attr.state_enabled, android.R.attr.state_checked}, // makeThumbDrawable(onDisableColor, thumbSize));// Disabled ON // thumbDrawable.addState(new int[] { -android.R.attr.state_enabled, -android.R.attr.state_checked}, // makeThumbDrawable(offDisableColor, thumbSize));// Disabled OFF // thumbDrawable.addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_checked }, // makeThumbDrawable(onColor, thumbSize)); // thumbDrawable.addState(new int[] {}, makeThumbDrawable(offColor, thumbSize)); // mThumbDrawable = thumbDrawable; // // final StateListDrawable trackDrawable = new StateListDrawable(); // trackDrawable.addState(new int[] { -android.R.attr.state_enabled, android.R.attr.state_checked}, // makeTrackDrawable(onDisableColor, thumbSize));// Disabled ON // trackDrawable.addState(new int[] { -android.R.attr.state_enabled, -android.R.attr.state_checked}, // makeTrackDrawable(offDisableColor, thumbSize));// Disabled OFF // trackDrawable.addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_checked }, // makeTrackDrawable(onColor, thumbSize)); // trackDrawable.addState(new int[] {}, makeTrackDrawable(offColor, thumbSize)); // mTrackDrawable = trackDrawable; // mTextOn = a.getText(R.styleable.SwitchCompat_android_textOn); // mTextOff = a.getText(R.styleable.SwitchCompat_android_textOff); mShowText = false;//a.getBoolean(R.styleable.SwitchCompat_showText, false); mThumbTextPadding = 0;//a.getDimensionPixelSize(R.styleable.SwitchCompat_thumbTextPadding, 0); // mSwitchMinWidth = a.getDimensionPixelSize(R.styleable.SwitchCompat_switchMinWidth, 0); mSwitchMinWidth = Math.max(mSwitchMinWidth, thumbWidth * 2); mSwitchPadding = 0;//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); // }else{ // ColorStateList colors = a.getColorStateList(R.styleable.SwitchCompat_switchTextColor); // if (colors != null) { // mTextColors = colors; // } else { // // If no color set in TextAppearance, default to the view's textColor // mTextColors = getTextColors(); // } // float ts = a.getDimension(R.styleable.SwitchCompat_switchTextSize, 0); // if (ts != 0) { // if (ts != mTextPaint.getTextSize()) { // mTextPaint.setTextSize(ts); // requestLayout(); // } // } // } // 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:com.android.gallery3d.data.UriImage.java
public Bitmap drawTextToBitmap(Context gContext, String gText, Bitmap bitmap) { Resources resources = gContext.getResources(); float scale = resources.getDisplayMetrics().density; android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig(); // set default bitmap config if none if (bitmapConfig == null) { bitmapConfig = android.graphics.Bitmap.Config.ARGB_8888; }//from w w w . j a v a2s.c o m // resource bitmaps are imutable, // so we need to convert it to mutable one bitmap = bitmap.copy(bitmapConfig, true); Canvas canvas = new Canvas(bitmap); // new antialised Paint Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); // text color - #3D3D3D paint.setColor(Color.rgb(61, 61, 61)); // text size in pixels paint.setTextSize((int) (25 * scale)); // text shadow paint.setShadowLayer(1f, 0f, 1f, Color.WHITE); // draw text to the Canvas center Rect bounds = new Rect(); paint.setTextAlign(Align.CENTER); paint.getTextBounds(gText, 0, gText.length(), bounds); int x = (bitmap.getWidth() - bounds.width()) / 2; int y = (bitmap.getHeight() + bounds.height()) / 2; canvas.drawText(gText, x * scale, y * scale, paint); return bitmap; }
From source file:com.aniruddhc.acemusic.player.Dialogs.ID3sArtistEditorDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mContext = getActivity();/*from w w w. j a v a 2 s . c om*/ parentActivity = getActivity(); dialogFragment = this; //Get the artist name. ARTIST = getArguments().getString("ARTIST"); 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); } } }); if (ARTIST != null) { songURIsList = getAllSongsByArtist(ARTIST); //Populate the ArrayLists with the song tags. try { getSongTags(songURIsList); } 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(); } //Now check if any of the ArrayLists contain the same exact elements. boolean titlesSame = checkIfAllElementsEqual(titlesList); boolean artistsSame = checkIfAllElementsEqual(artistsList); boolean albumsSame = checkIfAllElementsEqual(albumsList); boolean albumArtistsSame = checkIfAllElementsEqual(albumArtistsList); boolean genresSame = checkIfAllElementsEqual(genresList); boolean producersSame = checkIfAllElementsEqual(producersList); boolean yearsSame = checkIfAllElementsEqual(yearsList); boolean tracksSame = checkIfAllElementsEqual(trackNumbersList); boolean totalTracksSame = checkIfAllElementsEqual(totalTracksList); boolean commentsSame = checkIfAllElementsEqual(commentsList); //Populate the EditTexts. setEditorFields(titlesSame, titlesList, titleEditText); setEditorFields(artistsSame, artistsList, artistEditText); setEditorFields(albumsSame, albumsList, albumEditText); setEditorFields(albumArtistsSame, albumArtistsList, albumArtistEditText); setEditorFields(genresSame, genresList, genreEditText); setEditorFields(producersSame, producersList, producerEditText); setEditorFields(yearsSame, yearsList, yearEditText); setEditorFields(tracksSame, trackNumbersList, trackEditText); setEditorFields(totalTracksSame, totalTracksList, trackTotalEditText); setEditorFields(commentsSame, commentsList, commentsEditText); } 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(); AsyncSaveArtistTagsTask asyncSaveArtistTagsTask = new AsyncSaveArtistTagsTask(getActivity(), getActivity()); asyncSaveArtistTagsTask.execute(); } }); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return builder.create(); }
From source file:org.telegram.ui.Cells.FeaturedStickerSetCell.java
public void setStickersSet(TLRPC.StickerSetCovered set, boolean divider, boolean unread) { boolean sameSet = set == stickersSet && wasLayout; needDivider = divider;// w ww . j a v a 2 s . c o m stickersSet = set; lastUpdateTime = System.currentTimeMillis(); setWillNotDraw(!needDivider); if (currentAnimation != null) { currentAnimation.cancel(); currentAnimation = null; } textView.setText(stickersSet.set.title); if (unread) { Drawable drawable = new Drawable() { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); @Override public void draw(Canvas canvas) { paint.setColor(0xff44a8ea); canvas.drawCircle(AndroidUtilities.dp(4), AndroidUtilities.dp(5), AndroidUtilities.dp(3), paint); } @Override public void setAlpha(int alpha) { } @Override public void setColorFilter(ColorFilter colorFilter) { } @Override public int getOpacity() { return 0; } @Override public int getIntrinsicWidth() { return AndroidUtilities.dp(12); } @Override public int getIntrinsicHeight() { return AndroidUtilities.dp(8); } }; textView.setCompoundDrawablesWithIntrinsicBounds(LocaleController.isRTL ? null : drawable, null, LocaleController.isRTL ? drawable : null, null); } else { textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } valueTextView.setText(LocaleController.formatPluralString("Stickers", set.set.count)); if (set.cover != null && set.cover.thumb != null && set.cover.thumb.location != null) { imageView.setImage(set.cover.thumb.location, null, "webp", null); } else if (!set.covers.isEmpty()) { imageView.setImage(set.covers.get(0).thumb.location, null, "webp", null); } if (sameSet) { boolean wasInstalled = isInstalled; if (isInstalled = StickersQuery.isStickerPackInstalled(set.set.id)) { if (!wasInstalled) { checkImage.setVisibility(VISIBLE); addButton.setClickable(false); currentAnimation = new AnimatorSet(); currentAnimation.setDuration(200); currentAnimation.playTogether(ObjectAnimator.ofFloat(addButton, "alpha", 1.0f, 0.0f), ObjectAnimator.ofFloat(addButton, "scaleX", 1.0f, 0.01f), ObjectAnimator.ofFloat(addButton, "scaleY", 1.0f, 0.01f), ObjectAnimator.ofFloat(checkImage, "alpha", 0.0f, 1.0f), ObjectAnimator.ofFloat(checkImage, "scaleX", 0.01f, 1.0f), ObjectAnimator.ofFloat(checkImage, "scaleY", 0.01f, 1.0f)); currentAnimation.addListener(new AnimatorListenerAdapterProxy() { @Override public void onAnimationEnd(Animator animator) { if (currentAnimation != null && currentAnimation.equals(animator)) { addButton.setVisibility(INVISIBLE); } } @Override public void onAnimationCancel(Animator animator) { if (currentAnimation != null && currentAnimation.equals(animator)) { currentAnimation = null; } } }); currentAnimation.start(); } } else { if (wasInstalled) { addButton.setVisibility(VISIBLE); addButton.setClickable(true); currentAnimation = new AnimatorSet(); currentAnimation.setDuration(200); currentAnimation.playTogether(ObjectAnimator.ofFloat(checkImage, "alpha", 1.0f, 0.0f), ObjectAnimator.ofFloat(checkImage, "scaleX", 1.0f, 0.01f), ObjectAnimator.ofFloat(checkImage, "scaleY", 1.0f, 0.01f), ObjectAnimator.ofFloat(addButton, "alpha", 0.0f, 1.0f), ObjectAnimator.ofFloat(addButton, "scaleX", 0.01f, 1.0f), ObjectAnimator.ofFloat(addButton, "scaleY", 0.01f, 1.0f)); currentAnimation.addListener(new AnimatorListenerAdapterProxy() { @Override public void onAnimationEnd(Animator animator) { if (currentAnimation != null && currentAnimation.equals(animator)) { checkImage.setVisibility(INVISIBLE); } } @Override public void onAnimationCancel(Animator animator) { if (currentAnimation != null && currentAnimation.equals(animator)) { currentAnimation = null; } } }); currentAnimation.start(); } } } else { if (isInstalled = StickersQuery.isStickerPackInstalled(set.set.id)) { addButton.setVisibility(INVISIBLE); addButton.setClickable(false); checkImage.setVisibility(VISIBLE); checkImage.setScaleX(1.0f); checkImage.setScaleY(1.0f); checkImage.setAlpha(1.0f); } else { addButton.setVisibility(VISIBLE); addButton.setClickable(true); checkImage.setVisibility(INVISIBLE); addButton.setScaleX(1.0f); addButton.setScaleY(1.0f); addButton.setAlpha(1.0f); } } }
From source file:com.aniruddhc.acemusic.player.Dialogs.ID3sAlbumEditorDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { mApp = (Common) getActivity().getApplicationContext(); parentActivity = getActivity();//from ww w.j ava2 s . c o m dialogFragment = this; titlesList = new ArrayList<String>(); artistsList = new ArrayList<String>(); albumsList = new ArrayList<String>(); albumArtistsList = new ArrayList<String>(); genresList = new ArrayList<String>(); producersList = new ArrayList<String>(); yearsList = new ArrayList<String>(); trackNumbersList = new ArrayList<String>(); totalTracksList = new ArrayList<String>(); commentsList = new ArrayList<String>(); songURIsList = new ArrayList<String>(); songSourcesList = new ArrayList<String>(); songIdsList = new ArrayList<String>(); 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 album and artist name. ARTIST = getArguments().getString("ARTIST"); ALBUM = getArguments().getString("ALBUM"); CALLING_FRAGMENT = getArguments().getString("CALLING_FRAGMENT"); if (ARTIST != null && ALBUM != null) { songURIsList = getAllSongsInAlbum(ALBUM, ARTIST); //Populate the ArrayLists with the song tags. try { getSongTags(songURIsList); } 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(); } //Now check if any of the ArrayLists contain the same exact elements. boolean titlesSame = checkIfAllElementsEqual(titlesList); boolean artistsSame = checkIfAllElementsEqual(artistsList); boolean albumsSame = checkIfAllElementsEqual(albumsList); boolean albumArtistsSame = checkIfAllElementsEqual(albumArtistsList); boolean genresSame = checkIfAllElementsEqual(genresList); boolean producersSame = checkIfAllElementsEqual(producersList); boolean yearsSame = checkIfAllElementsEqual(yearsList); boolean tracksSame = checkIfAllElementsEqual(trackNumbersList); boolean totalTracksSame = checkIfAllElementsEqual(totalTracksList); boolean commentsSame = checkIfAllElementsEqual(commentsList); //Populate the EditTexts. setEditorFields(titlesSame, titlesList, titleEditText); setEditorFields(artistsSame, artistsList, artistEditText); setEditorFields(albumsSame, albumsList, albumEditText); setEditorFields(albumArtistsSame, albumArtistsList, albumArtistEditText); setEditorFields(genresSame, genresList, genreEditText); setEditorFields(producersSame, producersList, producerEditText); setEditorFields(yearsSame, yearsList, yearEditText); setEditorFields(tracksSame, trackNumbersList, trackEditText); setEditorFields(totalTracksSame, totalTracksList, trackTotalEditText); setEditorFields(commentsSame, commentsList, commentsEditText); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Set the dialog title. builder.setTitle(R.string.edit_tags); builder.setView(rootView); builder.setNeutralButton(R.string.save, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { AsyncSaveAlbumTagsTask asyncSaveAlbumTagsTask = new AsyncSaveAlbumTagsTask(getActivity(), getActivity()); asyncSaveAlbumTagsTask.execute(); } }); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { clearArrayLists(); dialogFragment.dismiss(); } }); return builder.create(); }
From source file:com.elpstudio.player.EqualizerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { //Context.//from ww w . java 2 s .com mContext = getApplicationContext(); mApp = (Common) mContext.getApplicationContext(); mFragment = this; //setTheme(); super.onCreate(savedInstanceState); //Equalizer container elements. mScrollView = (ScrollView) findViewById(R.id.equalizerScrollView); //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); //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); 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); 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(); /* getSupportActionBar().setHomeButtonEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true);*/ }