use of com.google.android.material.floatingactionbutton.FloatingActionButton in project IITB-App by wncc.
the class UserFragment method populateViews.
private void populateViews() {
if (getActivity() == null || getView() == null)
return;
userProfilePictureImageView = getActivity().findViewById(R.id.user_profile_picture_profile);
TextView userNameTextView = getActivity().findViewById(R.id.user_name_profile);
TextView userRollNumberTextView = getActivity().findViewById(R.id.user_rollno_profile);
final TextView userEmailIDTextView = getActivity().findViewById(R.id.user_email_profile);
TextView userContactNumberTextView = getActivity().findViewById(R.id.user_contact_no_profile);
FloatingActionButton userShareFab = getActivity().findViewById(R.id.share_user_button);
Picasso.get().load(user.getUserProfilePictureUrl()).placeholder(R.drawable.user_placeholder).into(userProfilePictureImageView);
userProfilePictureImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
zoomImageFromThumb(userProfilePictureImageView);
}
});
mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
if (!showingMin) {
/* Show tabs */
getActivity().findViewById(R.id.tab_layout).setVisibility(VISIBLE);
/* Load lists */
final List<Role> roleList = user.getUserRoles();
final List<Body> bodyList = user.getUserFollowedBodies();
final List<Event> eventList = user.getUserGoingEvents();
final List<Role> formerRoleList = user.getUserFormerRoles();
/* Construct user profile */
final List<CardInterface> profile = new ArrayList<>(roleList);
for (Role role : formerRoleList) {
Role temp = new Role(role);
temp.setRoleName("Former " + role.getRoleName() + " " + role.getRoleYear());
profile.add(temp);
}
profile.addAll(user.getUserAchievements());
List<Event> eventInterestedList = user.getUserInterestedEvents();
eventList.removeAll(eventInterestedList);
eventList.addAll(eventInterestedList);
GenericRecyclerViewFragment frag1 = GenericRecyclerViewFragment.newInstance(profile);
BodyRecyclerViewFragment frag2 = BodyRecyclerViewFragment.newInstance(bodyList);
EventRecyclerViewFragment frag3 = EventRecyclerViewFragment.newInstance(eventList);
frag1.parentFragment = this;
frag2.parentFragment = this;
frag3.parentFragment = this;
TabAdapter tabAdapter = new TabAdapter(getChildFragmentManager());
tabAdapter.addFragment(frag1, "Profile");
tabAdapter.addFragment(frag2, "Following");
tabAdapter.addFragment(frag3, "Events");
// Set up the ViewPager with the sections adapter.
ViewPager viewPager = (ViewPager) getActivity().findViewById(R.id.viewPager);
viewPager.setAdapter(tabAdapter);
viewPager.setOffscreenPageLimit(2);
TabLayout tabLayout = (TabLayout) getActivity().findViewById(R.id.tab_layout);
tabLayout.setupWithViewPager(viewPager);
userShareFab.show();
getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE);
}
userNameTextView.setText(user.getUserName());
userRollNumberTextView.setText(user.getUserRollNumber());
if (user.getUserEmail() != null && !user.getUserEmail().equals("N/A")) {
userEmailIDTextView.setText(user.getUserEmail());
} else {
if (user.getUserRollNumber() != null)
userEmailIDTextView.setText(user.getUserRollNumber() + "@iitb.ac.in");
}
userEmailIDTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mail((String) userEmailIDTextView.getText());
}
});
if (!"N/A".equals(user.getUserContactNumber())) {
userContactNumberTextView.setText(user.getUserContactNumber());
userContactNumberTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
call(user.getUserContactNumber());
}
});
} else {
userContactNumberTextView.setVisibility(View.GONE);
}
userShareFab.setOnClickListener(new View.OnClickListener() {
String shareUrl = ShareURLMaker.getUserURL(user);
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Sharing URL");
i.putExtra(Intent.EXTRA_TEXT, shareUrl);
startActivity(Intent.createChooser(i, "Share URL"));
}
});
}
use of com.google.android.material.floatingactionbutton.FloatingActionButton in project J2ME-Loader by nikita36078.
the class AppsListFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
registerForContextMenu(getListView());
setHasOptionsMenu(true);
setListAdapter(adapter);
FloatingActionButton fab = view.findViewById(R.id.fab);
fab.setOnClickListener(v -> {
String path = preferences.getString(PREF_LAST_PATH, null);
if (path == null) {
File dir = Environment.getExternalStorageDirectory();
if (dir.canRead()) {
path = dir.getAbsolutePath();
}
}
openFileLauncher.launch(path);
});
}
use of com.google.android.material.floatingactionbutton.FloatingActionButton in project FlexibleAdapter by davideas.
the class FragmentStaggeredLayout method addItem.
private int addItem(StaggeredItemStatus status, StaggeredHeaderItem headerItem) {
StaggeredItem staggeredItem = DatabaseService.newStaggeredItem(DatabaseService.getInstance().getMaxStaggeredId(), headerItem);
// !!!
staggeredItem.setStatus(status);
// The section object is known
mAdapter.addItemToSection(staggeredItem, staggeredItem.getHeader(), new DatabaseService.ItemComparatorByGroup());
// Add Item to the Database as well for next refresh
DatabaseService.getInstance().addItem(staggeredItem, new DatabaseService.ItemComparatorById());
// Change fab action (MOVE ITEM)
if (mAdapter.getItemCountOfTypes(R.layout.recycler_staggered_item) >= 15) {
FloatingActionButton fab = getActivity().findViewById(R.id.fab);
fab.setImageResource(R.drawable.ic_sort_white_24dp);
}
// Retrieve the final position due to a possible hidden header became now visible!
int scrollTo = mAdapter.getGlobalPositionOf(staggeredItem);
Log.d(TAG, "Creating New Item " + staggeredItem + " at position " + scrollTo);
return scrollTo;
}
use of com.google.android.material.floatingactionbutton.FloatingActionButton in project SherlockAdapter by EvilBT.
the class MultiSelectItemActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_multi_select_item);
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) {
getSelectedList();
}
});
findViewById(R.id.selectAll).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 全选
adapter.selectAll();
}
});
findViewById(R.id.unselectAll).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 全不选
adapter.clearSelectAll();
}
});
adapter = new MyMultiSelectAdapter();
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
recyclerView.setAdapter(adapter);
// 屏障默认的Change动画,默认的Change动画会闪烁一下
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
adapter.setOnItemCheckedChangeListener(new OnItemCheckedChangeListener() {
@Override
public void onItemCheck(@NonNull View view, boolean isChecked, int adapterPosition) {
final int id = view.getId();
if (id == R.id.checkbox) {
IMultiSelectItem selectorItem = adapter.getData(adapterPosition);
if (selectorItem != null) {
final int selectedSize = adapter.getSelectedItems().size();
if (isChecked && selectedSize > 9) {
Toast.makeText(MultiSelectItemActivity.this, "您最多只能选择9个", Toast.LENGTH_SHORT).show();
selectorItem.setChecked(false);
adapter.notifyItemChanged(adapterPosition);
}
}
}
}
});
List<IMultiSelectItem> data = new ArrayList<>(20);
for (int i = 0; i < 40; i++) {
SelectorCard card = new SelectorCard(i);
data.add(card);
}
// 添加一个不可选中的数据在列表上
NoSelectCard card = new NoSelectCard("我跟他们不一样");
data.add(0, card);
adapter.setData(data);
}
use of com.google.android.material.floatingactionbutton.FloatingActionButton in project EhViewer by seven332.
the class HostsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
hosts = EhApplication.getHosts(this);
data = hosts.getAll();
setContentView(R.layout.activity_hosts);
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
recyclerView = findViewById(R.id.recycler_view);
tip = findViewById(R.id.tip);
FloatingActionButton fab = findViewById(R.id.fab);
adapter = new HostsAdapter();
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(this, R.attr.dividerColor), LayoutUtils.dp2pix(this, 1));
decoration.setShowLastDivider(true);
recyclerView.addItemDecoration(decoration);
recyclerView.setSelector(Ripple.generateRippleDrawable(this, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT)));
recyclerView.setHasFixedSize(true);
recyclerView.setOnItemClickListener(this);
recyclerView.setPadding(recyclerView.getPaddingLeft(), recyclerView.getPaddingTop(), recyclerView.getPaddingRight(), recyclerView.getPaddingBottom() + getResources().getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab));
fab.setOnClickListener(this);
recyclerView.setVisibility(data.isEmpty() ? View.GONE : View.VISIBLE);
tip.setVisibility(data.isEmpty() ? View.VISIBLE : View.GONE);
}
Aggregations