Example usage for android.content.res Configuration HARDKEYBOARDHIDDEN_NO

List of usage examples for android.content.res Configuration HARDKEYBOARDHIDDEN_NO

Introduction

In this page you can find the example usage for android.content.res Configuration HARDKEYBOARDHIDDEN_NO.

Prototype

int HARDKEYBOARDHIDDEN_NO

To view the source code for android.content.res Configuration HARDKEYBOARDHIDDEN_NO.

Click Source Link

Document

Constant for #hardKeyboardHidden , value corresponding to the physical keyboard being exposed.

Usage

From source file:com.renard.documentview.DocumentPagerFragment.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    boolean isKeyboardHidden = Configuration.KEYBOARDHIDDEN_YES == newConfig.hardKeyboardHidden
            || Configuration.HARDKEYBOARDHIDDEN_YES == newConfig.hardKeyboardHidden;
    boolean isKeyboardShown = Configuration.KEYBOARDHIDDEN_NO == newConfig.hardKeyboardHidden
            || Configuration.HARDKEYBOARDHIDDEN_NO == newConfig.hardKeyboardHidden;
    // DocumentPagerFragment pagerFragment = (DocumentPagerFragment)
    // getSupportFragmentManager().findFragmentById(R.id.document_fragment_container);
    // if (pagerFragment!=null){
    if (isKeyboardShown) {
        showTitleIndicator(false);//from   w  w  w .j ava2  s  . c om
    } else if (isKeyboardHidden) {
        showTitleIndicator(true);
    }
    // }
}

From source file:de.questmaster.fatremote.fragments.RemoteFragment.java

private TextWatcher determineKeyboardTextChangedListener() {
    TextWatcher tw = null;/*from w ww.  ja  va2 s .c  o  m*/

    //check for bad keyboards
    boolean hwKeyboardShown = getActivity().getResources()
            .getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
    String swKeyboardName = Settings.Secure.getString(getActivity().getContentResolver(),
            Settings.Secure.DEFAULT_INPUT_METHOD);

    if (!hwKeyboardShown && swKeyboardName.contains("nuance.xt9")) { // ASUS Transformer Prime SoftKeyboard
        tw = new TextWatcher() {
            public void afterTextChanged(Editable s) {
            }

            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            public void onTextChanged(CharSequence s, int start, int before, int count) {
                int diff = count - before;

                if (s.length() > 0) {
                    // Send Character
                    keyCode = 0xf9;
                    if (diff > 0) { // +1
                        keyModifier = (short) Character.codePointAt(s, before);
                    } else if (diff < 0) { // -1
                        keyModifier = (short) 0x7f; // backspace
                    } else {
                        keyModifier = (short) 0x0a; // enter
                    }

                    // send keyCode
                    invokeSend();
                }
            }
        };
    } else { // Android Default Behaviour                
        tw = new TextWatcher() {
            public void afterTextChanged(Editable s) {
            }

            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            public void onTextChanged(CharSequence s, int start, int before, int count) {
                if (s.length() > 0 || before != 0) {
                    // Send Character
                    keyCode = 0xf9;
                    if (before == 0) {
                        keyModifier = (short) Character.codePointAt(s, start);
                    } else if (start == 0) {
                        keyModifier = 0x0a; // enter
                    } else {
                        keyModifier = (short) 0x7f; // backspace
                    }

                    // send keyCode
                    invokeSend();
                }
            }
        };
    }

    return tw;
}

From source file:gov.nasa.arc.geocam.geocam.CameraActivity.java

@Override
public void onResume() {
    super.onResume();

    mServiceBound = bindService(new Intent(this, GeoCamService.class), mServiceConn, Context.BIND_AUTO_CREATE);
    if (!mServiceBound) {
        Log.e(GeoCamMobile.DEBUG_ID, "CameraActivity::onResume - error binding to service");
    }//from   w w w.  ja v a  2  s. co m

    mForeground.foreground();

    mSensorManager.registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
            SensorManager.SENSOR_DELAY_GAME);
    mSensorManager.registerListener(mSensorListener,
            mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_GAME);

    mLatText.setText("Lat: unavailable");
    mLonText.setText("Lon: unavailable");

    IntentFilter filter = new IntentFilter(GeoCamMobile.LOCATION_CHANGED);
    this.registerReceiver(mLocationReceiver, filter);

    if (getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
        showDialog(DIALOG_HIDE_KEYBOARD);
    }

    // Unset focus and picture status flags when returning from another activity
    mLensIsFocused = false;
    mPictureTaken = false;
}

From source file:gov.nasa.arc.geocam.geocam.CameraActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    Log.d(GeoCamMobile.DEBUG_ID, "Keyboard hidden: " + String.valueOf(newConfig.keyboardHidden));
    if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
        showDialog(DIALOG_HIDE_KEYBOARD);
    } else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
        dismissDialog(DIALOG_HIDE_KEYBOARD);
    }/* ww w.  ja v a  2  s .  c om*/
}

From source file:kr.wdream.storyshop.AndroidUtilities.java

