Android SpiceRequest - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SpiceRequest class.

This code example shows how to use the following methods:
public abstract class SpringAndroidSpiceRequest<RESULT> extends SpiceRequest<RESULT> {
 
    private RestTemplate restTemplate;
 
    public SpringAndroidSpiceRequest(Class<RESULT> clazz) {
        super(clazz);
    } 
 
    public RestTemplate getRestTemplate() { 
        return restTemplate;
    } 
 
    public void setRestTemplate(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    } 
 
    @Override 
    /** 
     * This method doesn't really work within the Spring Android module : once the request is  
     * loading data from network, there is no way to interrupt it. This is weakness of the spring android framework, 
6
CodeRank
This code example shows how to use the following methods:
public class ReverseStringRequest extends SpiceRequest<String> {
 
    private String word;
 
    public ReverseStringRequest(String word) {
        super(String.class);
        this.word = word;
    } 
 
    @Override 
    public String loadDataFromNetwork() throws Exception {
 
        // With Uri.Builder class we can build our url is a safe manner 
        Uri.Builder uriBuilder = Uri.parse(
            "http://robospice-sample.appspot.com/reverse").buildUpon();
        uriBuilder.appendQueryParameter("word", word);
 
        String url = uriBuilder.build().toString();
 
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) {
4
CodeRank
This code example shows how to use the following methods:
	private String imei; 
	private int versionCode; 
	private String locale; 
 
	public ApplicationAuthorizationRequest(String packageName, int versionCode, long storeId, String storeToken, String imei, String locale) { 
		super(ApplicationAuthorization.class); 
		this.packageName = packageName; 
		this.storeId = storeId; 
		this.storeToken = storeToken; 
		this.imei = imei; 
		this.versionCode = versionCode; 
		this.locale = locale; 
	} 
 
	@Override 
	public ApplicationAuthorization loadDataFromNetwork() throws Exception { 
		return WebServices.getInstance().getApplicationAuthorizations(packageName, versionCode, storeId, storeToken, imei, locale); 
	} 
} 
4
CodeRank
This code example shows how to use the following methods:
 */ 
public class GetFriendsRequest extends SpiceRequest<List> { 
 
    private CachedCC98Service mCC98Service; 
    public GetFriendsRequest(CachedCC98Service service) { 
        super(List.class ); 
        mCC98Service = service; 
    } 
    @Override 
    public List<UserStatueEntity> loadDataFromNetwork() throws Exception { 
 
        return null; 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:
	private String storeToken; 
	private int versionCode; 
	private String encryptedDeviceId; 
	 
	public ApplicationCheckForUpdateRequest(String packageName, int versionCode, long storeId, String storeToken, String encryptedDeviceId) { 
		super(ApplicationCheckUpdate.class); 
		this.packageName = packageName; 
		this.storeId = storeId; 
		this.storeToken = storeToken; 
		this.versionCode = versionCode; 
		this.encryptedDeviceId = encryptedDeviceId; 
	} 
 
	@Override 
	public ApplicationCheckUpdate loadDataFromNetwork() throws Exception { 
		return WebServices.getInstance().getApplicationCheckForUpdate(packageName, storeId, storeToken, encryptedDeviceId, versionCode); 
	} 
} 
4
CodeRank
This code example shows how to use the following methods:
	private long storeId; 
	private long applicationId; 
	private String storeToken; 
 
	public ApplicationBinaryUrlRequest(long storeId, long applicationId, String storeToken) { 
		super(DownloadUrl.class); 
		this.storeId = storeId; 
		this.applicationId = applicationId; 
		this.storeToken = storeToken; 
	} 
 
	@Override 
	public DownloadUrl loadDataFromNetwork() throws Exception { 
		return WebServices.getInstance().getApplicationDownloadUrl(storeId, applicationId, storeToken); 
	} 
 
} 
4
CodeRank
This code example shows how to use the following methods:
public class NetworkRequest extends SpiceRequest<NetworkConnectionResult> { 
    private final HttpContext mHttpContext; 
    private final NetworkConnectionRequest mNetworkConnectionRequest; 
 
    public NetworkRequest(HttpContext hContext, NetworkConnectionRequest request) { 
        super(NetworkConnectionResult.class); 
        mHttpContext = hContext; 
        mNetworkConnectionRequest = request; 
    } 
 
    @Override 
    public NetworkConnectionResult loadDataFromNetwork() throws Exception { 
        NetworkConnection network = new NetworkConnection(); 
        network.setHttpContext(mHttpContext); 
        return network.wget(mNetworkConnectionRequest); 
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:
 
public abstract class BaseRequest<T> extends SpiceRequest<T> { 
    private Context mContext; 
 
    public BaseRequest(Class<T> clazz) { 
        super(clazz); 
    } 
 
    public BaseRequest(Class<T> clazz, Context ctx) { 
        super(clazz); 
        mContext = ctx; 
    } 
 
    public Context getContext() { 
        return mContext; 
    } 
 
    public void setContext(Context context) { 
        mContext = context; 
    } 
4
CodeRank
This code example shows how to use the following methods:
	private String login;
	private String passwd;
	private boolean authenticated = false;
 
	public AuthenticatedRequest(Context context, Class<RESULT> clazz) {
		super(clazz);
		this.context = context;
		init(); 
	} 
 
	protected void init() { 
		AccountManager accManager = AccountManager.get(context);
 
		Account[] accounts = accManager
				.getAccountsByType(Constants.ACCOUNT_TYPE);
 
		if (accounts.length == 1) {
			this.login = accounts[0].name;
			this.passwd = AccountManager.get(context).getPassword(accounts[0]);
		} 
4
CodeRank
See Code Examples for Android SpiceRequest Methods: