diff --git a/res/drawable/ic_baseline_keyboard_arrow_down_24.xml b/res/drawable/ic_baseline_keyboard_arrow_down_24.xml new file mode 100644 index 00000000..8f152f17 --- /dev/null +++ b/res/drawable/ic_baseline_keyboard_arrow_down_24.xml @@ -0,0 +1,12 @@ + + + + diff --git a/res/drawable/ic_baseline_keyboard_arrow_left_24.xml b/res/drawable/ic_baseline_keyboard_arrow_left_24.xml new file mode 100644 index 00000000..76bea2d8 --- /dev/null +++ b/res/drawable/ic_baseline_keyboard_arrow_left_24.xml @@ -0,0 +1,12 @@ + + + + diff --git a/res/drawable/ic_baseline_keyboard_arrow_right_24.xml b/res/drawable/ic_baseline_keyboard_arrow_right_24.xml new file mode 100644 index 00000000..044532c2 --- /dev/null +++ b/res/drawable/ic_baseline_keyboard_arrow_right_24.xml @@ -0,0 +1,12 @@ + + + + diff --git a/res/drawable/ic_baseline_keyboard_arrow_up_24.xml b/res/drawable/ic_baseline_keyboard_arrow_up_24.xml new file mode 100644 index 00000000..2a10ec62 --- /dev/null +++ b/res/drawable/ic_baseline_keyboard_arrow_up_24.xml @@ -0,0 +1,12 @@ + + + + diff --git a/res/drawable/ic_home_black_24dp.xml b/res/drawable/ic_home_black_24dp.xml index 70fb2910..e79881cb 100644 --- a/res/drawable/ic_home_black_24dp.xml +++ b/res/drawable/ic_home_black_24dp.xml @@ -1,9 +1,12 @@ - + + + android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" /> diff --git a/res/drawable/ic_mic_black.xml b/res/drawable/ic_mic_black.xml index b22ad75f..db102dad 100644 --- a/res/drawable/ic_mic_black.xml +++ b/res/drawable/ic_mic_black.xml @@ -1,9 +1,12 @@ - + android:tint="?attr/colorControlNormal" + android:viewportHeight="24" + android:viewportWidth="24" + android:width="24dp" + xmlns:android="http://schemas.android.com/apk/res/android"> + + android:pathData="M 16.766667,8.7612589 v 2.5197071 c 0,2.182796 -2.138935,3.959544 -4.766667,3.959544 -2.6277329,0 -4.7666673,-1.776748 -4.7666673,-3.959544 V 8.7612589 H 5.4999999 v 2.5197071 c 0,2.732804 2.4587328,4.991913 5.6333321,5.345392 v 2.933663 H 8.0999999 v 1.439831 H 15.9 V 19.560021 H 12.866667 V 16.626358 C 16.041267,16.272879 18.5,14.01377 18.5,11.280966 V 8.7612589 Z M 12,13.800679 A 3.0333332,2.5197106 0 0 1 8.9666671,11.280966 V 5.5216304 a 3.0333332,2.5197106 0 1 1 6.0666649,0 V 11.280966 A 3.0333332,2.5197106 0 0 1 12,13.800679 Z" /> \ No newline at end of file diff --git a/res/layout/activity_bigscreen.xml b/res/layout/activity_bigscreen.xml index d5d1d640..36a998c8 100644 --- a/res/layout/activity_bigscreen.xml +++ b/res/layout/activity_bigscreen.xml @@ -1,89 +1,126 @@ - - + + + + android:layout_height="0dp" + android:layout_margin="24dp" + + app:layout_constraintBottom_toTopOf="@+id/rLinearLayout" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/toolbar_layout"> + + + + + + + + + + + + + + + + + + - - + android:theme="@style/DisableableButton"/> + android:theme="@style/DisableableButton"/> - + - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/res/values-night/colors-night.xml b/res/values-night/colors-night.xml index b05df957..f7ac2be0 100644 --- a/res/values-night/colors-night.xml +++ b/res/values-night/colors-night.xml @@ -2,6 +2,7 @@ @android:color/black #555555 + @color/darkGrey #222222 #333333 @android:color/black diff --git a/res/values/styles.xml b/res/values/styles.xml index 3ac5f9fc..d38bbb0a 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -52,6 +52,19 @@ @drawable/disableable_button + + + + diff --git a/src/org/kde/kdeconnect/Plugins/BigscreenPlugin/BigscreenActivity.java b/src/org/kde/kdeconnect/Plugins/BigscreenPlugin/BigscreenActivity.java index c569ddb2..3a2bb8a7 100644 --- a/src/org/kde/kdeconnect/Plugins/BigscreenPlugin/BigscreenActivity.java +++ b/src/org/kde/kdeconnect/Plugins/BigscreenPlugin/BigscreenActivity.java @@ -43,35 +43,36 @@ public class BigscreenActivity extends AppCompatActivity { Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); - final String deviceId = getIntent().getStringExtra("deviceId"); - - if (!SpeechRecognizer.isRecognitionAvailable(this)) { - binding.micButton.setEnabled(false); - binding.micButton.setVisibility(View.INVISIBLE); - } - - BackgroundService.RunWithPlugin(this, deviceId, BigscreenPlugin.class, plugin -> runOnUiThread(() -> { - binding.leftButton.setOnClickListener(v -> plugin.sendLeft()); - binding.rightButton.setOnClickListener(v -> plugin.sendRight()); - binding.upButton.setOnClickListener(v -> plugin.sendUp()); - binding.downButton.setOnClickListener(v -> plugin.sendDown()); - binding.selectButton.setOnClickListener(v -> plugin.sendSelect()); - binding.homeButton.setOnClickListener(v -> plugin.sendHome()); - binding.micButton.setOnClickListener(v -> { - if (plugin.hasMicPermission()) { - activateSTT(); - } else { - new PermissionsAlertDialogFragment.Builder() - .setTitle(plugin.getDisplayName()) - .setMessage(R.string.bigscreen_optional_permission_explanation) - .setPositiveButton(R.string.ok) - .setNegativeButton(R.string.cancel) - .setPermissions(new String[]{Manifest.permission.RECORD_AUDIO}) - .setRequestCode(MainActivity.RESULT_NEEDS_RELOAD) - .create().show(getSupportFragmentManager(), null); - } - }); - })); + // TODO uncomment before merging +// final String deviceId = getIntent().getStringExtra("deviceId"); +// +// if (!SpeechRecognizer.isRecognitionAvailable(this)) { +// binding.micButton.setEnabled(false); +// binding.micButton.setVisibility(View.INVISIBLE); +// } +// +// BackgroundService.RunWithPlugin(this, deviceId, BigscreenPlugin.class, plugin -> runOnUiThread(() -> { +// binding.leftButton.setOnClickListener(v -> plugin.sendLeft()); +// binding.rightButton.setOnClickListener(v -> plugin.sendRight()); +// binding.upButton.setOnClickListener(v -> plugin.sendUp()); +// binding.downButton.setOnClickListener(v -> plugin.sendDown()); +// binding.selectButton.setOnClickListener(v -> plugin.sendSelect()); +// binding.homeButton.setOnClickListener(v -> plugin.sendHome()); +// binding.micButton.setOnClickListener(v -> { +// if (plugin.hasMicPermission()) { +// activateSTT(); +// } else { +// new PermissionsAlertDialogFragment.Builder() +// .setTitle(plugin.getDisplayName()) +// .setMessage(R.string.bigscreen_optional_permission_explanation) +// .setPositiveButton(R.string.ok) +// .setNegativeButton(R.string.cancel) +// .setPermissions(new String[]{Manifest.permission.RECORD_AUDIO}) +// .setRequestCode(MainActivity.RESULT_NEEDS_RELOAD) +// .create().show(getSupportFragmentManager(), null); +// } +// }); +// })); } public void activateSTT() { diff --git a/src/org/kde/kdeconnect/UserInterface/About/AboutFragment.kt b/src/org/kde/kdeconnect/UserInterface/About/AboutFragment.kt index 9331db92..5f871b05 100644 --- a/src/org/kde/kdeconnect/UserInterface/About/AboutFragment.kt +++ b/src/org/kde/kdeconnect/UserInterface/About/AboutFragment.kt @@ -16,6 +16,7 @@ import android.view.ViewGroup import android.widget.FrameLayout import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment +import org.kde.kdeconnect.Plugins.BigscreenPlugin.BigscreenActivity import org.kde.kdeconnect.UserInterface.List.ListAdapter import org.kde.kdeconnect.UserInterface.MainActivity import org.kde.kdeconnect_tp.R @@ -89,8 +90,9 @@ class AboutFragment : Fragment() { startActivity(Intent(context, LicensesActivity::class.java)) } + // TODO change back go AboutKDEActivity::class.java before merging binding!!.aboutKdeButton.setOnClickListener { - startActivity(Intent(context, AboutKDEActivity::class.java)) + startActivity(Intent(context, BigscreenActivity::class.java)) } setupInfoButton(aboutData.websiteURL, binding!!.websiteButton) diff --git a/src/org/kde/kdeconnect/UserInterface/Utils/RoundedConstraintLayout.kt b/src/org/kde/kdeconnect/UserInterface/Utils/RoundedConstraintLayout.kt new file mode 100644 index 00000000..26609219 --- /dev/null +++ b/src/org/kde/kdeconnect/UserInterface/Utils/RoundedConstraintLayout.kt @@ -0,0 +1,52 @@ +/* + * SPDX-FileCopyrightText: 2022 Manuel Jesús de la Fuente + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +package org.kde.kdeconnect.UserInterface.Utils + +import android.annotation.TargetApi +import android.content.Context +import android.graphics.Canvas +import android.graphics.Path +import android.graphics.RectF +import android.util.AttributeSet +import androidx.constraintlayout.widget.ConstraintLayout + +class RoundedConstraintLayout : ConstraintLayout { + + constructor(context: Context) : super(context) + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) + : super(context, attrs, defStyleAttr) + + @TargetApi(21) + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) + : super(context, attrs, defStyleAttr, defStyleRes) + + var path: Path = Path() + + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { + super.onSizeChanged(w, h, oldw, oldh) + + val width = w.toFloat() + val height = h.toFloat() + + // Set the corner radius here. You could change this to i.e. 28.0F to match Material 3 but + // since this is only used in the Bigscreen activity for the circle pad it's just taking + // the runtime width as the radius to make it fully rounded + val radius = width + + with (this.path) { + addRoundRect( + RectF(0.0F, 0.0F, width, height), radius, radius, Path.Direction.CW + ) + } + } + + override fun dispatchDraw(canvas: Canvas?) { + canvas?.clipPath(this.path) + super.dispatchDraw(canvas) + } +} \ No newline at end of file