Пример #1
0
 private void init() {
   room_id = sp.getInt("current_room_id", 1);
   sub_sys_name = getIntent().getStringExtra("sub_sys_name");
   if (sub_sys_name == null) {
     sub_sys_name = "";
   }
   context = this;
   // 组件
   toolbar = getViewById(R.id.sub_toolbar);
   subToolbarTitle = getViewById(R.id.sub_toolbar_title);
   listView = getViewById(R.id.temperature_listView);
   circleProgressBar = getViewById(R.id.progressBar);
   circleProgressBar.setVisibility(View.VISIBLE);
 }
Пример #2
0
        @Override
        public void onClick(View view) {

          System.out.println("Button clicked");

          if (loginButton.getText().toString().isEmpty()
              || password.getText().toString().isEmpty()) {

            Toast.makeText(Login.this, "please fill out both fields", Toast.LENGTH_SHORT).show();

          } else {
            progressBar.setVisibility(View.VISIBLE);
            loginButton.setEnabled(false);
            new ParseOperation("Network")
                .logIn(
                    username.getText().toString(),
                    password.getText().toString(),
                    new ParseOperation.ParseOperationCallback() {
                      @Override
                      public void finished(boolean success, final ParseException e) {
                        if (success) {
                          BuzzAnalytics.logLogin(Login.this, "Buzz", false);
                          getFollowed();
                        } else {
                          Login.this.runOnUiThread(
                              new Runnable() {
                                @Override
                                public void run() {
                                  progressBar.setVisibility(View.GONE);
                                  Toast.makeText(Login.this, e.getMessage(), Toast.LENGTH_SHORT)
                                      .show();
                                  loginButton.setEnabled(true);
                                  Application.logger.logEvent("Login failed");
                                }
                              });
                        }
                      }
                    },
                    Login.this);
          }
        }