Skip to content

ParseQueryAdapter for RecyclerView #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marios-codes opened this issue Aug 18, 2015 · 26 comments
Closed

ParseQueryAdapter for RecyclerView #58

marios-codes opened this issue Aug 18, 2015 · 26 comments
Labels

Comments

@marios-codes
Copy link

When parsequeryadapter will be compatible with recyclerview as of now it is only compatible with listview. Official android documentation suggests that we migrate to recyclerview and for some lollipop APIs to work we need recyclerview.

@wangmengyan95
Copy link
Contributor

@msrowley thanks for opening this issue again. We don't have immediately plan for this feature but we will definitely do it in the future. Please keep an eye on this issue. I will update the status once we start to work on it.

@ralphilius
Copy link

Hello,

I found a gist by @ameron32 which adds support for RecyclerView. I am not sure if his approach is good but I am using it without any issue so far.

https://gist.github.com/ameron32/34329dbd5856bf5ea7c3

@wangmengyan95
Copy link
Contributor

@ralphilius Thanks for the resource, we will take a look and try to add it to our repo as soon as possible. Since it works for you right now, I will close this issue. Feel free to re-open it if you have any questions.

@marios-codes
Copy link
Author

@ralphilius Thank you very much for the info. I am trying to use this into my project, but I cannot understand where and if I should use the ViewHolder, onBindViewHolder(), and onCreateViewHolder methods that are required from recyclerview. Would it be easy for you to share some code to understand how I should use this gist as it is crucial for my app. Thank you again for your time!!

@ralphilius
Copy link

@msrowley If you notice that there are 3 possible Constructors. The 1st one is more adaptive. Let's say I am creating ParseGridAdapter. The code is:

public class ParseGridAdapter extends ParseRecyclerQueryAdapter<MyCustomModel, ParseGridAdapter.ViewHolder>{

public ParseGridAdapter(ParseQueryAdapter.QueryFactory<MyCustomModel> factory, boolean hasStableIds) {
    super(factory, hasStableIds);
    //Your other code here
}

Then you just need to do normally as with Recycler adapter.

factory can be obtained with below code or you just need to pass in your classname when declaring your adapter.

    ParseQueryAdapter.QueryFactory<YourCustomModel> factory = new ParseQueryAdapter.QueryFactory<YourCustomModel>() {
        @Override
        public ParseQuery<YourCustomModel> create() {
            ParseQuery<YourCustomModel> query = ParseWallpaper.getQuery();
           //Your other code here
            return query;
        }
    };

@marios-codes
Copy link
Author

@ralphilius Thank you very much for your lightning fast reply. So to make things clear for me, I just have to use the first code snippet and then all the other stuff (like defining the row layout.xml and the view holder pattern ) are going to be configured on the recycler view methods? Sorry if I am a little confusing for you, but I am relatively new to this and I cannot easily make the connection between the classic parse query adapter and this gist. If you ever have some time and will, it would be very helpful for me if you could share an empty structure of this gist with all the methods I should use and when inside the code. Nonetheless, thank you for the above snippet, I will try to figure it out!!

@marios-codes
Copy link
Author

@ralphilius Never mind!! I figured it out. My mistake was that I was trying to modify the original gist rather than extending it to my custom class. Thank you again for your time and the code snippets above!!

@marios-codes
Copy link
Author

@wangmengyan95 I tried the above gist and it works really well for the basic adapter functionality but it misses crucial parsequeryadapter methods, that made development more easy and straightforward. So any news please from the official dev team on that matter??

@lukas1994
Copy link
Contributor

see #72
(it's not ready yet but we're working on it)

@marios-codes
Copy link
Author

@lukas1994 Thanks for updating the status!! I am watching for changes, as we really need it for our project! Keep up the good work!! Cheers.

@marios-codes
Copy link
Author

@lukas1994 I've seen that the development has stopped about a month ago. Is there a problem with the implementation or you have forked it somewhere else?? Will it be ready anytime soon, as it is needed to adopt the material design principles in our app?? Thank you again!!

@marios-codes
Copy link
Author

@wangmengyan95 How can I re-open the issue please, because it's been a long time now, and this should be a priority for the parse sdk, as for any app that wants to support the material design principles and widgets and be backwards compatible with older versions of android, it is a necessity to use the recycler view widget from the support library, something that parsequeryadapter doesn't support until today. I really cannot understand why it is not implemented yet. Are you aware of the latest android development news?? RecyclerView is out for at least one and a half year and the design support and AppCompat libraries which support the material design guidelines are at least out for half a year. As I stated in my op, Google suggests migration to RecyclerView not only for Lollipop(and now Marshmallow) , but for older versions too!! I would like to hear from you please.

@marios-codes
Copy link
Author

@wangmengyan95 @lukas1994 As this is a paid sdk, and there is no profound way to access parse support other than github, could you at least give an answer and show some care for your customers??

@ralphilius
Copy link

@msrowley Actually they have built it but not tested/merged it to master brand yet. You can check this pull request for more information: #72

If you want, you can use the ParseQueryAdapter code in that pull. I have adapted and tailored it to use with a custom layout.

Cheers,

@wangmengyan95
Copy link
Contributor

@msrowley @ralphilius, we are working on open source ParseUI(probably we will do it this week) so before that we want to keep master as stable as possible. After that, we will start to handle this PR. It seems Lukas do not actively maintain his PR so I wil take over it.

@ralphilius
Copy link

@wangmengyan95 Thanks. Please make it easy to use custom layout too. I have tried to adjust current PR to allow this.

@marios-codes
Copy link
Author

@wangmengyan95 Thank you for sharing information on this matter. Hope to implement it soon. Please keep us posted here on the progression. Have a nice weekend!!

@marios-codes
Copy link
Author

@wangmengyan95 Hello there. Any news on the development of ParseQueryAdapter for RecyclerView please??

@juicycleff
Copy link

Waiting for the QueryAdapter for RecyclerView to no avail. I wonder why its taking Parse so long have it out. Using RecyclerView in my project with the Parse SDK has been a bit cumbersome, Sometimes making me feel ike we should have used the old plain REST API

@marios-codes
Copy link
Author

@wangmengyan95 Any answer please?? Should we change platform?? At least keep us informed. Lack of professionalism? Why you continue to mark it as closed??

@juicycleff
Copy link

Please I would like someone to help point me in the right direction with using the ParseRecyclerQueryAdapter. I'm trying to retrieve articles with my current adapter class that implements the standard RecyclerView. my implementation of pagination is not working properly soIi would like a demonstration from anyone that has used the ParseRecyclerQueryAdapter to achieve the following. By translating it from me so I get the implementation.

public class ArticleRVAdapter extends RecyclerView.Adapter<ArticleRVAdapter.ArticleViewHolder> {

List<Article> articleData = Collections.emptyList();
private LayoutInflater inflater;
private Context context;

public ArticleRVAdapter(Context context, List<Article> data){
    inflater=LayoutInflater.from(context);
    this.articleData= data;
    this.context = context;
}

@Override
public ArticleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

