Skip to content

Commit 5a451a4

Browse files
committed
Merge branch 'less-hungarian-naming'
2 parents 40261f3 + df8f2bb commit 5a451a4

9 files changed

Lines changed: 157 additions & 160 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
## [Unreleased]
55

66
- Rewrote `addCodePointsToSet` as `toCodePointSet`
7+
- Eliminated suffix Hungarian notation outside method names
78
- Tweaked Help > Miscellaneous explanations
89
- Put Function column before Action column in table
910
- Moved 'Retract keyboard' explanation into table

app/src/main/java/io/github/yawnoc/strokeinput/CandidatesViewAdapter.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public class CandidatesViewAdapter
2727
{
2828
private CandidateListener candidateListener;
2929
private final LayoutInflater layoutInflater;
30-
private final List<String> candidateList;
30+
private final List<String> candidates;
3131

32-
CandidatesViewAdapter(final Context context, final List<String> candidateList)
32+
CandidatesViewAdapter(final Context context, final List<String> candidates)
3333
{
3434
this.layoutInflater = LayoutInflater.from(context);
35-
this.candidateList = candidateList;
35+
this.candidates = candidates;
3636
}
3737

3838
public interface CandidateListener
@@ -46,10 +46,10 @@ public void setCandidateListener(final CandidateListener candidateListener)
4646
}
4747

4848
@SuppressLint("NotifyDataSetChanged")
49-
public void updateCandidateList(final List<String> candidateList)
49+
public void updateCandidates(final List<String> candidates)
5050
{
51-
this.candidateList.clear();
52-
this.candidateList.addAll(candidateList);
51+
this.candidates.clear();
52+
this.candidates.addAll(candidates);
5353
notifyDataSetChanged();
5454
}
5555

@@ -64,14 +64,14 @@ public ButtonHolder onCreateViewHolder(@NonNull final ViewGroup viewGroup, final
6464
@Override
6565
public void onBindViewHolder(@NonNull final ButtonHolder buttonHolder, final int candidateIndex)
6666
{
67-
final String candidate = candidateList.get(candidateIndex);
67+
final String candidate = candidates.get(candidateIndex);
6868
buttonHolder.candidateButton.setText(candidate);
6969
}
7070

7171
@Override
7272
public int getItemCount()
7373
{
74-
return candidateList.size();
74+
return candidates.size();
7575
}
7676

7777
public class ButtonHolder

app/src/main/java/io/github/yawnoc/strokeinput/InputContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ public void setStrokeDigitSequence(final String strokeDigitSequence)
143143
strokeSequenceBar.setStrokeDigitSequence(strokeDigitSequence);
144144
}
145145

146-
public void setCandidateList(final List<String> candidateList)
146+
public void setCandidates(final List<String> candidates)
147147
{
148-
candidatesViewAdapter.updateCandidateList(candidateList);
148+
candidatesViewAdapter.updateCandidates(candidates);
149149
candidatesView.scrollToPosition(0);
150150
}
151151

app/src/main/java/io/github/yawnoc/strokeinput/Key.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ public boolean containsPoint(final int x, final int y)
167167
&&
168168
(this.isExtendedRight || x <= this.x + this.width)
169169
&&
170-
this.y <= y && y <= this.y + this.height
170+
this.y <= y
171+
&&
172+
y <= this.y + this.height
171173
);
172174
}
173175

app/src/main/java/io/github/yawnoc/strokeinput/KeyPreviewPlane.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class KeyPreviewPlane
3939
private int width;
4040
private int height;
4141
private int keyboardHeight;
42-
private final List<Key> keyList = new ArrayList<>();
42+
private final List<Key> keys = new ArrayList<>();
4343
private Key latestKey;
4444
private int shiftMode = KeyboardView.SHIFT_DISABLED;
4545

@@ -77,7 +77,7 @@ private void initialiseDismissalHandler()
7777
public void handleMessage(@NonNull Message message)
7878
{
7979
Key key = (Key) message.obj;
80-
keyList.remove(key);
80+
keys.remove(key);
8181
invalidate();
8282
}
8383
};
@@ -117,17 +117,17 @@ public void updateShiftMode(final int shiftMode)
117117

118118
public void showPreviewAt(final Key key)
119119
{
120-
if (key != null && !keyList.contains(key) && key.isPreviewable)
120+
if (key != null && !keys.contains(key) && key.isPreviewable)
121121
{
122-
keyList.add(key);
122+
keys.add(key);
123123
}
124124
latestKey = key;
125125
invalidate();
126126
}
127127

128128
public void movePreviewTo(final Key key)
129129
{
130-
keyList.remove(latestKey);
130+
keys.remove(latestKey);
131131
showPreviewAt(key);
132132
}
133133

