Skip to content
Snippets Groups Projects
Commit 077c532c authored by genofire's avatar genofire
Browse files

Merge branch 'styles-menu' into 'master'

Menu fixes and style polish

See merge request card10/companion-app-android!8
parents e3ffecbd ac7105e5
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".MainActivity"> <activity android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
......
...@@ -33,6 +33,7 @@ import androidx.fragment.app.Fragment ...@@ -33,6 +33,7 @@ import androidx.fragment.app.Fragment
import de.ccc.events.badge.card10.CARD10_BLUETOOTH_MAC_PREFIX import de.ccc.events.badge.card10.CARD10_BLUETOOTH_MAC_PREFIX
import de.ccc.events.badge.card10.R import de.ccc.events.badge.card10.R
import de.ccc.events.badge.card10.common.ConnectionService import de.ccc.events.badge.card10.common.ConnectionService
import de.ccc.events.badge.card10.filetransfer.FileTransferFragment
import de.ccc.events.badge.card10.hatchery.AppListFragment import de.ccc.events.badge.card10.hatchery.AppListFragment
import de.ccc.events.badge.card10.mood.MoodFragment import de.ccc.events.badge.card10.mood.MoodFragment
import de.ccc.events.badge.card10.scanner.ScannerFragment import de.ccc.events.badge.card10.scanner.ScannerFragment
...@@ -46,27 +47,23 @@ class MainFragment : Fragment() { ...@@ -46,27 +47,23 @@ class MainFragment : Fragment() {
inflater.inflate(R.layout.main_fragment, container, false) inflater.inflate(R.layout.main_fragment, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
button_pair.setOnClickListener { startFragment(ScannerFragment()) }
button_mood.setOnClickListener { startFragment(MoodFragment()) }
button_beautiful.setOnClickListener { startFragment(BeautifulFragment()) }
button_hatchery.setOnClickListener { startFragment(AppListFragment()) }
button_send.setOnClickListener { startFragment(FileTransferFragment()) }
val bondedCard10s = val bondedCard10s =
bluetoothAdapter.bondedDevices.filter { it.address.startsWith(CARD10_BLUETOOTH_MAC_PREFIX, true) } bluetoothAdapter.bondedDevices.filter { it.address.startsWith(CARD10_BLUETOOTH_MAC_PREFIX, true) }
if (bondedCard10s.isNotEmpty()) { if (bondedCard10s.isNotEmpty()) {
val device = bondedCard10s.get(0) val device = bondedCard10s[0]
label_status.text = getString(R.string.main_label_paired, device.name, device.address) label_status.text = getString(R.string.main_label_paired, device.name, device.address)
container_paired.visibility = View.VISIBLE
} else {
label_status.text = getString(R.string.main_label_not_connected)
container_paired.visibility = View.GONE
}
if (ConnectionService.isConnected()) {
showConnectedView(view) showConnectedView(view)
} else { } else {
label_status.text = getString(R.string.main_label_not_connected)
showDisconnectedView(view) showDisconnectedView(view)
} }
button_pair.setOnClickListener { startFragment(ScannerFragment()) }
button_mood.setOnClickListener { startFragment(MoodFragment()) }
button_beautiful.setOnClickListener { startFragment(BeautifulFragment()) }
button_hatchery.setOnClickListener { startFragment(AppListFragment()) }
} }
private fun startFragment(fragment: Fragment) { private fun startFragment(fragment: Fragment) {
...@@ -79,19 +76,10 @@ class MainFragment : Fragment() { ...@@ -79,19 +76,10 @@ class MainFragment : Fragment() {
private fun showConnectedView(view: View) { private fun showConnectedView(view: View) {
view.findViewById<ConstraintLayout>(R.id.container_connected).visibility = View.VISIBLE view.findViewById<ConstraintLayout>(R.id.container_connected).visibility = View.VISIBLE
view.findViewById<ConstraintLayout>(R.id.container_disconnected).visibility = View.GONE view.findViewById<ConstraintLayout>(R.id.container_disconnected).visibility = View.GONE
val buttonSend = view.findViewById<Button>(R.id.button_send)
buttonSend.setOnClickListener {
// TODO: Open file transfer fragment
}
} }
private fun showDisconnectedView(view: View) { private fun showDisconnectedView(view: View) {
view.findViewById<ConstraintLayout>(R.id.container_connected).visibility = View.GONE view.findViewById<ConstraintLayout>(R.id.container_connected).visibility = View.GONE
view.findViewById<ConstraintLayout>(R.id.container_disconnected).visibility = View.VISIBLE view.findViewById<ConstraintLayout>(R.id.container_disconnected).visibility = View.VISIBLE
val buttonConnect = view.findViewById<Button>(R.id.button_connect)
buttonConnect.setOnClickListener {
// TODO: Open scan fragment
}
} }
} }
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp" android:height="108dp" android:width="108dp" android:height="108dp"
android:viewportWidth="512" android:viewportHeight="512"> android:viewportWidth="512" android:viewportHeight="512">
<path android:fillColor="#FF0090" <path android:fillColor="#0076ba"
android:pathData="M0,0h512v512h-512z"/> <group android:translateX="-255" android:translateY="145"> android:pathData="M0,0h512v512h-512z"/> <group android:translateX="-255" android:translateY="145">
<path android:fillColor="#00FFFFFF" <path android:fillColor="#00005383"
android:pathData="m431.2,210.5h-19.4c-19.5,0 -35.4,-15.9 -35.4,-35.4L376.4,45.4c0,-19.5 15.9,-35.4 35.4,-35.4h122.9l0.1,46.3h-19.8c-11,0 -19.9,9 -19.9,19.9v68.1c0,11 9,19.9 19.9,19.9h68.1c11,0 19.9,-9 19.9,-19.9L603,76.2c0,-11 -9,-19.9 -19.9,-19.9h-19.8l-0.2,-46.3h50.8c19.5,0 35.4,15.9 35.4,35.4L649.3,175.1c0,19.5 -15.9,35.4 -35.4,35.4h-154L459.6,56.1 417.9,110.4" android:pathData="m431.2,210.5h-19.4c-19.5,0 -35.4,-15.9 -35.4,-35.4L376.4,45.4c0,-19.5 15.9,-35.4 35.4,-35.4h122.9l0.1,46.3h-19.8c-11,0 -19.9,9 -19.9,19.9v68.1c0,11 9,19.9 19.9,19.9h68.1c11,0 19.9,-9 19.9,-19.9L603,76.2c0,-11 -9,-19.9 -19.9,-19.9h-19.8l-0.2,-46.3h50.8c19.5,0 35.4,15.9 35.4,35.4L649.3,175.1c0,19.5 -15.9,35.4 -35.4,35.4h-154L459.6,56.1 417.9,110.4"
android:strokeColor="#FFFFFF" android:strokeLineCap="round" android:strokeColor="#FFFFFF" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="15"/> android:strokeLineJoin="round" android:strokeWidth="15"/>
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
android:width="108dp" android:width="108dp"
android:viewportHeight="108" android:viewportHeight="108"
android:viewportWidth="108"> android:viewportWidth="108">
<path android:fillColor="#FF0090" <path android:fillColor="#0076ba"
android:pathData="M0,0h108v108h-108z"/> android:pathData="M0,0h108v108h-108z"/>
</vector> </vector>
...@@ -24,77 +24,68 @@ ...@@ -24,77 +24,68 @@
app:layout_constraintTop_toBottomOf="@+id/image_logo"/> app:layout_constraintTop_toBottomOf="@+id/image_logo"/>
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/label_status" app:layout_constraintTop_toBottomOf="@+id/label_status"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/container_disconnected"> android:id="@+id/container_disconnected">
<Button android:id="@+id/button_pair" <Button android:id="@+id/button_pair"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="pair" android:text="@string/main_button_pair"
android:layout_marginTop="@dimen/main_label_margin"
style="@style/MainButton"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/> app:layout_constraintRight_toRightOf="parent"/>
<Button android:id="@+id/button_connect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/main_button_connect"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/button_pair"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/container_disconnected" app:layout_constraintTop_toBottomOf="@+id/label_status"
android:id="@+id/container_paired"> android:id="@+id/container_connected">
<Button android:layout_width="wrap_content" <Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/main_label_margin" android:layout_marginTop="@dimen/main_label_margin"
android:id="@+id/button_mood" style="@style/MainButton"
android:text="@string/main_button_mood" android:id="@+id/button_hatchery"
app:layout_constraintTop_toTopOf="parent" android:text="@string/main_button_browse_apps"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
/> app:layout_constraintTop_toTopOf="parent"
android:enabled="false"/>
<Button android:layout_width="wrap_content" <Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/main_label_margin" android:layout_marginTop="@dimen/main_button_margin"
android:id="@+id/button_beautiful" style="@style/MainButton"
android:text="Beautiful" android:id="@+id/button_send"
app:layout_constraintTop_toBottomOf="@id/button_mood" android:text="@string/main_button_send_file"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
/> app:layout_constraintTop_toBottomOf="@+id/button_hatchery"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/label_status"
android:id="@+id/container_connected">
<Button android:layout_width="wrap_content" <Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/main_label_margin" android:layout_marginTop="@dimen/main_button_margin"
android:id="@+id/button_hatchery" style="@style/MainButton"
android:text="@string/main_button_browse_apps" android:id="@+id/button_mood"
android:text="@string/main_button_mood"
app:layout_constraintTop_toBottomOf="@+id/button_send"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"/>
app:layout_constraintTop_toTopOf="parent"/>
<Button android:layout_width="wrap_content" <Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/main_label_margin" android:layout_marginTop="@dimen/main_button_margin"
android:id="@+id/button_send" style="@style/MainButton"
android:text="@string/main_button_send_file" android:id="@+id/button_beautiful"
android:text="@string/main_button_beautiful"
app:layout_constraintTop_toBottomOf="@+id/button_mood"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"/>
app:layout_constraintTop_toBottomOf="@+id/button_hatchery"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#FF0090</color> <color name="colorPrimary">#0076ba</color>
<color name="colorPrimaryDark">#E0115F</color> <color name="colorPrimaryDark">#005383</color>
<color name="colorAccent">#44A597</color> <color name="colorAccent">#99ba00</color>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="activity_padding">24dp</dimen> <dimen name="activity_padding">24dp</dimen>
<dimen name="logo_margin_bottom">24dp</dimen> <dimen name="logo_margin_bottom">24dp</dimen>
<dimen name="main_label_margin">24dp</dimen> <dimen name="main_label_margin">32dp</dimen>
<dimen name="main_button_margin">16dp</dimen>
<dimen name="send_label_margin">24dp</dimen> <dimen name="send_label_margin">24dp</dimen>
<dimen name="app_list_item_padding">16dp</dimen> <dimen name="app_list_item_padding">16dp</dimen>
......
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
<string name="main_label_paired">You are paired to %1$s (%2$s)</string> <string name="main_label_paired">You are paired to %1$s (%2$s)</string>
<string name="main_label_not_connected">You are currently not connected to your card10.</string> <string name="main_label_not_connected">You are currently not connected to your card10.</string>
<string name="main_label_status">You are connected to %1$s (%2$s)</string> <string name="main_label_status">You are connected to %1$s (%2$s)</string>
<string name="main_button_connect">Connect</string> <string name="main_button_pair">Pair</string>
<string name="main_button_manage_pairings">Manage Paired Devices</string>
<string name="main_button_browse_apps">Browse Apps</string> <string name="main_button_browse_apps">Browse Apps</string>
<string name="main_button_send_file">Send File</string> <string name="main_button_send_file">Send File</string>
<string name="main_button_mood">Change Mood</string> <string name="main_button_mood">Change Mood</string>
<string name="main_button_beautiful">Beautiful</string>
<string name="file_transfer_button_pick_file">Select</string> <string name="file_transfer_button_pick_file">Select</string>
<string name="file_transfer_button_start_transfer">Start</string> <string name="file_transfer_button_start_transfer">Start</string>
......
...@@ -8,4 +8,8 @@ ...@@ -8,4 +8,8 @@
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
</style> </style>
<style name="MainButton" parent="Widget.AppCompat.Button.Colored">
<item name="android:minWidth">200dp</item>
</style>
</resources> </resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment