Skip to content

Instantly share code, notes, and snippets.

View Bhavdip's full-sized avatar
🎯
Focusing

bhavdip Bhavdip

🎯
Focusing
View GitHub Profile
@Antarix
Antarix / round_background.xml
Created February 7, 2013 03:39
Round background image drawable for android
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<stroke android:width="1dp" android:color="#FFFFFF" />
<gradient
android:startColor="#679031"
android:centerColor="#679031"
@daichan4649
daichan4649 / AndroidManifest.xml
Last active June 2, 2023 14:51
show Fragment on LockScreen (for Android)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="daichan4649.lockoverlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
@koral--
koral-- / SinglePagerTitleStrip.java
Last active April 10, 2017 10:43
Modification of android.support.v4.view.PagerTitleStrip preserving only primary page indicator, see http://www.thedroidsonroids.com/blog/android/pagertitlestrip-with-current-page-indicator-only/ for more info.
/*
* Copyright (C) 2011 The Android Open Source Project
*
* 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
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#000"
android:background="?android:attr/activatedBackgroundIndicator"
@kitek
kitek / list_selector.xml
Last active January 3, 2016 15:31
Custom ListView selector drawable/list_selector.xml android:listSelector="@drawable/selector"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:constantSize="true">
<item android:state_focused="false" android:state_pressed="false">
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke android:width="0dp" android:color="@android:color/transparent" />
<padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" />

Make your multiple type view adapter with annotations!

Gist for Making a Multiple View Types Adapter With Annotations

Pretty easy to use.

  1. Create your delegate adapters, implementing DelegateAdapter, and with the annotation DelegateAdapterType. e.g:
@DelegateAdapterType(itemType = 0)
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);
}
@meSingh
meSingh / make_slug.php
Created July 1, 2013 13:35
Create WordPress like slugs from any string in php.
<?php
/**
*
* Genrate Slugs from Title or any given string
*
* @param string $str
* @return Slug
*
**/
//OnClickListener stub
public class ButtonListener implements OnClickListener {
private UpdateUIListener mUIListener;
public ButtonListener(UpdateUIListener uiListener){
mUIListener = uiListener;
}
@Override
@uklimaschewski
uklimaschewski / UnescapeJavaString
Created September 28, 2013 12:50
Unescapes a string that contains standard Java escape sequences: - \b \f \n \r \t \" \' : BS, FF, NL, CR, TAB, single and double quote - \X \XX \XXX : Octal character from 0 to 377 (that is in Hex: 0x00 to 0xFF) - \uXXXX : Hexadecimal based Unicode character
/**
* Unescapes a string that contains standard Java escape sequences.
* <ul>
* <li><strong>&#92;b &#92;f &#92;n &#92;r &#92;t &#92;" &#92;'</strong> :
* BS, FF, NL, CR, TAB, double and single quote.</li>
* <li><strong>&#92;X &#92;XX &#92;XXX</strong> : Octal character
* specification (0 - 377, 0x00 - 0xFF).</li>
* <li><strong>&#92;uXXXX</strong> : Hexadecimal based Unicode character.</li>
* </ul>