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


Java ShakeDetector类代码示例

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


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

示例1: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_match);
    ButterKnife.bind(this);

    MatchFragment matchFragment =MatchFragment.newInstance();
    makeFullScreen();

    ShakeDetector shakeDetector=new ShakeDetector(this);
    SensorManager sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
    shakeDetector.start(sensorManager);

    if(isFirstStart){
        //to avoid overlapping of fragments' views
        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, matchFragment).commit();
    }else {
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, matchFragment).commit();
    }
    isFirstStart=true;
}
 
开发者ID:othreecodes,项目名称:Dampp,代码行数:23,代码来源:MatchActivity.java

示例2: setUpSeekBars

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
public void setUpSeekBars() {
    shakeNumber = Prefs.with(this).readInt(PreferencesUtils.PREFERENCES_SHAKE_NUMBER, 6);
    sensorSensitivity = Prefs.with(this).readInt(PreferencesUtils.PREFERENCES_SENSOR_SENSITIVITY,
            ShakeDetector.SENSITIVITY_LIGHT);
    timeUntilRestart = Prefs.with(this).readInt(PreferencesUtils.PREFERENCES_TIME_TO_RESTART, 500);

    seekbarShakeNumber.setKeyProgressIncrement(1);
    seekbarSensitivity.setKeyProgressIncrement(1);
    seekbarTimeUntilRestart.setKeyProgressIncrement(1);

    seekbarShakeNumber.setProgress(shakeNumber - 3);
    seekbarSensitivity.setProgress(sensorSensitivity - 7);
    seekbarTimeUntilRestart.setProgress((timeUntilRestart - 250) / 250);

    tvShakeNumber.setText(String.valueOf(shakeNumber));
    tvSensitivity.setText(String.valueOf(sensorSensitivity));
    tvTimeUntilRestart.setText(String.valueOf(timeUntilRestart));
}
 
开发者ID:GrenderG,项目名称:Protestr,代码行数:20,代码来源:DetentionAlertConfigActivity.java

示例3: onStartCommand

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null && (intent.hasExtra(SHAKE_COUNT_THRESHOLD_EXTRA) &&
            intent.hasExtra(SHAKE_RESET_THRESHOLD_EXTRA) &&
            intent.hasExtra(SENSOR_SENSITIVITY_EXTRA))) {
        shakeCountThreshold = intent.getExtras().getInt(SHAKE_COUNT_THRESHOLD_EXTRA);
        sensorSensitivity = intent.getExtras().getInt(SENSOR_SENSITIVITY_EXTRA);
        shakeResetThreshold = intent.getExtras().getInt(SHAKE_RESET_THRESHOLD_EXTRA);
        testing = true;
    } else {
        shakeCountThreshold = Prefs.with(this).readInt(PreferencesUtils.PREFERENCES_SHAKE_NUMBER, 6);
        sensorSensitivity = Prefs.with(this).readInt(PreferencesUtils.PREFERENCES_SENSOR_SENSITIVITY,
                ShakeDetector.SENSITIVITY_LIGHT);
        shakeResetThreshold = Prefs.with(this).readInt(PreferencesUtils.PREFERENCES_TIME_TO_RESTART, 500);
    }

    listenForShakes();
    return START_STICKY_COMPATIBILITY;
}
 
开发者ID:GrenderG,项目名称:Protestr,代码行数:20,代码来源:ShakeToAlertService.java

示例4: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
    shakeDetectorListener = new ShakeDetectorListener(this, new ShakeDetectorListener.ShakeDetectorCallback() {
        @Override
        public void onStart() {
            progressBar.setVisibility(View.VISIBLE);
        }

        @Override
        public void onFinish() {
            progressBar.setVisibility(View.GONE);
        }
    });
    shakeDetector = new ShakeDetector(shakeDetectorListener);

    initView();
}
 
开发者ID:YukiSora,项目名称:Yandere,代码行数:23,代码来源:MainActivity.java

示例5: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_demo);
	SharedPreferences defualtPref = PreferenceManager.getDefaultSharedPreferences(this);
	defualtPref.edit().putString("Test", "Done").apply();

	SharedPreferences anotherPref = getSharedPreferences("Prasham", MODE_PRIVATE);
	anotherPref.edit().putString("Test", "Love you life").apply();
	anotherPref.edit().putInt("Test Int", 1138).apply();
	anotherPref.edit().putFloat("Test Float", 11.38F).apply();
	anotherPref.edit().putLong("Test Long", 113834).apply();
	anotherPref.edit().putBoolean("Test Boolean", true).apply();


	SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
	ShakeDetector sd = new ShakeDetector(this);
	sd.start(sensorManager);
}
 
开发者ID:PrashamTrivedi,项目名称:SharedPreferenceInspector,代码行数:20,代码来源:DemoActivity.java

示例6: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("");
    setContentView(R.layout.activity_home);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    metaball.setPaintMode(0);
    FilterModel filter = new FilterModel(this);
    commonAdapter = new FiltersAdapter(presenter(), filter.getFilters());
    framesAdapter = new FramesAdapter(presenter(), getResources().getStringArray(R.array.colors));
    recycler.setItemAnimator(new DefaultItemAnimator());
    recycler.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
    recycler.setHasFixedSize(true);
    seek.setOnProgressChangeListener(presenter().onFilterAdjusted);
    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    shakeDetector = new ShakeDetector(this);
    zoomImage.setNestedScrollView(nestedScrollView);
}
 
开发者ID:k0shk0sh,项目名称:Filtra-StyleMe-,代码行数:19,代码来源:Home.java

示例7: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    gson = new GsonBuilder().setPrettyPrinting().create();
    t = (TextView) findViewById(R.id.tv);
    /*fakeService.returnStringList().subscribe(new Action1<List<String>>() {
        @Override
        public void call(List<String> strings) {
            setText(strings);
        }
    });*/
    fakeService.returnMyModelObservable().subscribe(new Action1<MyModel>() {
        @Override
        public void call(MyModel myModel) {
            setText(myModel);
        }
    });
    SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    ShakeDetector sd = new ShakeDetector(this);
    sd.start(sensorManager);
}
 
开发者ID:fdoyle,项目名称:mocktopus,代码行数:23,代码来源:MainActivity.java

示例8: NotifyDeveloperHandler

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
NotifyDeveloperHandler(Application context, Iterable<String> emailAddress, LogLevel minLevel, final ActivityStateListener stateListener) {
    this.context = context;
    this.emailAddress = Lists.newArrayList(emailAddress);
    this.filter = new AtLeastFilter(minLevel);
    this.activityState = new WeakReference<>(stateListener);
    this.attachmentClassList = new ArrayList<>();
    this.shakeDetector = new ShakeDetector(new ShakeDetector.Listener() {
        @Override
        public void hearShake() {
            ActivityStateListener listener = activityState.get();
            if (listener != null) {
                if (listener.isAppInForeground()) {
                    beginPublishOnMainThread(new LogRecord(Level.INFO, "Report a problem with app"));
                } else {
                    Log.i(TAG, "Ignore shake event - the app appears to be in background");
                }
            } else {
                Log.i(TAG, "Ignore shake event - can't detect if app is in foreground (API < 14)");
            }
        }
    });
    this.emailSubject = context.getString(R.string.slf4android_email_subject) + context.getPackageName();
    this.emailBody = context.getString(R.string.slf4android_email_extra_text);
}
 
开发者ID:bright,项目名称:slf4android,代码行数:25,代码来源:NotifyDeveloperHandler.java

示例9: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if(BuildConfig.DEBUG) {
        Log.i(this.getClass().getName(), "received intent on create");
    }
    cDb = new CreditDatabase(getApplicationContext());
    setUpLocalBroadCastReceiver();
    startNfcIntentService(getIntent());
    setUpAddDataThingies();
    setUpStatistics();
    Helper.ratingCounter(this);
    if(!Helper.isNfcEnabled(this)){
        Helper.showEnableNfcDialog(this);
    }
    setUpNfcStuff();
    setUpAdView();
    SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    ShakeDetector sd = new ShakeDetector(this);
    sd.start(sensorManager);
}
 
