本文整理汇总了Java中com.parse.ParseQueryAdapter.QueryFactory方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQueryAdapter.QueryFactory方法的具体用法?Java ParseQueryAdapter.QueryFactory怎么用?Java ParseQueryAdapter.QueryFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQueryAdapter
的用法示例。
在下文中一共展示了ParseQueryAdapter.QueryFactory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: categorySpinnerSetup
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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());
}
示例2: UserViewAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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;
}
});
}
示例3: regionSpinnerSetup
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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());
}
示例4: regionSpinnerSetup
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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());
}
示例5: categorySpinnerSetup
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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());
}
示例6: HomeViewAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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;
}
});
}
示例7: DonationAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
public DonationAdapter(Context context,
ParseQueryAdapter.QueryFactory<Donation> queryFactory) {
// Custom Query
super(context, queryFactory);
activity = (FragmentActivity) context;
this.setObjectsPerPage(PAGE_SIZE);
}
示例8: PatientAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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();
}
});
}
示例9: HomeFeedAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
public HomeFeedAdapter(Context context,ParseQueryAdapter.QueryFactory<NewsItem> queryFactory) {
//Custom Query
super(context,queryFactory);
activity = (WatsiMainActivity) context;
this.setObjectsPerPage(PAGE_SIZE);
}
示例10: PhotoListAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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;
}
});
}
示例11: GoalAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
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;
}
});
}
示例12: CategoryAdapter
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
public CategoryAdapter(Context context) {
super(context, new ParseQueryAdapter.QueryFactory<Category>() {
@Override
public ParseQuery<Category> create() {
return new CategoryDao().getLocalQuery();
}
});
}
示例13: onCreate
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
/** 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);
}
示例14: onCreate
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
@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);
}
示例15: onCreate
import com.parse.ParseQueryAdapter; //导入方法依赖的package包/类
@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);
}