Skip to content

Instantly share code, notes, and snippets.

View TechIsFun's full-sized avatar

Andrea Maglie TechIsFun

View GitHub Profile
@TechIsFun
TechIsFun / ForceLocaleRuleUsage.java
Created November 3, 2020 22:30
Usage of ForceLocaleRule
@RunWith(AndroidJUnit4.class)
public class MyActivityTest {
@ClassRule
public static final ForceLocaleRule localeTestRule = new ForceLocaleRule(Locale.UK);
@Rule
public ActivityTestRule<MyActivity> mMyActivityRule = new ActivityTestRule<>(MyActivity.class);
private Context mContext;
@TechIsFun
TechIsFun / ForceLocaleRule.java
Created November 3, 2020 22:29
A test rule for setting device locale
public class ForceLocaleRule implements TestRule {
private final Locale mTestLocale;
private Locale mDeviceLocale;
public ForceLocaleRule(Locale testLocale) {
mTestLocale = testLocale;
}
@Override
#!/usr/bin/env bash
##################
# https://github.com/microsoft/appcenter/blob/master/sample-build-scripts/flutter/android-build/appcenter-post-clone.sh
##################
cd ..
# fail if any command fails
set -e
#!/usr/bin/env bash
############
# https://github.com/microsoft/appcenter/blob/master/sample-build-scripts/flutter/ios-build/appcenter-post-clone.sh
###########
# fail if any command fails
set -e
# debug log
set -x
find ~/projects -maxdepth 5 -type d -name 'build' | xargs -n 1 tmutil addexclusion
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.RectF;
import android.os.Build;
import android.text.Layout.Alignment;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;
@Test
public void testOnClickMapButton() throws Exception {
Context spyContext = spy(RuntimenEnvironment.application);
mActivity.onClickOnMapButton(spyContext);
verify(spyContext).startActivity(argThat(googleMapsIntentMatcher()));
}
private static Matcher<Intent> googleMapsIntentMatcher() {
public class CrashlyticsTree extends Timber.Tree {
@Override
protected void log(int priority, String tag, String message, Throwable t) {
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
Crashlytics.log(priority, tag, message);
public class MyDebugTree extends Timber.DebugTree {
@Override
protected String createStackElementTag(StackTraceElement element) {
return super.createStackElementTag(element) + ":" + element.getLineNumber();
}
}