mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Use system haptic feedback instead of custom vibration; enable on short press
Closes #66
This commit is contained in:
@@ -24,8 +24,6 @@
|
||||
android:versionCode="13"
|
||||
android:versionName="1.3.3">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="18" />
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.support.annotation.Nullable;
|
||||
import android.view.ActionMode;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -322,7 +323,6 @@ public class ListHabitsFragment extends Fragment
|
||||
if (isShortToggleEnabled) return;
|
||||
|
||||
toggleCheck(v);
|
||||
DialogHelper.vibrate(activity, 100);
|
||||
}
|
||||
|
||||
private void toggleCheck(View v)
|
||||
@@ -335,6 +335,8 @@ public class ListHabitsFragment extends Fragment
|
||||
Habit habit = loader.habits.get(tag);
|
||||
if(habit == null) return;
|
||||
|
||||
listView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
|
||||
helper.toggleCheckmarkView(v, habit);
|
||||
executeCommand(new ToggleRepetitionCommand(habit, timestamp), habit.getId());
|
||||
}
|
||||
|
||||
@@ -52,13 +52,6 @@ public abstract class DialogHelper
|
||||
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
|
||||
public static void vibrate(Context context, int duration)
|
||||
{
|
||||
Vibrator vb = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
vb.vibrate(duration);
|
||||
}
|
||||
|
||||
|
||||
public static void incrementLaunchCount(Context context)
|
||||
{
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
@@ -190,6 +190,7 @@ public class ListHabitsHelper
|
||||
btCheck.setTypeface(fontawesome);
|
||||
btCheck.setOnLongClickListener(onLongClickListener);
|
||||
btCheck.setOnClickListener(onClickListener);
|
||||
btCheck.setHapticFeedbackEnabled(false);
|
||||
((LinearLayout) view.findViewById(R.id.llButtons)).addView(check);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user