Java 类com.parse.ParseObject 实例源码

项目:sensorama    文件:MainActivity.java   
public void sampleFileExport(String fileName, String filePath) {
    String fileContent = sampleFileGetContent(filePath);
    byte[] data = fileContent.getBytes();
    ParseFile file = new ParseFile(fileName, data);

    TextView fileSize = (TextView) findViewById(R.id.sampleSize);
    fileSize.setText("" + fileContent.length());

    file.saveInBackground();

    ParseObject jobApplication = new ParseObject("SensoramaFile");
    jobApplication.put("fileName", fileName);
    jobApplication.put("sampleFile", file);
    jobApplication.put("devname", SRCfg.deviceName);
    jobApplication.saveInBackground();
}
项目:My-Sheep    文件:ParseApplication.java   
@Override
public void onCreate() {
    super.onCreate();
    ParseObject.registerSubclass(Kid.class);
    ParseObject.registerSubclass(Visit.class);
    ParseObject.registerSubclass(Attendance.class);
    Parse.initialize(new  Parse.Configuration.Builder(this)
            .applicationId("PARSE applicationId to be added here")
            .clientKey("Parse Client Id to be added here")
            .server("Parse server address to be added here").enableLocalDataStore().build());

    ParseUser.enableAutomaticUser();
    ParseACL defaultACL = new ParseACL();
    defaultACL.setPublicReadAccess(true);
    defaultACL.setPublicWriteAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);
}
项目:GCSApp    文件:ParseManager.java   
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
    ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
    pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
    pQuery.findInBackground(new FindCallback<ParseObject>() {

        @Override
        public void done(List<ParseObject> arg0, ParseException arg1) {
            if (arg0 != null) {
                List<EaseUser> mList = new ArrayList<EaseUser>();
                for (ParseObject pObject : arg0) {
                    EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
                    ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
                    if (parseFile != null) {
                        user.setAvatar(parseFile.getUrl());
                    }
                    user.setNick(pObject.getString(CONFIG_NICK));
                    EaseCommonUtils.setUserInitialLetter(user);
                    mList.add(user);
                }
                callback.onSuccess(mList);
            } else {
                callback.onError(arg1.getCode(), arg1.getMessage());
            }
        }
    });
}
项目:Clasick    文件:DisplayImage.java   
public static void retreiveprofile(String username , final Context context) {
    ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
    query.whereEqualTo("user",username);
    query.getFirstInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject parseObject, ParseException e) {

            if(parseObject!=null && e==null) {

                ParseFile file = (ParseFile) parseObject.get("image");
                String url = "http://wwww.webianks.com";

                if (file != null) {
                    url = file.getUrl().toString();
                }

                MainActivity.retriveProfileCallback(context, url);

            }else{
                //canntretrivee file
            }
        }
    });

}
项目:Clasick    文件:DisplayImage.java   
public static void retreivetimelineprofile(String username , final Context context) {
    ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
    query.whereEqualTo("user",username);
    query.getFirstInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject parseObject, ParseException e) {

            if(parseObject!=null && e==null) {

                ParseFile file = (ParseFile) parseObject.get("image");
                String url = "http://wwww.webianks.com";
                if (file != null) {

                    url = file.getUrl().toString();
                }

                Profile.retriveTimelineProfileCallback(context, url);

            }else{
                //canntretrivee file
            }
        }
    });

}
项目:Lab-Assistant    文件:MainActivity.java   
@Override
public void onStudentFound(String courseName, ParseObject object, int lab_count) {
    GradeFragment gradeFragment = GradeFragment.newInstance(courseName, lab_count);
    gradeFragment.setmObject(object);

    /*
    //added a little transition
    //TODO - add more transition animations
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        Slide slideTransition = new Slide(Gravity.RIGHT);
        slideTransition.setDuration(1000);
        Slide slideTransitionExit = new Slide(Gravity.LEFT);
        slideTransition.setDuration(1000);
        idNumberFragment.setExitTransition(slideTransitionExit);
        gradeFragment.setEnterTransition(slideTransition);
        gradeFragment.setAllowEnterTransitionOverlap(overlap);
        idNumberFragment.setAllowReturnTransitionOverlap(overlap);
    }*/

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.container, gradeFragment)
            .addToBackStack("Grades")
            .commit();
}
项目:Marketplace    文件:PostActivity.java   
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());
}
项目:projectTetViet    文件:PhotoActivity.java   
private void loadParseData(String Id){
    ParseQuery<ParseObject> query = ParseQuery.getQuery(EventTable);
    query.whereEqualTo("PhotoAlbumId", Id);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> productParseList, com.parse.ParseException e) {
            if (e == null) {
                if(productParseList.size() > 0){
                    eventList.addAll(productParseList);
                    eventAdapter = new PhotosAdapter(mContext, eventList);
                    gridView.setAdapter(eventAdapter);
                }else{
                    Toast.makeText(mContext,"Danh sách trống", Toast.LENGTH_SHORT).show();
                }
            } else {
                e.printStackTrace();
                LoggerFactory.e("loadParseData", "Error: " + e.getMessage());
            }
        }
    });

}
项目:projectTetViet    文件:VideosActivity.java   
private void loadParseData(){
    ParseQuery<ParseObject> query = ParseQuery.getQuery(tableName);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> productParseList, com.parse.ParseException e) {
            if (e == null) {
                if(productParseList.size() > 0){
                    eventList.addAll(productParseList);
                    eventAdapter = new VideoAdapter(mContext, eventList);
                    gridView.setAdapter(eventAdapter);
                }else{
                    Toast.makeText(mContext,"Danh sách trống", Toast.LENGTH_SHORT).show();
                }
            } else {
                e.printStackTrace();
                LoggerFactory.e("loadParseData", "Error: " + e.getMessage());
            }
        }
    });

}
项目:note.cntxt    文件:MyApplication.java   
@Override
public void onCreate() {
    super.onCreate();

    ParseObject.registerSubclass(Organization.class);
    ParseObject.registerSubclass(UserBeacon.class);
    ParseObject.registerSubclass(CustomUser.class);
    ParseObject.registerSubclass(Note.class);

    Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
            .applicationId(Parse_appID)
            .clientKey(null)
            .addNetworkInterceptor(new ParseLogInterceptor())
            .enableLocalDataStore() //enable local datastore within initialization since hosted elsewhere
            .server("http://estinote.herokuapp.com/parse/") // The trailing slash is important.
    .build()
    );

    //scan();
}
项目:langren    文件:MainApplication.java   
public void init() {

        MainApplication.ServerHost = getSharedPreferences("ip",MODE_PRIVATE).getString("ip",null);

        if(MainApplication.ServerHost==null)
            MainApplication.ServerHost = Constants.ServerHost;
        Fresco.initialize(getApplicationContext());

        ParseObject.registerSubclass(UserInfo.class);
        Parse.initialize(new Parse.Configuration.Builder(this)
                .applicationId("langrensha")
                .clientKey("")
                .server(Constants.makeNewIpAddress(MainApplication.ServerHost) + "/parse")
                .enableLocalDataStore()
                .build()
        );


        initSocket();

        SoundEffectManager.init(this);
    }
项目:Chateau    文件:ParseMessageDataSource.java   
@NonNull
@Override
public Observable<Void> send(@NonNull SendQuery<ExampleMessage> query) {
    final ExampleMessage message = query.getMessage();
    final String conversationId = query.getConversationId();
    final ParseObject parseMessage = createOutgoingParseObject(conversationId, message);
    // Give it a timestamp that ensured that it ends up last (this will be replaced by the real server side timestamp)
    mLastMessageTimestamp = Math.max(System.currentTimeMillis(), mLastMessageTimestamp + 1);

    final ExampleMessage unconfirmedMessage = ExampleMessage.createUnconfirmedMessage(message.getLocalId(), mParseHelper.getCurrentUser().getObjectId(), message.getPayload(), mLastMessageTimestamp);

    mUpdatePublisher.onNext(new Update<>(conversationId, Update.Action.ADDED, null, unconfirmedMessage));

    return saveMessage(parseMessage)
        .observeOn(Schedulers.io())
        .doOnError(throwable -> onFailedToSend(conversationId, unconfirmedMessage))
        .doOnSuccess(parseObject -> onMessageSent(conversationId, parseObject, unconfirmedMessage))
        .toObservable()
        .ignoreElements()
        .cast(Void.class);
}
项目:Chateau    文件:ParseMessageDataSource.java   
private ParseObject createOutgoingParseObject(String conversationId, ExampleMessage message) {
    final ParseObject parseMessage = ParseObject.create(MessagesTable.NAME);
    parseMessage.put(MessagesTable.Fields.FROM, mParseHelper.getCurrentUser());
    if (message.getPayload() instanceof TextPayload) {
        parseMessage.put(MessagesTable.Fields.TYPE, MessagesTable.Types.TEXT);
        parseMessage.put(MessagesTable.Fields.MESSAGE, ((TextPayload) message.getPayload()).getMessage());
    }
    else if (message.getPayload() instanceof ImagePayload) {
        parseMessage.put(MessagesTable.Fields.TYPE, MessagesTable.Types.IMAGE);
    }

    parseMessage.put(MessagesTable.Fields.CHAT, ParseObject.createWithoutData(ChatTable.NAME, conversationId));
    // Need to ensure the message sent back has the generated local id so it can be matched with responses form the server
    parseMessage.put(MessagesTable.Fields.LOCAL_ID, message.getLocalId());
    return parseMessage;
}
项目:Chateau    文件:ParseMessageDataSource.java   
/**
 * Request a single message in a conversation to be updated.
 */
private void updateMessage(@NonNull String conversationId, @NonNull String messageId) {
    ParseQuery<ParseObject> query = new ParseQuery<>(MessagesTable.NAME);
    query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ONLY);
    query.include(MessagesTable.Fields.IMAGE);
    Log.d(TAG, "Updating message: " + messageId);

    mParseHelper.get(query, messageId)
        .map(in -> ParseUtils.from(in, mParseHelper))
        .toList()
        .subscribe(messages -> {
            for (ExampleMessage message : messages) {
                mUpdatePublisher.onNext(new Update<>(conversationId, Update.Action.UPDATED, null, message));
            }
        });
}
项目:Chateau    文件:ParseConversationDataSource.java   
@NonNull
@Override
public Observable<List<ExampleConversation>> delete(DeleteConversationsQuery<ExampleConversation> query) {
    final Map<String, Object> params = new HashMap<>();
    List<String> chatIds = new ArrayList<>();
    for (ExampleConversation c : query.getConversations()) {
        chatIds.add(c.getId());
    }
    params.put(DeleteConversationsFunc.Fields.CHAT_IDS, chatIds);
    // The response contains all deleted conversations
    return mParseHelper.<List<ParseObject>>callFunction(DeleteConversationsFunc.NAME, params)
        .flatMap(Observable::from)
        .map(in -> ParseUtils.conversationFromChat(in, mParseHelper))
        .doOnNext(exampleConversation -> mConversationUpdatePublisher.onNext(true))
        .toList()
        .ignoreElements()
        .concatWith(load(null).ignoreElements().map(i -> Collections.<ExampleConversation>emptyList()))
        .subscribeOn(Schedulers.io());
}
项目:Chateau    文件:ParseUtils.java   
public static ExampleConversation conversationFromSubscription(ParseObject subscription, ParseHelper helper) {
    final ParseObject chatParseObject = subscription.getParseObject(ChatSubscriptionTable.Fields.CHAT);
    if (chatParseObject.isDataAvailable()) {
        final String name = TextUtils.isEmpty(chatParseObject.getString(ChatTable.Fields.NAME)) ? subscription.getString(ChatSubscriptionTable.Fields.NAME) : chatParseObject.getString(ChatTable.Fields.NAME);
        final List<BaseUser> users = Collections.emptyList(); // TODO: Populate!
        int unread = chatParseObject.getInt(ChatTable.Fields.MESSAGE_COUNT) - subscription.getInt(ChatSubscriptionTable.Fields.LAST_SEEN_COUNT);
        final boolean hasLastMessage = chatParseObject.has(ChatTable.Fields.LAST_MESSAGE) && chatParseObject.getParseObject(ChatTable.Fields.LAST_MESSAGE).isDataAvailable();
        final ExampleMessage lastMessage = hasLastMessage ? from(chatParseObject.getParseObject(ChatTable.Fields.LAST_MESSAGE), helper) : null;
        return new ExampleConversation(chatParseObject.getObjectId(),
            name,
            users,
            lastMessage,
            unread);
    }
    else {
        return new ExampleConversation(chatParseObject.getObjectId());
    }
}
项目:Chateau    文件:ParseMessageDataSourceTest.java   
@Test
public void sendTextMessage() {
    // Setup
    ExampleMessage message = ExampleMessage.createOutgoingTextMessage(TEST_CHAT_ID, "Hello world");
    final MessageQueries.SendQuery<ExampleMessage> sendQuery = new MessageQueries.SendQuery<>(TEST_CHAT_ID, message);
    final TestSubscriber<Update<ExampleMessage>> testSubscriber = new TestSubscriber<>();

    // Execute
    mUpdates.subscribe(testSubscriber);
    mTarget.send(sendQuery).subscribe();

    // Assert
    verify(mMockParseHelper).save(argThat(new CustomMatcher<ParseObject>("") {
        @Override
        public boolean matches(Object item) {
            final ParseObject parseMessage = (ParseObject) item;

            return parseMessage.getClassName().equals(MessagesTable.NAME);
        }
    }));
    testSubscriber.assertValueCount(2);
}
项目:Chateau    文件:ParseConversationDataSourceTest.java   
@Test
public void getConversation() {
    // Setup
    final String userId = "userId";
    mockCurrentUser(userId);

    final List<ParseObject> subscriptions = ModelTestHelper.createSubscriptions(10);
    final String chatId = "chatId";
    when(mMockParseHelper.find(Mockito.<ParseQuery<ParseObject>>any())).thenReturn(Observable.just(subscriptions));

    // Execute
    final TestSubscriber<ExampleConversation> testSubscriber = executeTarget(mTarget.get(new GetConversationQuery(chatId)));

    // Assert
    testSubscriber.assertCompleted();
    verify(mMockParseHelper).find(mParseQueryArgumentCaptor.capture());

    final ParseQuery<ParseObject> parseQuery = mParseQueryArgumentCaptor.getValue();
    assertThat(testSubscriber.getOnNextEvents().size(), is(10));
    assertThat(parseQuery.getClassName(), is(ChatSubscriptionTable.NAME));
}
项目:Chateau    文件:ParseConversationDataSourceTest.java   
@Test
public void createGroupConversation() {
    // Setup
    final List<String> userIds = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        userIds.add(Integer.toString(i));
    }
    final String groupName = "groupName";

    final Map<String, Object> expectedParams = new HashMap<>();
    expectedParams.put(CreateChatFunc.Fields.OTHER_USER_IDS, userIds);
    expectedParams.put(CreateChatFunc.Fields.GROUP_NAME, groupName);

    ParseObject subscription = ModelTestHelper.createSubscription("id");
    when(mMockParseHelper.<ParseObject>callFunction(eq(CreateChatFunc.NAME), argThat(MapMatchers.matchesEntriesIn(expectedParams))))
        .thenReturn(Observable.just(subscription));

    // Execute
    final TestSubscriber<ExampleConversation> testSubscriber = executeTarget(
        mTarget.create(new CreateGroupConversationQuery(userIds, groupName)));

    // Assert
    testSubscriber.assertCompleted();
    assertThat(testSubscriber.getOnNextEvents().size(), is(1));
}
项目:Chateau    文件:ParseConversationDataSourceTest.java   
@Test
public void createConversation() {
    // Setup
    final Map<String, Object> expectedParams = new HashMap<>();
    expectedParams.put(CreateChatFunc.Fields.OTHER_USER_IDS, Collections.singletonList("0"));

    ParseObject subscription = ModelTestHelper.createSubscription("id");
    when(mMockParseHelper.<ParseObject>callFunction(eq(CreateChatFunc.NAME), argThat(MapMatchers.matchesEntriesIn(expectedParams))))
        .thenReturn(Observable.just(subscription));

    // Execute
    final TestSubscriber<ExampleConversation> testSubscriber = executeTarget(
        mTarget.create(new CreateConversationQuery("0")));

    // Assert
    testSubscriber.assertCompleted();
    assertThat(testSubscriber.getOnNextEvents().size(), is(1));
}
项目:Chateau    文件:ParseConversationDataSourceTest.java   
@Test
public void markConversationRead() {
    // Setup
    String chatId = "chatId";
    final Map<String, Object> expectedParams = new HashMap<>();
    expectedParams.put(MarkChatReadFunc.Fields.CHAT_ID, chatId);
    when(mMockParseHelper.<ParseObject>callFunction(eq(MarkChatReadFunc.NAME), argThat(MapMatchers.matchesEntriesIn(expectedParams))))
        .thenReturn(Observable.empty());

    // Execute
    final TestSubscriber<Void> testSubscriber = executeTarget(
        mTarget.markRead(new MarkConversationReadQuery(chatId)));

    // Assert
    testSubscriber.assertCompleted();
    assertThat(testSubscriber.getOnNextEvents().size(), is(0));
}
项目:ChatDemoUI3.0    文件:ParseManager.java   
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
    ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
    pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
    pQuery.findInBackground(new FindCallback<ParseObject>() {

        @Override
        public void done(List<ParseObject> arg0, ParseException arg1) {
            if (arg0 != null) {
                List<EaseUser> mList = new ArrayList<EaseUser>();
                for (ParseObject pObject : arg0) {
                    EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
                    ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
                    if (parseFile != null) {
                        user.setAvatar(parseFile.getUrl());
                    }
                    user.setNick(pObject.getString(CONFIG_NICK));
                    EaseCommonUtils.setUserInitialLetter(user);
                    mList.add(user);
                }
                callback.onSuccess(mList);
            } else {
                callback.onError(arg1.getCode(), arg1.getMessage());
            }
        }
    });
}
项目:roboscout    文件:TeamListActivity.java   
public void localTeamList() {
    // Query backend
    ParseQuery<ParseObject> query = ParseQuery.getQuery("T" + teamNumber);
    query.fromLocalDatastore().findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> list, ParseException e) {
            // No exception, query successful
            if (e == null) {
                teams.clear();
                Collections.reverse(list);
                for (ParseObject object : list) {
                    if (object.getString("team").equals("")) continue;
                    Team team = new Team(object.getString("team"), object.getString("region"), object.getString("school"), object.getString("teamName"), object.getObjectId());
                    teams.add(team);
                }
            }
            adapter.notifyDataSetChanged();
            refresh.setRefreshing(false);
        }
    });
}
项目:BullshIT-DB_Android    文件:MainActivity.java   
public void addBullshITBank(final String NewNumber){
    if(NewNumber.length()<6){
        Toast.makeText(mContext,
                getResources().getString(R.string.too_short),
                Toast.LENGTH_LONG).show();
    }else{

        ParseQuery<ParseObject> query = ParseQuery.getQuery("BullshITBankDB");
        query.whereStartsWith("phone", NewNumber);
        query.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> parseObjects, ParseException e) {
                if (parseObjects.size() > 0) {
                    Toast.makeText(mContext,
                            getResources().getString(R.string.duplicate),
                            Toast.LENGTH_LONG).show();
                } else {
                    FragmentManager fragmentManager = getSupportFragmentManager();
                    DialogFragment ConfirmDialog = AddNewConfirmDialog.newInstance(NewNumber,GUID);
                    ConfirmDialog.show(fragmentManager,"confirmdialog");
                }
            }
        });

    }
}
项目:AmazingFriends    文件:RecipientsActivity.java   
protected ParseObject createMessage() {
    ParseObject message = new ParseObject(ParseConstants.CLASS_MESSAGES);
    message.put(ParseConstants.KEY_SENDER_ID, ParseUser.getCurrentUser().getObjectId());
    message.put(ParseConstants.KEY_SENDER_NAME, ParseUser.getCurrentUser().getUsername());
    message.put(ParseConstants.KEY_RECIPIENT_IDS, getRecipientIds());
    message.put(ParseConstants.KEY_FILE_TYPE, mFileType);

    byte[] fileBytes = FileHelper.getByteArrayFromFile(this, mMediaUri);

    if (fileBytes == null) {
        return null;
    }
    else {
        if (mFileType.equals(ParseConstants.TYPE_IMAGE)) {
            fileBytes = FileHelper.reduceImageForUpload(fileBytes);
        }

        String fileName = FileHelper.getFileName(this, mMediaUri, mFileType);
        ParseFile file = new ParseFile(fileName, fileBytes);
        message.put(ParseConstants.KEY_FILE, file);

        return message;
    }
}
项目:libertacao-android    文件:EventDetailActivity.java   
private void deleteEvent() {
    new AlertDialog.Builder(this)
            .setTitle(getString(R.string.delete))
            .setMessage(getString(R.string.deleteConfirm))
            .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    final ProgressDialog pd = ViewUtils.showProgressDialog(EventDetailActivity.this, getString(R.string.deletingEvent), false);
                    ParseObject eventParseObject = new ParseObject(Event.EVENT);
                    eventParseObject.setObjectId(event.getObjectId());
                    eventParseObject.deleteInBackground(new DeleteCallback() {
                        @Override
                        public void done(ParseException e) {
                            DatabaseHelper.getHelper(EventDetailActivity.this).getEventIntegerRuntimeExceptionDao().delete(event);
                            ViewUtils.hideProgressDialog(pd);
                            Toast.makeText(EventDetailActivity.this,
                                    EventDetailActivity.this.getString(R.string.eventDeletedSuccessfully),
                                    Toast.LENGTH_LONG).show();
                            finish();
                        }
                    });
                }
            })
            .setNegativeButton(android.R.string.no, null)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .show();
}
项目:connectedteam-android    文件:EventDetailsFragment.java   
private void joinEvent() {
    showLoadingDialog(getString(R.string.submitting));
    ParseRelation<ParseObject> attendees = mEvent.getRelation("attendees");
    attendees.add(ParseUser.getCurrentUser());
    mEvent.saveInBackground(new SaveCallback() {
        @Override
        public void done(ParseException e) {
            dismissDialog();
            if(e!=null){
                new AlertDialog.Builder(getActivity()).setMessage(e.getMessage()).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        getActivity().finish();
                    }
                }).setCancelable(false).show();
            }
            else{
                Toast.makeText(getActivity(), "You're going!", Toast.LENGTH_SHORT).show();
                aq.id(R.id.btn_submit).enabled(false);
                mHasJoined=true;
            }
        }
    });
}
项目:Volo    文件:ProfileListFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    ParseQuery<ParseObject> query = ParseQuery.getQuery("event_user");
    query.whereEqualTo("userID", ParseUser.getCurrentUser().getObjectId() );
    query.whereEqualTo("isPart", true);
            query.orderByDescending("createdAt");
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> events, ParseException e) {
            if (e == null) {
                mParticipatedEvents= events;

                ProfileListAdapter adapter = new ProfileListAdapter(getListView().getContext(), mParticipatedEvents);
                setListAdapter(adapter);



            } else {

            }
        }
    });


}
项目:quoteit_android    文件:MainActivity.java   
@Override
protected Void doInBackground(List<ParseObject>... lists) {
    List<ParseObject> list = lists[0];
    previosuUserList = list;
    for (int i=0;i<list.size();i++){
        dataset.add(new QuotePojo(list.get(i).getString("quote"),
                list.get(i).getString("author"),
                list.get(i).getString("user_id"),
                list.get(i).getString("user_name"),
                list.get(i).getLong("time")
        ));//end of constructor


    }

    ParseObject.create(String.valueOf(dataset)).pinInBackground();

    return null;
}
项目:androidClient    文件:Burrd.java   
@Override
public void onCreate() {
    super.onCreate();

    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);
    // Setup Model objects
    ParseObject.registerSubclass(DealModel.class);
    ParseObject.registerSubclass(RestaurantModel.class);
    // Production Database
    //Parse.initialize(this, "2TR1bOpjpFL8Wm7a7TXcbuoFCyJRB0VdSOXnf8tB", "hY2oFPc3k8RJLsZIsadM1Me0JS1ndnwRwim104WK");
    // Setup Parse db connection
    Parse.initialize(this, "zjbuJvWrvzgdpDvRnHejLD008hLGf6zHua5nCGvq", "7DegaPYh670uARgycPIDmt6yQgM2x6XvRDo5o6vI");

    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
            .defaultDisplayImageOptions(defaultOptions)
            .build();
    ImageLoader.getInstance().init(config);
}
项目:Android-ParseModel    文件:BaseCodeGenerator.java   
public static TypeSpec.Builder generate() {
    TypeSpec.Builder builder = TypeSpec.classBuilder(PARSE_BASE_OBJECT)
            .superclass(ParseObject.class)
            .addModifiers(Modifier.PUBLIC, Modifier.STATIC)
            .addField(FieldSpec
                    .builder(String.class, "KEY_OBJECT_ID", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
                    .initializer("$S", "objectId")
                    .build())
            .addField(FieldSpec
                    .builder(String.class, "KEY_CREATED_AT", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
                    .initializer("$S", "createdAt")
                    .build())
            .addField(FieldSpec
                    .builder(String.class, "KEY_UPDATED_AT", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
                    .initializer("$S", "updatedAt")
                    .build());

    return builder;
}
项目:AutoTimeHelper    文件:PointCRUD.java   
public void read(String UUID, ParseObject parseLine, final List<Slice> sliceList) {
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Point");
    if (!NetworkStatus.isConnected)
        query.fromLocalDatastore();

    query.whereEqualTo("UUID", UUID);
    query.getFirstInBackground(new GetCallback<ParseObject>() {
        public void done(ParseObject parsePoint, ParseException e) {
            if (parsePoint == null) {
                Log.i("Point", "Read: The getFirst request failed.");
            } else {
                // try {
                Log.i("Point", "Starting read");
                // parsePoint.fetch();
                Point point = new Point(parsePoint.getDouble("x"), parsePoint.getDouble("y"));
                point.setObjectId(parsePoint.getString("UUID"));
                onresult.onResult(point, sliceList);
                // } catch (ParseException e1) {
                // Log.d("Point", "Read: object not nul, but" + e1);
                // e1.printStackTrace();
                // }

            }
        }
    });
}
项目:Fitness-Buddy-Group-Project    文件:BlockSlotActivity.java   
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);
        }
    });

}
项目:HMS3310    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState)
{
    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);

    Parse.initialize(this, "cJNtcpbBye411pXYhnIUtQVeLBMQMKbWZ5CoNb5D", "XNe6Tbiwhlu15tmbsN4Ac7IFg7ENcpLP2cuJw5pU");
    ParseObject testObject = new ParseObject("TestObject");
    testObject.put("foo", "bar");
    testObject.saveInBackground();
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

}
项目:scout    文件:MainActivity.java   
private void getModelIdFromServer(final String filePath) {


        showProgressDialog();

        ParseQuery<ParseObject> parseQuery = ParseQuery.getQuery("Model");
        parseQuery.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> objects, ParseException e) {

                if (e == null) {

                    if (objects != null && objects.size() > 0) {

                        String model = objects.get(0).getString("model_id");

                        try {
                            readFile(filePath, model);
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    } else {
                        Toast.makeText(MainActivity.this, "Can't get model", Toast.LENGTH_LONG).show();
                    }
                } else {
                    Toast.makeText(MainActivity.this, "Can't get model", Toast.LENGTH_LONG).show();
                }

            }
        });


    }
