Steampunk: Enabled chart zoom with double-tap on bottom 1/3 of screen.
This commit is contained in:
parent
7c73a72c66
commit
512341e603
|
@ -55,7 +55,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand;
|
||||
public long datetime;
|
||||
public RelativeLayout mRelativeLayout;
|
||||
public LinearLayout mLinearLayout, mLinearLayout2, mDate;
|
||||
public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap;
|
||||
public long sgvLevel = 0;
|
||||
public int ageLevel = 1;
|
||||
public int loopLevel = 1;
|
||||
|
@ -171,6 +171,8 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
mDeltaGauge = (ImageView) stub.findViewById(R.id.delta_pointer);
|
||||
mHourHand = (ImageView) stub.findViewById(R.id.hour_hand);
|
||||
mMinuteHand = (ImageView) stub.findViewById(R.id.minute_hand);
|
||||
mChartTap = (LinearLayout) stub.findViewById(R.id.chart_zoom_tap);
|
||||
mMainMenuTap = (LinearLayout) stub.findViewById(R.id.main_menu_tap);
|
||||
chart = (LineChartView) stub.findViewById(R.id.chart);
|
||||
layoutSet = true;
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
|
|||
|
||||
public class Steampunk extends BaseWatchFace {
|
||||
|
||||
private long sgvTapTime = 0;
|
||||
private long chartTapTime = 0;
|
||||
private long mainMenuTapTime = 0;
|
||||
private float lastEndDegrees = 0f;
|
||||
private float deltaRotationAngle = 0f;
|
||||
|
||||
|
@ -33,13 +34,27 @@ public class Steampunk extends BaseWatchFace {
|
|||
@Override
|
||||
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
|
||||
|
||||
if (tapType == TAP_TYPE_TAP) {
|
||||
if (eventTime - sgvTapTime < 800) {
|
||||
if (tapType == TAP_TYPE_TAP&&
|
||||
x >= mChartTap.getLeft() &&
|
||||
x <= mChartTap.getRight()&&
|
||||
y >= mChartTap.getTop() &&
|
||||
y <= mChartTap.getBottom()){
|
||||
if (eventTime - chartTapTime < 800){
|
||||
changeChartTimeframe();
|
||||
}
|
||||
chartTapTime = eventTime;
|
||||
|
||||
} else if (tapType == TAP_TYPE_TAP&&
|
||||
x >= mMainMenuTap.getLeft() &&
|
||||
x <= mMainMenuTap.getRight()&&
|
||||
y >= mMainMenuTap.getTop() &&
|
||||
y <= mMainMenuTap.getBottom()){
|
||||
if (eventTime - mainMenuTapTime < 800){
|
||||
Intent intent = new Intent(this, MainMenuActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
sgvTapTime = eventTime;
|
||||
mainMenuTapTime = eventTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,4 +233,11 @@ public class Steampunk extends BaseWatchFace {
|
|||
mRigBattery.setTextSize(fontMedium);
|
||||
}
|
||||
}
|
||||
|
||||
private void changeChartTimeframe() {
|
||||
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
|
||||
timeframe = (timeframe%5) + 1;
|
||||
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue