I'm have a recycler view with installers apps, and I'm wanting to pin specific apps at the top, but I want those apps to scroll with the recycler view.
Kind of like how frequently used apps scroll with the app drawer on the stock launcher.
But I have been unable to find any information about this online. Can anyone point me in the right direction?
Here is my current adapter, I am currently using a listview but want to switch over to recyclerview
public class AppListAdapter extends ArrayAdapter<AppModel> {
private final LayoutInflater mLayoutInflater;
// Simple_list_item_2 contains a TwoLineListItem containing two TextViews.
public AppListAdapter(Context context) {
super(context, android.R.layout.simple_list_item_2);
mLayoutInflater = LayoutInflater.from(context);
}
public void setData(ArrayList<AppModel> appsList) {
clear();
if (appsList != null) {
addAll(appsList);
}
}
//If the platform version supports it add all items in one step, otherwise add in loop
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void addAll(Collection<? extends AppModel> appsCollection) {
// If internal version of system is higher or equal to lollipop
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
super.addAll(appsCollection);
}else{
for(AppModel app: appsCollection){
super.add(app);
}
}
}
/**
* Put new apps items in the list.
*/
@Override public View getView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView == null) {
view = mLayoutInflater.inflate(R.layout.list_item_icon_text, parent, false);
} else {
view = convertView;
}
AppModel item = getItem(position);
if (item.getIcon() == null) {
Log.d("Icon", " puste");
return null;
}
((ImageView) view.findViewById(R.id.icon)).setImageDrawable(item.getIcon());
((TextView) view.findViewById(R.id.text)).setText(item.getLabel());
return view;
}
}
Like the picture, I want apps at the top that are dedicated, and then below all installed apps