Java Code Examples for android.content.res.Configuration#HARDKEYBOARDHIDDEN_UNDEFINED

The following examples show how to use android.content.res.Configuration#HARDKEYBOARDHIDDEN_UNDEFINED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClueListActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
	super.onConfigurationChanged(newConfig);
	this.configuration = newConfig;
	try {
		if (this.prefs.getBoolean("forceKeyboard", false)
				|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
				|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
			InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

			if (imm != null)
				imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
						InputMethodManager.HIDE_NOT_ALWAYS);

		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 2
Source File: ClueListActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPause() {
	super.onPause();

	try {
		if ((puz != null) && (baseFile != null)) {
			if ((timer != null) && (puz.getPercentComplete() != 100)) {
				this.timer.stop();
				puz.setTime(timer.getElapsed());
				this.timer = null;
			}

			IO.save(puz, baseFile);
		}
	} catch (IOException ioe) {
		ioe.printStackTrace();
	}

	if (this.prefs.getBoolean("forceKeyboard", false)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
		InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(this.imageView.getWindowToken(), 0);
	}
}
 
Example 3
Source File: ClueListActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
private void render() {
	if (this.prefs.getBoolean("forceKeyboard", false)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
			|| (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
		if (this.useNativeKeyboard) {
			InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

			imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
					InputMethodManager.HIDE_IMPLICIT_ONLY);
		} else {
			this.keyboardView.setVisibility(View.VISIBLE);
		}
	} else {
		this.keyboardView.setVisibility(View.GONE);
	}

	this.imageView.setBitmap(renderer.drawWord());
}
 
Example 4
Source File: PlayActivity.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPause() {
    try {
        if ((puz != null) && (baseFile != null)) {
            if ((puz.getPercentComplete() != 100) && (this.timer != null)) {
                this.timer.stop();
                puz.setTime(timer.getElapsed());
                this.timer = null;
            }

            IO.save(puz, baseFile);
        }
    } catch (IOException ioe) {
        LOG.log(Level.SEVERE, null, ioe);
    }

    this.timer = null;

    if ((this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
            || (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(clue.getWindowToken(), 0);
    }

    super.onPause();
}
 
Example 5
Source File: PlayActivity.java    From shortyz with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    this.configuration = newConfig;

    if (this.prefs.getBoolean("forceKeyboard", false)
            || (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
            || (this.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_UNDEFINED)) {
        if (this.useNativeKeyboard) {
            keyboardView.setVisibility(View.GONE);

            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
                    InputMethodManager.HIDE_NOT_ALWAYS);
        } else {
            this.keyboardView.setVisibility(View.VISIBLE);
        }
    } else {
        this.keyboardView.setVisibility(View.GONE);
    }

    this.runTimer = prefs.getBoolean("runTimer", false);

    if (runTimer) {
        this.handler.post(this.updateTimeTask);
    }

    metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    this.screenWidthInInches = (metrics.widthPixels > metrics.heightPixels ? metrics.widthPixels : metrics.heightPixels) / Math.round(160 * metrics.density);
    LOG.info("Configuration Changed "+this.screenWidthInInches+" ");
    if(this.screenWidthInInches >= 7){
        this.handler.post(this.fitToScreenTask);
    }
}