mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-19 08:20:15 +00:00
Add icon to layout for paste
Still TODOs for implementing the feature, creating a toggle to enable it, and icons for the button
This commit is contained in:
parent
b5934f3841
commit
6c500e731b
2 changed files with 48 additions and 26 deletions
|
@ -66,6 +66,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
|
||||
private final ViewGroup mSuggestionsStrip;
|
||||
private final ImageButton mVoiceKey;
|
||||
private final ImageButton mPasteKey;
|
||||
private final ImageButton mOtherKey;
|
||||
MainKeyboardView mMainKeyboardView;
|
||||
|
||||
|
@ -126,6 +127,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
|
||||
mSuggestionsStrip = findViewById(R.id.suggestions_strip);
|
||||
mVoiceKey = findViewById(R.id.suggestions_strip_voice_key);
|
||||
mPasteKey = findViewById(R.id.suggestions_strip_paste_key);
|
||||
mOtherKey = findViewById(R.id.suggestions_strip_other_key);
|
||||
mStripVisibilityGroup = new StripVisibilityGroup(this, mSuggestionsStrip);
|
||||
|
||||
|
@ -161,9 +163,13 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
R.styleable.Keyboard, defStyle, R.style.SuggestionStripView);
|
||||
final Drawable iconVoice = keyboardAttr.getDrawable(R.styleable.Keyboard_iconShortcutKey);
|
||||
final Drawable iconIncognito = keyboardAttr.getDrawable(R.styleable.Keyboard_iconIncognitoKey);
|
||||
//TODO: create and set a different icon for this
|
||||
final Drawable iconPaste = keyboardAttr.getDrawable(R.styleable.Keyboard_iconShortcutKey);
|
||||
keyboardAttr.recycle();
|
||||
mVoiceKey.setImageDrawable(iconVoice);
|
||||
mVoiceKey.setOnClickListener(this);
|
||||
mPasteKey.setImageDrawable(iconPaste);
|
||||
mPasteKey.setOnClickListener(this);
|
||||
|
||||
mOtherKey.setImageDrawable(iconIncognito);
|
||||
}
|
||||
|
@ -181,7 +187,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
final int visibility = shouldBeVisible ? VISIBLE : (isFullscreenMode ? GONE : INVISIBLE);
|
||||
setVisibility(visibility);
|
||||
final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent();
|
||||
mVoiceKey.setVisibility(currentSettingsValues.mShowsVoiceInputKey ? VISIBLE : INVISIBLE);
|
||||
//TODO: set either mVoiceKey or mPasteKey to INVISIBLE if the other is GONE
|
||||
mVoiceKey.setVisibility(currentSettingsValues.mShowsVoiceInputKey ? VISIBLE : GONE);
|
||||
//TODO: read visibility from settings
|
||||
mPasteKey.setVisibility(VISIBLE);
|
||||
mOtherKey.setVisibility(currentSettingsValues.mIncognitoModeEnabled ? VISIBLE : INVISIBLE);
|
||||
}
|
||||
|
||||
|
@ -413,6 +422,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
false /* isKeyRepeat */);
|
||||
return;
|
||||
}
|
||||
if (view == mPasteKey) {
|
||||
//TODO: fill in
|
||||
return;
|
||||
}
|
||||
|
||||
final Object tag = view.getTag();
|
||||
// {@link Integer} tag is set at
|
||||
|
|
|
@ -20,34 +20,43 @@
|
|||
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Provide audio and haptic feedback by ourselves based on the keyboard settings.
|
||||
We just need to ignore the system's audio and haptic feedback settings. -->
|
||||
<LinearLayout
|
||||
android:id="@+id/suggestions_strip"
|
||||
android:id="@+id/suggestions_strip_wrapper"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/config_suggestions_strip_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/config_suggestions_strip_horizontal_margin"
|
||||
android:hapticFeedbackEnabled="false"
|
||||
android:soundEffectsEnabled="false" />
|
||||
android:soundEffectsEnabled="false">
|
||||
<!-- Provide audio and haptic feedback by ourselves based on the keyboard settings.
|
||||
We just need to ignore the system's audio and haptic feedback settings. -->
|
||||
<ImageButton
|
||||
android:id="@+id/suggestions_strip_other_key"
|
||||
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_weight="0"
|
||||
style="?attr/suggestionWordStyle"
|
||||
android:contentDescription="@string/more_keys_strip_description" />
|
||||
<!-- Provide audio and haptic feedback by ourselves based on the keyboard settings.
|
||||
We just need to ignore the system's audio and haptic feedback settings. -->
|
||||
<LinearLayout
|
||||
android:id="@+id/suggestions_strip"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:hapticFeedbackEnabled="false"
|
||||
android:soundEffectsEnabled="false" />
|
||||
<ImageButton
|
||||
android:id="@+id/suggestions_strip_voice_key"
|
||||
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@string/spoken_description_mic"
|
||||
style="?attr/suggestionWordStyle" />
|
||||
<ImageButton
|
||||
android:id="@+id/suggestions_strip_paste_key"
|
||||
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
|
||||
android:layout_height="fill_parent"
|
||||
android:contentDescription="@string/spoken_description_mic"
|
||||
style="?attr/suggestionWordStyle" />
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue