当前位置: 首页>>代码示例>>Java>>正文


Java FloatingActionButton.setColorPressed方法代码示例

本文整理汇总了Java中com.melnykov.fab.FloatingActionButton.setColorPressed方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.setColorPressed方法的具体用法?Java FloatingActionButton.setColorPressed怎么用?Java FloatingActionButton.setColorPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.melnykov.fab.FloatingActionButton的用法示例。


在下文中一共展示了FloatingActionButton.setColorPressed方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpFAB

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
/**
 * Setup utility for the FAB
 *
 * @param context
 * @param icon         the icon to apply
 * @param button       the FAB button
 * @param mFABlistener the listener to apply
 */
public static void setUpFAB(Activity context, int icon, FloatingActionButton button, View.OnClickListener mFABlistener) {
    button.setVisibility(View.VISIBLE);
    button.setType(FloatingActionButton.TYPE_NORMAL);
    if (ThemeUtils.getAppTheme3(context) < 6) {
        button.setColorNormal(context.getResources().getColor(
                ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
        button.setColorPressed(context.getResources().getColor(
                ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context)));
    } else {
        button.setColorNormal(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
        button.setColorPressed(ThemeUtils.getDrawableColor(ThemeUtils.getAppTheme3(context), context));
    }
    button.setImageDrawable(context.getResources().getDrawable(icon));
    button.setOnClickListener(mFABlistener);
}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:24,代码来源:InterfaceUtils.java

示例2: onResume

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
public void onResume() {
    super.onResume();

    listView = (ListView) findViewById(R.id.list_view);
    bartoursAdapter = new BartoursAdapter(
            this,
            bartout.getBartours()
    );
    listView.setAdapter(bartoursAdapter);

    listView.setOnItemClickListener(this);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.newBartourButton);
    fab.attachToListView(listView);

    if(bartout.getActiveBartour() != null) {
        fab.setColorNormal(Color.GRAY);
        fab.setColorPressed(Color.GRAY);
        fab.setColorRipple(Color.GRAY);
    } else {
        fab.setColorNormal(Color.parseColor("#4CAF50"));
        fab.setColorPressed(Color.parseColor("#2E7D32"));
        fab.setColorRipple(Color.parseColor("#43A047"));
    }
}
 
开发者ID:Bartout-Team,项目名称:Bartout,代码行数:26,代码来源:HomeActivity.java

示例3: addHelperFab

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
public void addHelperFab(Context context ,HelperFab.Location location,final HelperFab fab) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
    final FloatingActionButton newFab = (FloatingActionButton)inflater.inflate(R.layout.fab_layout_normal,null);
    newFab.setBackgroundColor(fab.getBackgroundColor());
    newFab.setColorNormal(fab.getBackgroundColor());
    newFab.setColorPressed(fab.getFabSelectedColor());
    newFab.setColorRipple(fab.getFabRippleColor());
    newFab.setImageDrawable(fab.getDrawable());
    newFab.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            fab.onClick();
        }
    });

    if(location == HelperFab.Location.RIGHT) {
        helperFabRight = newFab;
    }
    else if(location == HelperFab.Location.LEFT) {
        helperFabLeft = newFab;
    }
}
 
开发者ID:oznakn,项目名称:HorizontalFabMenu,代码行数:24,代码来源:HorizontalFabMenu.java

示例4: onBindViewHolder

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ColorPaletteViewHolder holder, final int position) {
    final FloatingActionButton button = holder.getButton();
    button.setColorNormal(mNormalColorList[position]);
    button.setColorPressed(mPressedColorList[position]);
    button.setColorRipple(mRippleColorList[position]);
    setButtonSelectedStatus(button, mSelectedPosition == position);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setButtonSelectedStatus(button, true);
            updateButtons(position, mSelectedPosition);
            mSelectedPosition = position;
            if (mColorSelectedListener != null) {
                mColorSelectedListener.onColorSelected(position);
            }
        }
    });
}
 
开发者ID:gustavomondron,项目名称:twik,代码行数:20,代码来源:ColorPaletteAdapter.java

示例5: onContentChanged

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onContentChanged() {
    super.onContentChanged();

    if (!mHasFAB)
        return;

    View view = getWindow().getDecorView().findViewById(android.R.id.content);

    if (view instanceof FrameLayout) {
        FrameLayout base = (FrameLayout) view;

        if (base.findViewById(R.id.fab) == null) {
            FrameLayout layout = (FrameLayout) getLayoutInflater().inflate(R.layout.fab, base);
            mFAB = (FloatingActionButton) layout.findViewById(R.id.fab);
            layout.removeView(mFAB);
            base.addView(mFAB);

            mFAB.setColorRipple(UiUtil.darkerColor(mFAB.getColorNormal(), 0.5f));
            mFAB.setColorPressed(UiUtil.darkerColor(mFAB.getColorNormal(), 0.3f));
            mFAB.setOnClickListener(this);
        }
    }
}
 
