Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
com.github.nisrulz:recyclerviewhelper
Advanced tools
RecyclerViewHelper provides the most common functions around recycler view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items.
RecyclerViewHelper provides the most common functions around recycler view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items.
#Integration RecyclerViewHelper is available in the Jcenter, so getting it as simple as adding it as a dependency
// Required , so make sure your support libs are updated in the android sdk
compile "com.android.support:appcompat-v7:{latest version}'
compile "com.android.support:recyclerview-v7:{latest version}'
// RecyclerViewHelper
compile 'com.github.nisrulz:recyclerviewhelper:{latest version}'
where {latest version}
corresponds to published version in
NOTE : The version here corresponds to the version of recyclerview dependency.
#Usage
RHVAdapter
in your recycler view adapter and RHVViewHolder
in your ItemViewHolder
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ItemViewHolder> implements RVHAdapter {
...
@Override
public boolean onItemMove(int fromPosition, int toPosition) {
swap(fromPosition, toPosition);
return false;
}
@Override
public void onItemDismiss(int position, int direction) {
remove(position);
}
public class ItemViewHolder extends RecyclerView.ViewHolder implements RVHViewHolder {
...
@Override
public void onItemSelected(int actionstate) {
System.out.println("Item is selected");
}
@Override
public void onItemClear() {
System.out.println("Item is unselected");
}
}
// Helper functions you might want to implement to make changes in the list as an event is fired
private void remove(int position) {
dataList.remove(position);
notifyItemRemoved(position);
}
private void swap(int firstPosition, int secondPosition) {
Collections.swap(dataList, firstPosition, secondPosition);
notifyItemMoved(firstPosition, secondPosition);
}
}
public class MainActivity extends AppCompatActivity {
RecyclerView myrecyclerview;
ArrayList<String> data;
MyAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myrecyclerview = (RecyclerView) findViewById(R.id.rv_fruits);
data = new ArrayList<>();
data.add("Apple");
...
data.add("Fig");
// Setup your adapter
adapter = new MyAdapter(data);
// Setup
myrecyclerview.hasFixedSize();
myrecyclerview.setLayoutManager(new LinearLayoutManager(this));
myrecyclerview.setAdapter(adapter);
// Setup onItemTouchHandler to enable drag and drop , swipe left or right
ItemTouchHelper.Callback callback = new RVHItemTouchHelperCallback(adapter, true, true,
true);
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(myrecyclerview);
// Set the divider in the recyclerview
myrecyclerview.addItemDecoration(new RVHItemDividerDecoration(this, LinearLayoutManager.VERTICAL));
// Set On Click Listener
myrecyclerview.addOnItemTouchListener(new RVHItemClickListener(this, new RVHItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
String value = "Clicked Item " + data.get(position) + " at " + position;
Log.d("TAG", value);
Toast.makeText(MainActivity.this, value, Toast.LENGTH_SHORT).show();
}
}));
}
}
--
I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic rules to follow to ensure timely addition of your request:
develop
branch. Any other branch (unless specified by the maintainers) will get rejected.Special Credits to Paul Burke and his article which got me thinking
This library contains a modified version of his implementations of ItemTouchHelper.
Copyright 2016 Nishant Srivastava
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
RecyclerViewHelper provides the most common functions around recycler view like Swipe to dismiss, Drag and Drop, Divider in the ui, events for when item selected and when not selected, on-click listener for items.
We found that com.github.nisrulz:recyclerviewhelper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.