Skip to content

Instantly share code, notes, and snippets.

View JoachimR's full-sized avatar

Joachim Reiß JoachimR

  • https://bryter.com
  • Germany
View GitHub Profile
@JoachimR
JoachimR / gist:13292d950c1f8580e54e
Created May 28, 2015 09:39
Android Server Side Events
buildscript {
...
}
...
android {
...
}
dependencies {
@JoachimR
JoachimR / AndroidUtils.java
Last active November 18, 2015 13:51
AndroidUtils.java
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.content.Context;
import android.support.annotation.NonNull;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.data.DataFetcher;
import com.bumptech.glide.load.model.stream.StreamModelLoader;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import org.json.JSONArray;
import org.json.JSONException;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
@JoachimR
JoachimR / btn_flat_compat___v11.xml
Created December 19, 2015 12:04
Android material flat button v7 compat
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/btn_flat"
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="btn_flat"
android:textColor="@color/colorAccent"
package my;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteException;
import android.util.Log;
import my.DaoMaster;
@JoachimR
JoachimR / persons.json
Last active August 9, 2016 22:38
random persons with gender sample data as json
{
"person_list": [
{
"firstName": "Angela",
"gender": "female",
"lastName": "Rikard"
},
{
"firstName": "Yolanda",
"gender": "female",
@JoachimR
JoachimR / ChooseDayDialog.kt
Created November 20, 2017 15:39
ChooseDayDialog with optional request code
import android.app.DatePickerDialog
import android.app.Dialog
import android.os.Bundle
import android.support.v4.app.DialogFragment
import java.util.*
class ChooseDayDialog : DialogFragment() {
@JoachimR
JoachimR / TestUtils.kt
Created December 4, 2017 09:44
Android Espresso SwipeToRefreshLayout assert isRefreshing state
import android.support.annotation.IdRes
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.v4.widget.SwipeRefreshLayout
import android.view.View
import org.hamcrest.Description
import org.hamcrest.Matchers.not
import org.hamcrest.TypeSafeMatcher