@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tt_activity_detail_portrait);

    Intent intent = getIntent();
    if (intent == null) {
      logger.e("detailPortrait#displayimage#null intent");
      return;
    }

    String resUri = intent.getStringExtra(IntentConstant.KEY_AVATAR_URL);
    imageUri = resUri;
    logger.d("detailPortrait#displayimage#resUri:%s", resUri);

    boolean isContactAvatar =
        intent.getBooleanExtra(IntentConstant.KEY_IS_IMAGE_CONTACT_AVATAR, false);
    logger.d("displayimage#isContactAvatar:%s", isContactAvatar);

    final ZoomableImageView portraitView = (ZoomableImageView) findViewById(R.id.detail_portrait);

    if (portraitView == null) {
      logger.e("detailPortrait#displayimage#portraitView is null");
      return;
    }

    logger.d("detailPortrait#displayimage#going to load the detail portrait");

    if (isContactAvatar) {
      IMUIHelper.setEntityImageViewAvatarNoDefaultPortrait(
          portraitView, resUri, DBConstant.SESSION_TYPE_SINGLE, 0);
    } else {
      IMUIHelper.displayImageNoOptions(portraitView, resUri, -1, 0);
    }

    new Handler()
        .postDelayed(
            new Runnable() {
              @Override
              public void run() {
                portraitView.setFinishActivity(
                    new finishActivity() {
                      @Override
                      public void finish() {
                        if (DetailPortraitActivity.this != null) {
                          DetailPortraitActivity.this.finish();
                          overridePendingTransition(R.anim.tt_stay, R.anim.tt_image_exit);
                        }
                      }
                    });
              }
            },
            500);
  }
Example #2
0
 private void onSocketFailure(SocketEvent event) {
   logger.e("login#onLoginError -> errorCode:%s,", event.name());
   showLoginPage();
   String errorTip = getString(IMUIHelper.getSocketErrorTip(event));
   logger.d("login#errorTip:%s", errorTip);
   mLoginStatusView.setVisibility(View.GONE);
   Toast.makeText(this, errorTip, Toast.LENGTH_SHORT).show();
 }
Example #3
0
  private void initAutoLogin() {
    logger.i("login#initAutoLogin");

    splashPage = findViewById(R.id.splash_page);
    loginPage = findViewById(R.id.login_page);
    autoLogin = shouldAutoLogin();

    splashPage.setVisibility(autoLogin ? View.VISIBLE : View.GONE);
    loginPage.setVisibility(autoLogin ? View.GONE : View.VISIBLE);

    loginPage.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {

            if (mPasswordView != null) {
              intputManager.hideSoftInputFromWindow(mPasswordView.getWindowToken(), 0);
            }

            if (mNameView != null) {
              intputManager.hideSoftInputFromWindow(mNameView.getWindowToken(), 0);
            }

            return false;
          }
        });

    if (autoLogin) {
      Animation splashAnimation = AnimationUtils.loadAnimation(this, R.anim.login_splash);
      if (splashAnimation == null) {
        logger.e("login#loadAnimation login_splash failed");
        return;
      }

      splashPage.startAnimation(splashAnimation);
    }
  }