Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.

Commit d084f6f

Browse files
committed
Dummy phone settings screen
Available through Wear OS (app by Google)
1 parent b9f64a5 commit d084f6f

35 files changed

+576
-21
lines changed

.idea/modules.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@
3636
"com.google.android.wearable.watchface.wearableConfigurationAction"
3737
android:value=
3838
"com.example.android.wearable.watchface.CONFIG_DIGITAL" />
39-
39+
<meta-data
40+
android:name=
41+
"com.google.android.wearable.watchface.companionConfigurationAction"
42+
android:value=
43+
"com.example.android.wearable.watchface.CONFIG_DIGITAL" />
4044
<intent-filter>
4145
<action android:name="android.service.wallpaper.WallpaperService" />
4246

app/src/main/res/layout/imageview_and_textview_item.xml

+19-19
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
-->
77

88
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
9-
android:layout_width="match_parent"
10-
android:layout_height="48dp"
11-
xmlns:tools="http://schemas.android.com/tools"
12-
android:gravity="center_vertical"
13-
android:orientation="horizontal">
9+
android:layout_width="match_parent"
10+
android:layout_height="48dp"
11+
xmlns:tools="http://schemas.android.com/tools"
12+
android:gravity="center_vertical"
13+
android:orientation="horizontal">
1414

15-
<ImageView
16-
android:id="@+id/settingsListImagetView"
17-
android:layout_width="32dp"
18-
android:layout_height="32dp"
19-
android:src="@mipmap/ic_launcher"
20-
android:layout_marginStart="8dp"/>
15+
<ImageView
16+
android:id="@+id/settingsListImagetView"
17+
android:layout_width="32dp"
18+
android:layout_height="32dp"
19+
android:src="@mipmap/ic_launcher"
20+
android:layout_marginStart="8dp"/>
2121

22-
<TextView
23-
android:id="@+id/settingsListTextView"
24-
android:layout_width="wrap_content"
25-
android:layout_height="wrap_content"
26-
android:layout_marginStart="8dp"
27-
android:textColor="@color/digital_text"
28-
android:textSize="16sp"
29-
tools:text="Menu item name" />
22+
<TextView
23+
android:id="@+id/settingsListTextView"
24+
android:layout_width="wrap_content"
25+
android:layout_height="wrap_content"
26+
android:layout_marginStart="8dp"
27+
android:textColor="@color/digital_text"
28+
android:textSize="16sp"
29+
tools:text="Menu item name" />
3030

3131
</LinearLayout>

phone/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

phone/build.gradle

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2018. LayoutXML
3+
* Created by LayoutXML.
4+
* This product is protected by copyright and distributed under licenses restricting copying, distribution and decompilation.
5+
*/
6+
7+
apply plugin: 'com.android.application'
8+
9+
android {
10+
compileSdkVersion 27
11+
12+
13+
14+
defaultConfig {
15+
applicationId "com.layoutxml.twelveish"
16+
minSdkVersion 21
17+
targetSdkVersion 27
18+
versionCode 53
19+
versionName "1.0.3"
20+
21+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
22+
23+
}
24+
25+
buildTypes {
26+
release {
27+
minifyEnabled true
28+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29+
}
30+
}
31+
32+
}
33+
34+
dependencies {
35+
implementation fileTree(dir: 'libs', include: ['*.jar'])
36+
37+
implementation 'com.android.support:appcompat-v7:27.1.1'
38+
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
39+
testImplementation 'junit:junit:4.12'
40+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
41+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
42+
implementation 'com.android.support:recyclerview-v7:27.1.1'
43+
}

phone/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

