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
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android" | |
android:keyWidth="10%p" | |
android:keyHeight="7%p" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> | |
<!-- <Row></Row> --> | |
<Row android:keyWidth="9.09%p"> | |
<Key android:codes="-25" android:keyIcon="@drawable/ic_double_pointer_left" /> | |
<Key android:codes="-26" android:keyIcon="@drawable/ic_double_pointer_right" /> | |
<Key android:codes="-108" android:keyIcon="@drawable/ic_arrow_left" android:isRepeatable="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
/* | |
* Copyright (C) 2008-2009 Google Inc. | |
* | |
* 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 |
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 sra.keyboard; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.view.View.OnClickListener; | |
import android.view.View.OnFocusChangeListener; | |
import android.view.View.OnTouchListener; | |
import android.view.WindowManager; |
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 com.custom.keyboard; | |
import android.content.SharedPreferences; | |
import android.preference.PreferenceManager; | |
// import androidx.appcompat.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.View; | |
import top.defaults.colorpicker.ColorPickerPopup; |
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 boolean getPresentationShown() { | |
try { | |
return PreferenceManager.getDefaultSharedPreferences(this).getBoolean("presentation", false); | |
} | |
catch (Exception e) { | |
return false; | |
} | |
} | |
public void setPresentationShown() { |
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 void layoutAndShowPopupWindow(Key key, int xPosition) { | |
popupWindow = new PopupWindow(popupView, | |
LinearLayout.LayoutParams.WRAP_CONTENT, | |
LinearLayout.LayoutParams.WRAP_CONTENT); | |
popupWindow.setClippingEnabled(false);// <-- let popup display above keyboard | |
int location[] = new int[2]; | |
key.getLocationInWindow(location); | |
int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); | |
popupView.measure(measureSpec, measureSpec); | |
int popupWidth = popupView.getMeasuredWidth(); |
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
String bg = sharedPreferences.getString("bg", "#FF000000"); | |
int[] bgc = Util.fromColor(bg); | |
float[] sCustomColorArray = { | |
1.0f, 0, 0, 0, bgc[1], // red | |
0, 1.0f, 0, 0, bgc[2], // green | |
0, 0, 1.0f, 0, bgc[3], // blue | |
0, 0, 0, 1.0f, bgc[0] // alpha | |
}; | |
mDefaultFilter = sCustomColorArray; |
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
static Integer[] performLottery(int numNumbers, int numbersToPick) { | |
List<Integer> numbers = new ArrayList<>(); | |
for(int i = 0; i < numNumbers; i++) numbers.add(i + 1); | |
Collections.shuffle(numbers); | |
return numbers.subList(0, numbersToPick).toArray(new Integer[numbersToPick]); | |
} |
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
static int factorial(int number) { | |
int result = 1; | |
for (int factor = 2; factor <= number; factor++) { | |
result *= factor; | |
} | |
return result; | |
} |
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
static boolean isPalindrome(String s) { | |
StringBuilder sb = new StringBuilder(); | |
for (char c : s.toCharArray()) { | |
if (Character.isLetter(c)) { | |
sb.append(c); | |
} | |
} | |
String forward = sb.toString().toLowerCase(); | |
String backward = sb.reverse().toString().toLowerCase(); | |
return forward.equals(backward); |