Exemplo n.º 1
0
  private void notifyUser() {
    String msg = "";
    if (GroomUtils.userConnected()) {
      msg = getString(R.string.connected);
    } else {
      msg = getString(R.string.notconnected);
    }

    TSnackbar snackbar =
        TSnackbar.make(findViewById(R.id.main_content), msg, TSnackbar.LENGTH_SHORT);

    View snackbarView = snackbar.getView();
    snackbarView.setBackgroundColor(
        ContextCompat.getColor(GroomApplication.getContext(), R.color.colorAccent));
    TextView textView =
        (TextView) snackbarView.findViewById(com.androidadvance.topsnackbar.R.id.snackbar_text);
    textView.setTextColor(ContextCompat.getColor(GroomApplication.getContext(), R.color.whiteText));
    snackbar.show();
  }
Exemplo n.º 2
0
  private void showSyncStats() {
    final SharedPreferences sharedPreferences =
        GroomApplication.getContext()
            .getSharedPreferences(getString(R.string.groom_sync), Context.MODE_PRIVATE);
    String lastSync =
        sharedPreferences.getString(getString(R.string.last_sync), getString(R.string.never_sync));
    String eventsNumber =
        String.valueOf(Realm.getInstance(this).where(RealmEvent.class).findAll().size());
    String productsNumber =
        String.valueOf(Realm.getInstance(this).where(RealmProduct.class).findAll().size());

    ((TextView) findViewById(R.id.lastSync)).setText(lastSync);
    ((TextView) findViewById(R.id.eventsNumber)).setText(eventsNumber);
    ((TextView) findViewById(R.id.productsNumber)).setText(productsNumber);
  }