Esempio n. 1
0
  /**
   * Reload RecipeManager's settings, messages, etc and re-parse recipes.
   *
   * @param sender To whom to send the messages to, null = console.
   * @param check Set to true to only check recipes, settings are unaffected.
   */
  public void reload(CommandSender sender, boolean check, boolean firstTime) {
    Settings.getInstance().reload(sender); // (re)load settings
    Messages.getInstance().reload(sender); // (re)load messages from messages.yml
    Files.reload(sender); // (re)generate info files if they do not exist

    Updater.init(this, 32835, null);

    if (metrics == null) {
      if (Settings.getInstance().getMetrics()) { // start/stop metrics accordingly
        try {
          metrics = new Metrics(this);
          metrics.start();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    } else {
      metrics.stop();
    }
    if (!check) {
      if (Settings.getInstance().getClearRecipes() || !firstTime) {
        Vanilla.removeAllButSpecialRecipes();
        Recipes.getInstance().clean();
      }

      if (!firstTime && !Settings.getInstance().getClearRecipes()) {
        Vanilla.restoreAllButSpecialRecipes();
        Recipes.getInstance().index.putAll(Vanilla.initialRecipes);
      }
    }

    RecipeProcessor.reload(sender, check); // (re)parse recipe files
    Events.reload(); // (re)register events
  }
  public static DropType getDropTypeToGenerate(String objectType) {
    String baseKey = "workbench.dbexplorer.generate.drop";

    String type = Settings.getInstance().getProperty(baseKey, DropType.cascaded.name());

    if (objectType != null && !"default".equalsIgnoreCase(objectType)) {
      type =
          Settings.getInstance()
              .getProperty(baseKey + "." + DbSettings.getKeyValue(objectType), type);
    }

    // migrate from the old setting (true/false)
    if ("true".equalsIgnoreCase(type)) {
      return DropType.cascaded;
    }

    if ("false".equalsIgnoreCase(type)) {
      return DropType.none;
    }

    try {
      return DropType.valueOf(type);
    } catch (Exception ex) {
      return DropType.cascaded;
    }
  }
Esempio n. 3
0
  public static synchronized Logger getLogger(Class<?> clazz) {

    Logger logger = Logger.getLogger(clazz.getName());

    if (handler == null) {

      File logRoot = new File(Settings.getInstance().getLogDir());

      if (!logRoot.exists()) {
        if (!logRoot.mkdirs()) {
          System.err.println(
              "FATAL ERROR, Exiting: Unable to make log directories at " + logRoot.toString());
          throw new Error(
              "FATAL ERROR, Exiting: Unable to make log directories at " + logRoot.toString());
          // FIXME: remove this.  left in for the moment while nail down JUnit config
        }
      }

      Date date = new Date();
      SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss_SSS");
      String logfile =
          Settings.getInstance().getLogDir()
              + File.separator
              + formatter.format(date)
              + "_"
              + appName;
      try {
        OutputStream os = null;
        Formatter sf = null;
        if (Settings.getInstance().getXmlLogs()) {
          logfile = logfile + ".xml";
          sf = new XMLFormatter();
        } else {
          logfile = logfile + ".txt";
          sf = new LogFormatter();
        }

        if (Settings.getInstance().getCompressLogs()) {
          logfile += ".gz";
          os = new GZIPOutputStream(new FileOutputStream(logfile));
        } else {
          os = new FileOutputStream(logfile);
        }

        handler = new StreamHandler(os, sf);
        flusher = new Flusher();
        flusher.start();
      } catch (Exception e) {
        logger.severe("Failed to open log file " + logfile + ": " + e);
      }
    }

    if (handler != null) {
      logger.addHandler(handler);
    }

    return Logger.getLogger(clazz.getName());
  }
Esempio n. 4
0
  @Test
  public void testSession() {
    UserSession session1 = Settings.getInstance().createNewSession(null);
    UserSession session2 = Settings.getInstance().createNewSession(null);
    UserSession session3 = Settings.getInstance().createNewSession(null);

    System.out.println(session1);
    System.out.println(session2);
    System.out.println(session3);
  }
Esempio n. 5
0
  public void onLogout() {
    Settings.getInstance().setUserOnline(false);
    if (SMTHApplication.activeUser != null) {
      SMTHApplication.activeUser.setId("guest");
    }
    UpdateNavigationViewHeader();

    SMTHHelper helper = SMTHHelper.getInstance();
    helper
        .wService
        .logout()
        .observeOn(AndroidSchedulers.mainThread())
        .subscribeOn(Schedulers.io())
        .subscribe(
            new Subscriber<AjaxResponse>() {
              @Override
              public void onCompleted() {}

              @Override
              public void onError(Throwable e) {
                Toast.makeText(MainActivity.this, "退出登录失败!\n" + e.toString(), Toast.LENGTH_LONG)
                    .show();
              }

              @Override
              public void onNext(AjaxResponse ajaxResponse) {
                Toast.makeText(MainActivity.this, ajaxResponse.getAjax_msg(), Toast.LENGTH_LONG)
                    .show();
              }
            });
  }
Esempio n. 6
0
  public void initializeSensor(Context context, boolean forceNavigationMode) {
    try {

      try {
        if (!Settings.getInstance()
                .getBooleanValue(getText(R.string.settings_key_orientation).toString())
            && !forceNavigationMode) {
          log.log(Level.FINE, "Orientation is disabled in settings");
          return;
        }
      } catch (NoSuchFieldError e) {
        log.log(Level.SEVERE, "", e);
        return;
      }

      log.log(Level.FINE, "initialize sensor");
      SensorManager mSensorManager =
          (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
      mSensorManager.registerListener(
          this,
          mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION),
          SensorManager.SENSOR_DELAY_NORMAL);
    } catch (Exception e) {
      log.log(Level.SEVERE, "", e);
    }
  }
Esempio n. 7
0
 public void initLocation() {
   try {
     try {
       if (!Settings.getInstance()
           .getBooleanValue(getText(R.string.settings_key_gps).toString())) {
         log.log(Level.FINE, "GPS is disabled in settings");
         return;
       }
     } catch (NoSuchFieldError e) {
       log.log(Level.SEVERE, "", e);
       return;
     }
     List providers = this.getLocationManager().getProviders(true);
     if (providers.size() == 0) {
       log.log(Level.FINE, "no location providers enabled");
       this.showLocationSourceDialog();
     } else {
       log.log(Level.FINE, "location handler start");
       locationHandler.start();
       this.setLocationHandlerEnabled(true);
       // manager.initLocation();
     }
   } catch (Exception e) {
     log.log(Level.SEVERE, "", e);
   }
 }
 /**
  * Return a list of object types for which the DbExplorer should not confirm the execution from
  * within the "Source" panel.
  */
 public static Set<String> objectTypesToRunWithoutConfirmation() {
   List<String> types =
       Settings.getInstance().getListProperty("workbench.dbexplorer.exec.noconfirm.types", false);
   Set<String> result = CollectionUtil.caseInsensitiveSet();
   result.addAll(types);
   return result;
 }
Esempio n. 9
0
  public static void startServices(Context context) {
    Settings settings = Settings.getInstance(context);
    int interval = getIntervalTime(settings.getInt(Settings.NOTIFICATION_INTERVAL, 1));

    if (interval > -1) {
      startServiceAlarm(context, ReminderService.class, interval);
    }
  }
Esempio n. 10
0
  /**
   * Invoked within the update method of screens with an arrow. Checks if arrow has been selected.
   *
   * @param event the touch event
   * @return true if {@link TouchEvent} is within the bounds of the arrow.
   */
  public boolean checkSelected(TouchEvent event) {
    if (Assets.getInstance().inBounds(event, imageX, imageY, image.getWidth(), image.getHeight())) {
      if (Settings.getInstance().isSoundEnabled()) {
        Assets.getInstance().getMenuSelect().play(2);
      }

      return true;
    }

    return false;
  }
  @Override
  public void parse(InputStream in, OutputStream out) throws Exception {
    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
    CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT);
    Date startTime = Settings.getInstance().getStartTime();
    Date endTime = Settings.getInstance().getEndTime();
    long startTimeVal = startTime == null ? -1 : startTime.getTime();
    long endTimeVal = endTime == null ? -1 : endTime.getTime();

    String line;
    while ((line = reader.readLine()) != null) {
      String[] fields = line.split(",");
      long timestamp = Long.parseLong(fields[0]);
      if (timestamp == 0) {
        LOGGER.warning("Skip invalid data row: " + line);
        continue;
      }
      int rt = Integer.parseInt(fields[1]);
      if (startTimeVal > 0 && timestamp + rt < startTimeVal
          || endTimeVal > 0 && timestamp + rt > endTimeVal) continue;
      String label = fields[2];
      int skip = 0;
      if (fields[4].startsWith("\"")) ++skip;
      if (fields[skip + 5].startsWith("\"")) ++skip;
      int latency = Integer.parseInt(fields[skip + 9]);
      int threads = 0;
      int bytes = Integer.parseInt(fields[skip + 8]);
      boolean error = !Boolean.parseBoolean(fields[skip + 7]);
      csvPrinter.printRecord(
          "TX-" + label + (error ? "-F" : "-S"),
          timestamp,
          threads,
          error ? '1' : '0',
          latency,
          rt,
          bytes);
    }
    writer.flush();
  }
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup c, Bundle s) {
    settings = Settings.getInstance(getActivity());
    View v = inflater.inflate(R.layout.fragment_overview, c, false);
    cn = new ComponentName(getActivity(), AdminReceiver.class);
    dpm = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);

    toggle = (CompoundButton) v.findViewById(R.id.toggle_admin);
    lockscreenStatus = (TextView) v.findViewById(R.id.lockscreen_status);
    pinPasswordStatus = (TextView) v.findViewById(R.id.pin_password_status);
    keyguardStatus = (TextView) v.findViewById(R.id.keyguard_status);
    warning = v.findViewById(R.id.warning);
    disabledWarning = v.findViewById(R.id.disabled_warning);
    passwordWarning = v.findViewById(R.id.password_warning);

    if (hasPermanentMenuKey()) {
      v.findViewById(R.id.press_menu_for_more).setVisibility(View.VISIBLE);
    }
    toggle.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton c, boolean b) {
            Intent addAdmin = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
            if (!b) {
              Context ctx = getActivity();
              if (settings.get(Settings.LOCK_DISABLED) && CryptoUtils.isPasswordSaved(ctx)) {
                dpm.resetPassword(CryptoUtils.getPassword(ctx), 0);
                settings.set(Settings.LOCK_DISABLED, false);
              }
              dpm.removeActiveAdmin(cn);
              disabledWarning.setVisibility(View.VISIBLE);
              warning.setVisibility(View.GONE);

              new Handler()
                  .post(
                      new Runnable() {
                        @Override
                        public void run() {
                          getActivity().supportInvalidateOptionsMenu();
                        }
                      });
            } else {
              addAdmin.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, cn);
              addAdmin.putExtra(
                  DevicePolicyManager.EXTRA_ADD_EXPLANATION,
                  getActivity().getString(R.string.admin_add_explanation));
              startActivity(addAdmin);
            }
          }
        });
    return v;
  }
