// Path: RadarApp/app/src/main/java/bg/mentormate/academy/radarapp/adapters/RoomQueryAdapter.java
// public class RoomQueryAdapter extends ParseQueryAdapter<Room> {
// 
//     private static final int LIMIT = 50;
// 
//     public RoomQueryAdapter(final Context context, final String searchQuery) {
//         super(context, new QueryFactory<Room>() {
// 
//             @Override
//             public ParseQuery<Room> create() {
//                 ParseQuery<Room> query = new ParseQuery<>(Constants.ROOM_TABLE);
// 
//                 if (searchQuery != null) {
//                     query.whereContains(Constants.ROOM_COL_NAME, searchQuery);
//                 }
// 
//                 query.whereNotEqualTo(Constants.ROOM_COL_CREATED_BY,
//                             LocalDb.getInstance().getCurrentUser())
//                         .orderByDescending(Constants.PARSE_COL_CREATED_AT)
//                         .setLimit(LIMIT);
// 
//                 return query;
//             }
//         });
//     }
// 
//     @Override
//     public View getItemView(Room room, View v, ViewGroup parent) {
//         if (v == null) {
//             v = new RoomItem(getContext());
//         }
// 
//         ((RoomItem) v).setData(LocalDb.getInstance().getCurrentUser(), room);
// 
//         return v;
//     }
// }


import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import bg.mentormate.academy.radarapp.R;
import bg.mentormate.academy.radarapp.adapters.RoomQueryAdapter;
package bg.mentormate.academy.radarapp.fragments;




/**
 * Created by tl on 16.02.15.
 */
public class SearchRoomsFragment extends ListFragment implements View.OnClickListener,
        SwipeRefreshLayout.OnRefreshListener {

    private static final String QUERY = "query";

    /**
     * The fragment argument representing the section number for this
     * fragment.
     */
    private static final String ARG_TAB_NUMBER = "tab_number";

    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
    public static SearchRoomsFragment newInstance(int sectionNumber) {
        SearchRoomsFragment fragment = new SearchRoomsFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_TAB_NUMBER, sectionNumber);
        fragment.setArguments(args);
        return fragment;
    }

// Path: RadarApp/app/src/main/java/bg/mentormate/academy/radarapp/adapters/RoomQueryAdapter.java
// public class RoomQueryAdapter extends ParseQueryAdapter<Room> {
// 
//     private static final int LIMIT = 50;
// 
//     public RoomQueryAdapter(final Context context, final String searchQuery) {
//         super(context, new QueryFactory<Room>() {
// 
//             @Override
//             public ParseQuery<Room> create() {
//                 ParseQuery<Room> query = new ParseQuery<>(Constants.ROOM_TABLE);
// 
//                 if (searchQuery != null) {
//                     query.whereContains(Constants.ROOM_COL_NAME, searchQuery);
//                 }
// 
//                 query.whereNotEqualTo(Constants.ROOM_COL_CREATED_BY,
//                             LocalDb.getInstance().getCurrentUser())
//                         .orderByDescending(Constants.PARSE_COL_CREATED_AT)
//                         .setLimit(LIMIT);
// 
//                 return query;
//             }
//         });
//     }
// 
//     @Override
//     public View getItemView(Room room, View v, ViewGroup parent) {
//         if (v == null) {
//             v = new RoomItem(getContext());
//         }
// 
//         ((RoomItem) v).setData(LocalDb.getInstance().getCurrentUser(), room);
// 
//         return v;
//     }
// }


// Path: RadarApp/app/src/main/java/bg/mentormate/academy/radarapp/fragments/SearchRoomsFragment.java
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import bg.mentormate.academy.radarapp.R;
import bg.mentormate.academy.radarapp.adapters.RoomQueryAdapter;

package bg.mentormate.academy.radarapp.fragments;




/**
 * Created by tl on 16.02.15.
 */
public class SearchRoomsFragment extends ListFragment implements View.OnClickListener,
        SwipeRefreshLayout.OnRefreshListener {

    private static final String QUERY = "query";

    /**
     * The fragment argument representing the section number for this
     * fragment.
     */
    private static final String ARG_TAB_NUMBER = "tab_number";

    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
    public static SearchRoomsFragment newInstance(int sectionNumber) {
        SearchRoomsFragment fragment = new SearchRoomsFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_TAB_NUMBER, sectionNumber);
        fragment.setArguments(args);
        return fragment;
    }

    private RoomQueryAdapter mRoomQueryAdapter;