Search in sources :

Example 36 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method findLast.

@Override
public void findLast(AsyncCallback<Map> responder) {
    try {
        Object[] args = new Object[] { tableName };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "last", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 37 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method findLast.

private void findLast(List<String> relations, Integer relationsDepth, AsyncCallback<Map> responder) {
    try {
        Object[] args = new Object[] { tableName, relations, relationsDepth };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "last", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 38 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method getObjectCount.

@Override
public void getObjectCount(AsyncCallback<Integer> responder) {
    try {
        Object[] args = new Object[] { tableName };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "count", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 39 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class MapDrivenDataStore method getObjectCount.

@Override
public void getObjectCount(DataQueryBuilder dataQueryBuilder, AsyncCallback<Integer> responder) {
    try {
        if (dataQueryBuilder == null)
            throw new IllegalArgumentException(ExceptionMessage.NULL_FIELD("dataQueryBuilder"));
        BackendlessDataQuery dataQuery = dataQueryBuilder.build();
        Object[] args = new Object[] { tableName, dataQuery };
        Invoker.invokeAsync(Persistence.PERSISTENCE_MANAGER_SERVER_ALIAS, "count", args, responder);
    } catch (Throwable e) {
        if (responder != null)
            responder.handleFault(new BackendlessFault(e));
    }
}
Also used : NamedObject(weborb.reader.NamedObject) AnonymousObject(weborb.reader.AnonymousObject) BackendlessFault(com.backendless.exceptions.BackendlessFault)

Example 40 with BackendlessFault

use of com.backendless.exceptions.BackendlessFault in project Android-SDK by Backendless.

the class LoginActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.act_login);
    Backendless.initApp(LoginActivity.this, Default.APP_ID, Default.SECRET_KEY, Default.VERSION);
    TextView textEmail = (TextView) findViewById(R.id.textEmail);
    TextView textPass = (TextView) findViewById(R.id.textPass);
    TextView textPiar = (TextView) findViewById(R.id.textPiar);
    TextView textOr = (TextView) findViewById(R.id.textOr);
    Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/verdana.ttf");
    textEmail.setTypeface(typeface);
    textPass.setTypeface(typeface);
    textPiar.setTypeface(typeface);
    textOr.setTypeface(typeface);
    final Button loginBtn = (Button) findViewById(R.id.loginBtn);
    loginBtn.setTypeface(typeface);
    loginBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            EditText editEmailText = (EditText) findViewById(R.id.emailEdit);
            EditText editPasswordText = (EditText) findViewById(R.id.passwordEdit);
            final String messageMail = editEmailText.getText().toString();
            final String messagePassword = editPasswordText.getText().toString();
            if (TextUtils.isEmpty(messageMail) || TextUtils.isEmpty(messagePassword)) {
                String alertMessage = "Please, fill in empty fields!";
                Toast.makeText(LoginActivity.this, alertMessage, Toast.LENGTH_LONG).show();
                return;
            }
            progressDialog = ProgressDialog.show(LoginActivity.this, "", "Loading", true);
            Backendless.UserService.login(messageMail, messagePassword, new AsyncCallback<BackendlessUser>() {

                @Override
                public void handleResponse(BackendlessUser backendlessUser) {
                    progressDialog.cancel();
                    Intent intent = new Intent(LoginActivity.this, EndlessTaggingActivity.class);
                    intent.putExtra(Default.EXTRA_EMAIL, messageMail);
                    intent.putExtra(Default.EXTRA_PASSWORD, messagePassword);
                    startActivity(intent);
                }

                @Override
                public void handleFault(BackendlessFault backendlessFault) {
                    progressDialog.cancel();
                    Toast.makeText(LoginActivity.this, backendlessFault.getMessage(), Toast.LENGTH_LONG).show();
                }
            });
        }
    });
    Button goRegistrationBtn = (Button) findViewById(R.id.goRegistrationBtn);
    goRegistrationBtn.setTypeface(typeface);
    goRegistrationBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent(LoginActivity.this, RegistrationActivity.class);
            startActivity(intent);
            finish();
        }
    });
    Button facebookBtn = (Button) findViewById(R.id.facebookBtn);
    facebookBtn.setTypeface(typeface);
    facebookBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Backendless.UserService.loginWithFacebook(LoginActivity.this, new AsyncCallback<BackendlessUser>() {

                @Override
                public void handleResponse(BackendlessUser response) {
                    Intent intent = new Intent(LoginActivity.this, EndlessTaggingActivity.class);
                    startActivity(intent);
                }

                @Override
                public void handleFault(BackendlessFault fault) {
                    Toast.makeText(LoginActivity.this, fault.getMessage(), Toast.LENGTH_LONG).show();
                }
            });
        }
    });
    Button twitterBtn = (Button) findViewById(R.id.twitterBtn);
    twitterBtn.setTypeface(typeface);
    twitterBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Backendless.UserService.loginWithTwitter(LoginActivity.this, new AsyncCallback<BackendlessUser>() {

                @Override
                public void handleResponse(BackendlessUser response) {
                    Intent intent = new Intent(LoginActivity.this, EndlessTaggingActivity.class);
                    startActivity(intent);
                }

                @Override
                public void handleFault(BackendlessFault fault) {
                    Toast.makeText(LoginActivity.this, fault.getMessage(), Toast.LENGTH_LONG).show();
                }
            });
        }
    });
}
Also used : EditText(android.widget.EditText) BackendlessUser(com.backendless.BackendlessUser) Typeface(android.graphics.Typeface) AsyncCallback(com.backendless.async.callback.AsyncCallback) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) BackendlessFault(com.backendless.exceptions.BackendlessFault) Button(android.widget.Button) TextView(android.widget.TextView)

Aggregations

BackendlessFault (com.backendless.exceptions.BackendlessFault)65 AnonymousObject (weborb.reader.AnonymousObject)15 NamedObject (weborb.reader.NamedObject)15 AsyncCallback (com.backendless.async.callback.AsyncCallback)11 Intent (android.content.Intent)10 View (android.view.View)10 TextView (android.widget.TextView)6 BackendlessCollection (com.backendless.BackendlessCollection)6 List (java.util.List)6 Typeface (android.graphics.Typeface)5 BackendlessDataQuery (com.backendless.persistence.BackendlessDataQuery)5 EditText (android.widget.EditText)4 CollectionAdaptingPolicy (com.backendless.core.responder.policy.CollectionAdaptingPolicy)4 BackendlessFile (com.backendless.files.BackendlessFile)4 ArrayList (java.util.ArrayList)4 Button (android.widget.Button)3 GeoPoint (com.backendless.geo.GeoPoint)3 ProgressDialog (android.app.ProgressDialog)2 DialogInterface (android.content.DialogInterface)2 Bitmap (android.graphics.Bitmap)2