开发者ID:ueman,项目名称:CampusCardReader,代码行数:23,代码来源:MainActivity.java

示例10: listenForShakes

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
private void listenForShakes() {
    final SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    shakeDetector = new ShakeDetector(this);
    shakeDetector.setSensitivity(sensorSensitivity);
    shakeDetector.start(sensorManager);
}
 
开发者ID:GrenderG,项目名称:Protestr,代码行数:8,代码来源:ShakeToAlertService.java

示例11: start

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
/**
 * (Required) Start listening for device shaking. You MUST call <code>assemble</code> before calling this method.
 */
public void start() {
    if (!assembled) {
        throw new IllegalStateException("You MUST call assemble before calling start.");
    }

    if (startAttempted) {
        logger.d("You have already attempted to start this BugShaker instance. Calling start "
                + "again is a no-op.");

        return;
    }

    if (emailCapabilitiesProvider.canSendEmails()) {
        application.registerActivityLifecycleCallbacks(simpleActivityLifecycleCallback);

        final SensorManager sensorManager
                = (SensorManager) application.getSystemService(SENSOR_SERVICE);
        final ShakeDetector shakeDetector = new ShakeDetector(this);

        final boolean didStart = shakeDetector.start(sensorManager);

        if (didStart) {
            logger.d("Shake detection successfully started!");
        } else {
            logger.e("Error starting shake detection: hardware does not support detection.");
        }
    } else {
        logger.e("Error starting shake detection: device cannot send emails.");
    }

    startAttempted = true;
}
 
开发者ID:stkent,项目名称:bugshaker-android,代码行数:36,代码来源:BugShaker.java

示例12: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image);

    int type = getIntent().getIntExtra("type", NONE);
    isRandomizable = (type & RANDOM) == RANDOM;
    imageData = (ImageData)getIntent().getSerializableExtra("imageData");
    filename = String.format("yandere_%s.%s", imageData.id, imageData.file_ext);

    downloadManager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
    handler = new Handler();
    sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
    shakeDetectorListener = new ShakeDetectorListener(this, new ShakeDetectorListener.ShakeDetectorCallback() {
        @Override
        public void onStart() {
            progressBar.setVisibility(View.VISIBLE);
        }

        @Override
        public void onFinish() {
            progressBar.setVisibility(View.GONE);
            finish();
        }
    });
    shakeDetector = new ShakeDetector(shakeDetectorListener);
    scheduleTaskExecutor = Executors.newScheduledThreadPool(5);

    initView();
}
 
开发者ID:YukiSora,项目名称:Yandere,代码行数:31,代码来源:ImageActivity.java

示例13: init

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
/**
 * Starts listening shakes to open LynxActivity if a shake is detected and if the ShakeDetector is
 * enabled.
 */
public void init(final LynxConfig lynxConfig) {
  ShakeDetector shakeDetector = new ShakeDetector(new ShakeDetector.Listener() {
    @Override public void hearShake() {
      if (isEnabled) {
        openLynxActivity(lynxConfig);
      }
    }
  });
  SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
  shakeDetector.start(sensorManager);
}
 
开发者ID:pedrovgs,项目名称:Lynx,代码行数:16,代码来源:LynxShakeDetector.java

示例14: onCreate

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Timber.tag(getClass().getSimpleName());
    Timber.d(getClass().getSimpleName() + " is creating");

    SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    ShakeDetector shakeDetector = new ShakeDetector(this);
    shakeDetector.start(sensorManager);

    listenShowEmergencyButton();

    tombolPresenter = new TombolPresenter(this);
}
 
开发者ID:zetbaitsu,项目名称:Sigap,代码行数:15,代码来源:EmergencyService.java

示例15: onViewReady

import com.squareup.seismic.ShakeDetector; //导入依赖的package包/类
@Override
protected void onViewReady(Bundle savedInstanceState) {
    CacheManager.pluck().setShakeToNotify(false);
    SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    ShakeDetector shakeDetector = new ShakeDetector(this);
    shakeDetector.start(sensorManager);
}
 
开发者ID:zetbaitsu,项目名称:Sigap,代码行数:8,代码来源:CalibrateActivity.java


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