List of usage examples for android.content.res Configuration KEYBOARD_QWERTY
int KEYBOARD_QWERTY
To view the source code for android.content.res Configuration KEYBOARD_QWERTY.
Click Source Link
From source file:org.woltage.irssiconnectbot.ConsoleActivity.java
@Override @TargetApi(11)/*from w w w . j a va 2 s . co m*/ public void onCreate(Bundle icicle) { super.onCreate(icicle); if (!InstallMosh.isInstallStarted()) { new InstallMosh(this); } configureStrictMode(); hardKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY; hardKeyboard = hardKeyboard && !Build.MODEL.contains("Transformer"); this.setContentView(R.layout.act_console); BugSenseHandler.setup(this, "d27a12dc"); clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); prefs = PreferenceManager.getDefaultSharedPreferences(this); // hide action bar if requested by user try { ActionBar actionBar = getActionBar(); if (!prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) { actionBar.hide(); } actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); } catch (NoSuchMethodError error) { Log.w(TAG, "Android sdk version pre 11. Not touching ActionBar."); } // hide status bar if requested by user if (prefs.getBoolean(PreferenceConstants.FULLSCREEN, false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } // TODO find proper way to disable volume key beep if it exists. setVolumeControlStream(AudioManager.STREAM_MUSIC); // handle requested console from incoming intent requested = getIntent().getData(); inflater = LayoutInflater.from(this); flip = (ViewFlipper) findViewById(R.id.console_flip); empty = (TextView) findViewById(android.R.id.empty); stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group); stringPromptInstructions = (TextView) findViewById(R.id.console_password_instructions); stringPrompt = (EditText) findViewById(R.id.console_password); stringPrompt.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP) return false; if (keyCode != KeyEvent.KEYCODE_ENTER) return false; // pass collected password down to current terminal String value = stringPrompt.getText().toString(); PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return false; helper.setResponse(value); // finally clear password for next user stringPrompt.setText(""); updatePromptVisible(); return true; } }); booleanPromptGroup = (RelativeLayout) findViewById(R.id.console_boolean_group); booleanPrompt = (TextView) findViewById(R.id.console_prompt); booleanYes = (Button) findViewById(R.id.console_prompt_yes); booleanYes.setOnClickListener(new OnClickListener() { public void onClick(View v) { PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return; helper.setResponse(Boolean.TRUE); updatePromptVisible(); } }); booleanNo = (Button) findViewById(R.id.console_prompt_no); booleanNo.setOnClickListener(new OnClickListener() { public void onClick(View v) { PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return; helper.setResponse(Boolean.FALSE); updatePromptVisible(); } }); // preload animations for terminal switching slide_left_in = AnimationUtils.loadAnimation(this, R.anim.slide_left_in); slide_left_out = AnimationUtils.loadAnimation(this, R.anim.slide_left_out); slide_right_in = AnimationUtils.loadAnimation(this, R.anim.slide_right_in); slide_right_out = AnimationUtils.loadAnimation(this, R.anim.slide_right_out); fade_out_delayed = AnimationUtils.loadAnimation(this, R.anim.fade_out_delayed); fade_stay_hidden = AnimationUtils.loadAnimation(this, R.anim.fade_stay_hidden); // Preload animation for keyboard button keyboard_fade_in = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_in); keyboard_fade_out = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_out); inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); final RelativeLayout keyboardGroup = (RelativeLayout) findViewById(R.id.keyboard_group); if (Build.MODEL.contains("Transformer") && getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY && prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) { keyboardGroup.setEnabled(false); keyboardGroup.setVisibility(View.INVISIBLE); } mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard); mKeyboardButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; inputManager.showSoftInput(flip, InputMethodManager.SHOW_FORCED); keyboardGroup.setVisibility(View.GONE); } }); final ImageView symButton = (ImageView) findViewById(R.id.button_sym); symButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.showCharPickerDialog(terminal); keyboardGroup.setVisibility(View.GONE); } }); mInputButton = (ImageView) findViewById(R.id.button_input); mInputButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; final TerminalView terminal = (TerminalView) flip; Thread promptThread = new Thread(new Runnable() { public void run() { String inj = getCurrentPromptHelper().requestStringPrompt(null, ""); terminal.bridge.injectString(inj); } }); promptThread.setName("Prompt"); promptThread.setDaemon(true); promptThread.start(); keyboardGroup.setVisibility(View.GONE); } }); final ImageView ctrlButton = (ImageView) findViewById(R.id.button_ctrl); ctrlButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.metaPress(TerminalKeyListener.META_CTRL_ON); terminal.bridge.tryKeyVibrate(); keyboardGroup.setVisibility(View.GONE); } }); final ImageView escButton = (ImageView) findViewById(R.id.button_esc); escButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.sendEscape(); terminal.bridge.tryKeyVibrate(); keyboardGroup.setVisibility(View.GONE); } }); // detect fling gestures to switch between terminals final GestureDetector detect = new GestureDetector(new ICBSimpleOnGestureListener(this)); flip.setLongClickable(true); flip.setOnTouchListener(new ICBOnTouchListener(this, keyboardGroup, detect)); }
From source file:com.wearapp.PickFriendsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pick_friends_activity); newPermissionsRequest = new NewPermissionsRequest(this, Arrays.asList("xmpp_login")); FragmentManager fm = getSupportFragmentManager(); if (savedInstanceState == null) { // First time through, we create our fragment programmatically. final Bundle args = getIntent().getExtras(); friendPickerFragment = new FriendPickerFragment(args); fm.beginTransaction().add(R.id.friend_picker_fragment, friendPickerFragment).commit(); } else {/*ww w .ja v a2 s . c o m*/ // Subsequent times, our fragment is recreated by the framework and // already has saved and // restored its state, so we don't need to specify args again. (In // fact, this might be // incorrect if the fragment was modified programmatically since it // was created.) friendPickerFragment = (FriendPickerFragment) fm.findFragmentById(R.id.friend_picker_fragment); } friendPickerFragment.setOnErrorListener(new PickerFragment.OnErrorListener() { @Override public void onError(PickerFragment<?> fragment, FacebookException error) { PickFriendsActivity.this.onError(error); } }); friendPickerFragment.setOnSelectionChangedListener(new OnSelectionChangedListener() { @Override public void onSelectionChanged(PickerFragment<?> fragment) { // TODO Auto-generated method stub selectedUsers_temp1 = friendPickerFragment.getSelection(); /*tempselectedUsers = friendPickerFragment.getSelection(); if (selectedUsers.size()==0) { selectedUsers = tempselectedUsers; } for (GraphUser u :tempselectedUsers) { if (!selectedUsers.contains(u)) { selectedUsers.add(u); System.out.println("XX-add"+u.getName()); } } Iterator<GraphUser> it = selectedUsers.iterator(); while(it.hasNext()) { GraphUser u = it.next(); if (!tempselectedUsers.contains(u)) { it.remove(); selectedUsers.remove(u); System.out.println("XX-remove"+u.getName()); } } System.out.println("XX===="+selectedUsers.size()+"===="); for (GraphUser u :selectedUsers) { System.out.println("XX"+u.getName()); } System.out.println("XX========");*/ } }); friendPickerFragment.setOnDoneButtonClickedListener(new PickerFragment.OnDoneButtonClickedListener() { @Override public void onDoneButtonClicked(PickerFragment<?> fragment) { // We just store our selection in the Application for other // activities to look at. // FriendPickerApplication application = // (FriendPickerApplication) getApplication(); // if No friends selected , show the dialog if ((selectedUsers.size() == 0) && (selectedUsers_temp1.size() == 0)) { Toast.makeText(getApplicationContext(), "No selected users, Message not sent", Toast.LENGTH_LONG).show(); } else if ((selectedUsers.size() == 0) && (selectedUsers_temp1.size() != 0)) // if the friend list not been filtered by keywords, initiate the selectedUsers list { selectedUsers = selectedUsers_temp1; } //remove duplicated friends in the selected friend list for (int i = 0; i < selectedUsers.size() - 1; i++) { for (int j = selectedUsers.size() - 1; j > i; j--) { if (selectedUsers.get(j).getId().equals(selectedUsers.get(i).getId())) selectedUsers.remove(j); } } Session session = Session.getActiveSession(); editDialog = new EditText(PickFriendsActivity.this); editDialog.setRawInputType(Configuration.KEYBOARD_QWERTY); editDialog.setInputType(InputType.TYPE_CLASS_TEXT); if (session.isOpened()) { session.requestNewReadPermissions(newPermissionsRequest); for (GraphUser selectedUser : selectedUsers) { if (selectedUsers.size() - 1 != selectedUsers.indexOf(selectedUser)) friendslist_selected.append(selectedUser.getName() + ","); else friendslist_selected.append(selectedUser.getName()); } new AlertDialog.Builder(PickFriendsActivity.this) .setMessage("Please edit the messages to send to " + friendslist_selected + " in " + LocationUtil.selectedlocation.getName() + " ?") .setView(editDialog).setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub sendMessage(); finishActivity(); } }).setNegativeButton("NO", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "Message not sent", Toast.LENGTH_LONG) .show(); finishActivity(); } }).show(); } } }); }
From source file:org.connectbot.ConsoleActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { StrictModeSetup.run();//from w w w .j a v a 2 s.c o m } hardKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY; clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); prefs = PreferenceManager.getDefaultSharedPreferences(this); titleBarHide = prefs.getBoolean(PreferenceConstants.TITLEBARHIDE, false); if (titleBarHide && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // This is a separate method because Gradle does not uniformly respect the conditional // Build check. See: https://code.google.com/p/android/issues/detail?id=137195 requestActionBar(); } this.setContentView(R.layout.act_console); // hide status bar if requested by user if (prefs.getBoolean(PreferenceConstants.FULLSCREEN, false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } // TODO find proper way to disable volume key beep if it exists. setVolumeControlStream(AudioManager.STREAM_MUSIC); // handle requested console from incoming intent if (icicle == null) { requested = getIntent().getData(); } else { String uri = icicle.getString(STATE_SELECTED_URI); if (uri != null) { requested = Uri.parse(uri); } } inflater = LayoutInflater.from(this); toolbar = (Toolbar) findViewById(R.id.toolbar); pager = (TerminalViewPager) findViewById(R.id.console_flip); pager.addOnPageChangeListener(new TerminalViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { setTitle(adapter.getPageTitle(position)); onTerminalChanged(); } }); adapter = new TerminalPagerAdapter(); pager.setAdapter(adapter); empty = (TextView) findViewById(android.R.id.empty); stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group); stringPromptInstructions = (TextView) findViewById(R.id.console_password_instructions); stringPrompt = (EditText) findViewById(R.id.console_password); stringPrompt.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP) return false; if (keyCode != KeyEvent.KEYCODE_ENTER) return false; // pass collected password down to current terminal String value = stringPrompt.getText().toString(); PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return false; helper.setResponse(value); // finally clear password for next user stringPrompt.setText(""); updatePromptVisible(); return true; } }); booleanPromptGroup = (RelativeLayout) findViewById(R.id.console_boolean_group); booleanPrompt = (TextView) findViewById(R.id.console_prompt); booleanYes = (Button) findViewById(R.id.console_prompt_yes); booleanYes.setOnClickListener(new OnClickListener() { public void onClick(View v) { PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return; helper.setResponse(Boolean.TRUE); updatePromptVisible(); } }); Button booleanNo = (Button) findViewById(R.id.console_prompt_no); booleanNo.setOnClickListener(new OnClickListener() { public void onClick(View v) { PromptHelper helper = getCurrentPromptHelper(); if (helper == null) return; helper.setResponse(Boolean.FALSE); updatePromptVisible(); } }); fade_out_delayed = AnimationUtils.loadAnimation(this, R.anim.fade_out_delayed); // Preload animation for keyboard button keyboard_fade_in = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_in); keyboard_fade_out = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_out); keyboardGroup = (LinearLayout) findViewById(R.id.keyboard_group); keyboardAlwaysVisible = prefs.getBoolean(PreferenceConstants.KEY_ALWAYS_VISIVLE, false); if (keyboardAlwaysVisible) { // equivalent to android:layout_above=keyboard_group RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.ABOVE, R.id.keyboard_group); pager.setLayoutParams(layoutParams); // Show virtual keyboard keyboardGroup.setVisibility(View.VISIBLE); } mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard); mKeyboardButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { View terminal = adapter.getCurrentTerminalView(); if (terminal == null) return; InputMethodManager inputMethodManager = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); inputMethodManager.toggleSoftInputFromWindow(terminal.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0); terminal.requestFocus(); hideEmulatedKeys(); } }); findViewById(R.id.button_ctrl).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_esc).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_tab).setOnClickListener(emulatedKeysListener); addKeyRepeater(findViewById(R.id.button_up)); addKeyRepeater(findViewById(R.id.button_up)); addKeyRepeater(findViewById(R.id.button_down)); addKeyRepeater(findViewById(R.id.button_left)); addKeyRepeater(findViewById(R.id.button_right)); findViewById(R.id.button_home).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_end).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_pgup).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_pgdn).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f1).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f2).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f3).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f4).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f5).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f6).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f7).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f8).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f9).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f10).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f11).setOnClickListener(emulatedKeysListener); findViewById(R.id.button_f12).setOnClickListener(emulatedKeysListener); actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); if (titleBarHide) { actionBar.hide(); } actionBar.addOnMenuVisibilityListener(new ActionBar.OnMenuVisibilityListener() { public void onMenuVisibilityChanged(boolean isVisible) { inActionBarMenu = isVisible; if (!isVisible) { hideEmulatedKeys(); } } }); } final HorizontalScrollView keyboardScroll = (HorizontalScrollView) findViewById(R.id.keyboard_hscroll); if (!hardKeyboard) { // Show virtual keyboard and scroll back and forth showEmulatedKeys(false); keyboardScroll.postDelayed(new Runnable() { @Override public void run() { final int xscroll = findViewById(R.id.button_f12).getRight(); if (BuildConfig.DEBUG) { Log.d(TAG, "smoothScrollBy(toEnd[" + xscroll + "])"); } keyboardScroll.smoothScrollBy(xscroll, 0); keyboardScroll.postDelayed(new Runnable() { @Override public void run() { if (BuildConfig.DEBUG) { Log.d(TAG, "smoothScrollBy(toStart[" + (-xscroll) + "])"); } keyboardScroll.smoothScrollBy(-xscroll, 0); } }, 500); } }, 500); } // Reset keyboard auto-hide timer when scrolling keyboardScroll.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: autoHideEmulatedKeys(); break; case MotionEvent.ACTION_UP: v.performClick(); return (true); } return (false); } }); tabs = (TabLayout) findViewById(R.id.tabs); if (tabs != null) setupTabLayoutWithViewPager(); pager.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showEmulatedKeys(true); } }); // Change keyboard button image according to soft keyboard visibility // How to detect keyboard visibility: http://stackoverflow.com/q/4745988 contentView = findViewById(android.R.id.content); contentView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { Rect r = new Rect(); contentView.getWindowVisibleDisplayFrame(r); int screenHeight = contentView.getRootView().getHeight(); int keypadHeight = screenHeight - r.bottom; if (keypadHeight > screenHeight * 0.15) { // keyboard is opened mKeyboardButton.setImageResource(R.drawable.ic_keyboard_hide); mKeyboardButton.setContentDescription( getResources().getText(R.string.image_description_hide_keyboard)); } else { // keyboard is closed mKeyboardButton.setImageResource(R.drawable.ic_keyboard); mKeyboardButton.setContentDescription( getResources().getText(R.string.image_description_show_keyboard)); } } }); }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
public void onCreate(Bundle savedInstanceState) { Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler()); if (getPreferences().getBoolean("global", "pref_fullscreen", false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); IS_FULL_SCREEN = true;/* www . ja va2 s . c o m*/ } //else getWindow().addFlags(WindowManager.LayoutParams.FLAG else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); IS_FULL_SCREEN = false; } IS_KEYBOARD_AVAILABLE = getContext().getResources() .getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY; loadPreferences(); if (getPreferences().getBoolean("global", "pref_hardware_accel", true) && !BEFORE_HONEYCOMB) getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); //mActionBarHelper = ActionBarHelper.createInstance(this); //mActionBarHelper.onCreate(savedInstanceState); if (BEFORE_HONEYCOMB) { requestWindowFeature(Window.FEATURE_NO_TITLE); USE_ACTION_BAR = false; //} else if(isGTV()) { // USE_ACTION_BAR = false; // mBar = (LeftNavBarService.instance()).getLeftNavBar(this); } else if (!BEFORE_HONEYCOMB) { requestWindowFeature(Window.FEATURE_ACTION_BAR); USE_ACTION_BAR = true; mBar = getActionBar(); } if (mBar != null) { if (Build.VERSION.SDK_INT >= 14) mBar.setHomeButtonEnabled(true); mBar.setDisplayUseLogoEnabled(true); try { mBar.setCustomView(R.layout.title_bar); mBar.setDisplayShowCustomEnabled(true); mBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); //ViewGroup cv = (ViewGroup)ab.getCustomView(); //if(cv.findViewById(R.id.title_paste) != null) // cv.removeView(cv.findViewById(R.id.title_paste)); //ab.getCustomView().findViewById(R.id.title_icon).setVisibility(View.GONE); } catch (InflateException e) { Logger.LogWarning("Couldn't set up ActionBar custom view", e); } } else USE_ACTION_BAR = false; OpenFile.setTempFileRoot(new OpenFile(getFilesDir()).getChild("temp")); setupLoggingDb(); handleExceptionHandler(); getMimeTypes(); setupFilesDb(); super.onCreate(savedInstanceState); setContentView(R.layout.main_fragments); getWindow().setBackgroundDrawableResource(R.drawable.background_holo_dark); try { upgradeViewSettings(); } catch (Exception e) { } //try { showWarnings(); //} catch(Exception e) { } mEvHandler.setUpdateListener(this); getClipboard().setClipboardUpdateListener(this); try { /* Signature[] sigs = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES).signatures; for(Signature sig : sigs) if(sig.toCharsString().indexOf("4465627567") > -1) // check for "Debug" in signature IS_DEBUG_BUILD = true; */ if (IS_DEBUG_BUILD) IS_DEBUG_BUILD = (getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA).applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) == ApplicationInfo.FLAG_DEBUGGABLE; if (isBlackBerry()) IS_DEBUG_BUILD = false; } catch (NameNotFoundException e1) { } handleNetworking(); refreshCursors(); checkWelcome(); checkRoot(); if (!BEFORE_HONEYCOMB) { boolean show_underline = true; if (Build.VERSION.SDK_INT < 14) show_underline = isGTV(); else if (getResources().getBoolean(R.bool.large)) // ICS+ tablets show_underline = false; if (Build.VERSION.SDK_INT > 13 && !getResources().getBoolean(R.bool.large)) show_underline = true; View tu = findViewById(R.id.title_underline); if (tu != null && !show_underline) { getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_shadow)); tu.setVisibility(View.GONE); } //if(USE_ACTION_BAR) // setViewVisibility(false, false, R.id.title_bar, R.id.title_underline, R.id.title_underline_2); } if (BEFORE_HONEYCOMB || !USE_ACTION_BAR) ViewUtils.inflateView(this, R.id.title_stub); if (BEFORE_HONEYCOMB) ViewUtils.inflateView(this, R.id.base_stub); setViewVisibility(false, false, R.id.title_paste, R.id.title_ops, R.id.title_log); setOnClicks(R.id.title_ops, //R.id.menu_global_ops_icon, R.id.menu_global_ops_text, R.id.title_log, R.id.title_icon, R.id.menu_more, R.id.title_paste_icon //,R.id.title_sort, R.id.title_view, R.id.title_up ); checkTitleSeparator(); IconContextMenu.clearInstances(); if (findViewById(R.id.list_frag) == null) mSinglePane = true; else if (findViewById(R.id.list_frag).getVisibility() == View.GONE) mSinglePane = true; Logger.LogDebug("Looking for path"); OpenPath path = mLastPath; if (savedInstanceState == null || path == null) { String start = getPreferences().getString("global", "pref_start", "External"); if (savedInstanceState != null && savedInstanceState.containsKey("last") && !savedInstanceState.getString("last").equals("")) start = savedInstanceState.getString("last"); path = FileManager.getOpenCache(start, this); } if (path == null) path = OpenFile.getExternalMemoryDrive(true); if (FileManager.checkForNoMedia(path)) showToast(R.string.s_error_no_media, Toast.LENGTH_LONG); mLastPath = path; boolean bAddToStack = true; if (findViewById(R.id.content_pager_frame_stub) != null) ((ViewStub) findViewById(R.id.content_pager_frame_stub)).inflate(); Logger.LogDebug("Pager inflated"); if (fragmentManager == null) { fragmentManager = getSupportFragmentManager(); fragmentManager.addOnBackStackChangedListener(this); } mLogFragment = new LogViewerFragment(); FragmentTransaction ft = fragmentManager.beginTransaction(); Logger.LogDebug("Creating with " + path.getPath()); if (path instanceof OpenFile) new PeekAtGrandKidsTask().execute((OpenFile) path); initPager(); if (handleIntent(getIntent())) { path = mLastPath = null; bAddToStack = false; } if (mViewPager != null && mViewPagerAdapter != null && path != null) { //mViewPagerAdapter.add(mContentFragment); mLastPath = null; changePath(path, bAddToStack, true); setCurrentItem(mViewPagerAdapter.getCount() - 1, false); restoreOpenedEditors(); } else Logger.LogWarning("Nothing to show?!"); ft.commit(); invalidateOptionsMenu(); initBookmarkDropdown(); handleMediaReceiver(); if (!getPreferences().getBoolean("global", "pref_splash", false)) showSplashIntent(this, getPreferences().getString("global", "pref_start", "Internal")); }
From source file:jackpal.androidterm.Term.java
private boolean checkHaveFullHwKeyboard(Configuration c) { return (c.keyboard == Configuration.KEYBOARD_QWERTY) && (c.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO); }
From source file:org.navitproject.navit.Navit.java
/** * @brief Shows the native keyboard or other input method. * /* w w w . java 2 s . c o m*/ * @return {@code true} if an input method is going to be displayed, {@code false} if not */ public int showNativeKeyboard() { /* * Apologies for the huge mess that this function is, but Android's soft input API is a big * nightmare. Its devs have mercifully given us an option to show or hide the keyboard, but * there is no reliable way to figure out if it is actually showing, let alone how much of the * screen it occupies, so our best bet is guesswork. */ Configuration config = getResources().getConfiguration(); if ((config.keyboard == Configuration.KEYBOARD_QWERTY) && (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)) /* physical keyboard present, exit */ return 0; /* Use SHOW_FORCED here, else keyboard won't show in landscape mode */ mgr.showSoftInput(getCurrentFocus(), InputMethodManager.SHOW_FORCED); show_soft_keyboard_now_showing = true; /* * Crude way to estimate the height occupied by the keyboard: for AOSP on KitKat and Lollipop it * is about 62-63% of available screen width (in portrait mode) but no more than slightly above * 46% of height (in landscape mode). */ Display display_ = getWindowManager().getDefaultDisplay(); int width_ = display_.getWidth(); int height_ = display_.getHeight(); int maxHeight = height_ * 47 / 100; int inputHeight = width_ * 63 / 100; if (inputHeight > (maxHeight)) inputHeight = maxHeight; /* the receiver isn't going to fire before the UI thread becomes idle, well after this method returns */ Log.d(TAG, "showNativeKeyboard:return (assuming true)"); return inputHeight; }