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
/** | |
* Created by alexshr on 02.05.2017. | |
*/ | |
package com.skb.goodsapp; | |
import android.os.SystemClock; | |
import android.util.Log; | |
import java.util.Date; |
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.skb.goodsapp; | |
import android.util.Log; | |
import org.junit.Assert; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; |
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.skb.goodsapp; | |
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; | |
import io.reactivex.Scheduler; | |
import io.reactivex.android.plugins.RxAndroidPlugins; | |
import io.reactivex.internal.schedulers.ExecutorScheduler; | |
import io.reactivex.plugins.RxJavaPlugins; |
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.skb.goodsapp; | |
import com.skb.goodsapp.di.AppComponent; | |
import com.skb.goodsapp.di.AppModule; | |
import com.skb.goodsapp.di.DaggerService; | |
/** | |
* to replace MyApplication (using MockTestRunner) | |
* for MockWebServer usage | |
* |
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
/** | |
* Call it in Activity.onCreate to see facebook debug key hash | |
* | |
* @param activity | |
*/ | |
public static void logFbKeyHash(Activity activity) { | |
try { | |
PackageInfo info = activity.getPackageManager().getPackageInfo( | |
activity.getPackageName(), | |
PackageManager.GET_SIGNATURES); |
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
private void initTimber(){ | |
if (BuildConfig.DEBUG) { | |
Timber.plant(new DebugTree() { | |
@SuppressLint("DefaultLocale") | |
@Override | |
protected String createStackElementTag(@NonNull StackTraceElement element) { | |
return String.format("%s: %s:%d (%s)", | |
super.createStackElementTag(element), | |
element.getMethodName(), | |
element.getLineNumber(), |
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
public static Bitmap drawableToBitmap(Drawable drawable) { | |
if (drawable instanceof BitmapDrawable) { | |
return ((BitmapDrawable) drawable).getBitmap(); | |
} | |
int width = drawable.getIntrinsicWidth(); | |
width = width > 0 ? width : 1; | |
int height = drawable.getIntrinsicHeight(); | |
height = height > 0 ? height : 1; |
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
private boolean isServiceRunning() { | |
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); | |
boolean isRunning = false; | |
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { | |
if (LocationService.class.getName().equals(service.service.getClassName())) { | |
isRunning = true; | |
} | |
} | |
Timber.d("isRunning=%b", isRunning); | |
return isRunning; |
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
@file:Suppress("EXPERIMENTAL_API_USAGE") |
OlderNewer