Skip to content

Instantly share code, notes, and snippets.

View johnkil's full-sized avatar
:octocat:

Evgenii Shishkin johnkil

:octocat:
View GitHub Profile
import roboguice.activity.event.OnPauseEvent;
import roboguice.activity.event.OnResumeEvent;
import roboguice.event.EventManager;
import roboguice.event.Observes;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import com.google.inject.Inject;
@johnkil
johnkil / SystemSharedLibraryUtils.java
Last active December 10, 2015 13:49
Check if specify system shared library is installed.
/**
* Check if specify system shared library is installed.
*
* @param ctx {@link Context} instance
* @param libraryName System shared library name (ex. Google Maps library name "com.google.android.maps")
* @return true if system shared library is installed, else false
*/
public static boolean hasSystemSharedLibraryInstalled(Context ctx, String libraryName) {
boolean hasLibraryInstalled = false;
if (!TextUtils.isEmpty(libraryName)) {
@johnkil
johnkil / JTarUtils.java
Created December 20, 2012 12:59
Implementation of two versions of the utilities to decompress tar.gz archives (apache tar & jtar).
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
import org.xeustechnologies.jtar.TarEntry;
import org.xeustechnologies.jtar.TarInputStream;
@johnkil
johnkil / ZipFileUtils.java
Last active December 9, 2015 23:38
Implementation of two versions of the utilities to decompress zip archives (ZipInputStream & ZipFile).
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
@johnkil
johnkil / FileUtils.java
Last active February 9, 2021 21:13
File Util's. Set of basic static final methods for working with the file system on Android OS.
import java.io.File;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
/**
* File Util's.
@johnkil
johnkil / ScaleFadePageTransformer.java
Created December 4, 2012 06:23 — forked from jgilfelt/ScaleFadePageTransformer.java
An ICS+ app/widget drawer style PageTransformer for your ViewPager
/***
* Copyright (c) 2012 readyState Software Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@johnkil
johnkil / LicensesActivity.java
Created November 21, 2012 11:38 — forked from cyrilmottier/LicensesActivity.java
"Open source licenses" screen
package com.cyrilmottier.android.citybikes;
import android.os.Bundle;
import com.cyrilmottier.android.avelov.R;
import com.cyrilmottier.android.citybikes.app.BaseActivity;
public class LicensesActivity extends BaseActivity {
private WebView mWebView;
@johnkil
johnkil / FeedbackAndroid.java
Created November 10, 2012 09:57 — forked from TomTasche/feedback_android.java
Use built-in feedback mechanism on Android
// more information here: http://blog.tomtasche.at/2012/10/use-built-in-feedback-mechanism-on.html
try {
int i = 3 / 0;
} catch (Exception e) {
ApplicationErrorReport report = new ApplicationErrorReport();
report.packageName = report.processName = getApplication()
.getPackageName();
report.time = System.currentTimeMillis();
report.type = ApplicationErrorReport.TYPE_CRASH;
@johnkil
johnkil / GZIPUtils.java
Created October 22, 2012 18:25
Utilities for working with GZIP archives.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;
import java.util.zip.GZIPInputStream;
@johnkil
johnkil / Log.java
Created October 10, 2012 12:12
Оverride class android.util.Log
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import travel.opas.core.Consts;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Process;
import android.text.format.DateFormat;