Skip to content

Instantly share code, notes, and snippets.

View seemike's full-sized avatar

seemike

  • Mike Groezinger
  • Konstanz, Germany
  • 14:18 (UTC +02:00)
View GitHub Profile
@seemike
seemike / ActivityWithShareActions.java
Last active December 21, 2015 22:39
Android 4.0 share items on action bar (API Level 14 ICS )
public static final String SHARE_URL = "shareUrl";
public static final String SHARE_TITLE = "shareTitle";
private ShareActionProvider mShareActionProvider;
private String shareUrl;
private String shareTitle;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
@seemike
seemike / edittext-with-restricted-input.xml
Last active March 16, 2022 18:37
Android: restrict EditText field input to alphanumeric characters
<EditText
android:inputType="textNoSuggestions"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
/>
@seemike
seemike / SendEmailIntent.java
Last active December 22, 2015 06:58
Android: send an email. Lets the user select the email app if there is more than one
/**
* send an email. Lets the user select the email app if there is more than one
* @param to
* @param subject
* @param body
*/
void email(String to, String subject, String body){
//mailto url
to = to == null ? "" :to;
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" +to +"?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body)));
@seemike
seemike / AndroidManifest.xml
Last active December 22, 2015 21:39
Android: extended SearchView with a toggle to the right, behaving like iOS toggle
<activity android:name=".SearchableActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<!-- note: this is needed to show a keyboard with proposals -->
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
@seemike
seemike / RefineSearchDialogFragment.java
Created October 2, 2013 07:40
android non-model dialog fragment with other behind
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.setTitle("Suche verfeinern");
//set the dialog to non-modal and disable dim out fragment behind
Window window = dialog.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
@seemike
seemike / RefineSearchDialogFragment.java
Created October 9, 2013 11:06
android dialog attributes - modal, dim background, notitle
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
//set the dialog to non-modal and disable dim out fragment behind
Window window = dialog.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
//blur out the background
@seemike
seemike / MyDialogFragment.java
Created October 29, 2013 12:32
android: set size of the dialog window
@Override
public void onStart() {
super.onStart();
Log.d(LOG_TAG, "onStart");
if(null == getDialog()) return;
int dialogWidth = 300;
int dialogHeight = 400;
@seemike
seemike / custom_rules.xml
Last active December 28, 2015 00:39
Android ant build - removes Log.v verbose logging statements in sources
<?xml version="1.0" encoding="UTF-8"?>
<project name="release-custumrules">
<target name="-pre-build">
<tstamp>
<format property="builddate" pattern="dd.MM.yyyy HH:mm:ss" locale="de,CH" />
</tstamp>
<if condition="${build.is.packaging.debug}">
@seemike
seemike / gist:8452297
Created January 16, 2014 09:45
JSF if
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<ui:fragment rendered="#{null != journey}">
only shown if journey not null.
@seemike
seemike / data.sql
Last active November 30, 2016 10:18
cleancode: SQL statements: readable so you can see which value belong to which column
INSERT INTO HandlingUnitCodeRange (PK_ID, plant, storageLocation, prefix , minRange, maxRange, nextValue, active)
VALUES ( 1, '5000', '', '08150815', 100000, 150000, 100000, true);