public void categorySpinnerSetup() { ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() { public ParseQuery create() { ParseQuery query = new ParseQuery("Category"); return query; } }; categoryAdapter = new ParseQueryAdapter<ParseObject>(this, factory); categoryAdapter.setTextKey("name"); categorySpinner.setAdapter(categoryAdapter); categorySpinner.setSelection(1); categorySpinner .setOnItemSelectedListener(new CategorySpinnerListener()); }
public UserViewAdapter(Context context) { super(context, new ParseQueryAdapter.QueryFactory<Photo>() { public ParseQuery<Photo> create() { // Get the current user's photos ParseQuery<Photo> photosFromCurrentUserQuery = new ParseQuery<Photo>("Photo"); photosFromCurrentUserQuery.whereEqualTo("user", ParseUser.getCurrentUser()); photosFromCurrentUserQuery.whereExists("thumbnail"); photosFromCurrentUserQuery.include("user"); photosFromCurrentUserQuery.orderByDescending("createdAt"); return photosFromCurrentUserQuery; } }); }
public void regionSpinnerSetup() { ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() { public ParseQuery create() { ParseQuery query = new ParseQuery("Region"); return query; } }; regionAdapter = new ParseQueryAdapter<ParseObject>(this, factory); regionAdapter.setTextKey("name"); regionSpinner.setAdapter(regionAdapter); regionSpinner.setSelection(1); regionSpinner.setOnItemSelectedListener(new RegionSpinnerListener()); }
public void regionSpinnerSetup(){ ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() { @Override public ParseQuery create() { ParseQuery query = new ParseQuery("Region"); return query; } }; regionAdapter = new MyParseAdapter(getActivity(), factory); regionAdapter.setTextKey("name"); regionSpinner.setAdapter(regionAdapter); regionSpinner.setSelection(1); regionSpinner.setOnItemSelectedListener(new RegionSpinnerListener()); }
public void categorySpinnerSetup(){ ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() { @Override public ParseQuery create() { ParseQuery query = new ParseQuery("Category"); return query; } }; categoryAdapter = new MyParseAdapter(getActivity(), factory); categoryAdapter.setTextKey("name"); categorySpinner.setAdapter(categoryAdapter); categorySpinner.setSelection(1); categorySpinner.setOnItemSelectedListener(new CategorySpinnerListener()); }
public HomeViewAdapter(Context context) { super(context, new ParseQueryAdapter.QueryFactory<Photo>() { public ParseQuery<Photo> create() { // First, query for the friends whom the current user follows ParseQuery<com.parse.anypic.Activity> followingActivitiesQuery = new ParseQuery<com.parse.anypic.Activity>("Activity"); followingActivitiesQuery.whereMatches("type", "follow"); followingActivitiesQuery.whereEqualTo("fromUser", ParseUser.getCurrentUser()); // Get the photos from the Users returned in the previous query ParseQuery<Photo> photosFromFollowedUsersQuery = new ParseQuery<Photo>("Photo"); photosFromFollowedUsersQuery.whereMatchesKeyInQuery("user", "toUser", followingActivitiesQuery); photosFromFollowedUsersQuery.whereExists("image"); // Get the current user's photos ParseQuery<Photo> photosFromCurrentUserQuery = new ParseQuery<Photo>("Photo"); photosFromCurrentUserQuery.whereEqualTo("user", ParseUser.getCurrentUser()); photosFromCurrentUserQuery.whereExists("image"); // We create a final compound query that will find all of the photos that were // taken by the user's friends or by the user ParseQuery<Photo> query = ParseQuery.or(Arrays.asList( photosFromFollowedUsersQuery, photosFromCurrentUserQuery )); query.include("user"); query.orderByDescending("createdAt"); return query; } }); }
public DonationAdapter(Context context, ParseQueryAdapter.QueryFactory<Donation> queryFactory) { // Custom Query super(context, queryFactory); activity = (FragmentActivity) context; this.setObjectsPerPage(PAGE_SIZE); }
public DonationAdapter(final Context context, final String donorId) { // load all Donations // if required this is the place to apply where filters on Donations // list this(context, new ParseQueryAdapter.QueryFactory<Donation>() { @SuppressWarnings({ "rawtypes", "unchecked" }) public ParseQuery create() { return new ParseHelper(context).getDonationsByDonorId(donorId); } }); }
public PatientAdapter(final Context context) { // load all patients // if required this is the place to apply where filters on patients list this(context, new ParseQueryAdapter.QueryFactory<Patient>() { @SuppressWarnings({ "rawtypes", "unchecked" }) public ParseQuery create() { return new ParseHelper(context).getAllPatientsQuery(); } }); }
public HomeFeedAdapter(Context context,ParseQueryAdapter.QueryFactory<NewsItem> queryFactory) { //Custom Query super(context,queryFactory); activity = (WatsiMainActivity) context; this.setObjectsPerPage(PAGE_SIZE); }
public HomeFeedAdapter(final Context context) { // load all patients // if required this is the place to apply where filters on patients list this(context, new ParseQueryAdapter.QueryFactory<NewsItem>() { @SuppressWarnings({ "rawtypes", "unchecked" }) public ParseQuery create() { return new ParseHelper(context).getAllNewsFeedItem(); } }); }
public PhotoListAdapter(Context context) { super(context, new ParseQueryAdapter.QueryFactory<PrsPhoto>() { public ParseQuery<PrsPhoto> create() { // Here we can configure a ParseQuery to display // only top-rated meals. ParseQuery query = new ParseQuery("PrsPhoto"); return query; } }); }
public GoalAdapter(Context context) { super(context, new ParseQueryAdapter.QueryFactory<Goal>() { @Override public ParseQuery<Goal> create() { ParseQuery<Goal> query = ParseQuery.getQuery(Goal.class); query.whereEqualTo(Goal.USER_KEY, (User) User.getCurrentUser()); query.addAscendingOrder(Goal.GOAL_START_DATE_KEY); return query; } }); }
public CategoryAdapter(Context context) { super(context, new ParseQueryAdapter.QueryFactory<Category>() { @Override public ParseQuery<Category> create() { return new CategoryDao().getLocalQuery(); } }); }
/** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lain); s1=(Spinner)findViewById(R.id.contact); spad=new ParseQueryAdapter<ParseUser>(this,ParseUser.class); spad.setTextKey("username"); s1.setAdapter(spad); s1.setOnItemSelectedListener(this); b1=(Button)findViewById(R.id.b1); t2=(EditText)findViewById(R.id.t2); t3=(EditText)findViewById(R.id.title); b1.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View arg0) { String text=t2.getText().toString(); String title=t3.getText().toString(); newpost=new Post(); newpost.setMessage(text); newpost.setTitle(title); newpost.setReciever(reciever); newpost.setAuthor(ParseUser.getCurrentUser()); newpost.saveInBackground(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { setResult(Activity.RESULT_OK); finish(); } else { Toast.makeText(null, "Error saving: " + e.getMessage(),Toast.LENGTH_SHORT).show(); } } }); } }); }
/** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { ParseInstallation installation = ParseInstallation.getCurrentInstallation(); installation.put("user",ParseUser.getCurrentUser()); installation.saveInBackground(); super.onCreate(savedInstanceState); //getListView().setClickable(false); setContentView(R.layout.main); ParseQueryAdapter.QueryFactory<Post> factory = new ParseQueryAdapter.QueryFactory<Post>() { public ParseQuery<Post> create() { ParseQuery<Post> query = Post.getQuery(); query.include("author"); query.orderByDescending("createdAt"); query.whereEqualTo("reciever",ParseUser.getCurrentUser().getUsername()); query.setLimit(10); return query; } }; mainAdapter = new ParseQueryAdapter<Post>(this, factory) { @Override public View getItemView(Post post, View view, ViewGroup parent) { if (view == null) { view = View.inflate(getContext(), R.layout.post_item, null); } TextView contentView = (TextView) view.findViewById(R.id.contentView); TextView usernameView = (TextView) view.findViewById(R.id.usernameView); contentView.setText(post.getMessage()); usernameView.setText(post.getAuthor().getUsername()); return view; } }; ListView postsView = (ListView) this.findViewById(R.id.listy); postsView.setAdapter(mainAdapter); /*mainAdapter = new ParseQueryAdapter<Post>(this, Post.class); mainAdapter.setTextKey("message"); */ //setListAdapter(mainAdapter); }
public PatientAdapter(Context context,ParseQueryAdapter.QueryFactory<Patient> queryFactory) { //Custom Query super(context,queryFactory); activity = (WatsiMainActivity) context; this.setObjectsPerPage(PAGE_SIZE); }
public void setList(ParseQueryAdapter<BuzzboxPost> Po){ JazzyListView postsView = (JazzyListView) this.findViewById(R.id.postsView); postsView.setAdapter(Po); postsView.setTransitionEffect(JazzyHelper.CARDS); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ParseAnalytics.trackAppOpened(getIntent()); setContentView(R.layout.main); mLastHour = new Date(); mLastHour.setHours(mLastHour.getHours() - 2); // Instantiate a QueryFactory to define the ParseQuery to be used for fetching items in this // Adapter. ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() { public ParseQuery<ParseObject> create() { ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Image"); // query.whereGreaterThan("createdAt", mLastHour); query.orderByDescending("createdAt"); return query; } }; mAdapter = new ParseQueryAdapter<ParseObject>(this, factory) { @Override public View getItemView(ParseObject object, View v, ViewGroup parent) { if (v == null) { v = View.inflate(FotoFlickActivity.this, R.layout.photo, null); } super.getItemView(object, v, parent); final ImageView imgView = (ImageView)v; ImageLoader.getInstance() .loadImage(object.getString("imageURLString") , mTargetSize , new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { imgView.setImageBitmap(loadedImage); } }); imgView.setOnClickListener(mListener); return v; } }; // Perhaps set a callback to be fired upon successful loading of a new set of ParseObjects. mAdapter.addOnQueryLoadListener(new OnQueryLoadListener<ParseObject>() { @Override public void onLoading() { mProgressBar.setVisibility(View.VISIBLE); } @Override public void onLoaded(List<ParseObject> objects, Exception e) { mProgressBar.setVisibility(View.GONE); android.util.Log.d("Foto", "onLoaded"); if (objects != null) { android.util.Log.d("Foto", "parsing objects: " + objects.size()); } } }); mGridView = (GridView) findViewById(R.id.photo_grid); mProgressBar = (ProgressBar) findViewById(R.id.progress); mGridView.setAdapter(mAdapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_see_list); //this adapter queries all Todo items ParseQueryAdapter<ParseObject> adapter = new ParseQueryAdapter<ParseObject>(this, new ParseQueryAdapter.QueryFactory<ParseObject>() { @Override public ParseQuery<ParseObject> create() { //get query of Todo objects ParseQuery query = new ParseQuery("Todo"); //get current user ParseUser currentUser = ParseUser.getCurrentUser(); //filter to objects created by this user query.whereEqualTo("userId",currentUser.getObjectId()); return query; } }); //we want the text of the object so this is what it displays adapter.setTextKey("text"); //load objects adapter.loadObjects(); //instantiate the listview todoList = (ListView)findViewById(R.id.todolist); //set the adapter to load listview todoList.setAdapter(adapter); }