mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
bugfix in the android keyboard for the choice of language
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<TableLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -17,4 +17,4 @@
|
|||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</TableLayout>
|
||||||
@@ -10,8 +10,9 @@ import android.view.Gravity;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
|
import android.widget.TableLayout;
|
||||||
|
import android.widget.TableRow;
|
||||||
|
|
||||||
public class TranslatorKeyboardView extends KeyboardView {
|
public class TranslatorKeyboardView extends KeyboardView {
|
||||||
|
|
||||||
@@ -34,18 +35,26 @@ public class TranslatorKeyboardView extends KeyboardView {
|
|||||||
if (mLanguagesPopup == null) {
|
if (mLanguagesPopup == null) {
|
||||||
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
|
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
|
||||||
Context.LAYOUT_INFLATER_SERVICE);
|
Context.LAYOUT_INFLATER_SERVICE);
|
||||||
LinearLayout popupContainer = (LinearLayout)
|
TableLayout popupContainer = (TableLayout)
|
||||||
inflater.inflate(R.layout.keyboard_languages_options, null);
|
inflater.inflate(R.layout.keyboard_languages_options, null);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
TableRow row = null;
|
||||||
for (Language lang : mTranslator.getAvailableLanguages()) {
|
for (Language lang : mTranslator.getAvailableLanguages()) {
|
||||||
|
int col_index = index % 4;
|
||||||
|
if (col_index == 0) {
|
||||||
|
row = new TableRow(getContext());
|
||||||
|
popupContainer.addView(row);
|
||||||
|
}
|
||||||
|
|
||||||
Button item = new Button(getContext());
|
Button item = new Button(getContext());
|
||||||
item.setText(TranslatorKeyboard.getLanguageKeyLabel(lang));
|
item.setText(TranslatorKeyboard.getLanguageKeyLabel(lang));
|
||||||
item.setTag(index);
|
item.setTag(index);
|
||||||
item.setOnClickListener(this);
|
item.setOnClickListener(this);
|
||||||
popupContainer.addView(item, index++);
|
row.addView(item, col_index);
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
popupContainer.measure(
|
popupContainer.measure(
|
||||||
MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),
|
MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),
|
||||||
MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST));
|
MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST));
|
||||||
|
|||||||
Reference in New Issue
Block a user