示例#1
0
 public void dostuff() {
   cleanUp(getFilesDir());
   if (!Build.MODEL.equalsIgnoreCase("SPH-M910")) {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.setTitle("Warning Untested Phone!");
     builder
         .setMessage(
             "Use of Temp Root is recommended. Please insure that your phone is compatible with Joey Krim's permanent root method, before attempting permanent Root.")
         .setCancelable(true)
         .setPositiveButton(
             "OK",
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                 dialog.cancel();
               }
             });
     AlertDialog alert = builder.create();
     alert.setOwnerActivity(this);
     alert.show();
     recoverybutton.setVisibility(View.GONE);
     if (new File("/system/bin/su").exists() || new File("/system/xbin/su").exists()) {
       unrootbutton.setVisibility(View.GONE);
       detailtext.setText(
           "Your device is already rooted. You can remove the root using the Un-root button, which will delete all of the files installed to root your device. You can re-root your device if your root is malfunctioning.");
     }
     if (new File("/system/bin/joeykrim-root.sh").exists()) {
       unrootbutton.setVisibility(View.VISIBLE);
     }
   } else {
     if (new File("/system/bin/su").exists() || new File("/system/xbin/su").exists()) {
       NeedsRoot = false;
       unrootbutton.setVisibility(View.GONE);
       recoverybutton.setVisibility(View.VISIBLE);
       detailtext.setText(
           "Your device is already rooted. You can remove the root using the Un-root button, which will delete all of the files installed to root your device. You can re-root your device if your root is malfunctioning. You can also install CM01 custom recovery.");
     } else {
       recoverybutton.setVisibility(View.VISIBLE);
       unrootbutton.setVisibility(View.GONE);
     }
     if (new File("/system/bin/joeykrim-root.sh").exists()) {
       unrootbutton.setVisibility(View.VISIBLE);
     }
   }
 }
示例#2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // Handle item selection
   switch (item.getItemId()) {
     case R.id.about:
       AlertDialog.Builder builder = new AlertDialog.Builder(this);
       builder
           .setMessage("Intercept Root " + "\nFor the Samsung Intercept." + "\nSpaztecho")
           .setCancelable(true);
       AlertDialog alert = builder.create();
       alert.setOwnerActivity(this);
       alert.show();
       return true;
     case R.id.exit:
       int pid = android.os.Process.myPid();
       android.os.Process.killProcess(pid);
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.ll_title);
    setContentView(R.layout.lightlevels);

    mSensorRange =
        (int)
            ((SensorManager) getSystemService(SENSOR_SERVICE))
                .getDefaultSensor(Sensor.TYPE_LIGHT)
                .getMaximumRange();
    mHandler = new Handler();
    mSave = (Button) findViewById(R.id.btn_save);
    mSave.setOnClickListener(this);
    mDefaults = (Button) findViewById(R.id.btn_default);
    mDefaults.setOnClickListener(this);
    mReload = (Button) findViewById(R.id.btn_reload);
    mReload.setOnClickListener(this);
    mSensor = (TextView) findViewById(R.id.ll_tw_lux_value);
    mScreen = (TextView) findViewById(R.id.ll_tw_lcd_value);
    mButtons = (TextView) findViewById(R.id.ll_tw_btn_value);
    mKeyboard = (TextView) findViewById(R.id.ll_tw_kb_value);
    mNumLevels = (Button) findViewById(R.id.btn_num_levels);
    mNumLevels.setOnClickListener(this);

    if (getResources().getConfiguration().keyboard == Configuration.KEYBOARD_NOKEYS) {
      ((TableLayout) findViewById(R.id.ll_table_info)).removeView(findViewById(R.id.table_row_kb));
      ((TableRow) findViewById(R.id.ll_table_row_headers))
          .removeView(findViewById(R.id.ll_tw_header_kb));
      mHasKeyboard = false;
    } else {
      mHasKeyboard = true;
    }

    mEditor = new EditText(this);
    mEditor.setInputType(InputType.TYPE_CLASS_NUMBER);
    mEditor.setImeOptions(EditorInfo.IME_ACTION_NONE);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder
        .setPositiveButton(
            getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                dialogOk();
              }
            })
        .setNegativeButton(
            android.R.string.cancel,
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
              }
            })
        .setView(mEditor);
    mDialog = builder.create();
    mDialog.setOwnerActivity(this);
    mDialog
        .getWindow()
        .setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
                | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    loadData(false);
    mHasChanges = false;
    updateButtons();
  }