コード例 #1
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK) {
     if (Intent.ACTION_EDIT.equals(getIntent().getAction())) {
       boolean isPushCapable = false;
       try {
         Store store = mAccount.getRemoteStore();
         isPushCapable = store.isPushCapable();
       } catch (Exception e) {
         Log.e(VisualVoicemail.LOG_TAG, "Could not get remote store", e);
       }
       if (isPushCapable && mAccount.getFolderPushMode() != FolderMode.NONE) {
         MailService.actionRestartPushers(this, null);
       }
       mAccount.save(Preferences.getPreferences(this));
       finish();
     } else {
       // first time setup, return to AccountSetup activity to save account
       setResult(RESULT_OK);
       finish();
     }
   } else {
     if (!Intent.ACTION_EDIT.equals(
         getIntent().getAction())) { // remove account if failed initial setup
       if (mAccount != null) Preferences.getPreferences(this).deleteAccount(mAccount);
     }
   }
 }
コード例 #2
0
  public Track NextTrack() {
    if (historyPosition != 0) {
      // In History List
      historyPosition--;
      listPosition = historyList.get((historyList.size() - 1) - historyPosition);
    } else {
      if (trackList.size() > 1) {
        if (preferences.GetShuffle()) {
          int ranNum = (int) ((Math.random() * trackList.size()));

          while (ranNum == listPosition) {
            ranNum = (int) ((Math.random() * trackList.size()));
          }

          listPosition = ranNum;
        } else {
          if ((this.GetPosition() + 1) >= this.Length()) {
            if (preferences.GetRepeat()) {
              listPosition = 0;
            } else {
              return null;
            }
          } else {
            ++listPosition;
          }
        }
      }
    }

    return trackList.get(listPosition);
  }
コード例 #3
0
  public XmppManager getPushManager() {
    if (null != notificationService) {
      return notificationService.getPushManager();

    } else {
      // String username = Preferences.getUserName(Application.sharePref);
      // loginChatClient(username, username);
      Log.e(
          "notificationService====",
          "notificationServiceConnection=" + notificationServiceConnection);
      Log.e("notificationService====", "BeforeBindnotificationService=" + notificationService);

      this.bindService(
          NotificationService.getIntent(this),
          notificationServiceConnection,
          Context.BIND_AUTO_CREATE);
      loginXmppClient(
          Preferences.getUserName(Application.sharePref),
          Preferences.getUserName(Application.sharePref),
          notificationService.getPushManager());
      Log.e("notificationService====", "AffterBindnotificationService=" + notificationService);
      if (notificationService != null) {
        return notificationService.getPushManager();
      }
      return null;
    }
  }
コード例 #4
0
 @Override
 protected void configure(Configuration configuration) {
   if (preferences.getLocalFileSystemClassName() != null) {
     configuration.set("fs.file.impl", preferences.getLocalFileSystemClassName()); // $NON-NLS-1$
     configuration.setBoolean("fs.fs.impl.disable.cache", true); // $NON-NLS-1$
   }
 }
コード例 #5
0
 public void saveColWidth(Preferences pPref) {
   String colWidths = myMod.getColWidths();
   if (!colWidths.equals(pPref.listColWidth)) {
     pPref.listColWidth = colWidths;
     pPref.savePreferences();
   }
 }
コード例 #6
0
ファイル: HostTest.java プロジェクト: applejian/cyberduck
 public void testParseURLWithoutProtocol() {
   {
     String url = "user@hostname/path/to/file";
     Host h = Host.parse(url);
     assertTrue(h.getHostname().equals("hostname"));
     assertTrue(
         h.getProtocol()
             .equals(
                 ProtocolFactory.forName(
                     Preferences.instance().getProperty("connection.protocol.default"))));
     assertNotNull(h.getCredentials().getUsername());
     assertTrue(h.getCredentials().getUsername().equals("user"));
     assertNull(h.getCredentials().getPassword());
     assertTrue(h.getDefaultPath().equals("/path/to/file"));
   }
   {
     String url = "user@hostname";
     Host h = Host.parse(url);
     assertTrue(h.getHostname().equals("hostname"));
     assertTrue(
         h.getProtocol()
             .equals(
                 ProtocolFactory.forName(
                     Preferences.instance().getProperty("connection.protocol.default"))));
     assertNotNull(h.getCredentials().getUsername());
     assertTrue(h.getCredentials().getUsername().equals("user"));
     assertNull(h.getCredentials().getPassword());
   }
 }
コード例 #7
0
 public void storeLoaderAngle(String sPosition) {
   float volts = (float) leftAngleCh.getVoltage();
   float voltsR = (float) rightAngleCh.getVoltage();
   m_preferences.putFloat(sPosition, volts);
   m_preferences.putFloat(sPosition + "R", voltsR);
   System.out.println(sPosition + " = " + volts);
 }
コード例 #8
0
  public void newMessage(IrcMessage msg) {
    if ((!preferences.isSpamFilterEnabled()
        || new Date().getTime()
            > IrcNotificationManager.getInstance().getLastSoundDate() + 60000L)) {
      Uri sound = preferences.getNotificationSound();
      if (sound != null) {
        MediaPlayer mp = MediaPlayer.create(this, sound);
        if (mp != null) {
          mp.start();
        }
      }

      if (preferences.isVibrationEnabled()) {
        Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        if (v != null) {
          v.vibrate(500);
        }
      }

      IrcNotificationManager.getInstance().setLastSoundDate(new Date().getTime());
    }

    if (preferences.isFeedViewDefault()) {
      channelToView = FEED;
    } else {
      channelToView = msg.getLogicalChannel();
    }
    startMainApp(false);
  }
コード例 #9
0
ファイル: Main.java プロジェクト: cmengler/andlytics
    /*
     * (non-Javadoc)
     *
     * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
     */
    @Override
    protected void onPostExecute(Exception e) {

      hideLoadingIndecator(progressSwitcher);

      buttonRefresh.setEnabled(true);

      if (e != null) {

        if ((e instanceof InvalidJSONResponseException || e instanceof AuthenticationException)
            && !isAuthenticationRetry) {
          Log.w("Andlytics", "authentication faild, retry with new token");
          isAuthenticationRetry = true;
          authenticateAccountFromPreferences(true, Main.this);

        } else {
          handleUserVisibleException(e);
          new LoadDbEntries().execute(false);
        }

      } else {
        new LoadDbEntries().execute(false);

        if (Preferences.getProVersionHint(Main.this) && !isProVersion()) {
          showProDialog();
          Preferences.saveProVersionHint(Main.this, false);
        }
      }
    }
コード例 #10
0
ファイル: Rules.java プロジェクト: dicer/callmeter
 /** {@inheritDoc} */
 @Override
 public final void onClick(final View v) {
   switch (v.getId()) {
     case R.id.add:
       Preferences.setDefaultPlan(this, false);
       Intent intent = new Intent(this, RuleEdit.class);
       this.startActivity(intent);
       break;
     case R.id.ok:
       Preferences.setDefaultPlan(this, false);
       this.finish();
       break;
     case R.id.import_default:
       intent = new Intent(Intent.ACTION_VIEW, Uri.parse(this.getString(R.string.url_rulesets)));
       try {
         this.startActivity(intent);
       } catch (ActivityNotFoundException e) {
         Log.e(TAG, "no activity to load url", e);
         Toast.makeText(
                 this, "no activity to load url: " + intent.getDataString(), Toast.LENGTH_LONG)
             .show();
       }
       break;
     default:
       break;
   }
 }
コード例 #11
0
ファイル: VdrCommands.java プロジェクト: androvdr/AndroVDR
  public static Response setTimer(Epg epg) {
    GregorianCalendar startTime = new GregorianCalendar();
    startTime.setTimeInMillis(epg.startzeit * 1000 - Preferences.getVdr().margin_start * 60 * 1000);

    GregorianCalendar endTime = new GregorianCalendar();
    endTime.setTimeInMillis(
        epg.startzeit * 1000 + epg.dauer * 1000 + Preferences.getVdr().margin_stop * 60 * 1000);

    Timer timer = new Timer();
    timer.setChannelNumber(epg.kanal);
    timer.setStartTime(startTime);
    timer.setEndTime(endTime);
    timer.setPriority(50);
    timer.setLifetime(99);
    timer.setTitle((epg.titel == null) ? "Unknown" : epg.titel);
    timer.setDescription(AndroApplication.getAppContext().getString(R.string.app_name));
    timer.changeStateTo(Timer.VPS, Preferences.getVdr().vps);

    NEWT newt = new NEWT(timer.toNEWT());
    Response response = VDRConnection.send(newt);
    if (response.getCode() != 250) logger.error("Couldn't set timer: {}", response.getMessage());
    else {
      List<Timer> timers = TimerParser.parse(response.getMessage());
      if (timers.size() > 0) response = new R250("New timer \"" + timers.get(0).getID() + "\"");
    }
    return response;
  }
