Skip to content

Instantly share code, notes, and snippets.

View shihabmi7's full-sized avatar
🎯
Focusing

Muhammad Shihab Uddin shihabmi7

🎯
Focusing
  • Dhaka, Bangladesh
View GitHub Profile
@shihabmi7
shihabmi7 / DemoFoodListAdapter
Last active October 6, 2015 09:22
Pinned Section Listview
public class DemoFoodListAdapter extends BaseAdapter implements PinnedSectionListAdapter{
// i am following this library @aamir & @sweetwisher
// https://github.com/beworker/pinned-section-listview
private final Context mContext;
ArrayList<Food> foodList;
DisplayImageOptions options;
ImageLoader imageLoader = ImageLoader.getInstance();
@shihabmi7
shihabmi7 / gist:6db21ceed3c73e97d80d
Last active November 21, 2015 04:47
Sliding Menu Code
compile project('libraries:sliding_menu_library')
public void initializeSlidingMenu() {
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setBehindOffset(200);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.activity_sliding_menu);
public void imageSlider() {
final Handler mHandler = new Handler();
// Create runnable for posting
final Runnable mUpdateResults = new Runnable() {
public void run() {
AnimateandSlideShow();
@shihabmi7
shihabmi7 / gist:44906e0d9962e22b67f0
Created November 21, 2015 05:09
Google Map Location
private GoogleApiClient mGoogleApiClient;
private LocationRequest mLocationRequest;
protected Location mLastLocation;
protected synchronized void buildGoogleApiClient() {
// set which Service API you used
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
@shihabmi7
shihabmi7 / build.gradle
Last active December 1, 2016 06:19 — forked from jackgris/build.gradle
Example of use from Proguard, from Android Studio
buildscript {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'
@shihabmi7
shihabmi7 / ImagePicker.java
Created May 29, 2016 05:18 — forked from Mariovc/ ImagePicker.java
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
byte[] convertBitMapToByteArray(Bitmap bmp) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
return byteArray;
}
@shihabmi7
shihabmi7 / Text Marquee
Created June 23, 2016 04:42
Text Marquee
<TextView
android:id="@+id/textView_News_HeadLine"
style="@style/black_extra_large_heading_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="8dp"
android:ellipsize="marquee"
android:marqueeRepeatLimit="-1"
android:singleLine="true"
@shihabmi7
shihabmi7 / Avoid starting activity which is already in stack
Created June 23, 2016 04:44
Avoid starting activity which is already in stack?
android:launchMode="singleInstance"
# add this to your activity
@shihabmi7
shihabmi7 / Action Bar Heads Up Display
Created June 23, 2016 04:45
Action Bar Heads Up Display: Check Home Page & Set Back Button
ActionBar mActionBar = getSupportActionBar();
// checking either this is home actiivty or not for
// ActionBar.DISPLAY_HOME_AS_UP
if (this.getClass().getSimpleName()
.equalsIgnoreCase(RestaurentListActivity.class.getSimpleName())) {
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE
| ActionBar.DISPLAY_SHOW_CUSTOM
| ActionBar.DISPLAY_SHOW_HOME);
} else {