List of usage examples for android.view View FOCUS_DOWN
int FOCUS_DOWN
To view the source code for android.view View FOCUS_DOWN.
Click Source Link
From source file:com.yangtsaosoftware.pebblemessenger.activities.SetupFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 3) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { myTTS = new TextToSpeech(_context, this); } else {// w w w.ja v a 2s.c om SpannableStringBuilder ssb = new SpannableStringBuilder(); ssb.append(textInfo.getText()); ssb.append(redText(R.string.setup_tts_failed)); ssb.append('\n'); textInfo.setText(ssb); svMyview.fullScroll(View.FOCUS_DOWN); } } }
From source file:app.wz.MainActivity.java
public void setup() { Button btnSend = (Button) findViewById(R.id.btnSend); btnSend.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (bt.getServiceState() == BluetoothState.STATE_CONNECTED && (inputCmd.getText().length() != 0) && (inputVal.getText().length() != 0)) { int cmd = Integer.parseInt(inputCmd.getText().toString()); int val = Integer.parseInt(inputVal.getText().toString()); arduino.analogWrite(cmd, val); textRead.append("Sent Cmd:" + cmd + " Val:" + val + "\n"); textScroll.fullScroll(View.FOCUS_DOWN); } else { Toast.makeText(getApplicationContext(), "Not Connected", Toast.LENGTH_SHORT).show(); }//from ww w . j a v a2 s . c o m } }); }
From source file:com.yangtsaosoftware.pebblemessenger.activities.SetupFragment.java
@Override public void onInit(int i) { if (i == TextToSpeech.SUCCESS) { SpannableStringBuilder ssb = new SpannableStringBuilder(); ssb.append(textInfo.getText());/*from w w w.j a v a2 s . c o m*/ ssb.append(myTTS.getDefaultEngine() + " "); ssb.append(greenText(R.string.setup_tts_default_locale)); ssb.append(myTTS.getLanguage().getLanguage()); ssb.append('\n'); textInfo.setText(ssb); svMyview.fullScroll(View.FOCUS_DOWN); } else { myTTS.shutdown(); myTTS = null; } }
From source file:com.example.android.wearable.agendadata.MainActivity.java
private void appendLog(final String s) { mLogTextView.post(new Runnable() { @Override//w w w . j a va2s . c o m public void run() { mLogTextView.append(s); mLogTextView.append("\n"); mScroller.fullScroll(View.FOCUS_DOWN); } }); }
From source file:com.doodle.android.chips.ChipsView.java
public void addChip(String displayName, Uri avatarUrl, Contact contact, boolean isIndelible) { Chip chip = new Chip(displayName, avatarUrl, contact, isIndelible); mChipList.add(chip);//w ww .ja va 2 s .c om if (mChipsListener != null) { mChipsListener.onChipAdded(chip); } mEditText.setHint(null); onChipsChanged(true); post(new Runnable() { @Override public void run() { fullScroll(View.FOCUS_DOWN); } }); }
From source file:uk.co.threeonefour.android.snowball.activities.game.GameActivity.java
private void processOutputText(String text) { List<SpannableString> styledLines = formatter.format(text); StringBuilder sb = new StringBuilder(); for (SpannableString styledLine : styledLines) { sb.append(styledLine.toString()); sb.append(" "); textView.append(styledLine);//from www . ja v a 2 s.c om textView.append("\n"); } if ((lastCommand == null || isNewLocation(lastCommand)) && !isBumpedInto(text)) { lastLocation = sb.toString(); } textScrollView.fullScroll(View.FOCUS_DOWN); textScrollView.postDelayed(new Runnable() { @Override public void run() { textScrollView.fullScroll(View.FOCUS_DOWN); } }, 0); }
From source file:com.microsoft.aad.adal.AuthenticationActivity.java
private void setupWebView(String redirect, String queryParam, AuthenticationRequest request) { mWebView.getSettings().setJavaScriptEnabled(true); mWebView.requestFocus(View.FOCUS_DOWN); // Set focus to the view for touch event mWebView.setOnTouchListener(new View.OnTouchListener() { @Override/* w ww . j a v a 2 s . co m*/ public boolean onTouch(View view, MotionEvent event) { int action = event.getAction(); if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_UP) { if (!view.hasFocus()) { view.requestFocus(); } } return false; } }); mWebView.getSettings().setLoadWithOverviewMode(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setUseWideViewPort(true); mWebView.getSettings().setBuiltInZoomControls(true); mWebView.setWebViewClient(new CustomWebViewClient()); mWebView.setVisibility(View.INVISIBLE); }
From source file:app.wz.MainActivity.java
@Override public void onResume() { super.onResume(); // Always call the superclass method first if (neuro.updatePrefs(false)) { textRead.append("Reset Neuro \n"); textScroll.fullScroll(View.FOCUS_DOWN); }/*w w w.j ava 2s . c om*/ }
From source file:com.hippo.widget.BothScrollView.java
/** * You can call this function yourself to have the scroll view perform * scrolling from a key event, just as if the event had been dispatched to * it by the view hierarchy./*from www . j a v a 2 s . com*/ * * @param event The key event to execute. * @return Return true if the event was handled, else false. */ public boolean executeKeyEvent(KeyEvent event) { mTempRect.setEmpty(); if (!canScrollHorizontally()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null; } View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_RIGHT); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_RIGHT); } return false; } if (!canScrollVertically()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null; } View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); } return false; } boolean handled = false; if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_LEFT: if (!event.isAltPressed()) { handled = arrowScrollHorizontally(View.FOCUS_LEFT); } else { handled = fullScroll(View.FOCUS_LEFT); } break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (!event.isAltPressed()) { handled = arrowScrollHorizontally(View.FOCUS_RIGHT); } else { handled = fullScroll(View.FOCUS_RIGHT); } break; case KeyEvent.KEYCODE_DPAD_UP: if (!event.isAltPressed()) { handled = arrowScrollVertically(View.FOCUS_UP); } else { handled = fullScroll(View.FOCUS_UP); } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!event.isAltPressed()) { handled = arrowScrollVertically(View.FOCUS_DOWN); } else { handled = fullScroll(View.FOCUS_DOWN); } break; case KeyEvent.KEYCODE_SPACE: if (event.isCtrlPressed()) { pageScroll(event.isShiftPressed() ? View.FOCUS_LEFT : View.FOCUS_RIGHT); } else { pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN); } break; } } return handled; }
From source file:com.microsoft.windowsazure.mobileservices.authentication.LoginManager.java
/** * Creates the UI for the interactive authentication process * * @param startUrl The initial URL for the authentication process * @param endUrl The final URL for the authentication process * @param context The context used to create the authentication dialog * @param callback Callback to invoke when the authentication process finishes *//*w w w . j ava2s . co m*/ private void showLoginUIInternal(final String startUrl, final String endUrl, final Context context, LoginUIOperationCallback callback) { if (startUrl == null || startUrl == "") { throw new IllegalArgumentException("startUrl can not be null or empty"); } if (endUrl == null || endUrl == "") { throw new IllegalArgumentException("endUrl can not be null or empty"); } if (context == null) { throw new IllegalArgumentException("context can not be null"); } final LoginUIOperationCallback externalCallback = callback; final AlertDialog.Builder builder = new AlertDialog.Builder(context); // Create the Web View to show the login page final WebView wv = new WebView(context); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (externalCallback != null) { externalCallback.onCompleted(null, new MobileServiceException("User Canceled")); } } }); wv.getSettings().setJavaScriptEnabled(true); DisplayMetrics displaymetrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int webViewHeight = displaymetrics.heightPixels - 100; wv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, webViewHeight)); wv.requestFocus(View.FOCUS_DOWN); wv.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { int action = event.getAction(); if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_UP) { if (!view.hasFocus()) { view.requestFocus(); } } return false; } }); // Create a LinearLayout and add the WebView to the Layout LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(wv); // Add a dummy EditText to the layout as a workaround for a bug // that prevents showing the keyboard for the WebView on some devices EditText dummyEditText = new EditText(context); dummyEditText.setVisibility(View.GONE); layout.addView(dummyEditText); // Add the layout to the dialog builder.setView(layout); final AlertDialog dialog = builder.create(); wv.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { // If the URL of the started page matches with the final URL // format, the login process finished if (isFinalUrl(url)) { if (externalCallback != null) { externalCallback.onCompleted(url, null); } dialog.dismiss(); } super.onPageStarted(view, url, favicon); } // Checks if the given URL matches with the final URL's format private boolean isFinalUrl(String url) { if (url == null) { return false; } return url.startsWith(endUrl); } // Checks if the given URL matches with the start URL's format private boolean isStartUrl(String url) { if (url == null) { return false; } return url.startsWith(startUrl); } @Override public void onPageFinished(WebView view, String url) { if (isStartUrl(url)) { if (externalCallback != null) { externalCallback.onCompleted(null, new MobileServiceException( "Logging in with the selected authentication provider is not enabled")); } dialog.dismiss(); } } }); wv.loadUrl(startUrl); dialog.show(); }