@Override protected Boolean doInBackground(String... arg0) { try { threads = WebsiteHandler.searchInForums(context, arg0[0]); return true; } catch (Exception ex) { ex.printStackTrace(); return false; } }
@Override protected Boolean doInBackground(Void... arg0) { try { // Did we manage? if (WebsiteHandler.closeChatWindow(chatId)) { return true; } else { return false; } } catch (Exception ex) { ex.printStackTrace(); return false; } }
@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(); } } } } }