Android Open Source - tracks-android Preference Utils






From Project

Back to project page tracks-android.

License

The source code is released under:

Copyright (c) 2010 Adam Wolfe Gordon <awg@xvx.ca> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to...

If you think the Android project tracks-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ca.xvx.tracks.preferences;
/*from w  ww.  j  a v  a  2 s  . c  o  m*/
import android.content.SharedPreferences;

import java.net.URI;
import java.net.URISyntaxException;

public class PreferenceUtils {
  public static URI getUri(SharedPreferences prefs, String file) throws URISyntaxException {
    String server = prefs.getString(PreferenceConstants.SERVER, null);
    final boolean https = prefs.getBoolean(PreferenceConstants.HTTPS, false);
    final boolean badcert = prefs.getBoolean(PreferenceConstants.BADCERT, false);
    final int port;
    if(https) {
      port = Integer.parseInt(prefs.getString(PreferenceConstants.PORT, "443"));
    } else {
      port = Integer.parseInt(prefs.getString(PreferenceConstants.PORT, "80"));
    }
    final String protocol = https ? "https" : "http";
    final String[] spl = server.split("/", 2);
    final String path;
    if(spl.length > 1) {
      server = spl[0];
      path = "/" + spl[1] + "/";
    } else {
      path = "/";
    }

    return new URI(protocol, null, server, port, path + file, null, null);
  }
}




Java Source Code List

ca.xvx.tracks.ContextEditorActivity.java
ca.xvx.tracks.ContextXmlHandler.java
ca.xvx.tracks.DuplicateContextException.java
ca.xvx.tracks.DuplicateProjectException.java
ca.xvx.tracks.DuplicateTaskException.java
ca.xvx.tracks.ProjectEditorActivity.java
ca.xvx.tracks.ProjectXmlHandler.java
ca.xvx.tracks.Project.java
ca.xvx.tracks.SettingsActivity.java
ca.xvx.tracks.TaskEditorActivity.java
ca.xvx.tracks.TaskListActivity.java
ca.xvx.tracks.TaskListAdapter.java
ca.xvx.tracks.TaskListItem.java
ca.xvx.tracks.TaskXmlHandler.java
ca.xvx.tracks.Task.java
ca.xvx.tracks.TodoContext.java
ca.xvx.tracks.TracksAction.java
ca.xvx.tracks.TracksCommunicator.java
ca.xvx.tracks.preferences.PreferenceConstants.java
ca.xvx.tracks.preferences.PreferenceUtils.java
ca.xvx.tracks.util.HttpConnection.java