コード例 #12
0
ファイル: SwingComponentUtils.java プロジェクト: piopawlu/ols
  /**
   * Tries to load/restore the window state of the given window.
   *
   * @param aNamespace the namespace to use for the window state;
   * @param aProperties the properties to read from;
   * @param aWindow the window to load the state for.
   */
  public static void loadWindowState(final Preferences aProperties, final Window aWindow) {
    // Special case: for FileDialog/JFileChooser we also should restore the
    // properties...
    loadFileDialogState(aProperties, aWindow);

    try {
      final int xPos = aProperties.getInt("winXpos", -1);
      final int yPos = aProperties.getInt("winYpos", -1);
      if ((xPos >= 0) && (yPos >= 0)) {
        aWindow.setLocation(xPos, yPos);
      }
    } catch (NumberFormatException exception) {
      // Ignore...
    }

    if (isNonResizableWindow(aWindow)) {
      // In case the window cannot be resized, don't restore its width &
      // height...
      return;
    }

    try {
      final int width = aProperties.getInt("winWidth", -1);
      final int height = aProperties.getInt("winHeight", -1);
      if ((width >= 0) && (height >= 0)) {
        aWindow.setSize(width, height);
      }
    } catch (NumberFormatException exception) {
      // Ignore...
    }
  }
コード例 #13
0
  @Override
  public void onResume() {
    super.onResume();
    ActivityMonitor.getInstance().setCurrentActivity(this);

    if (!(preferences.getEmail().equals("")
        || preferences.getPassword().equals("")
        || preferences.getDid().equals(""))) {
      preRecentUpdate();
    } else {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setMessage(getString(R.string.conversations_first_run_dialog_text));
      builder.setPositiveButton(
          getString(R.string.preferences_name),
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              Intent preferencesIntent =
                  new Intent(conversationsActivity, PreferencesActivity.class);
              startActivity(preferencesIntent);
            }
          });
      builder.setNegativeButton(
          getString(R.string.help_name),
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              Intent helpIntent = new Intent(conversationsActivity, HelpActivity.class);
              startActivity(helpIntent);
            }
          });
      builder.setCancelable(false);
      builder.show();
    }
  }
コード例 #14
0
  /** Loads the default settings from Preferences to set up the dialog. */
  public void legacyLoadDefaults() {
    String defaultsString = Preferences.getDialogDefaults(getDialogName());

    if ((defaultsString != null) && (newImage != null)) {

      try {
        StringTokenizer st = new StringTokenizer(defaultsString, ",");

        textSearchWindowSide.setText("" + MipavUtil.getInt(st));
        textSimilarityWindowSide.setText("" + MipavUtil.getInt(st));
        textNoiseStandardDeviation.setText("" + MipavUtil.getFloat(st));
        textDegree.setText("" + MipavUtil.getFloat(st));
        doRician = MipavUtil.getBoolean(st);
        doRicianCheckBox.setSelected(doRician);
        textDegree.setEnabled(doRician);
        labelDegree.setEnabled(doRician);
        image25DCheckBox.setSelected(MipavUtil.getBoolean(st));

        if (MipavUtil.getBoolean(st)) {
          newImage.setSelected(true);
        } else {
          replaceImage.setSelected(true);
        }

      } catch (Exception ex) {

        // since there was a problem parsing the defaults string, start over with the original
        // defaults
        Preferences.debug("Resetting defaults for dialog: " + getDialogName());
        Preferences.removeProperty(getDialogName());
      }
    }
  }
コード例 #15
0
ファイル: HostTest.java プロジェクト: applejian/cyberduck
 public void testParseWithTwoKlammeraffen() {
   {
     String url = "user@name@hostname";
     Host h = Host.parse(url);
     assertTrue(h.getHostname().equals("hostname"));
     assertTrue(
         h.getProtocol()
             .equals(
                 ProtocolFactory.forName(
                     Preferences.instance().getProperty("connection.protocol.default"))));
     assertNotNull(h.getCredentials().getUsername());
     assertTrue(h.getCredentials().getUsername().equals("user@name"));
     assertNull(h.getCredentials().getPassword());
   }
   {
     String url = "user@name:password@hostname";
     Host h = Host.parse(url);
     assertTrue(h.getHostname().equals("hostname"));
     assertTrue(
         h.getProtocol()
             .equals(
                 ProtocolFactory.forName(
                     Preferences.instance().getProperty("connection.protocol.default"))));
     assertNotNull(h.getCredentials().getUsername());
     assertTrue(h.getCredentials().getUsername().equals("user@name"));
     assertTrue(h.getCredentials().getPassword().equals("password"));
   }
 }
