Java Code Examples for android.widget.Button#setTextColor()
The following examples show how to use
android.widget.Button#setTextColor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NavigationDrawerFragment.java From PlayMusicExporter with MIT License | 6 votes |
/** * Format the button * @param button The button * @param active Active */ public void setButtonActive(Button button, boolean active) { int colorText; int colorBackground; // Button is active if (active) { // Gets the active color colorText = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_text_active); colorBackground = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_active); } else { // Gets the normal color colorText = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_text); colorBackground = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_normal); } // Sets the color button.setBackgroundColor(colorBackground); button.setTextColor(colorText); button.getCompoundDrawables()[0].setColorFilter(colorText, PorterDuff.Mode.MULTIPLY); }
Example 2
Source File: HoloLight.java From heads-up with GNU General Public License v3.0 | 6 votes |
@Override public void addActionButton(ViewGroup actionButtons, String actionTitle, Drawable icon, View.OnClickListener clickListener, float fontMultiplier) { LayoutInflater inflater = LayoutInflater.from(actionButtons.getContext()); ViewGroup v = (ViewGroup) inflater.inflate( R.layout.button_notification, actionButtons); Button button = (Button) v.getChildAt(v.getChildCount() - 1); button.setText(actionTitle); button.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontMultiplier * button.getTextSize()); button.setTextColor(Color.DKGRAY); if (icon != null) { icon.mutate().setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY); button.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); } button.setOnClickListener(clickListener); }
Example 3
Source File: Intro.java From always-on-amoled with GNU General Public License v3.0 | 6 votes |
@Override public void onResume() { super.onResume(); try { permissions[0] = true; go = (Button) v.findViewById(R.id.go); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(-1, -1, 2003, 65794, -2); lp.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; View view = new View(context); ((WindowManager) context.getSystemService(WINDOW_SERVICE)).addView(view, lp); ((WindowManager) context.getSystemService(WINDOW_SERVICE)).removeView(view); go.setVisibility(View.INVISIBLE); } catch (Exception e) { permissions[0] = false; go.setTextColor(context.getResources().getColor(android.R.color.black)); go.setText(getString(R.string.intro_allow_now)); go.setEnabled(true); v.findViewById(R.id.go).setOnClickListener(v1 -> { if (Utils.isAndroidNewerThanM()) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName())); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); } }
Example 4
Source File: ToolUtils.java From KUtils-master with Apache License 2.0 | 6 votes |
/** * 设置MD风格样式 */ public static void setMdBtnStytle(BuildBean bean) { Button btnPositive = bean.alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); Button btnNegative = bean.alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE); Button btnNatural = bean.alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL); if (btnPositive != null && btnNegative != null) { btnPositive.setTextSize(bean.btnTxtSize); btnNegative.setTextSize(bean.btnTxtSize); btnNatural.setTextSize(bean.btnTxtSize); if (bean.btn1Color != 0) btnPositive.setTextColor(getColor(null, bean.btn1Color)); if (bean.btn2Color != 0) btnNegative.setTextColor(getColor(null, bean.btn2Color)); if (bean.btn3Color != 0) btnNatural.setTextColor(getColor(null, bean.btn3Color)); } Window window = bean.alertDialog.getWindow(); window.setGravity(bean.gravity); }
Example 5
Source File: NotificationHelper.java From Mysplash with GNU Lesser General Public License v3.0 | 6 votes |
public static void showActionSnackbar(@NonNull MysplashActivity activity, String content, String action, View.OnClickListener l) { View container = activity.provideSnackbarContainer(); if (container != null) { Snackbar snackbar = Snackbar .make(container, content, Snackbar.LENGTH_LONG) .setAction(action, l); Snackbar.SnackbarLayout snackbarLayout = (Snackbar.SnackbarLayout) snackbar.getView(); snackbarLayout.setBackgroundColor(ThemeManager.getRootColor(activity)); TextView contentTxt = snackbarLayout.findViewById(R.id.snackbar_text); contentTxt.setTextColor(ThemeManager.getContentColor(activity)); Button actionBtn = snackbarLayout.findViewById(R.id.snackbar_action); actionBtn.setTextColor(ThemeManager.getTitleColor(activity)); snackbar.show(); } }
Example 6
Source File: ThemeUtil.java From YiBo with Apache License 2.0 | 6 votes |
public static void setSecondaryMicroBlogHeader(View headerView) { if (headerView == null) { return; } Theme theme = ThemeUtil.createTheme(headerView.getContext()); LinearLayout llHeaderBase = (LinearLayout)headerView.findViewById(R.id.llHeaderBase); Button btnBack = (Button)headerView.findViewById(R.id.btnBack); Button btnPrevious = (Button)headerView.findViewById(R.id.btnPrevious); Button btnNext = (Button)headerView.findViewById(R.id.btnNext); Button btnOperate = (Button) headerView.findViewById(R.id.btnOperate); TextView tvTitle = (TextView) headerView.findViewById(R.id.tvTitle); llHeaderBase.setBackgroundDrawable(theme.getDrawable("bg_header")); llHeaderBase.setGravity(Gravity.CENTER); int padding8 = theme.dip2px(8); llHeaderBase.setPadding(padding8, 0, padding8, 0); btnBack.setBackgroundDrawable(theme.getDrawable("selector_btn_action_back")); btnBack.setTextColor(theme.getColorStateList("selector_btn_header_action")); tvTitle.setTextColor(theme.getColorStateList("selector_header_title")); btnPrevious.setBackgroundDrawable(theme.getDrawable("selector_btn_action_previous")); btnNext.setBackgroundDrawable(theme.getDrawable("selector_btn_action_next")); btnOperate.setBackgroundDrawable(theme.getDrawable("selector_btn_action_additional")); int padding12 = theme.dip2px(12); btnOperate.setPadding(padding12, 0, padding12, 0); btnOperate.setTextColor(theme.getColor("selector_btn_header_action")); }
Example 7
Source File: DownloadAdpater2.java From YTPlayer with GNU General Public License v3.0 | 6 votes |
private void setButtonColor(Button v) { switch (v.getText().toString()) { case "mp3": v.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(v.getContext(),R.color.colorAccent))); break; case "m4a": v.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(v.getContext(),R.color.blue))); break; case "mp4": v.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(v.getContext(),R.color.playback_indicator))); v.setTextColor(ContextCompat.getColor(v.getContext(),R.color.background)); break; } }
Example 8
Source File: NotificationHelper.java From Mysplash with GNU Lesser General Public License v3.0 | 5 votes |
public static void showActionSnackbar(String content, String action, int duration, View.OnClickListener l) { if (Mysplash.getInstance().getActivityCount() > 0) { MysplashActivity a = Mysplash.getInstance().getTopActivity(); View container = a.provideSnackbarContainer(); Snackbar snackbar = Snackbar .make(container, content, duration) .setAction(action, l); Snackbar.SnackbarLayout snackbarLayout = (Snackbar.SnackbarLayout) snackbar.getView(); TextView contentTxt = (TextView) snackbarLayout.findViewById(R.id.snackbar_text); DisplayUtils.setTypeface(a, contentTxt); Button actionBtn = (Button) snackbarLayout.findViewById(R.id.snackbar_action); if (Mysplash.getInstance().isLightTheme()) { contentTxt.setTextColor(ContextCompat.getColor(a, R.color.colorTextContent_light)); actionBtn.setTextColor(ContextCompat.getColor(a, R.color.colorTextTitle_light)); snackbarLayout.setBackgroundResource(R.color.colorRoot_light); } else { contentTxt.setTextColor(ContextCompat.getColor(a, R.color.colorTextContent_dark)); actionBtn.setTextColor(ContextCompat.getColor(a, R.color.colorTextTitle_dark)); snackbarLayout.setBackgroundResource(R.color.colorRoot_dark); } snackbar.show(); } }
Example 9
Source File: NumberPickerPreferenceDialog.java From an2linuxclient with GNU General Public License v3.0 | 5 votes |
@Override public void onStart() { super.onStart(); // Need to do this here, since getDialog() returns null in for example onBindDialogView() final Resources res = getContext().getResources(); final Window window = getDialog().getWindow(); Button button1 = window.findViewById(android.R.id.button1); Button button2 = window.findViewById(android.R.id.button2); button1.setTextColor(res.getColor(R.color.black)); button2.setTextColor(res.getColor(R.color.black)); }
Example 10
Source File: CustomizeViews.java From placeholderj with Apache License 2.0 | 5 votes |
private void customizeViewError(ViewGroup viewError, ImageView viewErrorImage, TextView viewErrorMessage, Button viewErrorTryAgainButton) { if (viewError != null) { if (mPlaceHolderManager.mViewErrorBackgroundColor != 0) { viewError.setBackgroundColor(getColor(mPlaceHolderManager.mViewErrorBackgroundColor)); } else if (mPlaceHolderManager.mViewErrorBackgroundResource > 0) { viewError.setBackgroundResource(mPlaceHolderManager.mViewErrorBackgroundResource); } if (mPlaceHolderManager.mViewErrorText > 0) { viewErrorMessage.setText(mPlaceHolderManager.mViewErrorText); } if (mPlaceHolderManager.mViewErrorTextSize > 0) { setTextSize(viewErrorMessage, mPlaceHolderManager.mViewErrorTextSize); } if (mPlaceHolderManager.mViewErrorTextColor != 0) { viewErrorMessage.setTextColor(getColor(mPlaceHolderManager.mViewErrorTextColor)); } if (mPlaceHolderManager.mViewErrorTryAgainButtonText > 0) { viewErrorTryAgainButton.setText(mPlaceHolderManager.mViewErrorTryAgainButtonText); } if (mPlaceHolderManager.mViewErrorTryAgainButtonTextColor > 0) { viewErrorTryAgainButton.setTextColor(mPlaceHolderManager.mViewErrorTryAgainButtonTextColor); } if (mPlaceHolderManager.mViewErrorTryAgainButtonBackgroundResource > 0) { int backgroundRes = mPlaceHolderManager.mViewErrorTryAgainButtonBackgroundResource; viewErrorTryAgainButton.setBackgroundResource(backgroundRes); } if (mPlaceHolderManager.mViewErrorImage > 0) { viewErrorImage.setImageDrawable(getDrawable(mPlaceHolderManager.mViewErrorImage)); } } }
Example 11
Source File: TopSnackBar.java From zulip-android with Apache License 2.0 | 5 votes |
/** * Create And Add Layout */ private void createAndAddLayout() { CoordinatorLayout.LayoutParams layoutParams = new CoordinatorLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); linearLayout.setLayoutParams(layoutParams); linearLayout.setOrientation(LinearLayout.HORIZONTAL); linearLayout.setWeightSum(1f); linearLayout.setGravity(Gravity.CENTER_VERTICAL); LinearLayout.LayoutParams tvLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT); tvLayoutParams.weight = 0.7f; LinearLayout.LayoutParams showButtonLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT); showButtonLayoutParams.weight = 0.3f; tvText = new TextView(context); tvText.setLayoutParams(tvLayoutParams); tvText.setTextColor(ContextCompat.getColor(context, R.color.top_snackbar_text_color)); tvText.setPadding(24, 0, 0, 0); linearLayout.addView(tvText); showButton = new Button(context); showButton.setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)); showButton.setTextColor(ContextCompat.getColor(context, R.color.top_snackbar_show_button_text_color)); showButton.setGravity(Gravity.END | Gravity.CENTER_VERTICAL); showButton.setLayoutParams(showButtonLayoutParams); linearLayout.addView(showButton); linearLayout.setVisibility(View.GONE); linearLayout.setBackgroundResource(R.drawable.top_snackbar_bg); }
Example 12
Source File: GosAirlinkReadyActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 5 votes |
private void initView() { cbSelect = (CheckBox) findViewById(R.id.cbSelect); tvSelect = (TextView) findViewById(R.id.tvSelect); btnNext = (Button) findViewById(R.id.btnNext); moudlechoose = (TextView) findViewById(R.id.moudlechoose); String mdchoose = getResources().getString(R.string.moudlechoose); String[] split = mdchoose.split("xx"); int setModuleSelectOn = GosDeploy.setModuleSelectOn(); if (setModuleSelectOn == 0) { moudlechoose.setVisibility(View.VISIBLE); } else { moudlechoose.setVisibility(View.INVISIBLE); } if (split.length > 1) { moudlechoose.setText( split[0] + " " + modeList.get(GosAirlinkChooseDeviceWorkWiFiActivity.modeNum) + " " + split[1]); } else { moudlechoose.setText( split[0] + " " + modeList.get(GosAirlinkChooseDeviceWorkWiFiActivity.modeNum) + " " ); } /** 加载Gif */ GifView gif = (GifView) findViewById(R.id.softreset); gif.setMovieResource(R.drawable.airlink); // 配置文件部署 btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor()); btnNext.setTextColor(GosDeploy.setButtonTextColor()); }
Example 13
Source File: MainActivity.java From androiddevice.info with GNU General Public License v2.0 | 5 votes |
private synchronized void submit() { LinearLayout alertLayout = (LinearLayout)LayoutInflater.from(MainActivity.this).inflate(R.layout.sending_alert,null); AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setCancelable(false).setView(alertLayout).setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); mAlertDialog = builder.show(); //Button isn't null after show Button button = mAlertDialog.getButton(AlertDialog.BUTTON_NEGATIVE); button.setBackgroundResource(R.drawable.black_background_state); button.setTextColor(MainActivity.this.getResources().getColor(android.R.color.white)); if(hasBeenSubmitted()) { ((TextView)mAlertDialog.findViewById(android.R.id.text1)).setText(R.string.alreadySent); mAlertDialog.findViewById(R.id.sending_progressbar).setVisibility(View.GONE); button.setEnabled(true); } else { button.setEnabled(false); final JSONObject deviceInformation = DeviceInformation.getInstance().getDeviceInformation(); if(null != mDeviceName && 0 != mDeviceName.length()) { try { deviceInformation.put("name", mDeviceName); } catch (JSONException e) { e.printStackTrace(); } } RequestBody formBody = new FormEncodingBuilder().add("device", deviceInformation.toString()).build(); Request request = new Request.Builder().url(getString(R.string.submit)).addHeader("User-Agent", "APP").post(formBody).build(); client.newCall(request).enqueue(new HTTPCallback(this.getApplication())); } }
Example 14
Source File: KeypadAdapter.java From PinLock with Apache License 2.0 | 5 votes |
/** * Setting Button background styles such as background, size and shape * @param view Button itself */ private void setStyle(Button view) { final int textSize = styledAttributes.getInt(R.styleable.PinLock_keypadTextSize, 12); view.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize); final int color = styledAttributes.getColor(R.styleable.PinLock_keypadTextColor, Color.BLACK); view.setTextColor(color); final int background = styledAttributes .getResourceId(R.styleable.PinLock_keypadButtonShape, R.drawable.rectangle); view.setBackgroundResource(background); }
Example 15
Source File: GeocodeActivity.java From PocketMaps with MIT License | 4 votes |
private OnClickListener createAddAddrClickListener(final GeoPoint loc, final EditType type, final EditText eaddr[], final TextView eaddrV[], final Button okButton, final String oldLocName) { OnClickListener l = new OnClickListener() { @Override public void onClick(View v) { if (okButton.getCurrentTextColor() == Color.BLUE) { // ViewEdit --> Switch to edit! okButton.setTextColor(Color.BLACK); okButton.setText(R.string.ok); fillText(eaddr, null, View.VISIBLE); fillText(eaddrV, null, View.GONE); return; } new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { Address addr = new Address(Locale.getDefault()); for (int i=0; i<eaddr.length; i++) { String line = eaddr[i].getText().toString(); if (i == (eaddr.length-1) && (!line.isEmpty()) && (!line.contains("\n"))) { // Force MultiLine! line = line + "\n"; } addr.setAddressLine(i, line); } GeoPoint newLoc = loc; if (type == EditType.EditOnly) { newLoc = getLocFromSpinner(locSpinner); } addr.setLatitude(newLoc.getLatitude()); addr.setLongitude(newLoc.getLongitude()); AddressLoc.addToProp(favourites, addr, oldLocName); String mapDir = Variable.getVariable().getMapsFolder().getParent(); String propFile = new File(mapDir,FAV_PROP_FILE).getPath(); try(FileOutputStream fos = new FileOutputStream(propFile)) { favourites.store(fos, "List of favourites"); } catch (IOException e) { logUser("Unable to store favourites"); } return null; } }.execute(); GeocodeActivity.this.finish(); } }; return l; }
Example 16
Source File: Patio.java From Patio with MIT License | 4 votes |
/** * Custom methods */ public void init(Context context, AttributeSet attributeSet) { //Setup defaults mContext = context; mMaxPictures = DEFAULT_MAX_PICTURES; mThumbnailHeight = mContext.getResources().getDimension(R.dimen.patio_default_thumbnail_height); mThumbnailWidth = mContext.getResources().getDimension(R.dimen.patio_default_thumbnail_width); mThumbnailsMessageString = mContext.getResources().getString(R.string.patio_thumbnails_message); mPatioThumbnails = new ArrayList<PatioThumbnail>(); setOrientation(VERTICAL); //Local defaults float thumbnailsContainerPadding = mContext.getResources().getDimension(R.dimen.patio_default_thumbnails_container_padding); int actionsTextColor = mContext.getResources().getColor(R.color.patio_default_action_text_color); int thumbnailsWrapperBackground = mContext.getResources().getColor(R.color.patio_default_thumbnails_container_background); //Inflate view and setup controls LayoutInflater inflater = LayoutInflater.from(context); inflater.inflate(WIDGET_LAYOUT_RES_ID, this, true); //Buttons mTakePicture = (Button) findViewById(R.id.patio_action_take_picture); mAttachPicture = (Button) findViewById(R.id.patio_action_attach_picture); mRemovePicture = (Button) findViewById(R.id.patio_action_remove_picture); mCancel = (Button) findViewById(R.id.patio_action_cancel); //Containers mThumbnailsWrapper = (HorizontalScrollView) findViewById(R.id.patio_thumbnails_wrapper); mThumbnailsContainer = (LinearLayout) findViewById(R.id.patio_thumbnails_container); mThumbnailsCount = (TextView) findViewById(R.id.patio_thumbnails_count_message); //Toolbars mToolbarAddActions = (LinearLayout) findViewById(R.id.patio_add_actions_toolbar); mToolbarRemoveActions = (LinearLayout) findViewById(R.id.patio_remove_actions_toolbar); mToolbarRemoveActions.setVisibility(View.GONE); //Set actions listeners if(!isInEditMode()) { mTakePicture.setOnClickListener(this); mAttachPicture.setOnClickListener(this); mRemovePicture.setOnClickListener(this); mCancel.setOnClickListener(this); } //Get defined attributes if(attributeSet != null) { TypedArray a = mContext.getTheme().obtainStyledAttributes(attributeSet, R.styleable.Patio, 0, 0); try { //Runtime mMaxPictures = a.getInt(R.styleable.Patio_maxPictures, DEFAULT_MAX_PICTURES); mThumbnailHeight = a.getDimension(R.styleable.Patio_thumbnailHeight, mThumbnailHeight); mThumbnailWidth = a.getDimension(R.styleable.Patio_thumbnailWidth, mThumbnailWidth); mThumbnailsMessageString = a.getString(R.styleable.Patio_thumbnailsMessage); //Local thumbnailsContainerPadding = a.getDimension(R.styleable.Patio_thumbnailsContainerPadding, thumbnailsContainerPadding); actionsTextColor = a.getColor(R.styleable.Patio_actionsTextColor, actionsTextColor); thumbnailsWrapperBackground = a.getColor(R.styleable.Patio_thumbnailsContainerBackground, thumbnailsWrapperBackground); } finally { a.recycle(); } } //Check Max Pictures if(mMaxPictures <= 0) { mMaxPictures = DEFAULT_MAX_PICTURES; } //Check Thumbnail Message if(mThumbnailsMessageString == null) { mThumbnailsMessageString = mContext.getResources().getString(R.string.patio_thumbnails_message); } //Setup actions text color mTakePicture.setTextColor(actionsTextColor); mAttachPicture.setTextColor(actionsTextColor); mRemovePicture.setTextColor(actionsTextColor); mCancel.setTextColor(actionsTextColor); //Setup thumbnails container background mThumbnailsWrapper.setBackgroundColor(thumbnailsWrapperBackground); //Setup dimensions ViewGroup.LayoutParams layoutParams; int paddingTop, paddingBottom, paddingLeft, paddingRight; //Thumbnails Wrapper height layoutParams = mThumbnailsWrapper.getLayoutParams(); layoutParams.height = Float.valueOf(mThumbnailHeight).intValue(); mThumbnailsWrapper.setLayoutParams(layoutParams); //Thumbnails Container padding paddingTop = paddingBottom = paddingLeft = paddingRight = Float.valueOf(thumbnailsContainerPadding).intValue(); mThumbnailsContainer.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); //Init Thumbnails Message updateThumbnailsMessage(); }
Example 17
Source File: MainActivity.java From androiddevice.info with GNU General Public License v2.0 | 4 votes |
private void buttonStyleHelper(Button b){ b.setBackgroundResource(R.drawable.black_background_state); b.setTextColor(getResources().getColor(android.R.color.white)); }
Example 18
Source File: MainActivity.java From dtube-mobile-unofficial with Apache License 2.0 | 4 votes |
@SuppressLint("InflateParams") public void initFeed(){ new Thread(() -> { videos = allVideos.getCategorizedVideos(selectedTab); class SortVideos implements Comparator<Video> { // Used for sorting in ascending order of // roll number public int compare(Video a, Video b) { return Long.compare(b.getDate(), a.getDate()); } } if (selectedTab == DtubeAPI.CAT_SUBSCRIBED || selectedTab == DtubeAPI.CAT_NEW) { synchronized (videos) { Collections.sort(videos, new SortVideos()); } } Log.d("dtube","UI: initFeed " + videos.size()); MainActivity.this.runOnUiThread(() -> { feedAdapter.setVideos(videos); feedAdapter.notifyDataSetChanged(); if (videos.size()>0) Log.d("dtube4","added vids ending with "+videos.get(videos.size()-1).title); }); }).start(); //Show button to login if user clicked on subscription feed and not logged in if (selectedTab == DtubeAPI.CAT_SUBSCRIBED) { if (accountInfo == null) { if (findViewById(R.id.login_for_subs) == null) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER; Button v = (Button)LayoutInflater.from(this).inflate(R.layout.login_for_subs_btn, null); if (Preferences.darkMode) v.setTextColor(Color.WHITE); v.setOnClickListener(view -> loginButtonClicked(null)); mainFrame.addView(v, lp); recyclerView.setFocusable(false); } }else if (findViewById(R.id.login_for_subs) != null) { mainFrame.removeView(findViewById(R.id.login_for_subs)); recyclerView.setFocusable(true); } }else if (findViewById(R.id.login_for_subs) != null) { mainFrame.removeView(findViewById(R.id.login_for_subs)); recyclerView.setFocusable(true); } gettingMoreVideos = false; updateBottomBar(); }
Example 19
Source File: ThemeHelper.java From Liz with GNU General Public License v3.0 | 4 votes |
public void themeButton(Button btn){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { btn.setTextColor(getTextColor()); btn.setBackgroundColor(getButtonBackgroundColor()); } }
Example 20
Source File: NGDialog.java From android_maplibui with GNU Lesser General Public License v3.0 | 4 votes |
protected void setEnabled(Button button, boolean state) { button.setEnabled(state); button.setTextColor(state ? mEnabledColor : mDisabledColor); }