Search in sources :

Example 1 with AVObject

use of com.avos.avoscloud.AVObject in project AnimeTaste by daimajia.

the class SocialPlatform method saveInformation.

private void saveInformation(final Platform platform, boolean update, AVObject toUpdateobject) {
    final AVObject object;
    if (update) {
        object = toUpdateobject;
    } else {
        object = new AVObject("Users");
    }
    object.setFetchWhenSave(true);
    object.put("username", platform.getDb().getUserName());
    object.put("avatar", platform.getDb().getUserIcon());
    object.put("uid", platform.getDb().getUserId());
    object.put("platform", platform.getName());
    object.put("others", platform.getDb().exportData());
    object.saveInBackground(new SaveCallback() {

        @Override
        public void done(AVException err) {
            if (err == null) {
                mSharedPreferences.edit().putString("objectid", object.getObjectId()).putString("username", platform.getDb().getUserName()).putString("avatar", platform.getDb().getUserIcon()).putString("uid", platform.getDb().getUserId()).putBoolean("login", true).putString("platform", platform.getName()).commit();
                MobclickAgent.onEvent(mContext, "login");
                mHandler.sendEmptyMessage(AUTH_SUCCESS);
            } else {
                mHandler.sendEmptyMessage(AUTH_SAVE_FAILED);
            }
        }
    });
}
Also used : SaveCallback(com.avos.avoscloud.SaveCallback) AVException(com.avos.avoscloud.AVException) AVObject(com.avos.avoscloud.AVObject)

Example 2 with AVObject

use of com.avos.avoscloud.AVObject in project AnimeTaste by daimajia.

the class FeedbackActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.action_feedback) {
        String feedback = mFeedback.getText().toString();
        if (feedback.length() == 0) {
            Toast.makeText(mContext, R.string.empty, Toast.LENGTH_SHORT).show();
        } else {
            AVObject feed = new AVObject("Feedback");
            feed.put("content", feedback);
            feed.put("phone", android.os.Build.MODEL);
            feed.put("os", android.os.Build.VERSION.SDK_INT);
            feed.saveInBackground();
            Toast.makeText(mContext, R.string.thanks, Toast.LENGTH_SHORT).show();
            finish();
        }
        return true;
    }
    if (item.getItemId() == android.R.id.home) {
        finish();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : AVObject(com.avos.avoscloud.AVObject)

Aggregations

AVObject (com.avos.avoscloud.AVObject)2 AVException (com.avos.avoscloud.AVException)1 SaveCallback (com.avos.avoscloud.SaveCallback)1