public static void checkDisplaySize(Context context, Configuration newConfiguration) {
    try {/*from   w  ww.  j  a  v a 2s.c om*/
        density = context.getResources().getDisplayMetrics().density;
        Configuration configuration = newConfiguration;
        if (configuration == null) {
            configuration = context.getResources().getConfiguration();
        }
        usingHardwareInput = configuration.keyboard != Configuration.KEYBOARD_NOKEYS
                && configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
        WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        if (manager != null) {
            Display display = manager.getDefaultDisplay();
            if (display != null) {
                display.getMetrics(displayMetrics);
                display.getSize(displaySize);
            }
        }
        if (configuration.screenWidthDp != Configuration.SCREEN_WIDTH_DP_UNDEFINED) {
            int newSize = (int) Math.ceil(configuration.screenWidthDp * density);
            if (Math.abs(displaySize.x - newSize) > 3) {
                displaySize.x = newSize;
            }
        }
        if (configuration.screenHeightDp != Configuration.SCREEN_HEIGHT_DP_UNDEFINED) {
            int newSize = (int) Math.ceil(configuration.screenHeightDp * density);
            if (Math.abs(displaySize.y - newSize) > 3) {
                displaySize.y = newSize;
            }
        }
        FileLog.e("tmessages", "display size = " + displaySize.x + " " + displaySize.y + " "
                + displayMetrics.xdpi + "x" + displayMetrics.ydpi);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
}

From source file:com.ferdi2005.secondgram.AndroidUtilities.java

public static void checkDisplaySize(Context context, Configuration newConfiguration) {
    try {/*from  w w w.  j ava2s  .c  om*/
        density = context.getResources().getDisplayMetrics().density;
        Configuration configuration = newConfiguration;
        if (configuration == null) {
            configuration = context.getResources().getConfiguration();
        }
        usingHardwareInput = configuration.keyboard != Configuration.KEYBOARD_NOKEYS
                && configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO;
        WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        if (manager != null) {
            Display display = manager.getDefaultDisplay();
            if (display != null) {
                display.getMetrics(displayMetrics);
                display.getSize(displaySize);
            }
        }
        if (configuration.screenWidthDp != Configuration.SCREEN_WIDTH_DP_UNDEFINED) {
            int newSize = (int) Math.ceil(configuration.screenWidthDp * density);
            if (Math.abs(displaySize.x - newSize) > 3) {
                displaySize.x = newSize;
            }
        }
        if (configuration.screenHeightDp != Configuration.SCREEN_HEIGHT_DP_UNDEFINED) {
            int newSize = (int) Math.ceil(configuration.screenHeightDp * density);
            if (Math.abs(displaySize.y - newSize) > 3) {
                displaySize.y = newSize;
            }
        }
        FileLog.e("display size = " + displaySize.x + " " + displaySize.y + " " + displayMetrics.xdpi + "x"
                + displayMetrics.ydpi);
    } catch (Exception e) {
        FileLog.e(e);
    }
}

From source file:com.undatech.opaque.RemoteCanvasActivity.java

/**
 * Sets the visibility of the extra keys appropriately.
 *///w  w w  .j av  a 2 s.  c  o  m
private void setExtraKeysVisibility(int visibility, boolean forceVisible) {
    Configuration config = getResources().getConfiguration();
    boolean makeVisible = forceVisible;
    if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)
        makeVisible = true;

    if (!extraKeysHidden && makeVisible && connection.getExtraKeysToggleType() == Constants.EXTRA_KEYS_ON) {
        layoutKeys.setVisibility(View.VISIBLE);
        layoutKeys.invalidate();
        return;
    }

    if (visibility == View.GONE) {
        layoutKeys.setVisibility(View.GONE);
        layoutKeys.invalidate();
    }
}

From source file:com.iiordanov.bVNC.RemoteCanvasActivity.java

/**
 * Sets the visibility of the extra keys appropriately.
 *//*from   ww  w  . j  a  va2  s  . c  om*/
private void setExtraKeysVisibility(int visibility, boolean forceVisible) {
    Configuration config = getResources().getConfiguration();
    //Log.e(TAG, "Hardware kbd hidden: " + Integer.toString(config.hardKeyboardHidden));
    //Log.e(TAG, "Any keyboard hidden: " + Integer.toString(config.keyboardHidden));
    //Log.e(TAG, "Keyboard type: " + Integer.toString(config.keyboard));

    boolean makeVisible = forceVisible;
    if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)
        makeVisible = true;

    if (!extraKeysHidden && makeVisible && connection.getExtraKeysToggleType() == Constants.EXTRA_KEYS_ON) {
        layoutKeys.setVisibility(View.VISIBLE);
        layoutKeys.invalidate();
        return;
    }

    if (visibility == View.GONE) {
        layoutKeys.setVisibility(View.GONE);
        layoutKeys.invalidate();
    }
}

From source file:com.iiordanov.runsoft.bVNC.RemoteCanvasActivity.java

/**
 * Sets the visibility of the extra keys appropriately.
 *///w w w.  jav a 2 s . com
private void setExtraKeysVisibility(int visibility, boolean forceVisible) {
    Configuration config = getResources().getConfiguration();
    //Log.e(TAG, "Hardware kbd hidden: " + Integer.toString(config.hardKeyboardHidden));
    //Log.e(TAG, "Any keyboard hidden: " + Integer.toString(config.keyboardHidden));
    //Log.e(TAG, "Keyboard type: " + Integer.toString(config.keyboard));

    boolean makeVisible = forceVisible;
    if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)
        makeVisible = true;

    if (!extraKeysHidden && makeVisible && connection.getExtraKeysToggleType() == Constants.EXTRA_KEYS_ON) {
        layoutKeys.setVisibility(View.VISIBLE);
        layoutKeys.invalidate();
        return;
    }

    if (visibility == View.GONE) {
        btnChatShowToggle.setVisibility(View.VISIBLE);
        layoutKeys.setVisibility(View.GONE);
        layoutKeys.invalidate();
    }
}

From source file:jackpal.androidterm.Term.java

private boolean checkHaveFullHwKeyboard(Configuration c) {
    return (c.keyboard == Configuration.KEYBOARD_QWERTY)
            && (c.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO);
}