This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (a) { | |
a.fn.replaceTag = function (f) { | |
var g = [], h = this.length; | |
while (h--) { | |
var k = document.createElement(f), b = this[h], d = b.attributes; | |
for (var c = d.length - 1; c >= 0; c--) { | |
var j = d[c]; | |
k.setAttribute(j.name, j.value) | |
} | |
k.innerHTML = b.innerHTML; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/14777593/android-textwatcher-saving-batches-of-similar-changes-for-undo-redo | |
public class UndoRedoHelper { | |
private static final String TAG = UndoRedoHelper.class.getCanonicalName(); | |
private boolean mIsUndoOrRedo = false; | |
private EditHistory mEditHistory; | |
private EditTextChangeListener mChangeListener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<p>If the language you speak is not on the list, you can include it in the URL</p> | |
<select><script> | |
var option = decodeURIComponent(document.location.hash.substring(1)); | |
document.write("<OPTION value=1>English</OPTION>"); | |
document.write("<OPTION value=2>French</OPTION>"); | |
document.write("<OPTION value=3>"+option+"</OPTION>"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Language detection and translation thanks to the Google language APIs | |
// Script inspired by Glen Smith's article: | |
// http://blogs.bytecode.com.au/glen/2009/07/30/getting-groovy-with-google-language-translation-apis.html | |
def text = URLEncoder.encode("J'ai envie de manger des fraises", "UTF-8") | |
def detectUrl = "http://www.google.com/uds/GlangDetect?v=1.0&q=${text}".toURL() | |
def langGuessResponse = jsonToGroovyMap(detectUrl.text) | |
def lang = langGuessResponse.responseData.language |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int longClickDuration = 3000; | |
private boolean isLongPress = false; | |
numEquipeCheat.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
if (event.getAction() == MotionEvent.ACTION_DOWN) { | |
isLongPress = true; | |
Handler handler = new Handler(); | |
handler.postDelayed(new Runnable() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EditText editText = new EditText(this) { | |
@Override | |
public InputConnection onCreateInputConnection(EditorInfo editorInfo) { | |
final InputConnection ic = super.onCreateInputConnection(editorInfo); | |
EditorInfoCompat.setContentMimeTypes(editorInfo, | |
new String [] {"image/png"}); | |
final InputConnectionCompat.OnCommitContentListener callback = | |
new InputConnectionCompat.OnCommitContentListener() { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wordbar.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View view, MotionEvent motionEvent) { | |
System.out.println(view+" "+motionEvent); | |
if (motionEvent.getX() < 0 || motionEvent.getX() > popupWindow.getWidth()) return true; | |
if (motionEvent.getY() < 0 || motionEvent.getY() > popupWindow.getHeight()) return true; | |
return false; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void makeKeyboardTransparent(InputMethodService service) { | |
try { | |
View decorView = service.getWindow().getWindow().getDecorView(); | |
final int viewId = fetchInternalRId("fullscreenArea"); | |
View fullscreenArea = decorView.findViewById(viewId); | |
if (fullscreenArea != null) { | |
modifyView(fullscreenArea); | |
return; | |
} | |
} catch (Exception e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float x1, x2, y1, y2, dx, dy; | |
String direction; | |
boolean isDown = false; | |
Keyboard.Key activeKey; | |
public String getDirection(MotionEvent me) { | |
switch(me.getAction()) { | |
case MotionEvent.ACTION_DOWN: { | |
isDown = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package name.boyle.chris.sgtpuzzles; | |
import java.util.ArrayList; | |
import java.util.LinkedHashMap; | |
import java.util.List; | |
import java.util.Map; | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.content.SharedPreferences; |
NewerOlder