当前位置: 首页>>代码示例>>Java>>正文


Java KeyCharacterMap类代码示例

本文整理汇总了Java中android.view.KeyCharacterMap的典型用法代码示例。如果您正苦于以下问题:Java KeyCharacterMap类的具体用法?Java KeyCharacterMap怎么用?Java KeyCharacterMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KeyCharacterMap类属于android.view包,在下文中一共展示了KeyCharacterMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isNavigationBarShow

import android.view.KeyCharacterMap; //导入依赖的package包/类
public static boolean isNavigationBarShow(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();
        Point realSize = new Point();
        display.getSize(size);
        display.getRealSize(realSize);
        return realSize.y != size.y;
    } else {
        boolean menu = ViewConfiguration.get(activity).hasPermanentMenuKey();
        boolean back = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
        if (menu || back) {
            return false;
        } else {
            return true;
        }
    }
}
 
开发者ID:mmjang,项目名称:quiz_helper,代码行数:19,代码来源:ViewUtil.java

示例2: sendDtmf

import android.view.KeyCharacterMap; //导入依赖的package包/类
/**
 * Send a dtmf signal to a call
 * 
 * @param callId the call to send the signal
 * @param keyCode the keyCode to send (android style)
 * @return
 */
public int sendDtmf(int callId, int keyCode) throws SameThreadException {
    if (!created) {
        return -1;
    }
    String keyPressed = "";
    // Since some device (xoom...) are apparently buggy with key character
    // map loading...
    // we have to do crappy thing here
    if (keyCode >= KeyEvent.KEYCODE_0 && keyCode <= KeyEvent.KEYCODE_9) {
        keyPressed = Integer.toString(keyCode - KeyEvent.KEYCODE_0);
    } else if (keyCode == KeyEvent.KEYCODE_POUND) {
        keyPressed = "#";
    } else if (keyCode == KeyEvent.KEYCODE_STAR) {
        keyPressed = "*";
    } else {
        // Fallback... should never be there if using visible dialpad, but
        // possible using keyboard
        KeyCharacterMap km = KeyCharacterMap.load(KeyCharacterMap.NUMERIC);
        keyPressed = Integer.toString(km.getNumber(keyCode));
    }
    return sendDtmf(callId, keyPressed);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:30,代码来源:PjSipService.java

示例3: isNavigationBarShow

import android.view.KeyCharacterMap; //导入依赖的package包/类
public static boolean isNavigationBarShow(Activity activity){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();
        Point realSize = new Point();
        display.getSize(size);
        display.getRealSize(realSize);
        return realSize.y!=size.y;
    }else {
        boolean menu = ViewConfiguration.get(activity).hasPermanentMenuKey();
        boolean back = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
        if(menu || back) {
            return false;
        }else {
            return true;
        }
    }
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:19,代码来源:ViewUtil.java

示例4: getNavBarHeight

import android.view.KeyCharacterMap; //导入依赖的package包/类
static int getNavBarHeight(Context c) {
    int result = 0;
    boolean hasMenuKey = ViewConfiguration.get(c).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

    if (!hasMenuKey && !hasBackKey) {
        // The device has a navigation bar
        Resources res = c.getResources();

        int orientation = res.getConfiguration().orientation;
        int resourceId;
        if (isTablet(c)) {
            resourceId = res.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
        } else {
            resourceId = res.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_width", "dimen", "android");
        }
        if (resourceId > 0) {
            return res.getDimensionPixelSize(resourceId);
        }
    }
    return result;
}
 
开发者ID:tylersuehr7,项目名称:chips-input-layout,代码行数:23,代码来源:Utils.java

示例5: getNavBarHeight

import android.view.KeyCharacterMap; //导入依赖的package包/类
public static int getNavBarHeight(Context context) {
    int result = 0;
    boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

    if(!hasMenuKey && !hasBackKey) {
        //The device has a navigation bar
        Resources resources = context.getResources();

        int orientation = context.getResources().getConfiguration().orientation;
        int resourceId;
        if (isTablet(context)){
            resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
        }  else {
            resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_width", "dimen", "android");
        }

        if (resourceId > 0) {
            return context.getResources().getDimensionPixelSize(resourceId);
        }
    }
    return result;
}
 
开发者ID:pchmn,项目名称:MaterialChipsInput,代码行数:24,代码来源:ViewUtil.java

示例6: handleMessage

import android.view.KeyCharacterMap; //导入依赖的package包/类
public void handleMessage(Message m) {
    switch (m.what) {
        case MSG_INJECT_KEY:
            final long eventTime = SystemClock.uptimeMillis();
            final InputManager inputManager = (InputManager)
                    XposedHelpers.callStaticMethod(InputManager.class, "getInstance");

            int flags = KeyEvent.FLAG_FROM_SYSTEM;
            XposedHelpers.callMethod(inputManager, "injectInputEvent",
                    new KeyEvent(eventTime - 50, eventTime - 50, KeyEvent.ACTION_DOWN, m.arg1, 0,
                            0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags, InputDevice.SOURCE_UNKNOWN), 0);
            XposedHelpers.callMethod(inputManager, "injectInputEvent",
                    new KeyEvent(eventTime - 50, eventTime - 25, KeyEvent.ACTION_UP, m.arg1, 0,
                            0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags, InputDevice.SOURCE_UNKNOWN), 0);

            break;
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:19,代码来源:PieController.java

示例7: injectKey

import android.view.KeyCharacterMap; //导入依赖的package包/类
public static void injectKey(final int keyCode) {
    Handler handler = (Handler) XposedHelpers.getObjectField(mPhoneWindowManager, "mHandler");
    if (handler == null) return;

    handler.post(new Runnable() {
        @Override
        public void run() {
            try {
                final long eventTime = SystemClock.uptimeMillis();
                final InputManager inputManager = (InputManager)
                        mContext.getSystemService(Context.INPUT_SERVICE);
                int flags = KeyEvent.FLAG_FROM_SYSTEM;
                XposedHelpers.callMethod(inputManager, "injectInputEvent",
                        new KeyEvent(eventTime - 50, eventTime - 50, KeyEvent.ACTION_DOWN,
                                keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                                InputDevice.SOURCE_UNKNOWN), 0);
                XposedHelpers.callMethod(inputManager, "injectInputEvent",
                        new KeyEvent(eventTime - 50, eventTime - 25, KeyEvent.ACTION_UP,
                                keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                                InputDevice.SOURCE_UNKNOWN), 0);
            } catch (Throwable t) {
                XposedBridge.log(t);
            }
        }
    });
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:27,代码来源:ModHwKeys.java

示例8: getNavigationBarHeight

import android.view.KeyCharacterMap; //导入依赖的package包/类
public static int getNavigationBarHeight(Context context) {

        boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
        boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME);


        if (hasBackKey && hasHomeKey) {
            return 0;
        } else {
            //
            Resources resources = context.getResources();
            int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
            if (resourceId > 0) {
                return resources.getDimensionPixelSize(resourceId);
            }
            return 0;
        }


    }
 
开发者ID:zhudongya123,项目名称:WechatChatroomHelper,代码行数:21,代码来源:ScreenUtils.java

示例9: getNavigationBarHeight

import android.view.KeyCharacterMap; //导入依赖的package包/类
/**
 * 取得NavigationBar的高度
 *
 * @param c
 * @return
 */
public static int getNavigationBarHeight(Context c) {
    int result = 0;
    boolean hasMenuKey = ViewConfiguration.get(c).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

    if (!hasMenuKey && !hasBackKey) {
        //The device has a navigation bar
        Resources resources = c.getResources();

        int orientation = resources.getConfiguration().orientation;
        int resourceId;
        if (isTablet(c)) {
            resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
        } else {
            resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_width", "dimen", "android");
        }

        if (resourceId > 0) {
            return resources.getDimensionPixelSize(resourceId);
        }
    }
    return result;
}
 
开发者ID:Grasea,项目名称:Grandroid2,代码行数:30,代码来源:DisplayAgent.java

示例10: getNavBarHeight

import android.view.KeyCharacterMap; //导入依赖的package包/类
private static int getNavBarHeight(Context context) {
    boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
    boolean hasNavBar = !hasMenuKey && !hasBackKey;

    if (hasNavBar) {
        boolean isPortrait = context.getResources().getConfiguration().orientation
                == Configuration.ORIENTATION_PORTRAIT;

        boolean isTablet = (context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) >=
                Configuration.SCREENLAYOUT_SIZE_LARGE;

        String key = isPortrait ? "navigation_bar_height" :
                (isTablet ? "navigation_bar_height_landscape" : null);

        return key == null ? 0 : getDimenSize(context, key);
    } else {
        return 0;
    }
}
 
开发者ID:BubbleOctopus,项目名称:Album,代码行数:22,代码来源:CommentUtils.java

示例11: sendKeyAndWaitForEvent

import android.view.KeyCharacterMap; //导入依赖的package包/类
/**
 * Send keys and blocks until the first specified accessibility event.
 *
 * Most key presses will cause some UI change to occur. If the device is busy, this will
 * block until the device begins to process the key press at which point the call returns
 * and normal wait for idle processing may begin. If no events are detected for the
 * timeout period specified, the call will return anyway with false.
 *
 * @param keyCode
 * @param metaState
 * @param eventType
 * @param timeout
 * @return true if events is received, otherwise false.
 */
public boolean sendKeyAndWaitForEvent(final int keyCode, final int metaState, final int eventType, long timeout) {
	Runnable command = new Runnable() {
		@Override
		public void run() {
			final long eventTime = SystemClock.uptimeMillis();
			KeyEvent downEvent = new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_DOWN, keyCode, 0, metaState, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD);
			if (injectEventSync(downEvent)) {
				KeyEvent upEvent = new KeyEvent(eventTime, eventTime, KeyEvent.ACTION_UP, keyCode, 0, metaState, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD);
				injectEventSync(upEvent);
			}
		}
	};

	return runAndWaitForEvents(command, new WaitForAnyEventPredicate(eventType), timeout) != null;
}
 
开发者ID:MagicHry,项目名称:EnhancedPUMA,代码行数:30,代码来源:MyInteractionController.java

示例12: hasNavBar

import android.view.KeyCharacterMap; //导入依赖的package包/类
public static boolean hasNavBar(Context context) {
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
    boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME);

    if (hasBackKey && hasHomeKey) {
        if (Build.MANUFACTURER.toLowerCase().contains("samsung") && !Build.MODEL.toLowerCase().contains("nexus")) {
            return false;
        }

        Resources resources = context.getResources();
        int id = resources.getIdentifier("config_showNavigationBar", "bool", "android");
        if (id > 0) {
            return resources.getBoolean(id);
        } else {
            return false;
        }
    } else {
        return true;
    }
}
 
开发者ID:klinker24,项目名称:Android-3DTouch-PeekView,代码行数:21,代码来源:NavigationUtils.java

示例13: isNavigationBarShow

import android.view.KeyCharacterMap; //导入依赖的package包/类
/**
 * 底部虚拟导航是否显示
 * @param activity activity
 * @return boolean
 */
public static boolean isNavigationBarShow(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();
        Point realSize = new Point();
        display.getSize(size);
        display.getRealSize(realSize);
        return realSize.y != size.y;
    } else {
        boolean menu = ViewConfiguration.get(activity).hasPermanentMenuKey();
        boolean back = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
        if (menu || back) {
            return false;
        } else {
            return true;
        }
    }
}
 
