本文整理匯總了Java中com.parse.ParseQuery.selectKeys方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseQuery.selectKeys方法的具體用法?Java ParseQuery.selectKeys怎麽用?Java ParseQuery.selectKeys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.selectKeys方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: alreadyBookedSlots
import com.parse.ParseQuery; //導入方法依賴的package包/類
public void alreadyBookedSlots(final String trainerId, final String sDay, final String sDate, final Context context) {
arBookedSlots.clear();
ParseObject trainer = ParseObject.createWithoutData("Trainer", trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
query.selectKeys(Arrays.asList("slot_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("slot_date", sDate);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> bookedSlots, com.parse.ParseException e) {
if (e == null) {
for (ParseObject slots : bookedSlots) {
int slotTime = Integer.valueOf(slots.getString("slot_time"));
arBookedSlots.add(slotTime);
}
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
populateAvailableSlots(trainerId, sDay, sDate, context);
}
});
}
示例2: getDaysBetweenDates
import com.parse.ParseQuery; //導入方法依賴的package包/類
public void getDaysBetweenDates(final Date startdate, final Date enddate, String trainerId) {
ParseObject trainer = ParseObject.createWithoutData("Trainer", trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("TrainerSlots");
query.selectKeys(Arrays.asList("day"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, com.parse.ParseException e) {
if (e == null) {
listOfAvailableDays.clear();
for (ParseObject slots : trainerSlots) {
String availableDay = slots.getString("day");
listOfAvailableDays.add(availableDay);
}
ArrayList<Date> unAvailableDates = new ArrayList<Date>();
Calendar calendar = new GregorianCalendar();
calendar.setTime(startdate);
while (calendar.getTime().before(enddate)) {
Date result = calendar.getTime();
for (int i = 0; i < listOfAvailableDays.size(); i++) {
if (listOfAvailableDays.contains(simpleDayFormat.format(result))) {
caldroidFragment.setBackgroundResourceForDate(R.color.availableSlotColor, result);
caldroidFragment.setTextColorForDate(R.color.white, result);
} else {
unAvailableDates.add(result);
}
}
calendar.add(Calendar.DATE, 1);
}
caldroidFragment.setDisableDates(unAvailableDates);
caldroidFragment.refreshView();
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例3: populateEvents
import com.parse.ParseQuery; //導入方法依賴的package包/類
private void populateEvents() {
String currentUser;
final ProgressWheel progressWheel = (ProgressWheel) findViewById(R.id.progress_wheel);
currentDate = Calendar.getInstance().getTime();// get current date
final SimpleDateFormat simpleDateStrFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
final String strCurrentDate = simpleDateStrFormat.format(currentDate);
if (SimpleUser.currentUserObjectId == null) {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
currentUser = pref.getString("userId", "");
} else {
currentUser = SimpleUser.currentUserObjectId;
}
ParseObject trainer = ParseObject.createWithoutData("Trainer", Trainer.currentTrainerObjectId);
ParseObject user = ParseObject.createWithoutData("SimpleUser", currentUser);
ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
query.selectKeys(Arrays.asList("slot_date", "slot_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("user_id", user);
query.whereEqualTo("status", "addtocart");
query.orderByAscending("slot_date");
adSlots.clear();
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, ParseException e) {
if (e == null) {
for (ParseObject slots : trainerSlots) {
BlockedSlots b = new BlockedSlots();
b.setSlotDate(slots.getString("slot_date"));
b.setSlotTime(slots.getString("slot_time"));
try {
Date cDate = simpleDateStrFormat.parse(strCurrentDate);
Date slotDate = simpleDateStrFormat.parse(slots.getString("slot_date"));
if (slotDate.after(cDate) || slotDate.equals(cDate)) {
alSlots.add(b);
}
adSlots.notifyDataSetChanged();
} catch (java.text.ParseException e1) {
e1.printStackTrace();
}
progressWheel.setVisibility(View.INVISIBLE);
adSlots.notifyDataSetChanged();
}
} else {
Log.v("DEBUG!!!!!!!!!!!!!", "Error occured >>>>>>>>>>>>>>>>>> " + e);
progressWheel.setVisibility(View.INVISIBLE);
}
}
});
bHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(UpcomingEventsActivity.this, HomeActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.enter_from_bottom, R.anim.stay_in_place);
}
});
}
示例4: populateAvailableSlots
import com.parse.ParseQuery; //導入方法依賴的package包/類
public void populateAvailableSlots(final String trainerId, final String day, final String sDate, final Context context) {
final TextView tvSlotsInfo = (TextView) findViewById(R.id.tvSlotsInfo);
final ParseObject trainer = ParseObject.createWithoutData("Trainer",trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("TrainerSlots");
query.selectKeys(Arrays.asList("start_time", "end_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("day", day);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, com.parse.ParseException e) {
if (e == null) {
listOfSlots.clear();
for (ParseObject slots : trainerSlots) {
int startTimeInt = Integer.valueOf(slots.getString("start_time"));
int endTimeInt = Integer.valueOf(slots.getString("end_time"));
arraySlots.clear();
for (int i = startTimeInt; startTimeInt < endTimeInt; startTimeInt++) {
arraySlots.add(startTimeInt);
}
// find out time slots not in arBookedSlots
List<Integer> noBookedSlots = new ArrayList<Integer>(arraySlots);
noBookedSlots.removeAll(arBookedSlots);
for (int k = 0; k < noBookedSlots.size(); k++) {
int intSlotsWithoutBookedSlots = noBookedSlots.get(k);
String slotsWithoutBookedSlots;
if (intSlotsWithoutBookedSlots <= 11) {
slotsWithoutBookedSlots = intSlotsWithoutBookedSlots + " " + Constants.AM;
} else if (intSlotsWithoutBookedSlots == 12) {
slotsWithoutBookedSlots = intSlotsWithoutBookedSlots + " " + Constants.PM;
} else {
slotsWithoutBookedSlots = (intSlotsWithoutBookedSlots - 12) + " " + Constants.PM;
}
listOfSlots.add(slotsWithoutBookedSlots);
}
SimpleDateFormat dt = new SimpleDateFormat("MMMM dd");
tvSlotsInfo.setText(listOfSlots.size() + " slots available on " + dt.format(new Date(sDate)) + ", " + day);
bSelectSlot.setBackground(getResources().getDrawable(R.drawable.primary_blue_button));
try {
Date d = simpleDateStrFormat.parse(sDate);
caldroidFragment.setBackgroundResourceForDate(R.color.selectedSlotColor, d);
previousDate = d;
caldroidFragment.refreshView();
} catch (java.text.ParseException e1) {
e1.printStackTrace();
}
}
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例5: populateCart
import com.parse.ParseQuery; //導入方法依賴的package包/類
private void populateCart(){
String currentUser;
currentDate = Calendar.getInstance().getTime();// get current date
final SimpleDateFormat simpleDateStrFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
final String strCurrentDate = simpleDateStrFormat.format(currentDate);
if (SimpleUser.currentUserObjectId == null){
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
currentUser = pref.getString("userId","n");
}else {
currentUser = SimpleUser.currentUserObjectId;
}
ParseObject trainer = ParseObject.createWithoutData("Trainer", Trainer.currentTrainerObjectId);
ParseObject user = ParseObject.createWithoutData("SimpleUser", currentUser);
ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
query.selectKeys(Arrays.asList("slot_date","slot_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("user_id", user);
query.whereEqualTo("status", Constants.ADD_TO_CART);
query.orderByAscending("slot_date");
adSlots.clear();
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, ParseException e) {
if (e == null) {
for (ParseObject slots : trainerSlots) {
BlockedSlots b = new BlockedSlots();
b.setSlotDate(slots.getString("slot_date"));
b.setSlotTime(slots.getString("slot_time"));
try {
Date cDate = simpleDateStrFormat.parse(strCurrentDate);
Date slotDate = simpleDateStrFormat.parse(slots.getString("slot_date"));
if (slotDate.after(cDate) || slotDate.equals(cDate)) {
alSlots.add(b);
}
if (alSlots.size() > 0) {
int slotAmount = Trainer.currentPrice*alSlots.size();
int aSize = alSlots.size();
tvNoOfSlots.setText(aSize+" * $" +Trainer.currentPrice+".00 = $"+slotAmount+".00");
tvFooterTotalAmt.setText(Html.fromHtml("Total Amount: <b>$" + slotAmount + ".00</b>"));
}
adSlots.notifyDataSetChanged();
} catch (java.text.ParseException e1) {
e1.printStackTrace();
}
adSlots.notifyDataSetChanged();
}
} else {
Log.v("DEBUG!!!!!!!!!!!!!", "Error occured >>>>>>>>>>>>>>>>>> " + e);
}
}
});
bProceedtoPayment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CartActivity.this, PaymentActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.enter_from_bottom, R.anim.stay_in_place);
}
});
}