當前位置: 首頁>>代碼示例>>Java>>正文


Java EditText.post方法代碼示例

本文整理匯總了Java中android.widget.EditText.post方法的典型用法代碼示例。如果您正苦於以下問題:Java EditText.post方法的具體用法?Java EditText.post怎麽用?Java EditText.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.EditText的用法示例。


在下文中一共展示了EditText.post方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showSoftkey

import android.widget.EditText; //導入方法依賴的package包/類
public void showSoftkey(final EditText inputTarget) {
  postOnKeyboardOpen(new Runnable() {
    @Override public void run() {
      hideAttachedInput(true);
    }
  });
  inputTarget.post(new Runnable() {
    @Override public void run() {
      inputTarget.requestFocus();
      ServiceUtil.getInputMethodManager(inputTarget.getContext()).showSoftInput(inputTarget, 0);
    }
  });
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:14,代碼來源:InputAwareLayout.java

示例2: showNewNetworkProxyDialog

import android.widget.EditText; //導入方法依賴的package包/類
private void showNewNetworkProxyDialog(final ProxyAdapter proxyAdapter) {
  final int originalSelection = networkProxyAddress.isSet() ? ProxyAdapter.PROXY : ProxyAdapter.NONE;

  View view = LayoutInflater.from(app).inflate(R.layout.debug_drawer_network_proxy, null);
  final EditText hostView = findById(view, R.id.debug_drawer_network_proxy_host);

  if (networkProxyAddress.isSet()) {
    String host = networkProxyAddress.get().getHostName();
    hostView.setText(host); // Set the current host.
    hostView.setSelection(0, host.length()); // Pre-select it for editing.

    // Show the keyboard. Post this to the next frame when the dialog has been attached.
    hostView.post(() -> Keyboards.showKeyboard(hostView));
  }

  new AlertDialog.Builder(getContext()) //
      .setTitle("Set Network Proxy")
      .setView(view)
      .setNegativeButton("Cancel", (dialog, i) -> {
        networkProxyView.setSelection(originalSelection);
        dialog.cancel();
      })
      .setPositiveButton("Use", (dialog, i) -> {
        String in = hostView.getText().toString();
        InetSocketAddress address = InetSocketAddressPreferenceAdapter.parse(in);
        if (address != null) {
          networkProxyAddress.set(address);
          // Force a restart to re-initialize the app with the new proxy.
          ProcessPhoenix.triggerRebirth(getContext());
        } else {
          networkProxyView.setSelection(originalSelection);
        }
      })
      .setOnCancelListener(dialogInterface -> networkProxyView.setSelection(originalSelection))
      .show();
}
 
開發者ID:rogues-dev,項目名稱:superglue,代碼行數:37,代碼來源:DebugView.java

示例3: show

import android.widget.EditText; //導入方法依賴的package包/類
public void show() {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(titleRes);
    View view = View.inflate(context, R.layout.dialog_enter_text, null);

    final EditText input = (EditText) view.findViewById(R.id.editText);
    input.setText(value);
    input.setSelection(input.getText().length());

    if (hint != null) {
        input.setHint(hint);
    }

    input.setInputType(inputType);
    builder.setView(view);
    builder.setPositiveButton(R.string.button_ok, null);
    builder.setNegativeButton(R.string.button_cancel, (dialog, which) -> dialog.cancel());

    final AlertDialog alertDialog = builder.create();
    alertDialog.setOnShowListener(dialog -> {
        Button b = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);

        b.setOnClickListener(view1 -> {
            input.setError(null);
            String newValue = input.getText().toString().trim();

            if (TextUtils.isEmpty(newValue) && !allowEmpty) {
                input.setError(context.getString(R.string.field_is_required));
                input.requestFocus();
            } else {
                try {
                    if (validator != null) {
                        validator.validate(newValue);
                    }

                    if (callback != null) {
                        callback.onChanged(newValue);
                    }

                    if (target != null) {
                        target.setText(newValue);
                    }

                    alertDialog.dismiss();
                } catch (IllegalArgumentException e) {
                    input.setError(e.getMessage());
                    input.requestFocus();
                }
            }
        });
    });

    alertDialog.setOnDismissListener(onDismissListener);
    alertDialog.show();

    input.post(() -> {
        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);
    });
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:61,代碼來源:InputTextDialog.java

示例4: initViews

import android.widget.EditText; //導入方法依賴的package包/類
private void initViews(){
    mContentView = LayoutInflater.from(mContext)
            .inflate(R.layout.item_wave_loading_view, mViewGroup, false);
    mWaveLoadingView = (WaveLoadingView) mContentView.findViewById(R.id.wave_loading_view);
    mWaveLoadingView.post(new Runnable() {
        @Override
        public void run() {
            mWaveLoadingView.setWaveColor(mBookshelf.getColor());
        }
    });
    mRedPicker = (SeekBar) mContentView.findViewById(R.id.red_picker);
    mGreenPicker = (SeekBar) mContentView.findViewById(R.id.green_picker);
    mBluePicker = (SeekBar) mContentView.findViewById(R.id.blue_picker);
    mAmpPicker = (SeekBar) mContentView.findViewById(R.id.amp_picker);
    mWavePicker = (SeekBar) mContentView.findViewById(R.id.wave_picker);
    mCurrentPage = (EditText) mContentView.findViewById(R.id.edit_current_page);
    mTotalPages = (TextView) mContentView.findViewById(R.id.text_total_page);
    mConfirmButton = (Button) mContentView.findViewById(R.id.button_confirm);
    //mCancelButton = (Button) mContentView.findViewById(R.id.button_cancel);


    mRedPicker.post(new Runnable() {
        @Override
        public void run() {
            mRedPicker.setProgress( (int)((mBookshelf.getRed() / 255.0f) * 100));
        }
    });
    mGreenPicker.post(new Runnable() {
        @Override
        public void run() {
            mGreenPicker.setProgress((int)((mBookshelf.getGreen() / 255.0f) * 100));
        }
    });
    mBluePicker.post(new Runnable() {
        @Override
        public void run() {
            mBluePicker.setProgress((int)((mBookshelf.getBlue() / 255.0f) * 100));
        }
    });
    mAmpPicker.post(new Runnable() {
        @Override
        public void run() {
            //範圍是0~1
            mAmpPicker.setProgress((int) (mBookshelf.getAmpratio() * 100));
        }
    });
    mWavePicker.post(new Runnable() {
        @Override
        public void run() {
            mWavePicker.setProgress((int) (mBookshelf.getWaveratio() * 100));
        }
    });
    mCurrentPage.post(new Runnable() {
        @Override
        public void run() {
            mCurrentPage.setText(""+mBookshelf.getCurrentpage());
        }
    });
    mTotalPages.post(new Runnable() {
        @Override
        public void run() {
            mTotalPages.setText("of "+mBookshelf.getTotalpage());
        }
    });
    //mWaveLoadingView.setProgress(mBookshelf.getProgress());
    Log.e("此時progress是",mBookshelf.getProgress()+"");
    mWaveLoadingView.setTitletext(((int)(mBookshelf.getProgress() * 100)) + "" + " %");


}
 
開發者ID:chengkun123,項目名稱:ReadMark,代碼行數:71,代碼來源:WaveLoadingViewHolder.java


注:本文中的android.widget.EditText.post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。