开发者ID:ymex,项目名称:kits,代码行数:24,代码来源:ToolKit.java

示例14: getNavBarHeight

import android.view.KeyCharacterMap; //导入依赖的package包/类
public static int getNavBarHeight(Context context) {
    int result = 0;
    boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

    if(!hasMenuKey && !hasBackKey) {
        //The device has a navigation bar
        Resources resources = context.getResources();

        int orientation = resources.getConfiguration().orientation;
        int resourceId;
        if (isTablet(context)){
            resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
        }  else {
            resourceId = resources.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_width", "dimen", "android");
        }

        if (resourceId > 0) {
            return resources.getDimensionPixelSize(resourceId);
        }
    }
    return result;
}
 
开发者ID:stanidesis,项目名称:quotograph,代码行数:24,代码来源:UIUtils.java

示例15: onKeyShortcut

import android.view.KeyCharacterMap; //导入依赖的package包/类
public final boolean onKeyShortcut(int paramInt, KeyEvent paramKeyEvent)
{
  Menu localMenu = getMenu();
  int i;
  if (localMenu != null)
  {
    if (paramKeyEvent == null) {
      break label54;
    }
    i = paramKeyEvent.getDeviceId();
    if (KeyCharacterMap.load(i).getKeyboardType() == 1) {
      break label60;
    }
  }
  label54:
  label60:
  for (boolean bool = true;; bool = false)
  {
    localMenu.setQwertyMode(bool);
    localMenu.performShortcut(paramInt, paramKeyEvent, 0);
    return true;
    i = -1;
    break;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:26,代码来源:ToolbarActionBar.java


注:本文中的android.view.KeyCharacterMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。