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


Java GestureLibraries.fromRawResource方法代码示例

本文整理汇总了Java中android.gesture.GestureLibraries.fromRawResource方法的典型用法代码示例。如果您正苦于以下问题:Java GestureLibraries.fromRawResource方法的具体用法?Java GestureLibraries.fromRawResource怎么用?Java GestureLibraries.fromRawResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.gesture.GestureLibraries的用法示例。


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

示例1: initGesture

import android.gesture.GestureLibraries; //导入方法依赖的package包/类
private void initGesture() {
	final GestureLibrary gestureLibrary = GestureLibraries.fromRawResource(
			context, R.raw.gestures);
	gestureLibrary.load();

	gestureOverlayView
			.addOnGesturePerformedListener(new OnGesturePerformedListener() {

				@Override
				public void onGesturePerformed(GestureOverlayView overlay,
						Gesture gesture) {
					ArrayList<Prediction> arrayList = gestureLibrary
							.recognize(gesture);

					Prediction prediction = arrayList.get(0);
					if (prediction.score >= 3.0) {
						if (prediction.name.equals("back")) {
							Toast.makeText(context, "退出",
									Toast.LENGTH_SHORT).show();
							finish();
						}

					} else {
						Toast.makeText(context, "手势不存在", Toast.LENGTH_SHORT)
								.show();
					}

				}
			});

}
 
开发者ID:chenyufeng1991,项目名称:BaiduMap-TrafficAssistant,代码行数:32,代码来源:MainActivity.java

示例2: getOverlayContentView

import android.gesture.GestureLibraries; //导入方法依赖的package包/类
/**
 * Add the content view of the activity into a GestureOverlayView and return the new view
 *
 * @param contentView the original content view of the activity
 * @param packageName the package name of the app who uses this library
 * @param rawId       the resource identifier of the gesture file in your raw folder
 * @return the new contentView wrapped in a GestureOverlayView
 */
public static View getOverlayContentView(final View contentView, final String packageName,
                                         int rawId) {
    //load the gestures
    final GestureLibrary gestureLib = GestureLibraries
            .fromRawResource(contentView.getContext(), rawId);
    if (!gestureLib.load()) {
        Log.w(TAG, "could not load gestures");
        return contentView;
    }

    GestureOverlayView gestureOverlayView = new GestureOverlayView(contentView.getContext());
    gestureOverlayView.setGestureColor(Color.TRANSPARENT);
    gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT);
    gestureOverlayView.addView(contentView);
    gestureOverlayView
            .addOnGesturePerformedListener(new GestureOverlayView.OnGesturePerformedListener() {
                @Override
                public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
                    //load all gestures
                    ArrayList<Prediction> predictions = gestureLib.recognize(gesture);
                    //the only received prediction should be "netural"
                    for (Prediction prediction : predictions) {
                        if (prediction.score > 1.0) {
                            showDialog(contentView.getContext(), packageName);
                        }
                    }
                }
            });
    return gestureOverlayView;
}
 
开发者ID:Netural,项目名称:AboutApp,代码行数:39,代码来源:AboutAppOverlay.java

示例3: onCreate

import android.gesture.GestureLibraries; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    //
    Gson gson = new Gson();
    SharedPreferences prefs = getSharedPreferences("MyPref", MODE_PRIVATE);
    String wrapperStr = prefs.getString("memMap", null);
    MapWrapper wrapper = gson.fromJson(wrapperStr, MapWrapper.class);
    this.keys = wrapper.getKeys();
    this.values = wrapper.getValues(keys);
    //

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hand_writing_train);
    generateHashMap(memMap, keys,values);

    keyList.addAll(myNewHashMap.keySet());
    valueList.addAll(myNewHashMap.values());

    textView2 = (TextView)findViewById(R.id.textView2);

    textView2.setText("The first one of map : "+myNewHashMap.get(keyList.get(0))+", write "+keyList.get(0));
    MediaPlayer.create(handWritingTrain.this,audio[keyList.get(0)]).start();
    textView4 = (TextView)findViewById(R.id.textView4);

    gestureResult = (TextView)findViewById(R.id.gestureresult);
    gestureOverlayView = (GestureOverlayView)findViewById(R.id.gestures);

    gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
    gestureLibrary.load();

    gestureOverlayView.addOnGesturePerformedListener(gesturePerformedListener);

}
 
开发者ID:MemoryGroup,项目名称:442repo,代码行数:35,代码来源:handWritingTrain.java

示例4: init

import android.gesture.GestureLibraries; //导入方法依赖的package包/类
private void init() {
    iLanguage();
    app = (ApplicationUtil) GestureActivity.this.getApplication();
    tvShow = (TextView) findViewById(R.id.tv_show);
    tvShow.setText(strShow);
    tvGestureGuide = (TextView) findViewById(R.id.tv_gesture_guide);
    tvGestureGuide.setText(strGestureGuide);
    final List<String> lLetter = new ArrayList<>();
    List<String> lString = new ArrayList<>();
    lLetter.add("c");
    lString.add(strCmd);
    lLetter.add("t");
    lString.add(strTaskManager);
    lLetter.add("e/z");
    lString.add(strExplorer);
    lLetter.add("s");
    lString.add(strDeviceManager);
    lLetter.add("d");
    lString.add(strDiskManager);
    lLetter.add("r");
    lString.add(strRegistryEditor);
    lLetter.add("j");
    lString.add(strCalculator);
    lLetter.add("n");
    lString.add(strNotepad);
    lLetter.add("h/p");
    lString.add(strPaint);
    lLetter.add("w/x");
    lString.add(strWrite);
    lLetter.add("b/l");
    lString.add(strBrowser);
    govTouch = (GestureOverlayView) findViewById(R.id.gov_touch);
    govTouch.setGestureStrokeType(GestureOverlayView.GESTURE_STROKE_TYPE_MULTIPLE);
    govTouch.setFadeOffset(1500);
    govTouch.setGestureColor(Color.WHITE);
    govTouch.setGestureStrokeWidth(20);
    govTouch.addOnGesturePerformedListener(new GestureOverlayView.OnGesturePerformedListener() {

        @Override
        public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
            ArrayList<Prediction> predictions = mGestureLib
                    .recognize(gesture);
            if (predictions.size() > 0) {
                Prediction prediction = predictions.get(0);
                if (prediction.score > 1.0) {
                    String tmp = GestureUtil.getCommand(prediction.name);
                    if (!tmp.equals("")) {
                        sendMessage("remote", tmp);
                    }
                }
            }
        }
    });
    if (mGestureLib == null) {
        mGestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
        mGestureLib.load();
    }
    btnGestureProblem = (LinearLayout) findViewById(R.id.btn_gesture_problem);
    btnGestureProblem.setOnClickListener(this);
    btnBack = (Button) findViewById(R.id.btn_back);
    btnBack.setOnClickListener(this);
}
 
开发者ID:1anc3r,项目名称:AirFree-Client,代码行数:63,代码来源:GestureActivity.java

示例5: onCreate

import android.gesture.GestureLibraries; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
	View inflate = getLayoutInflater().inflate(R.layout.main, null);
	gestureOverlayView.addView(inflate);
	gestureOverlayView.addOnGesturePerformedListener(this);
	gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
	if (!gestureLib.load()) {
		finish();
	}
	setContentView(gestureOverlayView);
}
 
开发者ID:vogellacompany,项目名称:codeexamples-android,代码行数:15,代码来源:GestureTest.java

示例6: init

import android.gesture.GestureLibraries; //导入方法依赖的package包/类
private static void init (Context context) {		
	if (glib == null) {
		glib = GestureLibraries.fromRawResource(context, R.raw.gestures);
		glib.load();
	}
}
 
开发者ID:gmud,项目名称:bbsbrowser_android,代码行数:7,代码来源:UserUtil.java

示例7: CreateTheLayout

import android.gesture.GestureLibraries; //导入方法依赖的package包/类
@SuppressWarnings("static-access")
public void CreateTheLayout() {

	context = this;

	mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
	twifi = (WifiManager) getSystemService(Lock.WIFI_SERVICE);
	cm = (ConnectivityManager) context
			.getSystemService(context.CONNECTIVITY_SERVICE);
	am = (AudioManager) getSystemService(context.AUDIO_SERVICE);

	manager = (TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
	carrierName = manager.getNetworkOperatorName();
	carrier = (TextView) findViewById(R.id.textView2);
	carrier.setText(carrierName.toUpperCase());

	pm = context.getPackageManager();

	gLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
	gOverlay = (GestureOverlayView) findViewById(R.id.gestureOverlayView1);
	gOverlay.addOnGesturePerformedListener(this);

	battery = (TextView) findViewById(R.id.battery);
	Date = (TextView) findViewById(R.id.date);
	Time = (TextView) findViewById(R.id.time);
	text = (TextView) findViewById(R.id.texts);
	data = (TextView) findViewById(R.id.textView4);
	msgs = (TextView) findViewById(R.id.textView7);
	calls = (TextView) findViewById(R.id.textView5);
	bluetooth = (TextView) findViewById(R.id.textView3);
	wifi = (TextView) findViewById(R.id.textView1);
	sound = (TextView) findViewById(R.id.textView6);
	whats = (TextView) findViewById(R.id.textView8);
	pmm = (TextView) findViewById(R.id.pm);


	policyManager = (DevicePolicyManager) context
			.getSystemService(Context.DEVICE_POLICY_SERVICE);
	adminReceiver = new ComponentName(context, DeviceAdmin.class);
	admin = policyManager.isAdminActive(adminReceiver);

	r0 = (TableLayout) findViewById(R.id.r0);
	r0.setDrawingCacheEnabled(true);
	r0.buildDrawingCache();

	v1 = (View)findViewById(R.id.v1);
	v2 = (View)findViewById(R.id.v2);
}
 
开发者ID:Pi-Developers,项目名称:Pi-Locker,代码行数:49,代码来源:Lock.java


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