Exemple #1
1
 /**
  * The entire purpose of this function is to recover the issues that were in the old version of
  * the library and then to delete the remaining file when we are done with it. A user should never
  * need to call this function, this gets automatically run for them in {@link
  * Api#init(android.app.Application)}.
  */
 public void recoverOldIssues() {
   Log.d(TAG, "Attempting to recover old feeback for the benefit of the user.");
   FileInputStream oldCacheFile = null;
   try {
     // Load the old data from a file
     oldCacheFile = context.openFileInput(OLD_ISSUES_CACHE_FILE);
     final String oldIssuesWithCommentsJSON = IOUtils.toString(oldCacheFile);
     // Parse the Data - The old json save contained IssuesWithComments
     final IssuesWithComments oldIssues =
         new IssueParser(TAG).parseIssues(oldIssuesWithCommentsJSON);
     // Save the data in the new database.
     for (Issue issue : oldIssues.issues()) {
       addCreatedIssue(issue);
     }
   } catch (FileNotFoundException e) {
     Log.i(
         TAG,
         "There was no old version of the issues cache lying around. Don't need to recover anything.");
   } catch (IOException e) {
     Log.i(TAG, "Encountered problems handling the old cache file", e);
   } finally {
     if (oldCacheFile != null) {
       try {
         oldCacheFile.close();
         oldCacheFile = null;
       } catch (IOException e) {
         Log.wtf(TAG, "Could not close a file that we already had opened.", e);
       }
       // Remove the file now that we are done with it.
       context.deleteFile(OLD_ISSUES_CACHE_FILE);
     }
   }
 }
Exemple #2
0
    /**
     * Break up {@code message} into maximum-length chunks (if needed) and send to either {@link
     * Log#println(int, String, String) Log.println()} or {@link Log#wtf(String, String) Log.wtf()}
     * for logging.
     *
     * <p>{@inheritDoc}
     */
    @Override
    protected void log(int priority, String tag, String message, Throwable t) {
      if (message.length() < MAX_LOG_LENGTH) {
        if (priority == Log.ASSERT) {
          Log.wtf(tag, message);
        } else {
          Log.println(priority, tag, message);
        }
        return;
      }

      // Split by line, then ensure each line can fit into Log's maximum length.
      for (int i = 0, length = message.length(); i < length; i++) {
        int newline = message.indexOf('\n', i);
        newline = newline != -1 ? newline : length;
        do {
          int end = Math.min(newline, i + MAX_LOG_LENGTH);
          String part = message.substring(i, end);
          if (priority == Log.ASSERT) {
            Log.wtf(tag, part);
          } else {
            Log.println(priority, tag, part);
          }
          i = end;
        } while (i < newline);
      }
    }
Exemple #3
0
 @Override
 public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
   Log.wtf(TAG, "Connection State Change: " + status + " -> " + connectionState(newState));
   if (status == BluetoothGatt.GATT_SUCCESS
       && newState == BluetoothProfile.STATE_CONNECTED) {
     /*
      * Once successfully connected, we must next discover all the services on the
      * device before we can read and write their characteristics.
      */
     gatt.discoverServices();
     // mHandler.sendMessage(Message.obtain(null, MSG_PROGRESS, "Discovering Services..."));
   } else if (newState == BluetoothProfile.STATE_DISCONNECTED
       && status != BluetoothGatt.GATT_SUCCESS) {
     /*
      * If at any point we disconnect, send a message to clear the weather values
      * out of the UI
      */
     Log.wtf("Status: ", "Disconnected");
     Integer[] values = new Integer[] {-1, -1, -1, -1, -1, -1, -1, -1};
     DownloadWebPageTask task = new DownloadWebPageTask();
     task.execute(values);
     // mConnectedGatt.close();
     // gatt.close();
     if (!isScanRunning) {
       runOnUiThread(mStartRunnable);
     }
   }
 }
Exemple #4
0
        /*
         * Send an enable command to each sensor by writing a configuration
         * characteristic.  This is specific to the SensorTag to keep power
         * low by disabling sensors you aren't using.
         */
        private void enableNextSensor(BluetoothGatt gatt) {
          BluetoothGattCharacteristic characteristic;
          gatt2 = gatt;
          Log.wtf("mState is", mState + "");
          switch (mState) {
            case 0:
              Log.wtf(TAG, "Renaming");
              characteristic = gatt.getService(MAIN_SERVICE).getCharacteristic(ERROR_CHAR);

              gatt.readCharacteristic(characteristic);
              break;

            case 1:
              Log.d(TAG, "Enabling pressure cal");
              characteristic = gatt.getService(MAIN_SERVICE).getCharacteristic(CONFIG_CHAR);
              characteristic.setValue(new byte[] {0x01});
              gatt.writeCharacteristic(characteristic);
              break;

            default:
              mHandler.sendEmptyMessage(MSG_DISMISS);
              Log.i(TAG, "All Sensors Enabled");
              return;
          }
        }
 private void toQuery() {
   Log.wtf("collectionGuid", collectionGuid);
   Log.wtf("sharePre.getPres", sharePre.getPres("guid"));
   new QueryFavorOrNotTask(
           QueryDetailActivity.this, new GetData(), collectionGuid, sharePre.getPres("guid"))
       .execute();
 }
    private BluetoothServerSocket getBluetoothServerSocket() throws IOException {
      BluetoothServerSocket tmp;

      if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD_MR1) {
        tmp = mBluetoothAdapter.listenUsingRfcommWithServiceRecord(SERVICE_NAME, mServiceUuid);
        if (DBG) Log.d(TAG, "Using secure bluetooth server socket");
      } else {
        try {
          // compatibility with pre SDK 10 devices
          Method listener =
              mBluetoothAdapter
                  .getClass()
                  .getMethod(
                      "listenUsingInsecureRfcommWithServiceRecord", String.class, UUID.class);
          tmp =
              (BluetoothServerSocket)
                  listener.invoke(mBluetoothAdapter, SERVICE_NAME, mServiceUuid);
          if (DBG) Log.d(TAG, "Using insecure bluetooth server socket");
        } catch (NoSuchMethodException e) {
          Log.wtf(TAG, "listenUsingInsecureRfcommWithServiceRecord not found");
          throw new IOException(e);
        } catch (InvocationTargetException e) {
          Log.wtf(TAG, "listenUsingInsecureRfcommWithServiceRecord not available on mBtAdapter");
          throw new IOException(e);
        } catch (IllegalAccessException e) {
          Log.wtf(TAG, "listenUsingInsecureRfcommWithServiceRecord not available on mBtAdapter");
          throw new IOException(e);
        }
      }
      return tmp;
    }
 private void selectItem(int pos) {
   if (pos < 0 || pos >= mMainMenu.getEntries().length) {
     pos = 0;
   }
   String titlePrefix = getString(R.string.main_activity_title_prefix);
   getSupportActionBar().setTitle(titlePrefix + mMainMenu.getEntries()[pos]);
   String nextFragmentTag = "FRAGMENT_TAG_" + Integer.toString(pos);
   Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.container);
   if (currentFragment != null && nextFragmentTag.equals(currentFragment.getTag())) {
     return;
   }
   Fragment recycledFragment = getSupportFragmentManager().findFragmentByTag(nextFragmentTag);
   try {
     FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
     if (currentFragment != null) {
       transaction.detach(currentFragment);
     }
     if (recycledFragment != null) {
       transaction.attach(recycledFragment);
     } else {
       transaction.add(R.id.container, mMainMenu.createFragment(pos), nextFragmentTag);
     }
     transaction.commit();
     getSupportFragmentManager().executePendingTransactions();
     // The header takes the first position.
     mDrawerMenu.setItemChecked(pos + 1, true);
     getAppPreferences().edit().putInt(PREF_LAST_SCREEN_ID, pos).apply();
   } catch (InstantiationException e) {
     Log.wtf(TAG, "Error while instantiating the selected fragment", e);
   } catch (IllegalAccessException e) {
     Log.wtf(TAG, "Error while instantiating the selected fragment", e);
   }
 }
Exemple #8
0
  private void stopScan() {
    Log.wtf(TAG, "Stopping scan : " + found);
    found = false;
    mBluetoothAdapter.stopLeScan(this);
    setProgressBarIndeterminateVisibility(false);

    for (BluetoothDevice x : mDevices) {
      if (x.getName() == null) {
      } else if (x.getName().equalsIgnoreCase(deviceName) && !found) {
        found = true;
        Log.wtf(TAG, "Device name is: " + deviceName);
        Log.wtf(TAG, "Device name is: " + "CONNECTING!!!!!");
        if (!leManager.isConnected()) {
          leManager.setDevice(x);
          Log.wtf(TAG, "Device name is: " + "CONNECT!!!!!");
          leManager.connectDevice(4);
        }
        //                BluetoothDevice device = x;
        //                currentDevice = device;
        //                mConnectedGatt = device.connectGatt(this, true, mGattCallback);
        //                mConnectedGatt.requestConnectionPriority(1);
        // Display progress UI
        // mHandler.sendMessage(Message.obtain(null, MSG_PROGRESS, "Connecting to " +
        // device.getName() + "..."));
      }
    }
    if (!found && stillRunning && !leManager.isConnected()) {
      if (!isScanRunning) {
        Log.wtf(TAG, "Restarting scan");
        runOnUiThread(mStartRunnable);
      }
    }
  }
Exemple #9
0
 public void reset() {
   if (this.context.deleteDatabase(DATEBASE_NAME)) {
     Log.wtf("DB", "deleteDatabase(): database deleted.");
     // recreate the database
     this.getWritableDatabase();
   } else {
     Log.wtf("DB", "deleteDatabase(): database NOT deleted.");
   }
 }
Exemple #10
0
        @Override
        public void onCharacteristicRead(
            BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
          Log.wtf("Read", characteristic.getUuid().toString());
          if (ERROR_CHAR.equals(characteristic.getUuid())) {
            Log.wtf("Something", "" + characteristic.getValue()[0]);

            advance();
            enableNextSensor(gatt);
          }
          super.onCharacteristicRead(gatt, characteristic, status);
        }
Exemple #11
0
        private void writeSecurity(BluetoothGatt gatt) {
          Log.wtf(TAG, "Security Written");
          BluetoothGattCharacteristic securityCharacteristic = null;
          byte[] packet = new byte[1];
          int i = 153;

          packet[0] = (byte) i;
          securityCharacteristic = gatt.getService(MAIN_SERVICE).getCharacteristic(SECURITY_KEY);
          securityCharacteristic.setValue(packet);
          Log.wtf(TAG, packet[0] + "");
          gatt.writeCharacteristic(securityCharacteristic);
        }
 private T newModel() {
   Class<T> type = getType();
   Constructor<T> emptyConstructor = (Constructor<T>) type.getConstructors()[0];
   try {
     T model = emptyConstructor.newInstance(null);
     return model;
   } catch (InstantiationException e) {
     Log.wtf(TAG, e);
   } catch (InvocationTargetException e) {
     Log.wtf(TAG, e);
   } catch (IllegalAccessException e) {
     Log.wtf(TAG, e);
   }
   return null;
 }
Exemple #13
0
  /**
   * Fetch the provided URI, returning a {@link JarInputStream} if the response body is appropriate.
   *
   * <p>Protected to allow for mocking.
   *
   * @return the entity body as a stream, or null on failure.
   */
  @SuppressWarnings("static-method")
  @RobocopTarget
  protected JarInputStream fetchDistribution(URI uri, HttpURLConnection connection)
      throws IOException {
    final int status = connection.getResponseCode();

    Log.d(LOGTAG, "Distribution fetch: " + status);
    // We record HTTP statuses as 2xx, 3xx, 4xx, 5xx => 2, 3, 4, 5.
    final int value;
    if (status > 599 || status < 100) {
      Log.wtf(LOGTAG, "Unexpected HTTP status code: " + status);
      value = CODE_CATEGORY_STATUS_OUT_OF_RANGE;
    } else {
      value = status / 100;
    }

    Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, value);

    if (status != 200) {
      Log.w(LOGTAG, "Got status " + status + " fetching distribution.");
      Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, CODE_CATEGORY_FETCH_NON_SUCCESS_RESPONSE);
      return null;
    }

    final String contentType = connection.getContentType();
    if (contentType == null || !contentType.startsWith(EXPECTED_CONTENT_TYPE)) {
      Log.w(LOGTAG, "Malformed response: invalid Content-Type.");
      Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, CODE_CATEGORY_FETCH_INVALID_CONTENT_TYPE);
      return null;
    }

    return new JarInputStream(new BufferedInputStream(connection.getInputStream()), true);
  }
  private void loadOrCreateLastRun() throws IOException {
    // default values. In case when reading lastrun fails - there are default values
    lastRunData.put("original_apk_extracted", "false");
    lastRunData.put("modded_temp_extracted", "false");

    if (!LASTRUN_FILE.exists()) {
      saveLastRun();
    }
    Map<String, String> m = new HashMap<>();
    try {
      BufferedReader r = new BufferedReader(new FileReader(LASTRUN_FILE));
      String l;
      while ((l = r.readLine()) != null) {
        String[] split = l.split("=");
        if (split.length != 2) {
          Log.w(TAG, "Invalid line in lastrun.txt: " + l);
          continue;
        }
        m.put(split[0].trim(), split[1].trim());
      }
    } catch (FileNotFoundException e) {
      Log.wtf(TAG, "Lastrun file doesn't exist");
    }
    lastRunData.clear();
    lastRunData.putAll(m);
  }
    private static ArrayList<String> extractTextFromNotification(Service service, RemoteViews view) {
    	LayoutInflater inflater = (LayoutInflater) service.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	    ArrayList<String> result = new ArrayList<String>();
	    if (view == null) {
	    	Log.d(TAG, "View is empty");
	    	return null;
	    }
		try {
			int layoutid = view.getLayoutId();
			ViewGroup localView = (ViewGroup) inflater.inflate(layoutid, null);
		    view.reapply(service.getApplicationContext(), localView);
		    ArrayList<View> outViews = new ArrayList<View>();
		    extractViewType(outViews, TextView.class, localView);
		    for (View  ttv: outViews) {
		    	TextView tv = (TextView) ttv;
		    	String txt = tv.getText().toString();
		    	if (!TextUtils.isEmpty(txt) && tv.getId() != TIMESTAMPID) {
		    		result.add(txt);
		    	}
			}
		} catch (Exception e) {
			Log.d(TAG, "FAILED to load notification " + e.toString());
			Log.wtf(TAG, e);
			return null;
			//notification might have dissapeared by now
		}
		Log.d(TAG, "Return result" + result);
	    return result;
    }
Exemple #16
0
  @Test
  public void testWTFWithExceptionNoArgs() {
    l.wtf(STRING_WITH_NO_ARGS, EXCEPTION);

    PowerMockito.verifyStatic();
    Log.wtf(TAG, STRING_WITH_NO_ARGS, EXCEPTION);
  }
Exemple #17
0
 @Override
 public void handleMessage(Message object) {
   if (!(object.what != 1 || e.this.isConnecting())) {
     object = (b) object.obj;
     object.gT();
     object.unregister();
     return;
   }
   if (object.what == 3) {
     e.this.IX.b(new ConnectionResult((Integer) object.obj, null));
     return;
   }
   if (object.what == 4) {
     e.this.az(1);
     e.this.Lz = null;
     e.this.IX.aB((Integer) object.obj);
     return;
   }
   if (!(object.what != 2 || e.this.isConnected())) {
     object = (b) object.obj;
     object.gT();
     object.unregister();
     return;
   }
   if (object.what == 2 || object.what == 1) {
     ((b) object.obj).gU();
     return;
   }
   Log.wtf("GmsClient", "Don't know how to handle this message.");
 }
Exemple #18
0
  /**
   * Adds two query parameters into the Uri, namely the language code and the version code of the
   * app's package as gotten via the context.
   *
   * @return the uri with added query parameters
   */
  public static Uri uriWithAddedParameters(Context context, Uri baseUri) {
    Uri.Builder builder = baseUri.buildUpon();

    // Add in the preferred language
    builder.appendQueryParameter(PARAM_LANGUAGE_CODE, Locale.getDefault().toString());

    // Add in the package version code
    if (sCachedVersionCode == null) {
      // There is no cached version code, so try to get it from the package manager.
      try {
        // cache the version code
        PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        sCachedVersionCode = Integer.toString(info.versionCode);

        // append the version code to the uri
        builder.appendQueryParameter(PARAM_VERSION, sCachedVersionCode);
      } catch (NameNotFoundException e) {
        // Cannot find the package name, so don't add in the version parameter
        // This shouldn't happen.
        Log.wtf(TAG, "Invalid package name for context", e);
      }
    } else {
      builder.appendQueryParameter(PARAM_VERSION, sCachedVersionCode);
    }

    // Build the full uri and return it
    return builder.build();
  }
Exemple #19
0
  @Test
  public void testWTFNoArgs() {
    l.wtf(STRING_WITH_NO_ARGS);

    PowerMockito.verifyStatic();
    Log.wtf(TAG, STRING_WITH_NO_ARGS);
  }
  /**
   * The '@JavascriptInterface is required to make the method accessible from the Javascript layer
   *
   * <p>The code in this method is based on the documentation here:
   *
   * <p>http://developer.android.com/training/notify-user/build-notification.html
   *
   * @param message The message displayed in the notification
   */
  @JavascriptInterface
  public void showNotification(String message) {
    Log.wtf(TAG, "showNotification");
    NotificationCompat.Builder mBuilder =
        new NotificationCompat.Builder(mContext)
            .setSmallIcon(R.drawable.notification_icon)
            .setContentTitle(mContext.getString(R.string.notification_title))
            .setContentText(message)
            .setAutoCancel(true);

    // Creates an explicit intent for an Activity in your app
    Intent resultIntent = new Intent(mContext, MainActivity.class);
    resultIntent.putExtra(MainFragment.EXTRA_FROM_NOTIFICATION, true);

    // The stack builder object will contain an artificial back stack for the
    // started Activity.
    // This ensures that navigating backward from the Activity leads out of
    // your application to the Home screen.
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext);
    // Adds the back stack for the Intent (but not the Intent itself)
    stackBuilder.addParentStack(MainActivity.class);
    // Adds the Intent that starts the Activity to the top of the stack
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent resultPendingIntent =
        stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setContentIntent(resultPendingIntent);
    NotificationManager mNotificationManager =
        (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
    // mId allows you to update the notification later on.
    mNotificationManager.notify(-1, mBuilder.build());
  }
 @Override
 protected Object extractJson(String response) {
   Log.wtf("Send JSON message", response);
   Gson gson = new Gson();
   SendMessageModel sendMessageModel = gson.fromJson(response, SendMessageModel.class);
   return sendMessageModel;
 }
  @Override
  public void log(int priority, String tag, String message) {
    switch (priority) {
      case QLog.VERBOSE:
        Log.v(tag, message);
        break;

      case QLog.DEBUG:
        Log.d(tag, message);
        break;

      case QLog.INFO:
        Log.i(tag, message);
        break;

      case QLog.WARN:
        Log.w(tag, message);
        break;

      case QLog.ERROR:
        Log.e(tag, message);
        break;

      case QLog.WTF:
        Log.wtf(tag, message);
        break;

      default:
        Log.i(tag, message);
        break;
    }
  }
Exemple #23
0
        protected void a(com.google.android.gms.location.LocationClient.OnRemoveGeofencesResultListener onremovegeofencesresultlistener)
        {
label0:
            {
label1:
                {
                    if (onremovegeofencesresultlistener != null)
                    {
                        switch (Oy)
                        {
                        default:
                            Log.wtf("LocationClientImpl", (new StringBuilder()).append("Unsupported action: ").append(Oy).toString());
                            break;

                        case 1: // '\001'
                            break label1;

                        case 2: // '\002'
                            break label0;
                        }
                    }
                    return;
                }
                onremovegeofencesresultlistener.onRemoveGeofencesByPendingIntentResult(Ah, mPendingIntent);
                return;
            }
            onremovegeofencesresultlistener.onRemoveGeofencesByRequestIdsResult(Ah, Ot);
        }
  // gets called by the button press
  public void startRecording(View v) {
    recordingTime = 0;
    progressBar.setProgress(recordingTime);

    Log.d(TAG, "startRecording()");
    // we need to unlock the camera so that mediaRecorder can use it
    this.camera.unlock(); // unnecessary in API >= 14
    // now we can initialize the media recorder and set it up with our
    // camera
    this.mediaRecorder = new MediaRecorder();
    this.mediaRecorder.setCamera(this.camera);
    this.mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
    this.mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
    // mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    // mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
    // mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
    this.mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_LOW));
    this.mediaRecorder.setOutputFile(this.initFile().getAbsolutePath());
    this.mediaRecorder.setPreviewDisplay(this.cameraPreview.getHolder().getSurface());
    try {
      this.mediaRecorder.prepare();
      // start the actual recording
      // throws IllegalStateException if not prepared
      this.mediaRecorder.start();
      // Toast.makeText(this, R.string.recording, Toast.LENGTH_SHORT).show();
      // enable the stop button by indicating that we are recording
    } catch (Exception e) {
      Log.wtf(TAG, "Failed to prepare MediaRecorder", e);
      // Toast.makeText(this, R.string.cannot_record, Toast.LENGTH_SHORT).show();
      this.releaseMediaRecorder();
    }
  }
  public void run() {
    try {
      if (this.service == null || this.service.isStopped()) {
        this.seekBar.setProgress(0);
        this.seekBar.setEnabled(false);
        this.toggleButtons(true, false);
        this.togglePlayPauseButtons(false);
        this.status.setText(R.string.init_time);
      } else {
        int position = this.service.position();
        // update the status
        this.status.setText(formatAsTime(position));

        // update the seekbar
        this.seekBar.setMax(this.service.duration());
        this.seekBar.setProgress(position);
        this.seekBar.setEnabled(true);

        if (this.service.isPlaying()) {
          // schedule a callback of this method in 500 ms
          this.handler.postDelayed(this, 500);
        }
      }
    } catch (RemoteException e) {
      Log.wtf(TAG, "Failed to talk to the service", e);
    }
  }
  protected static void CopyFiles() throws Exception {
    try {
      // create base file for rightarrow and playbutton
      copyRessource(R.raw.playbutton, PathData.APP_DIRECTORY + "playbutton.png");
      copyRessource(R.raw.rightarrow, PathData.APP_DIRECTORY + "nextarrow.png");
      copyRessource(R.raw.root, PathData.APP_DIRECTORY + "root.png");
      copyRessource(R.raw.correction, PathData.APP_DIRECTORY + "correction.png");

      Indiagram play = new Indiagram("", "../app/playbutton.png", "");
      Indiagram next = new Indiagram("", "../app/nextarrow.png", "");
      String s = AppData.current_activity.getResources().getString(R.string.homeCategoryName);
      // Log.d("Bootstrap - CopyFiles", s);
      boolean b = new File(PathData.APP_DIRECTORY + PathData.HOME_FILE).delete();
      if (!b) {
        // Log.d("Bootstrap - copyFiles", "fail delete");
      }
      b = new File(PathData.APP_DIRECTORY + PathData.HOME_FILE).exists();
      if (!b) {
        // Log.d("Bootstrap - copyFiles", "home deleted");
      } else {
        // Log.d("Bootstrap - copyFiles", "home pas deleted");
      }
      Category home = new Category(s, "../app/root.png", "", Color.LTGRAY);
      AppData.homeCategory = home;
      // Log.d("Bootstrap - copyFiles", "home.text : "+
      // AppData.homeCategory.text);
      CategoryOrIndiagramXmlConverter writer = CategoryOrIndiagramXmlConverter.getInstance();
      writer.write(play, PathData.PLAYBUTTON_FILE, PathData.APP_DIRECTORY);
      writer.write(next, PathData.NEXTARROW_FILE, PathData.APP_DIRECTORY);
      writer.write(home, PathData.HOME_FILE, PathData.APP_DIRECTORY);
    } catch (Exception ex) {
      Log.wtf("Bootstrap I", ex);
    }
  }
