From 6c342331587c2ddebbee7b02795aa2cb39d6555a Mon Sep 17 00:00:00 2001 From: Philip Gregor Date: Wed, 7 Aug 2024 10:41:35 -0700 Subject: [PATCH] Addressed comments by sharadb-amazon --- .../casting/ConnectionExampleFragment.java | 32 ------------------- .../fragment_matter_connection_example.xml | 7 ---- .../core/CastingPlayerDiscovery.cpp | 28 ++++++---------- .../core/CastingPlayerDiscovery.h | 7 ---- 4 files changed, 10 insertions(+), 64 deletions(-) diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java index 3e0ea69d8d82ec..5db9a3560749b5 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java @@ -31,8 +31,6 @@ import androidx.fragment.app.Fragment; import com.R; import com.matter.casting.core.CastingPlayer; -import com.matter.casting.core.CastingPlayerDiscovery; -import com.matter.casting.core.MatterCastingPlayerDiscovery; import com.matter.casting.support.CommissionerDeclaration; import com.matter.casting.support.ConnectionCallbacks; import com.matter.casting.support.IdentificationDeclarationOptions; @@ -58,11 +56,6 @@ public class ConnectionExampleFragment extends Fragment { private TextView connectionFragmentStatusTextView; private Button connectionFragmentNextButton; - // Get a singleton instance of the MatterCastingPlayerDiscovery. Which can be used to call - // stopDiscovery() during connection. - static final CastingPlayerDiscovery matterCastingPlayerDiscovery = - MatterCastingPlayerDiscovery.getInstance(); - public ConnectionExampleFragment( CastingPlayer targetCastingPlayer, boolean useCommissionerGeneratedPasscode) { Log.i( @@ -130,13 +123,6 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { callback.handleConnectionComplete(targetCastingPlayer, useCommissionerGeneratedPasscode); }); - Button stopDiscoveryButton = getView().findViewById(R.id.stopDiscoveryButton); - stopDiscoveryButton.setOnClickListener( - v -> { - Log.i(TAG, "onViewCreated() stopDiscoveryButton button clicked. Calling stopDiscovery()"); - stopDiscovery(); - }); - Executors.newSingleThreadExecutor() .submit( () -> { @@ -369,24 +355,6 @@ public void onClick(DialogInterface dialog, int which) { .setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } - private void stopDiscovery() { - Log.i( - TAG, - "ConnectionExampleFragment stopDiscovery() called, calling MatterCastingPlayerDiscovery.stopDiscovery()"); - - MatterError err = matterCastingPlayerDiscovery.stopDiscovery(); - if (err.hasError()) { - Log.e( - TAG, - "ConnectionExampleFragment stopDiscovery() MatterCastingPlayerDiscovery.stopDiscovery() called, err Stop: " - + err); - } else { - Log.d( - TAG, - "ConnectionExampleFragment stopDiscovery() MatterCastingPlayerDiscovery.stopDiscovery() success"); - } - } - /** Interface for notifying the host. */ public interface Callback { /** Notifies listener to trigger transition on completion of connection */ diff --git a/examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_matter_connection_example.xml b/examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_matter_connection_example.xml index 0bf14095abdfc8..9c2cf867326175 100644 --- a/examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_matter_connection_example.xml +++ b/examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_matter_connection_example.xml @@ -29,13 +29,6 @@ android:layout_height="wrap_content" android:text="@string/matter_connection_next_button_text" /> -