mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-25 08:43:24 +01:00
Remove the vibration settings
Instead of using the vibrator directly, use performHapticFeedback, which will integrate better with the system settings.
This commit is contained in:
parent
e0131fa6b0
commit
ef03dfed5c
@ -15,10 +15,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">Abstand der Zeichen in den Ecken der Tasten (%s)</string>
|
<string name="pref_swipe_dist_summary">Abstand der Zeichen in den Ecken der Tasten (%s)</string>
|
||||||
<string name="pref_long_timeout_title">Zeitüberschreitung bei Tastenwiederholung</string>
|
<string name="pref_long_timeout_title">Zeitüberschreitung bei Tastenwiederholung</string>
|
||||||
<string name="pref_long_interval_title">Intervall der Tastenwiederholung</string>
|
<string name="pref_long_interval_title">Intervall der Tastenwiederholung</string>
|
||||||
<string name="pref_category_vibrate">Vibration</string>
|
|
||||||
<string name="pref_vibrate_title">Vibration</string>
|
|
||||||
<string name="pref_vibrate_summary">Vibration bei Tastendruck ein-/ausschalten</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Dauer</string>
|
|
||||||
<string name="pref_precise_repeat_title">Präzise Cursorsteuerung</string>
|
<string name="pref_precise_repeat_title">Präzise Cursorsteuerung</string>
|
||||||
<string name="pref_precise_repeat_summary">Geschwindigkeit der Tastenwiederholung durch weniger oder mehr Wischen anpassen</string>
|
<string name="pref_precise_repeat_summary">Geschwindigkeit der Tastenwiederholung durch weniger oder mehr Wischen anpassen</string>
|
||||||
<string name="pref_lockable_keys_title">Sperrbare Hilfstasten</string>
|
<string name="pref_lockable_keys_title">Sperrbare Hilfstasten</string>
|
||||||
|
@ -13,10 +13,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">Distancia de caracteres en las esquinas de las letras (%s)</string>
|
<string name="pref_swipe_dist_summary">Distancia de caracteres en las esquinas de las letras (%s)</string>
|
||||||
<string name="pref_long_timeout_title">Tiempo de espera de repetición de tecla</string>
|
<string name="pref_long_timeout_title">Tiempo de espera de repetición de tecla</string>
|
||||||
<string name="pref_long_interval_title">Intervalo de repetición de tecla</string>
|
<string name="pref_long_interval_title">Intervalo de repetición de tecla</string>
|
||||||
<string name="pref_category_vibrate">Vibración</string>
|
|
||||||
<string name="pref_vibrate_title">Vibración</string>
|
|
||||||
<string name="pref_vibrate_summary">Habilitar/deshabilitar vibración al presionar una tecla</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Duración</string>
|
|
||||||
<string name="pref_precise_repeat_title">Movimientos de cursor preciso</string>
|
<string name="pref_precise_repeat_title">Movimientos de cursor preciso</string>
|
||||||
<string name="pref_precise_repeat_summary">Modular la velocidad de repetición de teclas según si se desliza más o menos</string>
|
<string name="pref_precise_repeat_summary">Modular la velocidad de repetición de teclas según si se desliza más o menos</string>
|
||||||
<string name="pref_lockable_keys_title">Bloqueo de teclas modificadoras</string>
|
<string name="pref_lockable_keys_title">Bloqueo de teclas modificadoras</string>
|
||||||
|
@ -13,10 +13,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">La distance des caractères dans les coins (%s)</string>
|
<string name="pref_swipe_dist_summary">La distance des caractères dans les coins (%s)</string>
|
||||||
<string name="pref_long_timeout_title">Délai avant répétition</string>
|
<string name="pref_long_timeout_title">Délai avant répétition</string>
|
||||||
<string name="pref_long_interval_title">Écart entre répétitions</string>
|
<string name="pref_long_interval_title">Écart entre répétitions</string>
|
||||||
<string name="pref_category_vibrate">Vibration</string>
|
|
||||||
<string name="pref_vibrate_title">Vibreur</string>
|
|
||||||
<string name="pref_vibrate_summary">Vibration a chaque touche</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Durée</string>
|
|
||||||
<string name="pref_precise_repeat_title">Mouvement précis du curseur</string>
|
<string name="pref_precise_repeat_title">Mouvement précis du curseur</string>
|
||||||
<string name="pref_precise_repeat_summary">Modifier la vitesse de répétition en bougeant le doigt</string>
|
<string name="pref_precise_repeat_summary">Modifier la vitesse de répétition en bougeant le doigt</string>
|
||||||
<string name="pref_category_style">Style</string>
|
<string name="pref_category_style">Style</string>
|
||||||
|
@ -13,10 +13,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">키 모서리 문자의 입력 범위 (%s)</string>
|
<string name="pref_swipe_dist_summary">키 모서리 문자의 입력 범위 (%s)</string>
|
||||||
<string name="pref_long_timeout_title">키 길게 누르기 지연</string>
|
<string name="pref_long_timeout_title">키 길게 누르기 지연</string>
|
||||||
<string name="pref_long_interval_title">키 반복 간격</string>
|
<string name="pref_long_interval_title">키 반복 간격</string>
|
||||||
<string name="pref_category_vibrate">진동</string>
|
|
||||||
<string name="pref_vibrate_title">진동</string>
|
|
||||||
<string name="pref_vibrate_summary">키 누를 때 진동 키거/끄기</string>
|
|
||||||
<string name="pref_vibrate_duration_title">지속 시간</string>
|
|
||||||
<string name="pref_precise_repeat_title">정확한 커서 움직임</string>
|
<string name="pref_precise_repeat_title">정확한 커서 움직임</string>
|
||||||
<string name="pref_precise_repeat_summary">더 많거나 적은 스와이프로 키 반복 조절</string>
|
<string name="pref_precise_repeat_summary">더 많거나 적은 스와이프로 키 반복 조절</string>
|
||||||
<string name="pref_category_style">스타일</string>
|
<string name="pref_category_style">스타일</string>
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">Taustiņu stūros esošo rakstzīmju attālums (%s)</string>
|
<string name="pref_swipe_dist_summary">Taustiņu stūros esošo rakstzīmju attālums (%s)</string>
|
||||||
<string name="pref_long_timeout_title">Taustiņa atkārtošanās ātrums</string>
|
<string name="pref_long_timeout_title">Taustiņa atkārtošanās ātrums</string>
|
||||||
<string name="pref_long_interval_title">Taustiņa atkārtošanās aizture</string>
|
<string name="pref_long_interval_title">Taustiņa atkārtošanās aizture</string>
|
||||||
<string name="pref_category_vibrate">Trīcēšana</string>
|
|
||||||
<string name="pref_vibrate_title">Trīcēšana</string>
|
|
||||||
<string name="pref_vibrate_summary">Iespējot/atspējot taustiņa piespiešanas trīcēšanu</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Ilgums</string>
|
|
||||||
<string name="pref_precise_repeat_title">Pielāgojama kursora kustība</string>
|
<string name="pref_precise_repeat_title">Pielāgojama kursora kustība</string>
|
||||||
<string name="pref_precise_repeat_summary">Mainīt taustiņa atkārtošanās ātrumu ar pavilkšanas attālumu</string>
|
<string name="pref_precise_repeat_summary">Mainīt taustiņa atkārtošanās ātrumu ar pavilkšanas attālumu</string>
|
||||||
<string name="pref_lockable_keys_title">Slēdzami pārveidotājtaustiņi</string>
|
<string name="pref_lockable_keys_title">Slēdzami pārveidotājtaustiņi</string>
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">Distância até acionar os cantos das teclas (%s)</string>
|
<string name="pref_swipe_dist_summary">Distância até acionar os cantos das teclas (%s)</string>
|
||||||
<string name="pref_long_timeout_title">Tempo até repetir tecla</string>
|
<string name="pref_long_timeout_title">Tempo até repetir tecla</string>
|
||||||
<string name="pref_long_interval_title">Intervalo de repetição de tecla</string>
|
<string name="pref_long_interval_title">Intervalo de repetição de tecla</string>
|
||||||
<string name="pref_category_vibrate">Vibração</string>
|
|
||||||
<string name="pref_vibrate_title">Vibração</string>
|
|
||||||
<string name="pref_vibrate_summary">Ativar/desativar vibração ao digitar</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Duração</string>
|
|
||||||
<string name="pref_precise_repeat_title">Precisão nos movimentos do cursor</string>
|
<string name="pref_precise_repeat_title">Precisão nos movimentos do cursor</string>
|
||||||
<string name="pref_precise_repeat_summary">Varia a velocidade de repetição a depender do quanto deslizar</string>
|
<string name="pref_precise_repeat_summary">Varia a velocidade de repetição a depender do quanto deslizar</string>
|
||||||
<string name="pref_lockable_keys_title">Teclas traváveis</string>
|
<string name="pref_lockable_keys_title">Teclas traváveis</string>
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">Tuşların köşelerindeki karakterlerin uzaklıkları (%s)</string>
|
<string name="pref_swipe_dist_summary">Tuşların köşelerindeki karakterlerin uzaklıkları (%s)</string>
|
||||||
<string name="pref_long_timeout_title">Tuş tekrarlama beklemesi</string>
|
<string name="pref_long_timeout_title">Tuş tekrarlama beklemesi</string>
|
||||||
<string name="pref_long_interval_title">Tuş tekrarlama aralığı</string>
|
<string name="pref_long_interval_title">Tuş tekrarlama aralığı</string>
|
||||||
<string name="pref_category_vibrate">Titreşim</string>
|
|
||||||
<string name="pref_vibrate_title">Titreşim</string>
|
|
||||||
<string name="pref_vibrate_summary">Tuşa basıldığında titreşimi etkinleştir</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Süre</string>
|
|
||||||
<string name="pref_precise_repeat_title">İmleç hareketini ayarla</string>
|
<string name="pref_precise_repeat_title">İmleç hareketini ayarla</string>
|
||||||
<string name="pref_precise_repeat_summary">Tuş tekrar hızını az ya da çok kaydırarak ayarla</string>
|
<string name="pref_precise_repeat_summary">Tuş tekrar hızını az ya da çok kaydırarak ayarla</string>
|
||||||
<string name="pref_lockable_keys_title">Sabitlenebilir değiştiriciler</string>
|
<string name="pref_lockable_keys_title">Sabitlenebilir değiştiriciler</string>
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">输入按键四角的符号需要滑动的距离 (%s)</string>
|
<string name="pref_swipe_dist_summary">输入按键四角的符号需要滑动的距离 (%s)</string>
|
||||||
<string name="pref_long_timeout_title">长按到开始重复输入的时间</string>
|
<string name="pref_long_timeout_title">长按到开始重复输入的时间</string>
|
||||||
<string name="pref_long_interval_title">长按后每次重复输入的时间间隔</string>
|
<string name="pref_long_interval_title">长按后每次重复输入的时间间隔</string>
|
||||||
<string name="pref_category_vibrate">振动</string>
|
|
||||||
<string name="pref_vibrate_title">振动</string>
|
|
||||||
<string name="pref_vibrate_summary">启用或者禁用按下按键时振动</string>
|
|
||||||
<string name="pref_vibrate_duration_title">每次振动持续的时间</string>
|
|
||||||
<string name="pref_precise_repeat_title">精确控制光标移速</string>
|
<string name="pref_precise_repeat_title">精确控制光标移速</string>
|
||||||
<string name="pref_precise_repeat_summary">按键重复按下速度由手指滑动的距离决定</string>
|
<string name="pref_precise_repeat_summary">按键重复按下速度由手指滑动的距离决定</string>
|
||||||
<string name="pref_lockable_keys_title">组合键锁定</string>
|
<string name="pref_lockable_keys_title">组合键锁定</string>
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
<string name="pref_swipe_dist_summary">Distance of characters in the corners of the keys (%s)</string>
|
<string name="pref_swipe_dist_summary">Distance of characters in the corners of the keys (%s)</string>
|
||||||
<string name="pref_long_timeout_title">Key repeat timeout</string>
|
<string name="pref_long_timeout_title">Key repeat timeout</string>
|
||||||
<string name="pref_long_interval_title">Key repeat interval</string>
|
<string name="pref_long_interval_title">Key repeat interval</string>
|
||||||
<string name="pref_category_vibrate">Vibration</string>
|
|
||||||
<string name="pref_vibrate_title">Vibration</string>
|
|
||||||
<string name="pref_vibrate_summary">Enable/disable vibration on keypress</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Duration</string>
|
|
||||||
<string name="pref_precise_repeat_title">Precise cursor movements</string>
|
<string name="pref_precise_repeat_title">Precise cursor movements</string>
|
||||||
<string name="pref_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
|
<string name="pref_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
|
||||||
<string name="pref_lockable_keys_title">Lockable modifiers</string>
|
<string name="pref_lockable_keys_title">Lockable modifiers</string>
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
<CheckBoxPreference android:key="lockable_box" android:title="Box" android:defaultValue="false"/>
|
<CheckBoxPreference android:key="lockable_box" android:title="Box" android:defaultValue="false"/>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/pref_category_vibrate">
|
|
||||||
<CheckBoxPreference android:key="vibrate_enabled" android:title="@string/pref_vibrate_title" android:summary="@string/pref_vibrate_summary" android:defaultValue="true"/>
|
|
||||||
<juloo.common.IntSlideBarPreference android:key="vibrate_duration" android:title="@string/pref_vibrate_duration_title" android:summary="%sms" android:defaultValue="20" min="5" max="100"/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
<PreferenceCategory android:title="@string/pref_category_style">
|
<PreferenceCategory android:title="@string/pref_category_style">
|
||||||
<ListPreference android:key="theme" android:title="@string/pref_theme" android:summary="%s" android:defaultValue="system" android:entries="@array/pref_theme_entries" android:entryValues="@array/pref_theme_values"/>
|
<ListPreference android:key="theme" android:title="@string/pref_theme" android:summary="%s" android:defaultValue="system" android:entries="@array/pref_theme_entries" android:entryValues="@array/pref_theme_values"/>
|
||||||
<juloo.common.IntSlideBarPreference android:key="margin_bottom" android:title="@string/pref_margin_bottom_title" android:summary="%sdp" android:defaultValue="5" min="0" max="100"/>
|
<juloo.common.IntSlideBarPreference android:key="margin_bottom" android:title="@string/pref_margin_bottom_title" android:summary="%sdp" android:defaultValue="5" min="0" max="100"/>
|
||||||
|
@ -26,8 +26,6 @@ final class Config
|
|||||||
public int layout; // Or '-1' for the system defaults
|
public int layout; // Or '-1' for the system defaults
|
||||||
public int programming_layout; // Or '-1' for none
|
public int programming_layout; // Or '-1' for none
|
||||||
public float swipe_dist_px;
|
public float swipe_dist_px;
|
||||||
public boolean vibrateEnabled;
|
|
||||||
public long vibrateDuration;
|
|
||||||
public long longPressTimeout;
|
public long longPressTimeout;
|
||||||
public long longPressInterval;
|
public long longPressInterval;
|
||||||
public float marginBottom;
|
public float marginBottom;
|
||||||
@ -62,8 +60,6 @@ final class Config
|
|||||||
// default values
|
// default values
|
||||||
layout = -1;
|
layout = -1;
|
||||||
programming_layout = -1;
|
programming_layout = -1;
|
||||||
vibrateEnabled = true;
|
|
||||||
vibrateDuration = 20;
|
|
||||||
longPressTimeout = 600;
|
longPressTimeout = 600;
|
||||||
longPressInterval = 65;
|
longPressInterval = 65;
|
||||||
marginBottom = res.getDimension(R.dimen.margin_bottom);
|
marginBottom = res.getDimension(R.dimen.margin_bottom);
|
||||||
@ -119,8 +115,6 @@ final class Config
|
|||||||
// Take the mean of both dimensions as an approximation of the diagonal.
|
// Take the mean of both dimensions as an approximation of the diagonal.
|
||||||
float physical_scaling = (dm.widthPixels + dm.heightPixels) / (dm.xdpi + dm.ydpi);
|
float physical_scaling = (dm.widthPixels + dm.heightPixels) / (dm.xdpi + dm.ydpi);
|
||||||
swipe_dist_px = Float.valueOf(prefs.getString("swipe_dist", "15")) * physical_scaling;;
|
swipe_dist_px = Float.valueOf(prefs.getString("swipe_dist", "15")) * physical_scaling;;
|
||||||
vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
|
|
||||||
vibrateDuration = prefs.getInt("vibrate_duration", (int)vibrateDuration);
|
|
||||||
longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
|
longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
|
||||||
longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
|
longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
|
||||||
marginBottom = getDipPref(dm, prefs, "margin_bottom", marginBottom);
|
marginBottom = getDipPref(dm, prefs, "margin_bottom", marginBottom);
|
||||||
|
@ -7,9 +7,9 @@ import android.graphics.Paint;
|
|||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
import android.os.Build.VERSION;
|
import android.os.Build.VERSION;
|
||||||
import android.os.Vibrator;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -26,7 +26,6 @@ public class Keyboard2View extends View
|
|||||||
|
|
||||||
private Pointers.Modifiers _mods;
|
private Pointers.Modifiers _mods;
|
||||||
|
|
||||||
private Vibrator _vibratorService;
|
|
||||||
private long _lastVibration = 0;
|
private long _lastVibration = 0;
|
||||||
|
|
||||||
private static int _currentWhat = 0;
|
private static int _currentWhat = 0;
|
||||||
@ -49,7 +48,6 @@ public class Keyboard2View extends View
|
|||||||
public Keyboard2View(Context context, AttributeSet attrs)
|
public Keyboard2View(Context context, AttributeSet attrs)
|
||||||
{
|
{
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
_vibratorService = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
_theme = new Theme(getContext(), attrs);
|
_theme = new Theme(getContext(), attrs);
|
||||||
_config = Config.globalConfig();
|
_config = Config.globalConfig();
|
||||||
_pointers = new Pointers(this, _config);
|
_pointers = new Pointers(this, _config);
|
||||||
@ -191,19 +189,14 @@ public class Keyboard2View extends View
|
|||||||
|
|
||||||
private void vibrate()
|
private void vibrate()
|
||||||
{
|
{
|
||||||
if (!_config.vibrateEnabled)
|
|
||||||
return ;
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if ((now - _lastVibration) > VIBRATE_MIN_INTERVAL)
|
if ((now - _lastVibration) > VIBRATE_MIN_INTERVAL)
|
||||||
{
|
{
|
||||||
_lastVibration = now;
|
_lastVibration = now;
|
||||||
try
|
if (VERSION.SDK_INT >= 5)
|
||||||
{
|
{
|
||||||
_vibratorService.vibrate(_config.vibrateDuration);
|
performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
|
||||||
}
|
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user