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

The following examples show how to use android.content.res.Configuration#KEYBOARD_QWERTY . 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: LocationBarLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if (mUrlHasFocus && mUrlFocusedWithoutAnimations
            && newConfig.keyboard != Configuration.KEYBOARD_QWERTY) {
        // If we lose the hardware keyboard and the focus animations were not run, then the
        // user has not typed any text, so we will just clear the focus instead.
        setUrlBarFocus(false);
    }
}
 
Example 2
Source File: ToolbarManager.java    From delion with Apache License 2.0 5 votes vote down vote up
private boolean shouldShowCusrsorInLocationBar() {
    Tab tab = mToolbarModel.getTab();
    if (tab == null) return false;
    NativePage nativePage = tab.getNativePage();
    if (!(nativePage instanceof NewTabPage) && !(nativePage instanceof IncognitoNewTabPage)) {
        return false;
    }

    Context context = mToolbar.getContext();
    return DeviceFormFactor.isTablet(context)
            && context.getResources().getConfiguration().keyboard
            == Configuration.KEYBOARD_QWERTY;
}
 
Example 3
Source File: LocationBarLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
protected void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if (mUrlHasFocus && mUrlFocusedWithoutAnimations
            && newConfig.keyboard != Configuration.KEYBOARD_QWERTY) {
        // If we lose the hardware keyboard and the focus animations were not run, then the
        // user has not typed any text, so we will just clear the focus instead.
        setUrlBarFocus(false);
    }
}
 
Example 4
Source File: ToolbarManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private boolean shouldShowCusrsorInLocationBar() {
    Tab tab = mToolbarModel.getTab();
    if (tab == null) return false;
    NativePage nativePage = tab.getNativePage();
    if (!(nativePage instanceof NewTabPage) && !(nativePage instanceof IncognitoNewTabPage)) {
        return false;
    }

    Context context = mToolbar.getContext();
    return DeviceFormFactor.isTablet(context)
            && context.getResources().getConfiguration().keyboard
            == Configuration.KEYBOARD_QWERTY;
}
 
Example 5
Source File: LocationBarLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if (mUrlHasFocus && mUrlFocusedWithoutAnimations
            && newConfig.keyboard != Configuration.KEYBOARD_QWERTY) {
        // If we lose the hardware keyboard and the focus animations were not run, then the
        // user has not typed any text, so we will just clear the focus instead.
        setUrlBarFocus(false);
    }
}
 
Example 6
Source File: ToolbarManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private boolean shouldShowCusrsorInLocationBar() {
    Tab tab = mToolbarModel.getTab();
    if (tab == null) return false;
    NativePage nativePage = tab.getNativePage();
    if (!(nativePage instanceof NewTabPage) && !(nativePage instanceof IncognitoNewTabPage)) {
        return false;
    }

    Context context = mToolbar.getContext();
    return DeviceFormFactor.isTablet()
            && context.getResources().getConfiguration().keyboard
            == Configuration.KEYBOARD_QWERTY;
}
 
Example 7
Source File: DialerActivity.java    From emerald-dialer with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	DialerApp.setTheme(this);
	setContentView(R.layout.main);
	SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
	if (!preferences.getBoolean("privacy_policy", false)) {
		showPrivacyPolicyDialog(preferences.edit());
	}
	if (Build.VERSION.SDK_INT >= 23 && !hasRequiredPermissions()) {
		requestPermissions(PERMISSIONS, 0);
		for (int i = 0; i < 5; i++) {
			if (checkSelfPermission(PERMISSIONS[i]) == PackageManager.PERMISSION_GRANTED) {
				continue;
			} else {
				finish();
			}
		}
	}
	numberField = (EditText)findViewById(R.id.number_field);
	parseIntent(getIntent());
	telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
	setButtonListeners();
	numberField.setCursorVisible(false);
	numberField.requestFocus();
	numberField.addTextChangedListener(this);
	list = (ListView) findViewById(R.id.log_entries_list);
	onCallLogScrollListener = new OnCallLogScrollListener(this);
	list.setOnScrollListener(onCallLogScrollListener);
	TypedValue outValue = new TypedValue();
	getTheme().resolveAttribute(R.attr.drawableContactImage, outValue, true);
	int defaultContactImageId = outValue.resourceId;
	
	mAsyncContactImageLoader = new AsyncContactImageLoader(this, getResources().getDrawable(defaultContactImageId, getTheme()));
	logEntryAdapter = new LogEntryAdapter(this, null, mAsyncContactImageLoader);
	list.setAdapter(logEntryAdapter);
	list.setOnItemClickListener(this);
	list.setOnItemLongClickListener(this);
	String t9Locale = preferences.getString("t9_locale", "system");
	Context t9LocaleContext = null;
	if (!t9Locale.equals("system")) {
		Configuration t9Configuration = getResources().getConfiguration();
		t9Configuration.setLocale(new Locale(t9Locale, t9Locale));
		t9LocaleContext = createConfigurationContext(t9Configuration);
		Resources t9Resources = t9LocaleContext.getResources();
		// For numpad buttons (2...9)
		int[] numpadLettersIds = new int[] {
			R.string.numpad_2,
			R.string.numpad_3,
			R.string.numpad_4,
			R.string.numpad_5,
			R.string.numpad_6,
			R.string.numpad_7,
			R.string.numpad_8,
			R.string.numpad_9
		};
		for (int i = 2; i <= 9; i++) {
			((NumpadButton)(findViewById(buttonIds[i])))
					.setLetters(t9Resources.getString(numpadLettersIds[i-2]));
		}

	}

	contactsEntryAdapter = new ContactsEntryAdapter(this, mAsyncContactImageLoader, t9LocaleContext);
	int keyboardType = getResources().getConfiguration().keyboard;
	if (keyboardType == Configuration.KEYBOARD_QWERTY) {
		numberField.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
		contactsEntryAdapter.setRawFiltering(true);
		findViewById(R.id.btn_toggle_numpad).setVisibility(View.INVISIBLE);
		findViewById(R.id.numpad).setVisibility(View.GONE);
	} else if (keyboardType == Configuration.KEYBOARD_12KEY) {	
		findViewById(R.id.btn_toggle_numpad).setVisibility(View.INVISIBLE);
		findViewById(R.id.numpad).setVisibility(View.GONE);
	}
	
	getLoaderManager().initLoader(0, null, this);
	getLoaderManager().initLoader(1, null, this);
	getLoaderManager().getLoader(0).forceLoad();
	getLoaderManager().getLoader(1).forceLoad();
}
 
Example 8
Source File: Term.java    From Ansole with GNU General Public License v2.0 4 votes vote down vote up
private boolean checkHaveFullHwKeyboard(Configuration c) {
    return (c.keyboard == Configuration.KEYBOARD_QWERTY)
            && (c.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO);
}