项目:MyAnimeViewer    文件:ParseManager.java   
private void loadParseConfig(Context context) {
    ParseObject.registerSubclass(AnimeRecord.class);
    ParseObject.registerSubclass(EpisodeRecord.class);
    Parse.initialize(new Parse.Configuration.Builder(context)
            .applicationId(context.getString(R.string.parse_app_id))
            .clientKey("")
            .server(context.getString(R.string.parse_server))
            .enableLocalDataStore()
            .build()
    );
}
项目:GCSApp    文件:ParseManager.java   
public void asyncGetCurrentUserInfo(final EMValueCallBack<EaseUser> callback){
    final String username = EMClient.getInstance().getCurrentUser();
    asyncGetUserInfo(username, new EMValueCallBack<EaseUser>() {

        @Override
        public void onSuccess(EaseUser value) {
            callback.onSuccess(value);
        }

        @Override
        public void onError(int error, String errorMsg) {
            if (error == ParseException.OBJECT_NOT_FOUND) {
                ParseObject pUser = new ParseObject(CONFIG_TABLE_NAME);
                pUser.put(CONFIG_USERNAME, username);
                pUser.saveInBackground(new SaveCallback() {

                    @Override
                    public void done(ParseException arg0) {
                        if(arg0==null){
                            callback.onSuccess(new EaseUser(username));
                        }
                    }
                });
            }else{
                callback.onError(error, errorMsg);
            }
        }
    });
}
项目:GCSApp    文件:ParseManager.java   
public void asyncGetUserInfo(final String username,final EMValueCallBack<EaseUser> callback){
    ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
    pQuery.whereEqualTo(CONFIG_USERNAME, username);
    pQuery.getFirstInBackground(new GetCallback<ParseObject>() {

        @Override
        public void done(ParseObject pUser, ParseException e) {
            if(pUser!=null){
                String nick = pUser.getString(CONFIG_NICK);
                ParseFile pFile = pUser.getParseFile(CONFIG_AVATAR);
                if(callback!=null){
                    EaseUser user = DemoHelper.getInstance().getContactList().get(username);
                    if(user!=null){
                        user.setNick(nick);
                        if (pFile != null && pFile.getUrl() != null) {
                            user.setAvatar(pFile.getUrl());
                        }
                    }else{
                        user = new EaseUser(username);
                        user.setNick(nick);
                        if (pFile != null && pFile.getUrl() != null) {
                               user.setAvatar(pFile.getUrl());
                           }
                    }
                    callback.onSuccess(user);
                }
            }else{
                if(callback!=null){
                    callback.onError(e.getCode(), e.getMessage());
                }
            }

        }
    });
}
项目:Mediator_Android    文件:DataController.java   
private void prepareParse(Context context) {
    ParseObject.registerSubclass(LobbyEventCard.class);
    ParseObject.registerSubclass(ScheduleCard.class);
    ParseObject.registerSubclass(ScheduleGroupCard.class);
    ParseObject.registerSubclass(PlanCard.class);
    ParseObject.registerSubclass(PlanStandCard.class);

    Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
    Parse.initialize(context, Constans.PARSE_APP_ID, Constans.PARSE_CLIENT_KEY);
}
项目:UWI-Research-Days-Android    文件:ParseController.java   
@Override
public void onCreate() {
    super.onCreate();
    Parse.enableLocalDatastore(this);
    ParseObject.registerSubclass(Event.class);
    ParseObject.registerSubclass(Faculty.class);
    Parse.initialize(this);
    initializeDeviceId();
}