当前位置: 首页>>代码示例>>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;未经允许,请勿转载。