Skip to content

Instantly share code, notes, and snippets.

public class AnimatedActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//opening transition animations
overridePendingTransition(R.anim.activity_open_translate,R.anim.activity_close_scale);
}
@Override
protected void onPause() {
@bgorkowy
bgorkowy / AndroidManifest.xml
Created April 8, 2014 22:02 — forked from cyrilmottier/AndroidManifest.xml
Android example of how to add a custom logo to the ActionBar and ensure the best possible matching starting Window.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyrilmottier.android.anapp">
<!-- ... -->
<application
android:icon="@drawable/ic_launcher"
android:label="@string/config_app_name"
android:theme="@style/Theme.AnApp" >
@bgorkowy
bgorkowy / app_build.gradle
Created April 8, 2014 22:23
Gradle Setup for use with Android Annotations.
apply plugin: 'android'
apply plugin: 'android-apt'
def AAVersion = 'X.X.X'
apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName 'com.package.example.app'
// If you're using Android NBS flavors you should use the following line instead of hard-coded packageName
@bgorkowy
bgorkowy / PrefsUtil.java
Created April 8, 2014 22:44
Shared Preference util class starting body, using Android Annotations
import org.androidannotations.annotations.sharedpreferences.DefaultInt;
import org.androidannotations.annotations.sharedpreferences.DefaultString;
import org.androidannotations.annotations.sharedpreferences.SharedPref;
@SharedPref(value = SharedPref.Scope.APPLICATION_DEFAULT)
public interface PrefsUtil {
/**
* Example int preference, with default value 0
*/
Ion.with(imageView)
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.animateLoad(spinAnimation)
.animateIn(fadeInAnimation)
.load("http://example.com/image.png");
@bgorkowy
bgorkowy / .gitgnore
Last active August 29, 2015 14:00
.gitignore AS
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
@bgorkowy
bgorkowy / CustomTypefaceStyleSpan.java
Created May 21, 2014 14:35
CustomSpan, with the ability to set style from resource file and custom typeface. applyCustomTypeface() method taken from http://goo.gl/dtJulZ, TextApperanceSpan from android source code.
import android.content.Context;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.text.TextPaint;
import android.text.style.TextAppearanceSpan;
/**
* Created by bgorkowy on 2014-05-21.
*/
public class CustomTypefaceStyleSpan extends TextAppearanceSpan {
@Override
public void onCompleted(Exception e, JsonObject result) {
try {
if (e != null) {
throw e;
} else {
// zapis do bazy
// EventBus.post (new onSomeDataDownloadedEvent())
}
} catch (Exception ex) {
@bgorkowy
bgorkowy / progress_drawable.xml
Created July 18, 2014 09:01
Round Progress Bar
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:drawable="@drawable/progress_bar_bg" />
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%"
android:drawable="@drawable/progress_bar_progress" />
</item>
</layer-list>
public class NavigationDrawerLayout extends ScrimInsetsLinearLayout {
private int drawerMaxWidth = -1;
public NavigationDrawerLayout(Context context) {
super(context);
}
public NavigationDrawerLayout(Context context, AttributeSet attrs) {
super(context, attrs);