コード例 #1
0
 public static float getDirectionNow(final float directionNowPre, final Activity activity) {
   if (isLevel8) {
     try {
       final int rotation = level8.getRotation(activity);
       if (rotation == Surface.ROTATION_90) {
         return directionNowPre + 90;
       } else if (rotation == Surface.ROTATION_180) {
         return directionNowPre + 180;
       } else if (rotation == Surface.ROTATION_270) {
         return directionNowPre + 270;
       }
     } catch (final Exception e) {
       // This should never happen: IllegalArgumentException, IllegalAccessException or
       // InvocationTargetException
       Log.e(Settings.tag, "Cannot call getRotation()", e);
     }
   } else {
     final Display display = activity.getWindowManager().getDefaultDisplay();
     final int rotation = display.getOrientation();
     if (rotation == Configuration.ORIENTATION_LANDSCAPE) {
       return directionNowPre + 90;
     }
   }
   return directionNowPre;
 }
コード例 #2
0
 public static void dataChanged(final String name) {
   level8.dataChanged(name);
 }