@@ -0,0 +1,1835 @@
+/*%0A * Copyright (C) 2015 Pedro Vicente Gomez Sanchez.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.github.pedrovgs.lynx;%0A%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.hardware.SensorManager;%0Aimport com.squareup.seismic.ShakeDetector;%0A%0A/**%0A * Shake detector wrapper based on Square Seismic library: https://github.com/square/seismic%0A *%0A * @author Pedro Vicente G%C3%B3mez S%C3%A1nchez.%0A */%0Apublic class LynxShakeDetector %7B%0A%0A  private final Context context;%0A%0A  private static boolean isEnabled = true;%0A%0A  public LynxShakeDetector(Context context) %7B%0A    this.context = context;%0A  %7D%0A%0A  public void init() %7B%0A    ShakeDetector shakeDetector = new ShakeDetector(new ShakeDetector.Listener() %7B%0A      @Override public void hearShake() %7B%0A        if (isEnabled) %7B%0A          openLynxActivity();%0A        %7D%0A      %7D%0A    %7D);%0A    SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);%0A    shakeDetector.start(sensorManager);%0A  %7D%0A%0A  private void openLynxActivity() %7B%0A    Intent lynxActivityIntent = new Intent(context, LynxActivity.class);%0A    lynxActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);%0A    context.startActivity(lynxActivityIntent);%0A  %7D%0A%0A  static void enable() %7B%0A    isEnabled = true;%0A  %7D%0A%0A  static void disable() %7B%0A    isEnabled = false;%0A  %7D%0A%7D%0A

Create LynxShakeDetector, a wrapper of Square Seismic library.