Search in sources :

Example 31 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project SlantedTextView by HeZaiJin.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
        }
    });
    SlantedTextView stv = (SlantedTextView) findViewById(R.id.test);
//        stv.setText("PHP")
//                .setTextColor(Color.WHITE)
//                .setSlantedBackgroundColor(Color.BLACK)
//                .setTextSize(18)
//                .setSlantedLength(50)
//                .setMode(SlantedTextView.MODE_LEFT_BOTTOM);
}
Also used : SlantedTextView(com.haozhang.lib.SlantedTextView) FloatingActionButton(android.support.design.widget.FloatingActionButton) SlantedTextView(com.haozhang.lib.SlantedTextView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 32 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project RecyclerViewUndoSwipe by HoneyNeutrons.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    assert getSupportActionBar() != null;
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    setTabs();
    TextView tvDate = (TextView) findViewById(R.id.tvDate);
    TextView tvDay = (TextView) findViewById(R.id.tvDay);
    tvNumber = (TextView) findViewById(R.id.tvNumber);
    Calendar c = Calendar.getInstance();
    SimpleDateFormat dateformat = new SimpleDateFormat("MM.dd.yyyy", Locale.getDefault());
    assert tvDate != null;
    assert tvDay != null;
    tvDate.setTypeface(Typefaces.getRobotoBlack(this));
    tvDay.setTypeface(Typefaces.getRobotoBlack(this));
    tvDate.setText(dateformat.format(c.getTime()).toUpperCase());
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.cardList);
    assert recyclerView != null;
    recyclerView.setHasFixedSize(true);
    final LinearLayoutManager llm = new LinearLayoutManager(this);
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(llm);
    final ItemAdapter itemAdapter = new ItemAdapter(getApplicationContext(), this, tvNumber);
    recyclerView.setAdapter(itemAdapter);
    ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(itemAdapter, this);
    mItemTouchHelper = new ItemTouchHelper(callback);
    mItemTouchHelper.attachToRecyclerView(recyclerView);
    loadItems();
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    assert fab != null;
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Item item = new Item();
            nu = ItemAdapter.itemList.size();
            nu++;
            item.setItemName("item" + nu);
            llm.scrollToPositionWithOffset(0, dpToPx(56));
            itemAdapter.addItem(0, item);
        }
    });
}
Also used : SimpleItemTouchHelperCallback(com.honeyneutrons.undoswipe.helper.SimpleItemTouchHelperCallback) Calendar(java.util.Calendar) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) MenuItem(android.view.MenuItem) FloatingActionButton(android.support.design.widget.FloatingActionButton) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) SimpleDateFormat(java.text.SimpleDateFormat) Toolbar(android.support.v7.widget.Toolbar)

Example 33 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project AndroidDevelop by 7449.

the class SearchFragment method initActivityCreated.

@Override
protected void initActivityCreated() {
    FloatingActionButton mFAB = (FloatingActionButton) getActivity().findViewById(R.id.fa_btn);
    mFAB.setOnClickListener(this);
    showExplanation();
    mPresenter = new SearchPresenterImpl(this);
    mAdapter = new XRecyclerViewAdapter<>();
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(Constant.RECYCLERVIEW_LISTVIEW, StaggeredGridLayoutManager.VERTICAL));
    mRecyclerView.setAdapter(mAdapter.setLayoutId(R.layout.item_search).onXBind(this));
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) SearchPresenterImpl(com.codekk.search.presenter.SearchPresenterImpl)

Example 34 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project Rashr by DsLNeXuS.

the class BackupRestoreFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_backup_restore, container, false);
    mActivity = (RashrActivity) getActivity();
    mContext = root.getContext();
    mPager = (ViewPager) root.findViewById(R.id.vpBackupRestore);
    mAdapter = new BackupRestorePagerAdapter(getChildFragmentManager());
    mPager.setAdapter(mAdapter);
    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) root.findViewById(R.id.stlBackupRestore);
    slidingTabLayout.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {

        @Override
        public int getIndicatorColor(int position) {
            TypedValue typedValue = new TypedValue();
            Resources.Theme theme = mContext.getTheme();
            theme.resolveAttribute(R.attr.colorAccent, typedValue, true);
            return typedValue.data;
        }

        @Override
        public int getDividerColor(int position) {
            return 0;
        }
    });
    slidingTabLayout.setViewPager(mPager);
    final FloatingActionButton fab = (FloatingActionButton) root.findViewById(R.id.fabCreateBackup);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isRecovery = mPager.getCurrentItem() == 0;
            createBackup(isRecovery);
        }
    });
    fab.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_add_white));
    slidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            if (position == 0) {
                if (RashrApp.DEVICE.isRecoveryDD() || RashrApp.DEVICE.isRecoveryMTD()) {
                    fab.setVisibility(View.VISIBLE);
                } else {
                    fab.setVisibility(View.INVISIBLE);
                }
            } else {
                if (RashrApp.DEVICE.isKernelDD() || RashrApp.DEVICE.isKernelMTD()) {
                    fab.setVisibility(View.VISIBLE);
                } else {
                    fab.setVisibility(View.INVISIBLE);
                }
            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    mAdapter.getRecoveryBackupFragment().getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (!(RashrApp.DEVICE.isRecoveryDD() || RashrApp.DEVICE.isRecoveryMTD())) {
                Toast.makeText(mContext, R.string.op_not_supported, Toast.LENGTH_SHORT).show();
            } else {
                showPopup(view);
            }
        }
    });
    mAdapter.getKernelBackupFragment().getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (!(RashrApp.DEVICE.isKernelDD() || RashrApp.DEVICE.isKernelMTD())) {
                Toast.makeText(mContext, R.string.op_not_supported, Toast.LENGTH_SHORT).show();
            } else {
                showPopup(view);
            }
        }
    });
    return root;
}
Also used : SlidingTabLayout(de.mkrtchyan.recoverytools.view.SlidingTabLayout) View(android.view.View) AdapterView(android.widget.AdapterView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) ListView(android.widget.ListView) ViewPager(android.support.v4.view.ViewPager) FloatingActionButton(android.support.design.widget.FloatingActionButton) AdapterView(android.widget.AdapterView) TypedValue(android.util.TypedValue)

Example 35 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project teaTime by ancfdy.

the class PullHeaderLayout method setActionDrawable.

public void setActionDrawable(Drawable actionDrawable) {
    mActionDrawable = actionDrawable;
    if (mActionDrawable != null) {
        if (mActionView == null) {
            final int bgColor = Utils_Flyrefresh.getThemeColorFromAttrOrRes(getContext(), R.attr.colorAccent, R.color.accent);
            final int pressedColor = Utils_Flyrefresh.darkerColor(bgColor, 0.8f);
            final ShapeDrawable bgDrawable = new ShapeDrawable(new OvalShape());
            bgDrawable.getPaint().setColor(bgColor);
            mActionView = new FloatingActionButton(getContext());
            mActionView.setRippleColor(pressedColor);
            mActionView.setBackgroundDrawable(bgDrawable);
            addView(mActionView, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        }
        if (mFlyView == null) {
            mFlyView = new ImageView(getContext());
            mFlyView.setScaleType(ImageView.ScaleType.FIT_XY);
            addView(mFlyView, new LayoutParams(ACTION_ICON_SIZE, ACTION_ICON_SIZE));
            mFlyView.bringToFront();
            float elevation = ViewCompat.getElevation(mActionView);
            ViewCompat.setElevation(mFlyView, elevation + 1);
        }
        mFlyView.setImageDrawable(mActionDrawable);
    } else {
        if (mActionView != null) {
            removeView(mActionView);
            removeView(mFlyView);
            mActionView = null;
            mFlyView = null;
        }
    }
}
Also used : ShapeDrawable(android.graphics.drawable.ShapeDrawable) FloatingActionButton(android.support.design.widget.FloatingActionButton) ImageView(android.widget.ImageView) OvalShape(android.graphics.drawable.shapes.OvalShape)

Aggregations

FloatingActionButton (android.support.design.widget.FloatingActionButton)84 View (android.view.View)58 Toolbar (android.support.v7.widget.Toolbar)28 TextView (android.widget.TextView)20 ImageView (android.widget.ImageView)16 Intent (android.content.Intent)13 RecyclerView (android.support.v7.widget.RecyclerView)12 ColorStateList (android.content.res.ColorStateList)9 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 Bundle (android.os.Bundle)7 NavigationView (android.support.design.widget.NavigationView)7 TabLayout (android.support.design.widget.TabLayout)7 ViewPager (android.support.v4.view.ViewPager)7 ActionBar (android.support.v7.app.ActionBar)7 UiController (android.support.test.espresso.UiController)6 ViewAction (android.support.test.espresso.ViewAction)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)5 DrawerLayout (android.support.v4.widget.DrawerLayout)4 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)4