@@ -141,15 +141,15 @@ public void dismissLatest()
141141

142142
public void dismissAllImmediately()
143143
{
144-
keyList.clear();
144+
keys.clear();
145145
latestKey = null;
146146
invalidate();
147147
}
148148

149149
@Override
150150
public void onDraw(@NonNull final Canvas canvas)
151151
{
152-
for (final Key key : keyList)
152+
for (final Key key : keys)
153153
{
154154
final int keyPreviewWidth = (int) (key.previewMagnification * key.width);
155155
final int keyPreviewHeight = (int) (key.previewMagnification * key.height);

app/src/main/java/io/github/yawnoc/strokeinput/Keyboard.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class Keyboard
6969
private final Context applicationContext;
7070
private int width;
7171
private int height, naturalHeight;
72-
private final List<Key> keyList;
72+
private final List<Key> keys;
7373
public int fillColour;
7474

7575
// Key properties
@@ -107,15 +107,15 @@ public Keyboard(final Context context, final int layoutResourceId)
107107
defaultKeyTextSizePx = (int) Valuey.pxFromSp(DEFAULT_KEY_TEXT_SIZE_SP, displayMetrics);
108108
defaultKeyPreviewMarginYPx = (int) Valuey.pxFromDp(DEFAULT_KEY_PREVIEW_MARGIN_Y_DP, displayMetrics);
109109

110-
keyList = new ArrayList<>();
110+
keys = new ArrayList<>();
111111

112112
makeKeyboard(context, resources.getXml(layoutResourceId));
113113
adjustKeyboardHeight();
114114
}
115115

116-
public List<Key> getKeyList()
116+
public List<Key> getKeys()
117117
{
118-
return keyList;
118+
return keys;
119119
}
120120

121121
public int getWidth()
@@ -176,7 +176,7 @@ private void makeKeyboard(final Context context, final XmlResourceParser xmlReso
176176
case KEY_TAG:
177177
inKey = true;
178178
key = new Key(row, x, y, resources, xmlResourceParser);
179-
keyList.add(key);
179+
keys.add(key);
180180
break;
181181
}
182182
break;
@@ -210,7 +210,7 @@ else if (inRow)
210210
public void correctKeyboardWidth(int inputContainerWidth)
211211
{
212212
final float correctionFactor = ((float) inputContainerWidth) / screenWidth;
213-
for (final Key key : keyList)
213+
for (final Key key : keys)
214214
{
215215
key.x = (int) (key.naturalX * correctionFactor);
216216
key.width = (int) (key.naturalWidth * correctionFactor);
@@ -224,7 +224,7 @@ public void adjustKeyboardHeight()
224224
final float userAdjustmentFactor = MainActivity.keyboardHeightAdjustmentProgressToFactor(userAdjustmentProgress);
225225
final float actualAdjustmentFactor =
226226
Math.min(userAdjustmentFactor, KEYBOARD_HEIGHT_MAX_FRACTION * screenHeight / naturalHeight);
227-
for (final Key key : keyList)
227+
for (final Key key : keys)
228228
{
229229
key.y = (int) (key.naturalY * actualAdjustmentFactor);
230230
key.height = (int) (key.naturalHeight * actualAdjustmentFactor);

app/src/main/java/io/github/yawnoc/strokeinput/KeyboardView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class KeyboardView
7272
private LinearLayout mainInputPlane;
7373
private KeyPreviewPlane keyPreviewPlane;
7474
private Keyboard keyboard;
75-
private List<Key> keyList;
75+
private List<Key> keys;
7676

7777
// Active key
7878
private Key activeKey;
@@ -196,7 +196,7 @@ public void setKeyboard(final Keyboard keyboard)
196196
{
197197
keyboardListener.saveKeyboard(keyboard);
198198
this.keyboard = keyboard;
199-
keyList = keyboard.getKeyList();
199+
keys = keyboard.getKeys();
200200
keyboardFillPaint.setColor(keyboard.fillColour);
201201
if (shiftMode != SHIFT_PERSISTENT)
202202
{
@@ -256,7 +256,7 @@ public void onDraw(@NonNull final Canvas canvas)
256256

257257
canvas.drawRect(keyboardRectangle, keyboardFillPaint);
258258

259-
for (final Key key : keyList)
259+
for (final Key key : keys)
260260
{
261261
keyRectangle.set(0, 0, key.width, key.height);
262262

@@ -623,7 +623,7 @@ private void sendShiftUpEvent(boolean shouldRedrawKeyboard)
623623

624624
private Key getKeyAtPoint(final int x, final int y)
625625
{
626-
for (final Key key : keyList)
626+
for (final Key key : keys)
627627
{
628628
if (key.containsPoint(x, y))
629629
{

0 commit comments

Comments
 (0)