本文整理汇总了Java中com.melnykov.fab.FloatingActionButton.attachToRecyclerView方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.attachToRecyclerView方法的具体用法?Java FloatingActionButton.attachToRecyclerView怎么用?Java FloatingActionButton.attachToRecyclerView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.melnykov.fab.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.attachToRecyclerView方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.down_up_theme);
setContentView(R.layout.activity_wishlist);
myTitle = getString(R.string.app_name);
if (toolbar == null) {
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setTitle(myTitle);
toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
RecyclerView recyclerView = (RecyclerView) findViewById(
R.id.wishlist_recyclerview);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(new NumberedAdapter(30));
FloatingActionButton wishlistFab = (FloatingActionButton) findViewById(R.id.wishlist_fab);
wishlistFab.attachToRecyclerView(recyclerView);
}
示例2: initFloatingActionButton
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
/**
* Initialize the floating action button to add new grade entries.
*/
private void initFloatingActionButton(View rootView) {
fabAddGradeEntry = (FloatingActionButton) rootView.findViewById(R.id.fab_add_grade_entry);
fabAddGradeEntry.attachToRecyclerView(rvGrades);
fabAddGradeEntry.hide();
fabAddGradeEntry.setVisibility(View.GONE);
fabAddGradeEntry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter.enableEditMode(false);
fabAddGradeEntry.hide(true);
fabAddGradeEntry.setVisibility(View.GONE);
getActivity().invalidateOptionsMenu();
final Intent intent = new Intent(v.getContext(), GradeDetailedActivity.class);
intent.putExtra(GradeDetailedActivity.EXTRA_GRADE_HASH, "");
intent.putExtra(GradeDetailedActivity.EXTRA_ADD_NEW_GRADE_ENTRY, true);
v.getContext().startActivity(intent);
}
});
}
示例3: onViewCreated
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getLoaderManager().initLoader(LOADER_ID, null, this);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.contact_list);
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.attachToRecyclerView(recyclerView);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().getSupportFragmentManager().beginTransaction()
.replace(R.id.content_frame, new AllContactsFragment(), SELECT_CONTACTS_TAG)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.addToBackStack(SELECT_CONTACTS_TRANSACTION).commit();
}
});
}
示例4: initRecyclerAdapter
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
/**
* Initializes RecyclerView if pager is in corresponding view
*/
private void initRecyclerAdapter() {
mListView.setVisibility(View.GONE);
mLayoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
mTasksAdapter = new TasksAdapter(getActivity(), mCursor, this);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mTasksAdapter);
if (getActivity() instanceof PagerActivity) {
FloatingActionButton floatingActionButton = ((PagerActivity) getActivity()).getFab();
floatingActionButton.attachToRecyclerView(mRecyclerView);
}
// Prevent Swipe to refresh if recyclerview isn't in top position
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
int visible = mLayoutManager.findFirstCompletelyVisibleItemPosition();
if (mSwipeRefreshLayout != null) {
if (visible != 0) {
mSwipeRefreshLayout.setEnabled(false);
} else {
mSwipeRefreshLayout.setEnabled(true);
}
}
}
});
}
示例5: onCreate
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.down_up_theme);
setContentView(R.layout.activity_library);
myTitle = getString(R.string.app_name);
if (toolbar == null) {
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setTitle(myTitle);
toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
mRecyclerView = (RecyclerView) findViewById(
R.id.library_recyclerview);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(layoutManager);
FloatingActionButton libraryFab = (FloatingActionButton) findViewById(R.id.library_fab);
libraryFab.attachToRecyclerView(mRecyclerView);
fetchLibrary();
libraryFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), AddBookLibraryActivity.class);
startActivity(i);
}
});
}
示例6: onCreateView
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.fragment_review,container,false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_review);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
mRecyclerView.setLayoutManager(mLayoutManager);
Bundle extras = getActivity().getIntent().getExtras();
if (extras != null){
book = (Book)extras.get("SELECTED_BOOK");
// specify an adapter
reviewBookDAO = new ReviewBookDAO(getActivity().getApplicationContext());
reviewBookList = reviewBookDAO.getReviewByIdBook(book.getIdBook());
mAdapter = new ReviewAdapter(reviewBookList);
mRecyclerView.setAdapter(mAdapter);
}
//Responsavel pelo button flutuante.
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
fab.attachToRecyclerView(mRecyclerView);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogReview(book);
}
});
return(view);
}
示例7: 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;
}
示例8: wireAddReminderRequestButton
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
private void wireAddReminderRequestButton(View root, RecyclerView list) {
FloatingActionButton fab = (FloatingActionButton)root.findViewById(R.id.fab);
fab.attachToRecyclerView(list);
fab.setOnClickListener(new RequestAddReminderClickListener(this.onAddReminderRequestListener));
}
示例9: setupFAB
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
private void setupFAB(View parent, RecyclerView rv) {
fab = (FloatingActionButton) parent.findViewById(R.id.fab_to);
fab.attachToRecyclerView(rv);
fab.setOnClickListener(this);
}
示例10: setupFAB
import com.melnykov.fab.FloatingActionButton; //导入方法依赖的package包/类
private void setupFAB(View parent, RecyclerView rv) {
fab = (FloatingActionButton) parent.findViewById(R.id.fab_from);
fab.attachToRecyclerView(rv);
fab.setOnClickListener(this);
}