Ejemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.voltage_control);
    setHasOptionsMenu(true);

    mCategory = (PreferenceCategory) findPreference("uv_category");

    if (Utils.fileExists(VoltageUtils.UV_TABLE_FILE)) {
      if (mCategory.getPreferenceCount() != 0) {
        mCategory.removeAll();
      }
      addPreferences(true);
      isVdd = false;
    } else {
      if (Utils.fileExists(VoltageUtils.VDD_TABLE_FILE)) {
        if (mCategory.getPreferenceCount() != 0) {
          mCategory.removeAll();
        }
        addPreferences(false);
        isVdd = true;
      } else {
        if (mCategory.getPreferenceCount() != 0) {
          mCategory.removeAll();
        }
      }
    }

    isSupported(getPreferenceScreen(), getActivity());
  }
Ejemplo n.º 2
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   if (Utils.fileExists(VoltageUtils.UV_TABLE_FILE)
       || Utils.fileExists(VoltageUtils.VDD_TABLE_FILE)) {
     inflater.inflate(R.menu.menu_voltage, menu);
   }
 }