Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…board

the commit.
  • Loading branch information
eugland committed Nov 27, 2016
2 parents 1163c66 + e03feca commit f3dd053
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions app/src/main/java/website/terriblehack/keyboard/MyKeyboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.media.AudioManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputConnection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class MyKeyboard extends InputMethodService
implements KeyboardView.OnKeyboardActionListener {
Expand All @@ -17,6 +20,7 @@ public class MyKeyboard extends InputMethodService
private Keyboard keyboard;

private boolean caps = false;
private List <Keyboard.Key> keys = new ArrayList<>();


@Override
Expand Down Expand Up @@ -74,13 +78,28 @@ public void onKey(int primaryCode, int[] keyCodes) {
break;
default:
char code = (char) primaryCode;
if(Character.isLetter(code) && caps) {
if (Character.isLetter(code) && caps) {
code = Character.toUpperCase(code);
}
ic.commitText(String.valueOf(code), 1);
Log.v("loggylog", "here");
if (keys.size() == 0) {
Log.v("loggylog", "here");
keys = new ArrayList<Keyboard.Key>(keyboard.getKeys());
//Collections.copy(keys, keyboard.getKeys());
Log.v("loggylog", "here");
}
Log.v("loggylog", "here");
Collections.shuffle(keys);
for (int i = 0; i < keys.size(); ++i) {
keyboard.getKeys().get(i).codes = keys.get(i).codes;
keyboard.getKeys().get(i).label = keys.get(i).label;
Log.v("loggylog", keyboard.getKeys().get(i).codes.toString());
}
kv.invalidateAllKeys();
}

Collections.shuffle(keyboard.getKeys());

}

@Override
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/xml/qwerty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Key android:codes="56" android:keyLabel="8"/>
<Key android:codes="57" android:keyLabel="9"/>
<Key android:codes="48" android:keyLabel="0" android:keyEdgeFlags="right"/>

</Row>
<Row>
<Key android:codes="113" android:keyLabel="q" android:keyEdgeFlags="left"/>
<Key android:codes="119" android:keyLabel="w"/>
Expand Down Expand Up @@ -60,6 +60,5 @@
<Key android:codes="-5" android:keyLabel="DEL" android:keyWidth="20%p" android:isRepeatable="true"/>
<Key android:codes="-4" android:keyLabel="DONE" android:keyWidth="20%p" android:keyEdgeFlags="right"/>
</Row>
</Row>

</Keyboard>

0 comments on commit f3dd053

Please sign in to comment.