Updated projects for SDK 23

This commit is contained in:
Erik C. Thauvin 2015-10-21 19:42:08 -07:00
parent b379fc2acc
commit 17b7f26824
7 changed files with 85 additions and 42 deletions

View file

@ -33,15 +33,6 @@
*/
package net.thauvin.erik.android.emaily;
import static com.rosaloves.bitlyj.Bitly.as;
import static com.rosaloves.bitlyj.Bitly.shorten;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Date;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
@ -78,6 +69,15 @@ import com.google.api.services.urlshortener.Urlshortener;
import com.google.api.services.urlshortener.UrlshortenerRequest;
import com.google.api.services.urlshortener.model.Url;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Date;
import static com.rosaloves.bitlyj.Bitly.as;
import static com.rosaloves.bitlyj.Bitly.shorten;
/**
* The <code>Emaily</code> class implements a URL shortener intent.
*
@ -93,6 +93,17 @@ public class Emaily extends Activity
private String appName;
private SharedPreferences sharedPrefs;
/**
* Validates a string.
*
* @param s The string to validate.
* @return returns <code>true</code> if the string is not empty or null, <code>false</code> otherwise.
*/
public static boolean isValid(String s)
{
return (s != null) && (!s.trim().isEmpty());
}
@SuppressLint("CommitPrefEdits")
@Override
public void onCreate(Bundle savedInstanceState)
@ -290,17 +301,6 @@ public class Emaily extends Activity
startEmailyTask(intent, new Account(getPref(R.string.prefs_key_googl_account), ACCOUNT_TYPE), true);
}
/**
* Validates a string.
*
* @param s The string to validate.
* @return returns <code>true</code> if the string is not empty or null, <code>false</code> otherwise.
*/
public static boolean isValid(String s)
{
return (s != null) && (!s.trim().isEmpty());
}
/**
* Returns the value of the specified shared reference based on the specified string id. The default value is an empty string.
*
@ -643,10 +643,10 @@ public class Emaily extends Activity
*/
private class EmailyResult
{
private final Intent intent;
private int code = 0;
private String message;
private boolean retry = false;
private final Intent intent;
public EmailyResult(Intent intent)
{
@ -658,6 +658,11 @@ public class Emaily extends Activity
return code;
}
public void setCode(int code)
{
this.code = code;
}
public String getMessage()
{
if (isValid(message))
@ -670,6 +675,11 @@ public class Emaily extends Activity
}
}
public void setMessage(String message)
{
this.message = message;
}
public Intent getIntent()
{
return intent;
@ -685,16 +695,6 @@ public class Emaily extends Activity
return retry;
}
public void setCode(int code)
{
this.code = code;
}
public void setMessage(String message)
{
this.message = message;
}
public void setRetry(boolean retry)
{
this.retry = retry;