本文整理汇总了Java中com.parse.FunctionCallback类的典型用法代码示例。如果您正苦于以下问题:Java FunctionCallback类的具体用法?Java FunctionCallback怎么用?Java FunctionCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FunctionCallback类属于com.parse包,在下文中一共展示了FunctionCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestSessionToken
import com.parse.FunctionCallback; //导入依赖的package包/类
private void requestSessionToken(String authorizationCode) {
HashMap<String, Object> params = new HashMap<>();
params.put("authorizationCode", authorizationCode);
ParseCloud.callFunctionInBackground("requestSessionToken", params, new FunctionCallback<String>() {
@Override
public void done(String sessionToken, ParseException e) {
if (e == null) {
Log.d("cloud", "Got back: " + sessionToken);
becomeUser(sessionToken);
} else {
Toast.makeText(LoginActivity.this, "Login failed", Toast.LENGTH_LONG).show();
Log.d("error", e.toString());
}
}
});
}
示例2: upVote
import com.parse.FunctionCallback; //导入依赖的package包/类
public void upVote() {
if (dealModel != null) {
Map<String,String> params = new HashMap<>();
final Activity restaurantActivity = activity;
params.put("objectId", dealModel.getId());
params.put("deviceId", Device.getDeviceId(activity));
ParseCloud.callFunctionInBackground("upVote", params, new FunctionCallback<String>() {
public void done(String results, ParseException e) {
if (results != null) {
Toast.makeText(restaurantActivity, results, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(restaurantActivity, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
}
示例3: downVote
import com.parse.FunctionCallback; //导入依赖的package包/类
public void downVote() {
if (dealModel != null) {
Map<String, String> params = new HashMap<>();
final Activity restaurantActivity = activity;
params.put("objectId", dealModel.getId());
params.put("deviceId", Device.getDeviceId(activity));
ParseCloud.callFunctionInBackground("downVote", params, new FunctionCallback<String>() {
public void done(String results, ParseException e) {
if (results != null) {
Toast.makeText(restaurantActivity, results, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(restaurantActivity, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
}
示例4: undoUpVote
import com.parse.FunctionCallback; //导入依赖的package包/类
public void undoUpVote() {
if (dealModel != null) {
Map<String,String> params = new HashMap<>();
final Activity restaurantActivity = activity;
params.put("objectId", dealModel.getId());
params.put("deviceId", Device.getDeviceId(activity));
ParseCloud.callFunctionInBackground("undoUpVote", params, new FunctionCallback<String>() {
public void done(String results, ParseException e) {
if (results != null) {
Toast.makeText(restaurantActivity, results, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(restaurantActivity, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
}
示例5: undoDownVote
import com.parse.FunctionCallback; //导入依赖的package包/类
public void undoDownVote() {
if (dealModel != null) {
Map<String,String> params = new HashMap<>();
final Activity restaurantActivity = activity;
params.put("objectId", dealModel.getId());
params.put("deviceId", Device.getDeviceId(activity));
ParseCloud.callFunctionInBackground("undoDownVote", params, new FunctionCallback<String>() {
public void done(String results, ParseException e) {
if (results != null){
Toast.makeText(restaurantActivity, results, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(restaurantActivity, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
}
示例6: onClick
import com.parse.FunctionCallback; //导入依赖的package包/类
@Override
public void onClick(View view) {
if (view.getId() == R.id.resend_verification_email) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("userid", ParseUser.getCurrentUser().getObjectId());
ParseCloud.callFunctionInBackground("resendVerificationEmail", map, new FunctionCallback<Object>() {
@Override
public void done(Object o, ParseException e) {
if (e == null) {
Toast.makeText(InboxActivity.this, getString(R.string.email_verification_sent), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(InboxActivity.this, getString(R.string.failed_to_send_email_verification) + " " + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
}
示例7: getProfile
import com.parse.FunctionCallback; //导入依赖的package包/类
@Override
public List<Profile> getProfile(Email... emails) {
HashMap<String, Email> params = new HashMap<String, Email>();
int counter = 1;
for(Email email : emails) {
params.put("email" + counter, email);
counter++;
}
ParseCloud.callFunctionInBackground("hello", params, new FunctionCallback<Profile>() {
public void done(Profile fetchedProfile, ParseException e) {
if (e == null) {
if(ParseAdapter.profileList == null) {
ParseAdapter.profileList.add(fetchedProfile);
}
}
}
});
return ParseAdapter.profileList;
}
示例8: loadFeedItems
import com.parse.FunctionCallback; //导入依赖的package包/类
private void loadFeedItems() {
Map<String, String> params = new HashMap<>();
ParseCloud.callFunctionInBackground("loadFeed", params, new FunctionCallback<List<Design>>() {
@Override
public void done(List<Design> designs, ParseException e) {
if (e == null) {
mAdapter.addAll(designs);
} else {
e.printStackTrace();
}
progressBar.setVisibility(View.INVISIBLE);
}
});
}
示例9: fetchUsers
import com.parse.FunctionCallback; //导入依赖的package包/类
private void fetchUsers() {
Map<String, String> map = new HashMap<String, String>();
ParseCloud.callFunctionInBackground("loadFindPeople", map, new FunctionCallback<List<User>>() {
@Override
public void done(List<User> users, ParseException e) {
if (e == null) {
mAdapter.addAll(users);
} else {
e.printStackTrace();
}
progressBar.setVisibility(View.INVISIBLE);
}
});
}
示例10: resend_fun
import com.parse.FunctionCallback; //导入依赖的package包/类
public void resend_fun(View v)
{
if(busy==0)
{
busy =1;
HashMap<String, String> ha = new HashMap<String, String>();
ha.put("number", number);
ha.put("message", "Cloak Verification Code: "+verification_code);
ParseCloud.callFunctionInBackground("send_sms", ha, new FunctionCallback<String>() {
public void done(String result, ParseException e) {
busy =0;
if (e == null) {
Toast.makeText(con, "Successfully sent.", Toast.LENGTH_LONG).show();
Log.d("%%%%%%%%%%%%%%%%%%%%%%", result);
}
else{
Log.d("%%%%%%%%%%%%%%%%%%%%%%", e.getMessage());
}
}
});
}
else
{
Toast.makeText(con, "Please wait. Already sending another request.", Toast.LENGTH_LONG).show();
}
}
开发者ID:chinmaykrishna,项目名称:Social-Networking-App-where-you-smiling-is-liking-the-post,代码行数:28,代码来源:SignupActivity.java
示例11: getLCDetailsData
import com.parse.FunctionCallback; //导入依赖的package包/类
protected void getLCDetailsData() {
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("userId", ParseUser.getCurrentUser().getObjectId());
params.put("parentGoalId", goal.getParentGoal().getObjectId());
params.put("goalId", goal.getObjectId());
showLoadingView();
ParseCloud.callFunctionInBackground("goalDetailView", params,
new FunctionCallback<HashMap<String, Object>>() {
@SuppressWarnings("unchecked")
@Override
public void done(HashMap<String, Object> result, ParseException exception) {
if (exception == null) {
final ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
mLendingCircleDetail = mapper.convertValue(result.get("goalDetails"),
LCDetail.class);
posts.addAll((List<Post>) result.get("posts"));
aposts.notifyDataSetChanged();
HideLoadingView();
setUpCircle();
lvLCDetails.setAdapter(aposts);
} else {
Toast.makeText(LCDetailsActivity.this, R.string.parse_error_querying,
Toast.LENGTH_LONG).show();
Log.d("debug", exception.getLocalizedMessage());
}
}
});
}
示例12: onSavePost
import com.parse.FunctionCallback; //导入依赖的package包/类
@Override
public void onSavePost(String inputText) {
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("userId", ParseUser.getCurrentUser().getObjectId());
// parent goal id
params.put("goalId", goal.getParentGoal().getObjectId());
params.put("content", inputText);
// params.put("type", inputText);
// params.put("toUserId", goal.getObjectId());
ParseCloud.callFunctionInBackground("createPost", params,
new FunctionCallback<HashMap<String, Object>>() {
@Override
public void done(HashMap<String, Object> result, ParseException exception) {
if (exception == null) {
final ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
Log.d("debug", result.toString());
// add it to adapter
boolean success = (Boolean) result.get("success");
if (success) {
Post post = (Post) result.get("post");
aposts.insert(post, 0);
}
}
}
});
}
示例13: onSaveComment
import com.parse.FunctionCallback; //导入依赖的package包/类
@Override
public void onSaveComment(String postId, String inputText) {
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("userId", ParseUser.getCurrentUser().getObjectId());
params.put("postId", postId);
params.put("content", inputText);
// params.put("type", inputText);
// params.put("toUserId", goal.getObjectId());
ParseCloud.callFunctionInBackground("createComment", params,
new FunctionCallback<HashMap<String, Object>>() {
@Override
public void done(HashMap<String, Object> result, ParseException exception) {
if (exception == null) {
final ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
Log.d("debug", result.toString());
// add it to adapter
boolean success = (Boolean) result.get("success");
if (success) {
Post post = (Post) result.get("comment");
post.setUser(currentUser);
aposts.remove(post);
aposts.insert(post, 0);
}
}
}
});
}
示例14: setupData
import com.parse.FunctionCallback; //导入依赖的package包/类
private void setupData() {
tvEmptyLiquidAssets.setVisibility(View.INVISIBLE);
rlLiquidAssets.setVisibility(View.INVISIBLE);
pbLoadingLiquidAssets.setVisibility(View.VISIBLE);
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("userId", User.getCurrentUser().getObjectId());
Calendar today = Calendar.getInstance();
params.put("day", today.get(Calendar.DAY_OF_MONTH));
params.put("month", today.get(Calendar.MONTH) + 1); // Thanks Java...
params.put("year", today.get(Calendar.YEAR));
ParseCloud.callFunctionInBackground("stackedBarChartDetailView", params,
new FunctionCallback<HashMap<String, Object>>() {
@Override
public void done(HashMap<String, Object> result, ParseException exception) {
if (exception != null) {
Log.d("LiquidAssetsFragment", "error on querying transactions",
exception);
return;
}
final ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
final TransactionsDashboard dashboard = mapper.convertValue(result,
TransactionsDashboard.class);
mChart = dashboard.getChart();
Boolean hasData = mChart.getHasData();
if (!hasData) {
return;
}
setupSummary(dashboard);
setupChart(dashboard.getChart());
mTransactionsAdapter = new
TransactionsExpandableListAdapter(
dashboard.getTransactionsByDate(),
getActivity());
elvTransactions.setAdapter(mTransactionsAdapter);
elvTransactions.setEmptyView(tvEmptyTransactions);
elvTransactions.setGroupIndicator(null);
for (int i = 0; i <
mTransactionsAdapter.getGroupCount(); i++) {
elvTransactions.expandGroup(i);
}
pbLoadingLiquidAssets.setVisibility(View.INVISIBLE);
if (isSummaryEmpty()) {
tvEmptyLiquidAssets.setVisibility(View.VISIBLE);
} else {
rlLiquidAssets.setVisibility(View.VISIBLE);
}
}
});
}
示例15: onCreateView
import com.parse.FunctionCallback; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_dashboard, container, false);
setupViews(view);
setupListeners();
showMonthlySpentChartProgressBar();
ParseCloud.callFunctionInBackground("dashboardView", new HashMap<String, Object>(),
new FunctionCallback<HashMap<String, Object>>() {
@Override
public void done(HashMap<String, Object> result, ParseException exception) {
if (exception == null) {
// TODO: Handle case of no data points to plot
final ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
Log.d("DEBUG", result.toString());
final MainDashboard mainDashboardData = mapper.convertValue(result,
MainDashboard.class);
final CashSpentChart cashSpentChart = mainDashboardData
.getCashSpentChart();
BigDecimal totalCash = mainDashboardData.getTotalCash();
// Update total cash on Action Bar
ActionBar actionBar = getActivity().getActionBar();
actionBar.setSubtitle(
getResources().getString(
R.string.dashboard_subtitle_cash_available,
CurrencyUtils.getCurrencyValueFormatted(totalCash)));
List<BigDecimal> data = cashSpentChart.getData();
List<String> xLabels = cashSpentChart.getxLabels();
Log.d("DEBUG", "Data points: " + data.toString());
Log.d("DEBUG", "xLabels: " + xLabels.toString());
Log.d("DEBUG", "# of goals: "
+ String.valueOf(mainDashboardData.getGoals().size()));
setupChart(rlMonthlySpentChart, data, xLabels);
} else {
// TODO: better handle if parse throws and exception
Toast.makeText(getActivity(), getString(R.string.parse_error_querying),
Toast.LENGTH_LONG).show();
// Hide progress Bar
hideMonthlySpentChartProgressBar();
}
}
});
return view;
}