Skip to content

Instantly share code, notes, and snippets.

Avatar
🚢
React, Node.js & Android

Bartosz Jarocki BartoszJarocki

🚢
React, Node.js & Android
View GitHub Profile
View AndroidTimer.java
package com.skily.gps;
import android.os.Handler;
import java.util.concurrent.TimeUnit;
import timber.log.Timber;
public class AndroidTimer {
long mTrackedTime = 0;
long mLastUpdateTime = 0;
View ListFragment.java
abstract public class ListFragment<ViewHolderType extends RecyclerView.ViewHolder, ModelType> extends BaseFragment {
/**
* Views
*/
@InjectView(R.id.list) RecyclerView mRecyclerView;
@InjectView(R.id.progress_view) ProgressBar mProgressView;
@InjectView(R.id.empty) ViewStub mEmpty;
@InjectView(R.id.error_view) ErrorView mErrorView;
/**
View gist:a8f5d8fc9e6f67e0c9c7
/**
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
*/
public static void riseAndShine(Activity activity) {
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED);
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
View AdViewForListViewWrapperAdapter.java
package com.smartsoft.library.adapters;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
View WCFDateTimeParser.java
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
public class WCFDateTimeParser {
/**
* <p>WCF services supply Dates over JSON in a strange format. This method
* takes a WCF-formatted Date string and parses it into a JodaTime DateTime
* object. Assumes valid input matching a format described below.</p>
*
View RestUtils.java
public static String getMD5Hash(String password) {
try {
final MessageDigest messageDigest = MessageDigest.getInstance(MD5);
messageDigest.reset();
messageDigest.update(password.getBytes(UTF_8));
final byte[] resultByte = messageDigest.digest();
final String result = new String(Hex.encodeHex(resultByte));