Skip to content

Instantly share code, notes, and snippets.

View PomepuyN's full-sized avatar

Nicolas POMEPUY PomepuyN

View GitHub Profile
@PomepuyN
PomepuyN / Watch face Ambient mode detection
Last active November 5, 2018 23:07
Allow to detect Ambient mode to switch Watch face display on Wear devices
View Watch face Ambient mode detection
Handler handler = new Handler(Looper.getMainLooper());
final DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
displayManager.registerDisplayListener(new DisplayManager.DisplayListener() {
@Override
public void onDisplayAdded(int displayId) {
}
@Override
@PomepuyN
PomepuyN / gist:7b29e2592d39d687e95a
Last active August 29, 2015 14:06
Request Wear Mini Launcher to be disabled on your app
View gist:7b29e2592d39d687e95a

As Wear Mini launcher constantly retain a zone of the screen from being touched, it may cause issue with your app. Here is how you can disable it when your app is running.

Manifest

Add this line to your Manifest. Wear Mini Launcher will retrieve this meta to put your app in the exclusion list by default (the user will be able to revert this setting).

<manifest>
@PomepuyN
PomepuyN / SettingsAdapter.java
Last active June 5, 2018 09:02
Functional example of WearableListView
View SettingsAdapter.java
public class SettingsAdapter extends WearableListView.Adapter {
private final Context context;
private final List<SettingsItems> items;
public SettingsAdapter(Context context, List<SettingsItems> items) {
this.context = context;
this.items = items;
}
@PomepuyN
PomepuyN / loop_screencap.sh
Created December 15, 2014 10:42
Take a screenshot by second on android
View loop_screencap.sh
#!/bin/sh
LEVEL=3
ISCHARGING=false
while [ 1=1 ]
do
adb shell screencap -p | sed 's/\r$//' > screen${LEVEL}.png
@PomepuyN
PomepuyN / gist:db67516349330ad9c988
Created February 8, 2015 08:53
Gear Live issue
View gist:db67516349330ad9c988
DisplayManager.DisplayListener displayListener = new DisplayManager.DisplayListener() {
@Override
public void onDisplayAdded(int displayId) {
}
@Override
public void onDisplayRemoved(int displayId) {
}