Commit 7fe20f19 authored by Lukas Fülling's avatar Lukas Fülling

redesign

parent fbce5c07
/*
* Copyright (C) 2017 The Android Open Source Project
* Copyright (C) 2017 The Android Open Source Project (Only boilerplate code)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -57,6 +57,7 @@ public class VaporFace extends CanvasWatchFaceService {
private static final int BOTTOM_COMPLICATION_ID = 0;
public static final int[] COMPLICATION_IDS = {BOTTOM_COMPLICATION_ID};
// Left and right dial supported types.
......@@ -182,8 +183,7 @@ public class VaporFace extends CanvasWatchFaceService {
Rect bottomBounds =
// Left, Top, Right, Bottom
new Rect(
horizontalOffset,
new Rect(horizontalOffset,
verticalOffset,
(horizontalOffset + sizeOfComplication),
(verticalOffset + sizeOfComplication));
......@@ -229,12 +229,13 @@ public class VaporFace extends CanvasWatchFaceService {
complicationPaint.setTypeface(VAPOR_FONT);
ComplicationDrawable bottomComplicationDrawable = (ComplicationDrawable) getDrawable(R.drawable.custom_complication_styles);
bottomComplicationDrawable.setContext(getApplicationContext());
complicationDrawableSparseArray = new SparseArray<>(COMPLICATION_IDS.length);
complicationDrawableSparseArray.put(BOTTOM_COMPLICATION_ID, bottomComplicationDrawable);
setActiveComplications(COMPLICATION_IDS);
}
......@@ -394,6 +395,7 @@ public class VaporFace extends CanvasWatchFaceService {
ComplicationDrawable complicationDrawable;
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < COMPLICATION_IDS.length; i++) {
complicationDrawable = complicationDrawableSparseArray.get(COMPLICATION_IDS[i]);
......@@ -524,7 +526,7 @@ public class VaporFace extends CanvasWatchFaceService {
Rect bounds = new Rect();
paint.getTextBounds(text, 0, text.length(), bounds);
int x = (canvas.getWidth() / 2) - (bounds.width() / 2);
int y = (canvas.getHeight() / 2) - (bounds.height() / 2) - 32;
int y = (canvas.getHeight() / 2) - (bounds.height() / 2);
canvas.drawText(text, x, y, paint);
}
......
......@@ -58,12 +58,21 @@ public class VaporFaceConfigActivity extends Activity implements View.OnClickLis
defaultAddComplicationDrawable = getDrawable(R.drawable.add_complication);
selectedComplicationId = -1;
watchFaceComponentName = new ComponentName(getApplicationContext(), VaporFace.class);
bottomComplicationId =
VaporFace.getComplicationId(ComplicationLocation.BOTTOM);
initBottomComplication();
watchFaceComponentName =
new ComponentName(getApplicationContext(), VaporFace.class);
// Initialization of code to retrieve active complication data for the watch face.
providerInfoRetriever =
new ProviderInfoRetriever(getApplicationContext(), Executors.newCachedThreadPool());
providerInfoRetriever.init();
retrieveInitialComplicationsData();
}
private void initBottomComplication() {
bottomComplicationId = VaporFace.getComplicationId(ComplicationLocation.BOTTOM);
// Sets up bottom complication preview.
bottomComplicationBackground = findViewById(R.id.bottom_complication_background);
......@@ -73,13 +82,6 @@ public class VaporFaceConfigActivity extends Activity implements View.OnClickLis
// Sets default as "Add Complication" icon.
bottomComplication.setImageDrawable(defaultAddComplicationDrawable);
bottomComplicationBackground.setVisibility(View.INVISIBLE);
// Initialization of code to retrieve active complication data for the watch face.
providerInfoRetriever =
new ProviderInfoRetriever(getApplicationContext(), Executors.newCachedThreadPool());
providerInfoRetriever.init();
retrieveInitialComplicationsData();
}
@Override
......@@ -110,9 +112,7 @@ public class VaporFaceConfigActivity extends Activity implements View.OnClickLis
@Override
public void onClick(View view) {
if (view.equals(bottomComplication)) {
Log.d(TAG, "Bottom Complication click()");
launchComplicationHelperActivity(ComplicationLocation.BOTTOM);
}
}
......@@ -153,7 +153,6 @@ public class VaporFaceConfigActivity extends Activity implements View.OnClickLis
bottomComplication.setImageDrawable(defaultAddComplicationDrawable);
bottomComplicationBackground.setVisibility(View.INVISIBLE);
}
}
}
......
......@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
class="android.support.wearable.complications.rendering.ComplicationDrawable"
app:backgroundColor="@android:color/transparent"
app:borderColor="@color/complication_value_secondary"
app:borderColor="@color/grid_stripe"
app:borderDashGap="4dp"
app:borderDashWidth="1dp"
app:borderRadius="50dp"
......@@ -29,7 +29,7 @@
app:iconColor="@color/white"
app:rangedValuePrimaryColor="@color/white"
app:rangedValueRingWidth="1dp"
app:rangedValueSecondaryColor="@color/complication_value_secondary"
app:rangedValueSecondaryColor="@color/grid_pink"
app:textColor="@color/white"
app:textSize="12sp"
app:textTypeface="sans-serif-condensed"
......@@ -43,5 +43,5 @@
app:rangedValuePrimaryColor="@color/white"
app:titleColor="@color/white"
app:borderColor="@android:color/transparent"
app:rangedValueSecondaryColor="@color/complication_value_secondary"/>
app:rangedValueSecondaryColor="@color/grid_pink"/>
</drawable>
\ No newline at end of file
......@@ -22,8 +22,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/preview_digital" />
android:layout_centerVertical="true" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:text="@string/vapor_settings"
android:textSize="32sp"/>
<ImageView
android:id="@+id/bottom_complication_background"
......
......@@ -3,6 +3,7 @@
<color name="background">#000000</color>
<color name="digital_text">#ffffff</color>
<color name="ambient_mode_text_secondary">#080808</color>
<color name="complication_value_secondary">#7b1fa2</color>
<color name="grey">#e1e1e1</color>
<color name="grid_pink">#7b1fa2</color>
<color name="grid_stripe">#b08ae2</color>
<color name="grey">#818181</color>
</resources>
......@@ -2,4 +2,5 @@
<string name="app_name">vaporface</string>
<string name="message">Watch face tapped</string>
<string name="my_digital_name">Vapor</string>
<string name="vapor_settings" translatable="false">🌴⚙️</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment