Example #1
1
 @Override
 public void onClick(View view) {
   if (view.getId() == R.id.ll_uninstall) {
     CommandTask task = CommandTask.createForUninstall(context);
     task.execute();
   } else sInflateCallback.setOnViewIdReceived(view.getId());
 }
Example #2
0
  @Override
  public void onStart() {
    super.onStart();
    if (preferences.getBoolean("enable_server_on_app_startup", false)) {

      Context context = getSherlockActivity();
      context.startService(new Intent(context, ServerService.class));

      final boolean enableSU = preferences.getBoolean("run_as_root", false);
      final String execName = preferences.getString("use_server_httpd", "lighttpd");
      final String bindPort = preferences.getString("server_port", "8080");

      CommandTask task = CommandTask.createForConnect(context, execName, bindPort);
      task.enableSU(enableSU);
      task.execute();
    }
    new ConnectionListenerTask().execute();
  }
Example #3
0
    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean isEnable) {

      boolean enableSU = preferences.getBoolean("run_as_root", false);
      String execName = preferences.getString("use_server_httpd", "lighttpd");
      String bindPort = preferences.getString("server_port", "8080");

      if (isEnable) {
        context.startService(new Intent(context, ServerService.class));
        CommandTask task = CommandTask.createForConnect(context, execName, bindPort);
        task.enableSU(enableSU);
        task.execute();
      } else {
        CommandTask task = CommandTask.createForDisconnect(context);
        task.enableSU(enableSU);
        task.execute();

        NotificationManager notify =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        notify.cancel(143);
      }
    }