开发者ID:nextgis,项目名称:nextgislogger,代码行数:25,代码来源:ProgressBarActivity.java

示例6: setCheckInButtonColor

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
private void setCheckInButtonColor(View view) {
    FloatingActionButton checkInButton = (FloatingActionButton) view.findViewById(R.id.checkInButton);
    if(bartour == null) {
        checkInButton.setColorNormal(Color.GRAY);
        checkInButton.setColorPressed(Color.GRAY);
        checkInButton.setColorRipple(Color.GRAY);
    } else {
        checkInButton.setColorNormal(Color.parseColor("#4CAF50"));
        checkInButton.setColorPressed(Color.parseColor("#2E7D32"));
        checkInButton.setColorRipple(Color.parseColor("#43A047"));
    }
}
 
开发者ID:Bartout-Team,项目名称:Bartout,代码行数:13,代码来源:BarDetailsFragment.java

示例7: setupMenuItem

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
private static FloatingActionButton setupMenuItem(FloatingActionButton menuBase, int id,
                                                  int drawable,
                                                  int style,
                                                  View.OnClickListener menuItemClickListener) {
    int[] styleValues = new int[]{com.melnykov.fab.R.attr.fab_colorNormal,
                                  com.melnykov.fab.R.attr.fab_colorPressed,
                                  com.melnykov.fab.R.attr.fab_colorRipple,
                                  com.melnykov.fab.R.attr.fab_shadow};
    Context context = menuBase.getContext();
    TypedArray array = context.obtainStyledAttributes(style, styleValues);
    int color;

    FloatingActionButton button = new FloatingActionButton(menuBase.getContext(), null, style);
    button.setId(id);
    button.setType(menuBase.getType());

    if ((color = array.getColor(0, -1)) != -1)
        button.setColorNormal(color);
    if ((color = array.getColor(1, -1)) != -1)
        button.setColorPressed(color);
    if ((color = array.getColor(2, -1)) != -1)
        button.setColorRipple(color);
    if (array.getBoolean(3, false))
        button.setShadow(true);
    else
        button.setShadow(false);
    array.recycle();

    button.setImageResource(drawable);
    button.setLayoutParams(menuBase.getLayoutParams());
    button.setVisibility(View.GONE);
    button.setOnClickListener(menuItemClickListener);
    ((ViewGroup) menuBase.getParent()).addView(button);
    return button;
}
 
开发者ID:rahuliyer95,项目名称:FABMenu,代码行数:36,代码来源:FABMenuUtil.java

示例8: onCreateView

import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        //requestPermissions();
        View rootView = inflater.inflate(
                R.layout.fragment_recyclerview, container, false);

        recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
        FastScroller fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
        fastScroller.setRecyclerView(recyclerView);
        audioVisualization = (AudioVisualization) rootView.findViewById(R.id.visualizer_view);
        backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop);

        fab.attachToRecyclerView(recyclerView);
        fab.setColorNormal(getResources().getColor(R.color.colorAccent));
        fab.setColorPressed(getResources().getColor(R.color.widget_pause));
        fab.setColorRipple(getResources().getColor(R.color.window_background));

        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Handler handler = new Handler();
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        MusicPlayer.shuffleAll(getActivity());
                    }
                }, 80);
            }
        });

        new loadSongs().execute("");
        ((BaseActivity) getActivity()).setMusicStateListenerListener(this);

//        if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
//                && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.MODIFY_AUDIO_SETTINGS) == PackageManager.PERMISSION_GRANTED) {
//
//            requestPermissions();
//
//        }
//
//        requestPermissions();

        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
        Boolean stateWave = sharedPrefs.getBoolean(getString(R.string.pref_switch_wave_key), true);

        if(stateWave)
            backdrop.setVisibility(View.GONE);
        else
            backdrop.setVisibility(View.VISIBLE);

        return rootView;
    }
 
开发者ID:rohanoid5,项目名称:Muzesto,代码行数:55,代码来源:SongsFragment.java


注:本文中的com.melnykov.fab.FloatingActionButton.setColorPressed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。