예제 #1
0
파일: Util.java 프로젝트: gubo/slipwire
  /** @param view */
  public static void showSoftKeyboard(final View view) {
    if (view == null) {
      return;
    }

    final Runnable action =
        new Runnable() {
          @Override
          public void run() {
            final InputMethodManager imm =
                (InputMethodManager)
                    view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
          }
        };

    final View.OnFocusChangeListener restoreOnFocusChangeListener = view.getOnFocusChangeListener();

    final View.OnFocusChangeListener temporaryOnFocusChangeListener =
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(final View v, final boolean hasFocus) {
            view.setOnFocusChangeListener(restoreOnFocusChangeListener);
            view.postDelayed(action, 25);
          }
        };

    view.setOnFocusChangeListener(temporaryOnFocusChangeListener);
    view.requestFocus();
  }
예제 #2
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   View view = new Banner(this);
   view.setOnClickListener(this);
   setContentView(view);
   Log.d(TAG_NAME, "Banner View activated successfully!");
 }
예제 #3
0
파일: Util.java 프로젝트: gubo/slipwire
  /** @param view */
  public static void hideSoftKeyboard(final View view) {
    if (view == null) {
      return;
    }

    final Runnable action =
        new Runnable() {
          @Override
          public void run() {
            final InputMethodManager imm =
                (InputMethodManager)
                    view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(
                view.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
          }
        };

    view.postDelayed(action, 25);
  }
예제 #4
0
 @Override
 public void onClick(View v) {
   v.setOnClickListener(null);
   Log.d(TAG_NAME, "View: " + v.toString() + " clicked!");
   startActivity(new Intent(this, TocListActivity.class));
 }