android.view.KeyEvent.getRepeatCount()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(539)

本文整理了Java中android.view.KeyEvent.getRepeatCount()方法的一些代码示例,展示了KeyEvent.getRepeatCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.getRepeatCount()方法的具体详情如下:
包路径:android.view.KeyEvent
类名称:KeyEvent
方法名:getRepeatCount

KeyEvent.getRepeatCount介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)  {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    // do something on back.
    return true;
  }

  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: stackoverflow.com

.setOnKeyListener(new DialogInterface.OnKeyListener() {

  @Override
  public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) {
      return true; // Pretend we processed it
    }
    return false; // Any other keys are still processed as normal
  }
})

代码示例来源:origin: stackoverflow.com

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)  {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    // do something on back.
    return true;
  }

  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: stackoverflow.com

public boolean onKeyDown(int keyCode, KeyEvent event)  
 {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)
    {
     this.moveTaskToBack(true);
     return true;
    }
   return super.onKeyDown(keyCode, event);
 }

代码示例来源:origin: stackoverflow.com

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)  {
  if (Integer.parseInt(android.os.Build.VERSION.SDK) > 5
      && keyCode == KeyEvent.KEYCODE_BACK
      && event.getRepeatCount() == 0) {
    Log.d("CDA", "onKeyDown Called");
    onBackPressed();
    return true; 
  }
  return super.onKeyDown(keyCode, event);
}

@Override
public void onBackPressed() {
  Log.d("CDA", "onBackPressed Called");
  Intent setIntent = new Intent(Intent.ACTION_MAIN);
  setIntent.addCategory(Intent.CATEGORY_HOME);
  setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  startActivity(setIntent);
}

代码示例来源:origin: square/assertj-android

public KeyEventAssert hasRepeatCount(int count) {
 isNotNull();
 int actualCount = actual.getRepeatCount();
 assertThat(actualCount) //
   .overridingErrorMessage("Expected repeat count <%s> but was <%s>", count, actualCount) //
   .isEqualTo(count);
 return this;
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    if (editTextBodyLl != null && editTextBodyLl.getVisibility() == View.VISIBLE) {
      editTextBodyLl.setVisibility(View.GONE);
      return true;
    }
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: jdamcd/android-crop

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    event.startTracking();
    return true;
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: seven332/EhViewer

@Override
protected boolean handleMovementKey(TextView widget, Spannable buffer, int keyCode,
    int movementMetaState, KeyEvent event) {
  switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_ENTER:
      if (KeyEvent.metaStateHasNoModifiers(movementMetaState)) {
        if (event.getAction() == KeyEvent.ACTION_DOWN &&
            event.getRepeatCount() == 0 && action(CLICK, widget, buffer)) {
          return true;
        }
      }
      break;
  }
  return super.handleMovementKey(widget, buffer, keyCode, movementMetaState, event);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    Timber.i("DeckOptions - onBackPressed()");
    closeWithResult();
    return true;
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    Timber.i("MyAccount - onBackPressed()");
    finishWithAnimation(ActivityTransitionAnimation.FADE);
    return true;
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: Naoki2015/CircleDemo

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    if(edittextbody != null && edittextbody.getVisibility() == View.VISIBLE){
      //edittextbody.setVisibility(View.GONE);
      updateEditTextBodyVisible(View.GONE, null);
      return true;
    }
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    Timber.i("DeckOptions - onBackPressed()");
    closeDeckOptions();
    return true;
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
    Timber.i("onBackPressed()");
    setResult(RESULT_CANCELED);
    finishWithAnimation();
    return true;
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_SLASH &&
  event.isAltPressed() &&
  event.getRepeatCount()==0 &&
  Build.VERSION.SDK_INT<=Build.VERSION_CODES.M) {
  new ShortcutDialogFragment().show(getSupportFragmentManager(),
   "shortcuts");
  return(true);
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_SLASH &&
  event.isAltPressed() &&
  event.getRepeatCount()==0 &&
  Build.VERSION.SDK_INT<=Build.VERSION_CODES.M) {
  new ShortcutDialogFragment().show(getSupportFragmentManager(),
   "shortcuts");
  return(true);
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

相关文章