コード例 #16
0
  /**
   * Tests reading a 3.0.2 install with a mix of classic and OSGi plug-ins.
   *
   * @throws Exception
   */
  public void testClassicPlugins() throws Exception {
    // extract the 3.0.2 skeleton
    IPath location = extractClassicPlugins();

    // the new way
    ITargetDefinition definition = getNewTarget();
    ITargetLocation container = getTargetService().newDirectoryLocation(location.toOSString());
    definition.setTargetLocations(new ITargetLocation[] {container});
    Set urls = getAllBundleURLs(definition);
    assertTrue("Must be bundles", urls.size() > 0);

    Preferences store = PDECore.getDefault().getPluginPreferences();
    boolean restore = store.getBoolean(ICoreConstants.TARGET_PLATFORM_REALIZATION);
    try {
      store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, false);
      // the old way
      URL[] pluginPaths = PluginPathFinder.getPluginPaths(location.toOSString());
      for (int i = 0; i < pluginPaths.length; i++) {
        URL url = pluginPaths[i];
        if (!urls.contains(url)) {
          System.err.println(url.toString());
        }
      }
      assertEquals("Wrong number of bundles", pluginPaths.length, urls.size());
    } finally {
      store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, restore);
    }
  }
コード例 #17
0
 /**
  * Returns a {@link Preferences} with default values.
  *
  * @return default preferences
  */
 public static Preferences getDefault() {
   Preferences prefs = new Preferences();
   prefs.setLocalFileSystemClassName(
       System.getProperty(KEY_LOCAL_FILE_SYSTEM, DEFAULT_LOCAL_FILE_SYSTEM));
   prefs.setExplicitConfigurationPath(getFile(KEY_EXPLICIT_HADOOP_CONF));
   prefs.setExplicitCommandPath(getFile(KEY_EXPLICIT_HADOOP_COMMAND));
   return prefs;
 }
コード例 #18
0
  public void goToPosition(String sPosition) {

    m_sPosition = sPosition;
    pidLeft.setSetpoint(m_preferences.getFloat(sPosition, 0));
    pidRight.setSetpoint(m_preferences.getFloat(sPosition + "R", 0));

    System.out.println(sPosition + " Setpoint = " + m_preferences.getFloat(sPosition, 0));
  }
コード例 #19
0
ファイル: IngameScreen.java プロジェクト: blevine0001/space
  @Override
  public void hide() {
    // TODO remove controller listener

    // save zoom
    Preferences.putFloat("gameZoom", gameZoom);
    Preferences.flush();
  }
コード例 #20
0
ファイル: MenuActivity.java プロジェクト: aguilerin/SWADroid
 /** Deletes notifications and tests data from database */
 protected void cleanDatabase() {
   dbHelper.cleanTables();
   prefs.setLastCourseSelected(0);
   prefs.setRollcallCourseSelected(-1);
   Global.setSelectedRollcallCourseCode(-1);
   Toast.makeText(this, R.string.cleanDatabaseMsg, Toast.LENGTH_LONG).show();
   Log.i(Global.APP_TAG, getString(R.string.cleanDatabaseMsg));
 }