Exemple #27
0
 @Override
 public void onDescriptorWrite(
     BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
   // Once notifications are enabled, we move to the next sensor and start over with enable
   Log.wtf(TAG, "Descriptor Written");
   enableNextSensor(gatt);
 }
Exemple #28
0
 public void handleMessage(Message message) {
   if (message.what == 1 && !BC.isConnecting()) {
     message = (Connecting) message.obj;
     message.cP();
     message.unregister();
     return;
   }
   if (message.what == 3) {
     eh.a(BC).a(new ConnectionResult(((Integer) message.obj).intValue(), null));
     return;
   }
   if (message.what == 4) {
     eh.a(BC, 1);
     eh.a(BC, null);
     eh.a(BC).P(((Integer) message.obj).intValue());
     return;
   }
   if (message.what == 2 && !BC.isConnected()) {
     message = (Connected) message.obj;
     message.cP();
     message.unregister();
     return;
   }
   if (message.what == 2 || message.what == 1) {
     ((unregister) message.obj).ec();
     return;
   } else {
     Log.wtf("GmsClient", "Don't know how to handle this message.");
     return;
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    PreferenceScreen ps = getPreferenceManager().createPreferenceScreen(getActivity());
    ps.setTitle(R.string.quick_response_settings_title);

    mResponses = Utils.getQuickResponses(getActivity());

    if (mResponses != null) {
      mEditTextPrefs = new EditTextPreference[mResponses.length];

      Arrays.sort(mResponses);
      int i = 0;
      for (String response : mResponses) {
        EditTextPreference et = new EditTextPreference(getActivity());
        et.setDialogTitle(R.string.quick_response_settings_edit_title);
        et.setTitle(response); // Display Text
        et.setText(response); // Value to edit
        et.setOnPreferenceChangeListener(this);
        mEditTextPrefs[i++] = et;
        ps.addPreference(et);
      }
    } else {
      Log.wtf(TAG, "No responses found");
    }
    setPreferenceScreen(ps);
    /// M:Toast to alarm @{
    mToast = Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT);
    /// @}
  }
 private int pushNew()
     throws URISyntaxException, LocalStorageException, IOException, HttpException {
   int count = 0;
   long[] newIDs = local.findNew();
   Log.i(TAG, "Uploading " + newIDs.length + " new resource(s) (if not existing)");
   try {
     for (long id : newIDs)
       try {
         Resource res = local.findById(id, true);
         String eTag = remote.add(res);
         if (eTag != null) local.updateETag(res, eTag);
         local.clearDirty(res);
         count++;
       } catch (PreconditionFailedException e) {
         Log.i(TAG, "Didn't overwrite existing resource with other content");
       } catch (ValidationException e) {
         Log.e(TAG, "Couldn't create entity for adding: " + e.toString());
       } catch (RecordNotFoundException e) {
         Log.wtf(TAG, "Couldn't read new record", e);
       }
   } finally {
     local.commit();
   }
   return count;
 }