phone/src/main/AndroidManifest.xml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (c) 2018. LayoutXML
4+
~ Created by LayoutXML.
5+
~ This product is protected by copyright and distributed under licenses restricting copying, distribution and decompilation.
6+
-->
7+
8+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
9+
package="com.layoutxml.twelveish">
10+
11+
<!-- Required to act as a custom watch face. -->
12+
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Required for complications to receive complication data and open the provider chooser. -->
13+
<uses-permission android:name="com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA" />
14+
15+
<application
16+
android:allowBackup="true"
17+
android:icon="@mipmap/ic_launcher"
18+
android:label="@string/app_name"
19+
android:roundIcon="@mipmap/ic_launcher_round"
20+
android:supportsRtl="true"
21+
android:theme="@style/AppTheme">
22+
<activity android:name=".MainActivity"
23+
android:label="@string/app_name">
24+
<intent-filter>
25+
<action android:name="android.intent.action.MAIN" />
26+
<action android:name="com.example.android.wearable.watchface.CONFIG_DIGITAL" />
27+
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
28+
<category android:name="android.intent.category.DEFAULT" />
29+
</intent-filter>
30+
</activity>
31+
</application>
32+
33+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Copyright (c) 2018. LayoutXML
3+
* Created by LayoutXML.
4+
* This product is protected by copyright and distributed under licenses restricting copying, distribution and decompilation.
5+
*/
6+
7+
package com.layoutxml.twelveish;
8+
9+
import android.content.Intent;
10+
import android.support.annotation.NonNull;
11+
import android.support.v7.app.AppCompatActivity;
12+
import android.os.Bundle;
13+
import android.support.v7.widget.DefaultItemAnimator;
14+
import android.support.v7.widget.LinearLayoutManager;
15+
import android.support.v7.widget.RecyclerView;
16+
import android.util.Log;
17+
import android.view.LayoutInflater;
18+
import android.view.View;
19+
import android.view.ViewGroup;
20+
import android.widget.TextView;
21+
22+
import com.layoutxml.twelveish.objects.Setting;
23+
24+
import java.util.ArrayList;
25+
import java.util.List;
26+
27+
public class MainActivity extends AppCompatActivity {
28+
29+
private static final String TAG = "MainActivity";
30+
private List<Setting> values = new ArrayList<>();
31+
private SettingsAdapter mAdapter;
32+
33+
@Override
34+
protected void onCreate(Bundle savedInstanceState) {
35+
super.onCreate(savedInstanceState);
36+
setContentView(R.layout.activity_main);
37+
38+
RecyclerView mRecyclerView = findViewById(R.id.menuList);
39+
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
40+
41+
mAdapter = new SettingsAdapter();
42+
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
43+
mRecyclerView.setAdapter(mAdapter);
44+
generateValues();
45+
}
46+
47+
private void generateValues() {
48+
Setting setting = new Setting();
49+
setting.setName("Nothing in this screen yet.\nSupport LayoutXML by purchasing \"Support Development\" app on Google Play Store. Thanks.");
50+
values.add(setting);
51+
52+
mAdapter.notifyDataSetChanged();
53+
}
54+
55+
public class SettingsAdapter extends RecyclerView.Adapter<SettingsAdapter.MyViewHolder>{
56+
57+
class MyViewHolder extends RecyclerView.ViewHolder {
58+
59+
TextView name;
60+
61+
MyViewHolder(View view) {
62+
super(view);
63+
Log.d(TAG,"MyViewHolder");
64+
name = view.findViewById(R.id.settingsListTextView);
65+
66+
view.setOnClickListener(new View.OnClickListener() {
67+
@Override
68+
public void onClick(View v) {
69+
int position = getAdapterPosition(); // gets item position
70+
Intent intent;
71+
switch (position){
72+
/*case 0:
73+
intent = new Intent(MainActivity.this, ComplicationConfigActivity.class);
74+
MainActivity.this.startActivity(intent);
75+
break;*/
76+
default:
77+
break;
78+
}
79+
}
80+
});
81+
}
82+
}
83+
84+
@NonNull
85+
@Override
86+
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
87+
Log.d(TAG,"MyViewHolder onCreateViewHolder");
88+
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.textview_item,parent,false);
89+
return new MyViewHolder(itemView);
90+
}
91+
92+
@Override
93+
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
94+
Log.d(TAG,"MyViewHolder onBindViewHolder");
95+
Setting setting = values.get(position);
96+
holder.name.setText(setting.getName());
97+
98+
}
99+
100+
@Override
101+
public int getItemCount() {
102+
return values.size();
103+
}
104+
}
105+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2018. LayoutXML
3+
* Created by LayoutXML.
4+
* This product is protected by copyright and distributed under licenses restricting copying, distribution and decompilation.
5+
*/
6+
7+
package com.layoutxml.twelveish.objects;
8+
9+
public class Setting {
10+
11+
private String name;
12+
private Integer icon;
13+
14+
public Integer getIcon() {
15+
return icon;
16+
}
17+
18+
public void setIcon(Integer icon) {
19+
this.icon = icon;
20+
}
21+
22+
public String getName() {
23+
return name;
24+
}
25+
26+
public void setName(String name) {
27+
this.name = name;
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--
2+
~ Copyright (c) 2018. LayoutXML
3+
~ Created by LayoutXML.
4+
~ This product is protected by copyright and distributed under licenses restricting copying, distribution and decompilation.
5+
-->
6+
7+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
8+
xmlns:aapt="http://schemas.android.com/aapt"
9+
android:width="108dp"
10+
android:height="108dp"
11+
android:viewportHeight="108"
12+
android:viewportWidth="108">
13+
<path
14+
android:fillType="evenOdd"
15+
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
16+
android:strokeColor="#00000000"
17+
android:strokeWidth="1">
18+
<aapt:attr name="android:fillColor">
19+
<gradient
20+
android:endX="78.5885"
21+
android:endY="90.9159"
22+
android:startX="48.7653"
23+
android:startY="61.0927"
24+
android:type="linear">
25+
<item
26+
android:color="#44000000"
27+
android:offset="0.0" />
28+
<item
29+
android:color="#00000000"
30+
android:offset="1.0" />
31+
</gradient>
32+
</aapt:attr>
33+
</path>
34+
<path
35+
android:fillColor="#FFFFFF"
36+
android:fillType="nonZero"
37+
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
38+
android:strokeColor="#00000000"
39+
android:strokeWidth="1" />
40+
</vector>

0 commit comments

Comments
 (0)