コード例 #21
0
ファイル: LocationView.java プロジェクト: fdinel/avare
  /** @param canvas */
  private void drawCornerTextsAndTrack(Canvas canvas) {

    /*
     * Misc text in the information text location on the view like GPS status,
     * Maps status, and point destination/destination bearing, altitude, ...
     * Add shadows for better viewing
     */
    mPaint.setShadowLayer(SHADOW, SHADOW, SHADOW, Color.BLACK);
    mPaint.setColor(Color.WHITE);

    mPaint.setTextAlign(Align.LEFT);
    /*
     * Speed
     */
    canvas.drawText(
        "" + Math.round(mGpsParams.getSpeed()) + "kt", 0, getHeight() / mTextDiv, mPaint);
    /*
     * Altitude
     */
    canvas.drawText(
        "" + Math.round(mGpsParams.getAltitude()) + "ft", 0, getHeight() - mFontHeight, mPaint);

    mPaint.setTextAlign(Align.RIGHT);

    /*
     * Heading
     */
    canvas.drawText(
        "" + Math.round(mGpsParams.getBearing()) + '\u00B0',
        getWidth(),
        getHeight() - mFontHeight,
        mPaint);

    /*
     * Status/destination top right
     */
    if (mErrorStatus != null) {
      mPaint.setColor(Color.RED);
      canvas.drawText(mErrorStatus, getWidth(), getHeight() / mTextDiv * 2, mPaint);
    }

    /*
     * Point above error status
     */
    mPaint.setColor(Color.WHITE);
    if (mPoint != null) {
      canvas.drawText(mPoint, getWidth(), getHeight() / mTextDiv, mPaint);
    } else if (mDestination != null) {
      canvas.drawText(mDestination.toString(), getWidth(), getHeight() / mTextDiv, mPaint);
      if (mDestination.isFound() && mPref.isTrackEnabled() && (!mPref.isSimulationMode())) {
        if (null != mTrackShape) {
          mPaint.setColor(Color.MAGENTA);
          mPaint.setStrokeWidth(4);
          mTrackShape.drawShape(canvas, mOrigin, mScale, mMovement, mPaint, mFace);
        }
      }
    }
  }
コード例 #22
0
 // basic arcadeDrive: y=forward/backward speed, x=left/right speed
 public void arcadeDrive(double y, double x) {
   SmartDashboard.putNumber("RightEncoder", rightEncoder.get());
   SmartDashboard.putNumber("LeftEncoder", leftEncoder.get());
   Preferences p = Preferences.getInstance();
   final boolean kReverseDirection = p.getBoolean("DriveTrainReverseDirection", false);
   robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, kReverseDirection);
   robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, kReverseDirection);
   robotDrive.arcadeDrive(y, x);
 } // end arcadeDrive
コード例 #23
0
 // basic arcadeDrive: y=forward/backward speed, x=left/right speed
 public void arcadeDrive(double y, double x) {
   Preferences p = Preferences.getInstance();
   final boolean kReverseDirection = p.getBoolean("DriveTrainReverseDirection", false);
   robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, kReverseDirection);
   robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, kReverseDirection);
   robotDrive.arcadeDrive(y, x + 0.05);
   SmartDashboard.putNumber("DriveTrainGyro", -gyro.getAngle()); // upside down
   SmartDashboard.putNumber("RangefinderVoltage", ultraDist.getVoltage());
 } // end arcadeDrive
コード例 #24
0
  @Test
  public void userPrefsArePreservedWhenConvertingToAndFromJson() throws IOException {
    profile.setPreference("browser.startup.homepage", "http://www.example.com");

    String json = profile.toJson();
    FirefoxProfile rebuilt = FirefoxProfile.fromJson(json);
    Preferences parsedPrefs = parseUserPrefs(rebuilt);

    assertEquals("http://www.example.com", parsedPrefs.getPreference("browser.startup.homepage"));
  }
コード例 #25
0
  /**
   * This code is used to activate syntax coloring for each section detected by the
   * XWikiPartitionner The partitioner is activated in createDocument in PageDocumentProvider.java
   *
   * @see PageDocumentProvider#createDocument(Object)
   */
  @Override
  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));

    /* Use the XWiki markup for tables and default content. */
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new XWikiMarkupScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_TABLE);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_TABLE);

    /* Use the Velocity Scanner for velocity blocks */
    dr = new DefaultDamagerRepairer(new VelocityScanner());
    reconciler.setDamager(dr, XWikiPartitionScanner.VELOCITY);
    reconciler.setRepairer(dr, XWikiPartitionScanner.VELOCITY);

    /* Use the Groovy Scanner for groovy blocks */
    dr = new DefaultDamagerRepairer(new GroovyScanner());
    reconciler.setDamager(dr, XWikiPartitionScanner.GROOVY);
    reconciler.setRepairer(dr, XWikiPartitionScanner.GROOVY);

    /* Use a uniform style for html blocks. */
    RuleBasedScanner codeScanner = new RuleBasedScanner();
    codeScanner.setDefaultReturnToken(
        new Token(Preferences.getDefault().getTextAttribute(Preferences.Style.HTML)));
    dr = new DefaultDamagerRepairer(codeScanner);
    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_HTML);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_HTML);

    /* Use a uniform style for code blocks. */
    codeScanner = new RuleBasedScanner();
    codeScanner.setDefaultReturnToken(
        new Token(Preferences.getDefault().getTextAttribute(Preferences.Style.CODE)));
    dr = new DefaultDamagerRepairer(codeScanner);
    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_CODE);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_CODE);

    /* Use a uniform style for pre blocks. */
    RuleBasedScanner preScanner = new RuleBasedScanner();
    preScanner.setDefaultReturnToken(
        new Token(Preferences.getDefault().getTextAttribute(Preferences.Style.CODE)));
    dr = new DefaultDamagerRepairer(preScanner);
    reconciler.setDamager(dr, XWikiPartitionScanner.XWIKI_PRE);
    reconciler.setRepairer(dr, XWikiPartitionScanner.XWIKI_PRE);

    RuleBasedScanner javadocScanner = new GroovyScanner();
    dr = new DefaultDamagerRepairer(javadocScanner);
    reconciler.setDamager(dr, GroovyPartitionScanner.GROOVY_DEFAULT);
    reconciler.setRepairer(dr, GroovyPartitionScanner.GROOVY_DEFAULT);

    return reconciler;
  }
コード例 #26
0
 public boolean alignStraight() {
   double angleOut = gyro.getAngle() * Preferences.getInstance().getDouble("Gyro_kP", 0.0);
   SmartDashboard.putNumber("gyroErr", gyro.getAngle());
   SmartDashboard.putNumber("angleOut", angleOut);
   robotDrive.arcadeDrive(0, angleOut);
   if (Math.abs(gyro.getAngle()) < Preferences.getInstance().getDouble("AngleBuffer", 100)) {
     arcadeDrive(0, 0);
     return true;
   }
   return false;
 }
コード例 #27
0
ファイル: ChangeLog.java プロジェクト: Epixoft/voicesmith
  @Override
  public AlertDialog show() {
    Preferences preferences = new Preferences(context);

    if (!preferences.isChangeLogShowed()) {
      preferences.setChangeLogShowed(true);
      return super.show();
    }

    return null;
    // return super.show(); // TEST: show changelog always
  }
コード例 #28
0
  @Test
  public void backslashedCharsArePreservedWhenConvertingToAndFromJson() throws IOException {
    String dir =
        "c:\\aaa\\bbb\\ccc\\ddd\\eee\\fff\\ggg\\hhh\\iii\\jjj\\kkk\\lll\\mmm\\nnn\\ooo\\ppp\\qqq\\rrr\\sss\\ttt\\uuu\\vvv\\www\\xxx\\yyy\\zzz";
    profile.setPreference("browser.download.dir", dir);

    String json = profile.toJson();
    FirefoxProfile rebuilt = FirefoxProfile.fromJson(json);
    Preferences parsedPrefs = parseUserPrefs(rebuilt);

    assertEquals(dir, parsedPrefs.getPreference("browser.download.dir"));
  }
コード例 #29
0
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) {
     pref = (Preferences) data.getSerializableExtra("newPref");
     if (pref != null) {
       Log.d("DEBUG", "Image size: " + pref.getImageSize().toString());
       Log.d("DEBUG", "Color filter: " + pref.getColorFilter().toString());
       Log.d("DEBUG", "Image type: " + pref.getImageType().toString());
       Log.d("DEBUG", "Site filter: " + pref.getSiteFilter().toString());
     } else {
       Log.d("DEBUG", "Pref is null <onActivityResult>");
     }
   }
 }
コード例 #30
0
 public void tankDrive(double leftSpeed, double rightSpeed) {
   Preferences p = Preferences.getInstance();
   final boolean kReverseDirection = p.getBoolean("DriveTrainReverseDirection", false);
   robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, kReverseDirection);
   robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, kReverseDirection);
   //        if (kReverseDirection) {
   //            robotDrive.tankDrive(rightSpeed, leftSpeed);
   //            return;
   //        }
   robotDrive.tankDrive(leftSpeed, rightSpeed);
   SmartDashboard.putNumber("gyroErr", gyro.getAngle());
   SmartDashboard.putNumber("encoder", rightEncoder.get());
 } // end tankDrive