Back to project page no-cloud-share.
The source code is released under:
GNU General Public License
If you think the Android project no-cloud-share listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.ub0r.android.nocloudshare; //w w w . ja v a2s . c o m import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceActivity; import android.text.TextUtils; import android.view.MenuItem; import de.ub0r.android.logg0r.Log; public class SettingsActivity extends PreferenceActivity { private static final String TAG = "SettingsActivity"; public static final String PREFS_PORT = "port"; public static final String DEFAULT_PORT = "8808"; private static final String PREFS_EXPIRATION_MINUTES = "expiration"; private static final String DEFAULT_EXPIRATION_MINUTES = "15"; public static final String PREFS_SHOW_INDEX = "show_index"; public static final boolean DEFAULT_SHOW_INDEX = false; public static long getExpirationPeriod(final SharedPreferences p) { String s = p.getString(PREFS_EXPIRATION_MINUTES, DEFAULT_EXPIRATION_MINUTES); if (TextUtils.isEmpty(s)) { s = DEFAULT_EXPIRATION_MINUTES; } long l; try { l = Long.parseLong(s); } catch (NumberFormatException e) { Log.d(TAG, "could not parse expiration period: ", s); l = Long.parseLong(SettingsActivity.DEFAULT_EXPIRATION_MINUTES); } return l * 60L * 1000L; } @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); //noinspection ConstantConditions getActionBar().setDisplayHomeAsUpEnabled(true); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); //noinspection deprecation addPreferencesFromResource(R.xml.pref_settings); } @Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; default: return super.onOptionsItemSelected(item); } } }