Esempio n. 13
0
  private SettingsWindow() {
    this.settings = Settings.getInstance();

    setAlwaysOnTop(true);
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    setIconImage(new ImageIcon("img/settings-icon.png").getImage());
    setResizable(false);
    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    setTitle("Osobní nastavení");

    createMainPanel();
    createTabs();
    reloadSettings();

    addWindowListener(this);
  }
public class DeletePlacemarkThread extends Thread {
  String url = "http://brightkite.com/me/placemarks/";
  HttpConnection httpConnection = null;
  String serverResponse = "";
  PlacemarkScreen screen;
  Settings settings = Settings.getInstance();

  public DeletePlacemarkThread(int placemarkid, PlacemarkScreen screen) {
    this.screen = screen;
    this.url = url + placemarkid + ".json";
  }

  public void run() {
    try {
      this.url += NetworkConfig.getConnectionParameters(this.settings.getConnectionMode());
      this.httpConnection = ((HttpConnection) Connector.open(this.url));
      this.httpConnection.setRequestMethod("DELETE");
      this.httpConnection.setRequestProperty("User-Agent", BrightBerry.useragent);
      this.httpConnection.setRequestProperty("Authorization", this.settings.getAuthHeader());
      this.httpConnection.setRequestProperty("x-rim-transcode-content", "none");
      int rc = httpConnection.getResponseCode();
      System.out.println("Response code: " + rc);
      if (rc == 200) {
        this.screen.callDelete(true);
      } else {
        if (rc == 503) {
          BrightBerry.displayAlert("Error", "BrightKite is too busy at the moment try again later");
          this.screen.callDelete(false);
        } else if (rc == 401 || rc == 403) {
          BrightBerry.errorUnauthorized();
        } else {
          this.screen.callDelete(false);
        }
      }
      if (this.httpConnection != null) {
        this.httpConnection.close();
      }
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
}
Esempio n. 15
0
  public static int getCurrentLanguage(Context context) {
    int lang = Settings.getInstance(context).getInt(Settings.LANGUAGE, -1);
    if (lang == -1) {
      String language = Locale.getDefault().getLanguage();
      String country = Locale.getDefault().getCountry();

      if (DEBUG) {
        Log.d(TAG, "Locale.getLanguage() = " + language);
      }

      if (language.equalsIgnoreCase("zh")) {
        if (country.equalsIgnoreCase("CN")) {
          lang = 1;
        } else {
          lang = 2;
        }
      } else {
        lang = 0;
      }
    }

    return lang;
  }
Esempio n. 16
0
  @Override
  public void initComponent() {
    IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(getId("IntelliJEval"));
    if (pluginDescriptor != null && pluginDescriptor.isEnabled()) {
      livePluginNotificationGroup
          .createNotification(
              "It seems that you have IntelliJEval plugin enabled.<br/>Please disable it to use LivePlugin.",
              NotificationType.ERROR)
          .notify(null);
      return;
    }
    checkThatGroovyIsOnClasspath();

    Settings settings = Settings.getInstance();
    if (settings.justInstalled) {
      installHelloWorldPlugin();
      settings.justInstalled = false;
    }
    if (settings.runAllPluginsOnIDEStartup) {
      runAllPlugins();
    }

    new PluginToolWindowManager().init();
  }
Esempio n. 17
0
 public GeoLookupUtil() {
   Settings settings = Settings.getInstance();
   String path =
       settings.getSetting(Settings.STATE_LOCATION)
           + System.getProperty("file.separator")
           + MAXMIND_DIR
           + System.getProperty("file.separator");
   try {
     // geo
     File database = new File(path + MAXMIND_COUNTRY_DB);
     reader = new DatabaseReader.Builder(database).build();
     // asn
     asnService =
         new LookupService(
             path + MAXMIND_ASN_V4_DB,
             LookupService.GEOIP_MEMORY_CACHE | LookupService.GEOIP_CHECK_CACHE);
     asnV6Service =
         new LookupService(
             path + MAXMIND_ASN_V6_DB,
             LookupService.GEOIP_MEMORY_CACHE | LookupService.GEOIP_CHECK_CACHE);
   } catch (IOException e) {
     throw new RuntimeException("Error initializing Maxmind GEO/ASN database", e);
   }
 }
Esempio n. 18
0
 /**
  * getKey : A method to calculate and integer value for given string.
  *
  * @param value A value to be stored in hash table.
  * @return An integer value to be processed as key.
  */
 public static int getKey(String value) {
   int key = 0;
   for (int i = 0; i < value.length(); i++) key += value.charAt(i);
   return key % Settings.getInstance().Modulo;
 }
Esempio n. 19
0
 public static void switchTheme(Context context) {
   Settings.getInstance(context).putBoolean(Settings.THEME_DARK, !isDarkMode(context));
 }
Esempio n. 20
0
 public static boolean isDarkMode(Context context) {
   return Settings.getInstance(context).getBoolean(Settings.THEME_DARK, false);
 }
Esempio n. 21
0
 public static void clearOngoingUnreadCount(Context context) {
   Settings s = Settings.getInstance(context);
   s.putString(Settings.NOTIFICATION_ONGOING, "");
 }
 public static void setAllowAlterInDbExplorer(boolean flag) {
   Settings.getInstance().setProperty(PROP_ALLOW_ALTER_TABLE, flag);
 }
Esempio n. 23
0
 /**
  * Get the testPlans directory
  *
  * @return
  */
 public String getTemplatesDirectory() {
   return Settings.getInstance().getSetting("Directory.Templates") + File.separatorChar;
 }
 public static boolean getUseFilterForRetrieve() {
   return Settings.getInstance().getBoolProperty(PROP_USE_FILTER_RETRIEVE, false);
 }
Esempio n. 25
0
 @Override
 public SharedPreferences getSharedPreferences(Context context) {
   return Settings.getInstance(context).getSharedPreferences();
 }
Esempio n. 26
0
 @Override
 public void initLog(Context context) {
   LOG.initialize(Settings.getInstance(context));
 }
 public static void setUseFilterForRetrieve(boolean flag) {
   Settings.getInstance().setProperty(PROP_USE_FILTER_RETRIEVE, flag);
 }
 public static boolean getApplySQLSortInDbExplorer() {
   return Settings.getInstance().getBoolProperty(PROP_USE_SQLSORT, false);
 }
Esempio n. 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // how to adjust the height of toolbar
    // http://stackoverflow.com/questions/17439683/how-to-change-action-bar-size
    // zsmth_actionbar_size @ dimen ==> ThemeOverlay.ActionBar @ styles ==> theme @ app_bar_main.xml

    // init floating action button & circular action menu
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    initCircularActionMenu(fab);

    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    mToggle =
        new ActionBarDrawerToggle(
            this,
            mDrawer,
            toolbar,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    mDrawer.addDrawerListener(mToggle);
    mToggle.syncState();

    mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    mNavigationView.setNavigationItemSelectedListener(this);
    mNavigationView.setCheckedItem(R.id.nav_guidance);

    // http://stackoverflow.com/questions/33161345/android-support-v23-1-0-update-breaks-navigationview-get-find-header
    View headerView = mNavigationView.getHeaderView(0);
    mAvatar = (WrapContentDraweeView) headerView.findViewById(R.id.nav_user_avatar);
    mAvatar.setOnClickListener(this);

    mUsername = (TextView) headerView.findViewById(R.id.nav_user_name);
    mUsername.setOnClickListener(this);

    // http://stackoverflow.com/questions/27097126/marquee-title-in-toolbar-actionbar-in-android-with-lollipop-sdk
    TextView titleTextView = null;
    try {
      Field f = toolbar.getClass().getDeclaredField("mTitleTextView");
      f.setAccessible(true);
      titleTextView = (TextView) f.get(toolbar);
      titleTextView.setEllipsize(TextUtils.TruncateAt.START);
    } catch (NoSuchFieldException e) {
    } catch (IllegalAccessException e) {
    }

    // init all fragments
    initFragments();

    FragmentManager fm = getSupportFragmentManager();
    if (Settings.getInstance().isLaunchHotTopic()) {
      fm.beginTransaction().replace(R.id.content_frame, hotTopicFragment).commit();
    } else {
      fm.beginTransaction().replace(R.id.content_frame, favoriteBoardFragment).commit();
    }

    getSupportFragmentManager()
        .addOnBackStackChangedListener(
            new FragmentManager.OnBackStackChangedListener() {
              public void onBackStackChanged() {
                // Enable Up button only  if there are entries in the back stack
                boolean canback = getSupportFragmentManager().getBackStackEntryCount() > 0;
                if (canback) {
                  mToggle.setDrawerIndicatorEnabled(false);
                  getSupportActionBar().setDisplayShowHomeEnabled(true);
                  getSupportActionBar().setHomeButtonEnabled(true);
                  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                } else {
                  getSupportActionBar().setDisplayHomeAsUpEnabled(false);
                  mToggle.setDrawerIndicatorEnabled(true);
                  mDrawer.addDrawerListener(mToggle);
                }
              }
            });

    // start service to maintain user status
    setupUserStatusReceiver();
    updateUserStatusNow();
    UpdateNavigationViewHeader();

    // schedule the periodical run
    MaintainUserStatusService.schedule(MainActivity.this, mReceiver);

    if (Settings.getInstance().isFirstRun()) {
      // show info dialog after 5 seconds for the first run
      final Handler handler = new Handler();
      handler.postDelayed(
          new Runnable() {
            @Override
            public void run() {
              showInfoDialog();
            }
          },
          2000);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "search dialog is created!!!");

    mSettings = Settings.getInstance();

    super.onCreate(savedInstanceState);
    setContentView(R.layout.google_check_frequency);

    settings = this.getSharedPreferences(PREFERENCENAME, 0);

    m_RadioGroup = (RadioGroup) findViewById(R.id.rg_SetFrequencyTime);

    m_iCheckedTime = settings.getInt(TOGGLE_KEY, hourly);

    switch (m_iCheckedTime) {
      case fivemin:
        m_RadioGroup.check(R.id.rb_FiveMin);
        break;
      case thirtymin:
        m_RadioGroup.check(R.id.rb_ThirtyMin);
        break;
      case hourly:
        m_RadioGroup.check(R.id.rb_Hour);
        break;
      case daily:
        m_RadioGroup.check(R.id.rb_Daily);
        break;
      case fortnightly:
        m_RadioGroup.check(R.id.rb_Fortnightly);
        break;
      case -1:
        m_RadioGroup.check(R.id.rb_Off);
        break;
      default:
        Log.e(TAG, "the frequency time is not transport into this dialog!!!");
        m_RadioGroup.check(R.id.rb_Hour);
        break;
    }

    m_RadioGroup.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            switch (checkedId) {
              case R.id.rb_FiveMin:
                m_iCheckedTime = fivemin;
                break;
              case R.id.rb_ThirtyMin:
                m_iCheckedTime = thirtymin;
                break;
              case R.id.rb_Hour:
                m_iCheckedTime = hourly;
                break;
              case R.id.rb_Daily:
                m_iCheckedTime = daily;
                break;
              case R.id.rb_Fortnightly:
                m_iCheckedTime = fortnightly;
                break;
              case R.id.rb_Off:
                m_iCheckedTime = -1;
                break;
              default:
                Toast.makeText(
                    GoogleFrequencyToggle.this,
                    "ERROR: the frequency time is not chosen in this dialog!!!",
                    Toast.LENGTH_SHORT);
                Log.e(TAG, "the frequency time is not chosen in this dialog!!!");
                break;
            }
          }
        });

    m_btnOK = (Button) findViewById(R.id.btn_SetFrequencyOK);
    m_btnCancel = (Button) findViewById(R.id.btn_SetFrequencyCancel);

    m_btnOK.setOnClickListener(
        new OnClickListener() {

          /* (non-Javadoc)
           * @see android.view.View.OnClickListener#onClick(android.view.View)
           */
          @Override
          public void onClick(View v) {
            Intent intent = new Intent();
            intent.putExtra("RefreshFrequencyTime", m_iCheckedTime);
            setResult(RESULT_OK, intent);

            SharedPreferences.Editor editor = settings.edit();
            editor.putInt(TOGGLE_KEY, m_iCheckedTime);
            editor.commit();
            mSettings.setRestartServiceFlag(true);

            finish();
          }
        });

    m_btnCancel.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            setResult(RESULT_CANCELED);
            finish();
          }
        });
  }