@Override
  public void onCreate(Bundle icicle) {

    // onCreate - save the instance state
    super.onCreate(icicle);

    // Set sharedPreferences
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    PublicUtils.restoreCookies(this, icicle);

    // Setup the locale
    PublicUtils.setupLocale(this, sharedPreferences);

    // Set the content view
    setContentView(R.layout.forum_search_view);

    // Prepare to tango
    this.layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    // Get the elements
    buttonSearch = (Button) findViewById(R.id.button_search);
    fieldSearch = (EditText) findViewById(R.id.field_search);

    // Threads!
    threads = new ArrayList<ForumSearchResult>();
    setupList(threads);
  }
  @Override
  public void onResume() {

    super.onResume();

    // Setup the locale
    PublicUtils.setupLocale(this, sharedPreferences);

    // Setup the session
    PublicUtils.setupSession(this, sharedPreferences);
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    // Get the current item
    PlatoonData currentPlatoon = getItem(position);

    // Recycle
    if (convertView == null) {

      convertView = layoutInflater.inflate(R.layout.list_item_platoon, parent, false);
    }

    // Set the TextViews
    ((TextView) convertView.findViewById(R.id.text_name)).setText(currentPlatoon.getName());
    ((TextView) convertView.findViewById(R.id.text_tag)).setText(currentPlatoon.getTag());
    ((TextView) convertView.findViewById(R.id.text_members))
        .setText(currentPlatoon.getCountMembers() + "");
    ((TextView) convertView.findViewById(R.id.text_fans))
        .setText(currentPlatoon.getCountFans() + "");

    // Almost forgot - we got a Bitmap too!
    ((ImageView) convertView.findViewById(R.id.image_badge))
        .setImageBitmap(
            BitmapFactory.decodeFile(
                PublicUtils.getCachePath(context) + currentPlatoon.getId() + ".jpeg"));

    // Store it in the tag
    convertView.setTag(currentPlatoon);

    return convertView;
  }
  @Override
  public void onCreate(Bundle icicle) {

    // onCreate - save the instance state
    super.onCreate(icicle);

    // Set sharedPreferences
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    PublicUtils.restoreCookies(this, icicle);

    // Setup the locale
    PublicUtils.setupLocale(this, sharedPreferences);

    // Let's put 'em there
    addPreferencesFromResource(R.xml.settings_view);

    // Set the originalInterval
    originalInterval = sharedPreferences.getInt(Constants.SP_BL_INTERVAL_SERVICE, 0);
  }
Пример #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    // onCreate - save the instance state
    super.onCreate(savedInstanceState);

    // Set the content view
    setContentView(R.layout.main);

    // Are we active?
    if (PublicUtils.isMyServiceRunning(this) && WebsiteHandler.setActive()) {

      startActivity(new Intent(this, Dashboard.class));
    }

    // Check if the default-file is ok
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (sharedPreferences.getInt(Constants.SP_V_FILE, 0) == 0) {

      // Get the sharedPreferences
      SharedPreferences sharedPreferencesOld = getSharedPreferences(Constants.FILE_SHPREF, 0);
      SharedPreferences.Editor spEdit = sharedPreferences.edit();

      // Set it up
      spEdit.putInt(Constants.SP_V_FILE, sharedPreferencesOld.getInt(Constants.SP_V_FILE, 0) + 1);
      spEdit.putInt(
          Constants.SP_V_CHANGELOG,
          Integer.valueOf(
              String.valueOf(sharedPreferencesOld.getLong(Constants.SP_V_CHANGELOG, 0))));
      spEdit.putLong(
          Constants.SP_BL_PLATFORM_ID,
          sharedPreferencesOld.getLong(Constants.SP_BL_PLATFORM_ID, 0));
      spEdit.putLong(
          Constants.SP_BL_PROFILE_ID, sharedPreferencesOld.getLong(Constants.SP_BL_PROFILE_ID, 0));
      spEdit.putLong(
          Constants.SP_BL_PERSONA_ID, sharedPreferencesOld.getLong(Constants.SP_BL_PERSONA_ID, 0));
      spEdit.putString(
          Constants.SP_BL_EMAIL, sharedPreferencesOld.getString(Constants.SP_BL_EMAIL, ""));
      spEdit.putString(
          Constants.SP_BL_PASSWORD, sharedPreferencesOld.getString(Constants.SP_BL_PASSWORD, ""));
      spEdit.putString(
          Constants.SP_BL_USERNAME, sharedPreferencesOld.getString(Constants.SP_BL_USERNAME, ""));
      spEdit.putString(
          Constants.SP_BL_CHECKSUM, sharedPreferencesOld.getString(Constants.SP_BL_CHECKSUM, ""));
      spEdit.putBoolean(
          Constants.SP_BL_REMEMBER,
          sharedPreferencesOld.getBoolean(Constants.SP_BL_REMEMBER, false));

      // Commit!!
      spEdit.commit();
    }

    // Initialize the attributes
    postDataArray = new PostData[Constants.FIELD_NAMES_LOGIN.length];
    valueFields = new String[2];

    // Get the fields
    fieldEmail = (EditText) findViewById(R.id.field_email);
    fieldPassword = (EditText) findViewById(R.id.field_password);
    checkboxSave = (CheckBox) findViewById(R.id.checkbox_save);

    // Do we need to show the cool changelog-dialog?
    if (sharedPreferences.getInt(Constants.SP_V_CHANGELOG, Constants.CHANGELOG_VERSION - 1)
        < Constants.CHANGELOG_VERSION) {

      createChangelogDialog().show();
    }

    // Let's populate... or shall we not?
    if (sharedPreferences.contains(Constants.SP_BL_EMAIL)) {

      // Set the e-mail field
      fieldEmail.setText(sharedPreferences.getString(Constants.SP_BL_EMAIL, ""));

      // Did the user want us to remember the password?
      if (sharedPreferences.getBoolean(Constants.SP_BL_REMEMBER, false)) {

        // Do we have a password stored?
        if (!sharedPreferences.getString(Constants.SP_BL_PASSWORD, "").equals("")) {

          try {

            // Set the password (decrypted version)
            fieldPassword.setText(
                SimpleCrypto.decrypt(
                    sharedPreferences.getString(Constants.SP_BL_EMAIL, ""),
                    sharedPreferences.getString(Constants.SP_BL_PASSWORD, "")));

            checkboxSave.setChecked(true);

          } catch (Exception e) {

            e.printStackTrace();
          }
        }
      }
    }
  }