CLICK ME
// Add code here
| sealed class AppFailure { | |
| /** | |
| * Global Failure classes | |
| * These failures will be used across all over the app including Data Layer, Domain Layer, Framework Layer | |
| */ | |
| class GeneralFailure(var message: String, var errorCode: Int? = null) : AppFailure() | |
| class UnauthorizedFailure(var message: String = "Unauthorized", errorCode: Int? = null) : AppFailure() | |
| class LoginFailure(var message: String = "Unable to login", errorCode: Int? = null) : AppFailure() | |
| class ServerFailure(var message: String = "Unable to connect to the server side", errorCode: Int? = null) : AppFailure() | |
| class NoInternetFailure(var message: String = "Device is not connected to the internet", errorCode: Int? = null) : AppFailure() |
// Add code here
| import android.content.Context | |
| import android.net.ConnectivityManager | |
| import android.net.NetworkCapabilities | |
| import android.os.Build | |
| val Context.isConnected: Boolean | |
| get() { | |
| val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
| return when { | |
| Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> { |
| package com.android.test.activity; | |
| import android.os.Bundle; | |
| import android.support.v7.widget.Toolbar; | |
| import com.android.test.R; | |
| import com.android.test.fragment.MainFragment; | |
| import roboguice.RoboGuice; | |
| import roboguice.inject.InjectView; |
| public class ScreenUtility { | |
| private Activity activity; | |
| private float dpWidth; | |
| private float dpHeight; | |
| public ScreenUtility(Activity activity) { | |
| this.activity = activity; | |
| Display display = activity.getWindowManager().getDefaultDisplay(); |
| <?xml version="1.0" encoding="utf-8"?> | |
| <resources> | |
| <!-- RED --> | |
| <color name="red_50">#FFEBEE</color> | |
| <color name="red_100">#FFCDD2</color> | |
| <color name="red_200">#EF9A9A</color> | |
| <color name="red_300">#E57373</color> | |
| <color name="red_400">#EF5350</color> | |
| <color name="red_500">#F44336</color> |
| package trikke.gists; | |
| import android.graphics.Typeface; | |
| import android.text.Spannable; | |
| import android.text.SpannableString; | |
| import android.text.style.BackgroundColorSpan; | |
| import android.text.style.ForegroundColorSpan; | |
| import android.text.style.RelativeSizeSpan; | |
| import android.text.style.StrikethroughSpan; | |
| import android.text.style.StyleSpan; |
| /* | |
| * Copyright (C) 2014 Jared Rummler <[email protected]> | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| package com.emil.android.util; | |
| import android.content.Context; | |
| import android.location.Location; | |
| import android.location.LocationListener; | |
| import android.location.LocationManager; | |
| import android.os.Bundle; | |
| import android.util.Log; | |
| /** |
| package com.emil.android.util; | |
| import android.content.Context; | |
| import android.net.ConnectivityManager; | |
| import android.net.NetworkInfo; | |
| import android.telephony.TelephonyManager; | |
| /** | |
| * Check device's network connectivity and speed | |
| * @author emil http://stackoverflow.com/users/220710/emil |