This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME | Density | Pixels | 1/2 Square | 16:9 Image | Map Marker | | |
ldpi | 0.5 | 180 x 320 | | | |
mdpi | 1 | 360 x 640 | 180x180 | 360 x 202 | 32 | |
hdpi | 1.5 | 540 x 960 | 270x270 | 540 x 304 | 48 | |
xhdpi | 2 | 720 x 1280 | 360x360 | 720 x 405 | 64 | |
xxhdpi | 3 | 1080 x 1920 | 540x540 | 1080 x 608 | 96 | |
xxxhdpi | 4 | 1440 x 2560 | | 1440 x 810 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -rl 'Copyright ©2015' . | xargs sed -i "" 's/2015/2016/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###### | |
Application Class | |
###### | |
AdtagInitializer.initInstance(this) | |
.initUrlType(Url.UrlType.PRE_PROD) | |
.initUser("*******", "**********") | |
.initCompany("********"); | |
AdtagLogsManager.initInstance(this, Network.ALL, 200, 1000 * 60 * 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//package com.your.app.package; | |
import android.content.Context; | |
import java.io.File; | |
public final class PicassoCacheUtil { | |
public static boolean clearImageDiskCache(Context context) { | |
File cache = new File(context.getApplicationContext().getCacheDir(), "picasso-cache"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Note: I'm using JodaTime API to handle dates | |
public void checkPicassoCacheDate() { | |
final DateTime remoteImagesDate = mRemoteConfig.getRemoteImagesDate(); | |
final DateTime imagesCacheDate = mUserDefaults.getImagesCacheDate(); | |
if (remoteImagesDate.isAfter(imagesCacheDate)) { | |
//Local cache is old, clear it and save new date in a different thread | |
Thread t = new Thread(new Runnable() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.appwidget.AppWidgetProvider; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.widget.RemoteViews; | |
import com.greenlionsoft.cercaniaslib.R; | |
import com.greenlionsoft.sharedlib.logs.Logx; | |
import java.util.Arrays; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FavoritesProvider : IFavoritesProvider { | |
val database = FirebaseDatabase.getInstance() | |
val gson = Gson() | |
val favoritesCache = FavoritesMemoryCache() | |
override fun saveBusStopFavoritesList(favorites: List<BusStopFavorite>) { | |
//save in cache | |
favoritesCache.saveBusStopFavoritesList(favorites) | |
//save in remote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FavoritesMemoryCache { | |
//Bus Stop Favorites | |
private var busStopFavoritesList: MutableList<BusStopFavorite>?=null | |
fun retrieveBusStopFavoriteList(): List<BusStopFavorite>? { | |
if (busStopFavoritesList != null) { | |
return busStopFavoritesList.toList() | |
} | |
return null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//It emits "1", "2", "3" then signals completion | |
Observable.range(1,3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//retryCount is a Long variable value | |
//eg. When retryCount = 1, observable emmits a 0L after 2 sec, then completes | |
//eg. When retryCount = 2, observable emmits a 0L after 4 sec, then completes | |
//eg. When retryCount = 3, observable emmits a 0L after 8 sec, then completes | |
Observable.timer(Math.pow(2.toDouble(), retryCount.toDouble()).toLong(), TimeUnit.SECONDS) |
OlderNewer