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);
}
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);
}
});
}
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));
}
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;
}
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;
}
}
}
Aggregations