Skip to content

Instantly share code, notes, and snippets.

View johnkil's full-sized avatar
:octocat:

Evgenii Shishkin johnkil

:octocat:
View GitHub Profile
@johnkil
johnkil / .gitignore
Created September 11, 2012 14:25 — forked from keyboardsurfer/.gitignore
Android gitignore
# built application files
*.apk
*.ap_
*.jar
# keystore
*.keystore
# files for the dex VM
*.dex
@johnkil
johnkil / ConvertDimensionUtils.java
Created September 29, 2012 15:17
Convert DIP to PX and PX to DIP
/**
* This method convets dp unit to equivalent device specific value in pixels.
*
* @param dp A value in dp(Device independent pixels) unit. Which we need to convert into pixels
* @param context Context to get resources and device specific display metrics
* @return A float value to represent Pixels equivalent to dp according to device
*/
public static float convertDpToPixel(float dp,Context context){
Resources resources = context.getResources();
DisplayMetrics metrics = resources.getDisplayMetrics();
@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;
@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 / 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 / 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 / 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 / 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 / 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 / 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;