    View view = inflater.inflate(R.layout.article_item, parent, false);
    ArticleViewHolder viewHolder = new ArticleViewHolder(view);
    return viewHolder;
}

/**
 * Returns the total number of items in the data set hold by the adapter.
 *
 * @return The total number of items in this adapter.
 */
@Override
public int getItemCount() {
    return articleData.size();
}

public class ArticleViewHolder extends RecyclerView.ViewHolder
        implements View.OnClickListener {

    CardView cardView;
    TextView title;
    TextView body;
    Date dateCreated;
    TextView author;
    ImageView headImage;
    String objectId;

    public ArticleViewHolder(final View itemView) {
        super(itemView);
        itemView.setClickable(true);
        itemView.setLongClickable(true);
        itemView.setOnClickListener(this);


        cardView = (CardView) itemView.findViewById(R.id.card_article);
        title = (TextView) itemView.findViewById(R.id.text_title);
        body = (TextView) itemView.findViewById(R.id.text_article_body);
        //dateCreated = itemView.findViewById(R.id.text_article_body);
        author = (TextView) itemView.findViewById(R.id.text_author);
        headImage = (ImageView) itemView.findViewById(R.id.imageView_thumb);


    }
    @Override
    public void onClick(View v) {
        Intent intent = new Intent(v.getContext(), ArticleInformationActivity.class);
        intent.putExtra("article_id", articleData.get(getLayoutPosition()).getObjectId());
        intent.putExtra("article_title", articleData.get(getLayoutPosition()).getArticleTitle());
        intent.putExtra("article_body", articleData.get(getLayoutPosition()).getArticleBody());
        intent.putExtra("article_author", articleData.get(getLayoutPosition()).getArticleAuthor());
        intent.putExtra("article_date", articleData.get(getLayoutPosition()).getDateCreated());
        v.getContext().startActivity(intent);

    }
}

}

@siqtedar
Copy link

Dear wangmengyan95,
Is there any update on the development of ParseQueryRecyclerViewAdapter? I want to use it in my code. When would you merge it in the master? Is it expected soon?
Best!

@siqtedar
Copy link

Can anyone please guide me on how to use custom layout with this adapter (#72)? It works for the default case but I am unable to use it with custom layout. Please provide a sample for this.

@jorgecasariego
Copy link

@siqtedar this can help you

Stackoverflow

If you have any doubt just tell me

@spectrumIG
Copy link

This issue is marked as closed and I'm wondering why since there's no component merged and the PR is still stucked. I'm not a paid Parse user so...ok, i will accept this situation but, if this is the treatment reserved to customers too...well, I'm not going to be one for sure and i will not talk well about Parse support.This is not something trivial. It's a part of standard Android design pattern since Lollipop release. Very few people are still using ListAdapter as far as i know.

@arturwest
Copy link

Hi to all! I have done an example of recycler view adapter for parse with pagination https://github.com/arturwest/RecyclerParseQueryAdapter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants