Skip to content

Instantly share code, notes, and snippets.

View MaartenS's full-sized avatar

Maarten MaartenS

View GitHub Profile
@MaartenS
MaartenS / Bottom sheet Android.md
Last active October 24, 2020 03:53
Android snippets #android

##Flipboard style bottom sheet in Android

gradle dependecies

compile 'com.flipboard:bottomsheet-core:1.5.0'
compile 'com.flipboard:bottomsheet-commons:1.5.0' // optional

In view wrap your layout using the BottomSheetLayout

@MaartenS
MaartenS / 0_reuse_code.js
Created February 8, 2016 13:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am maartens on github.
  • I am pythousiast (https://keybase.io/pythousiast) on keybase.
  • I have a public key ASCODaTPU26EwDGEq3Fq16zn9vEnJw6lLlTdQYhy_cq-rAo

To claim this, I am signing this object:

Android - Tools attribute in layouts

The XML tools attributes allow you to see a more clear picture of your complete layout, without writing throwaway code or using dummy values that a user might accidentally see. To use the tools attributes in your XML file, you will first need to add the tools namespace. You can do this by adding xmlns:tools="http://schemas.android.com/tools" to your file’s parent view element. Alternatively, you can start typing tools in any view element, then Opt+Enter (Alt+Enter on Windows) to automatically add the namespace. It’s also a good idea to include context for your tools, so any custom themes and styles are applied to the preview as well. Do this by including tools:context=".MainActivity" in the parent element.

tools:text="title" - Set text on your view only for the layout preview. There is no lint warning for using a hardcoded string here, since it is just for debugging.

tools:src="@drawable/my_img" - Set the image on your view only for the layout preview.

tools:visibi

@MaartenS
MaartenS / sublime_plugins.md
Last active February 15, 2016 12:20
Overview of useful sublime plugins and other sublime useful tips.

Create a symbolic link for sublime

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
@MaartenS
MaartenS / Fish like autosugest.md
Last active February 15, 2016 12:19
Fish like autosuggestion in ow my zsh commandline.
@MaartenS
MaartenS / Android - material spinner.md
Last active February 20, 2019 13:29
example usage of the AppCompatSpinner
<android.support.design.widget.TextInputLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content">

    <android.support.v7.widget.AppCompatSpinner
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        bind:items="@{viewModel.spiinnerItems}" />
@MaartenS
MaartenS / Android - material toggle button.md
Last active February 16, 2016 09:18
Android switch/ toggle button/slider

####view

<android.support.v7.widget.SwitchCompat
        android:id="@+id/Switch"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textOff=""
        android:text="Toggle Switch"
        android:background="@android:color/transparent"
 android:textColor="@color/secondary_text"
@MaartenS
MaartenS / genymotionwithplay.txt
Created February 18, 2016 12:36 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
@MaartenS
MaartenS / Android - slide animation.md
Created February 18, 2016 13:24
Android view slide animation

view_slide_down.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/accelerate_interpolator">
    <translate
        android:duration="500"
        android:fromYDelta="0"
        android:toYDelta="100%p" />
</set>