-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from gifflet/feature/android-screen-capture-bro…
…adcast Replace OrientationEventListener with Broadcast Receiver for Screen Capture
- Loading branch information
Showing
8 changed files
with
113 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.shamanec.stream; | ||
|
||
import android.app.Application; | ||
import android.content.Intent; | ||
import android.content.res.Configuration; | ||
import android.util.Log; | ||
|
||
import static com.shamanec.stream.IntentActionConstants.ORIENTATION_CHANGED_ACTION; | ||
|
||
public class GadsApp extends Application { | ||
|
||
private static final String TAG = "GadsApp"; | ||
private int lastKnownOrientation = Configuration.ORIENTATION_UNDEFINED; | ||
|
||
@Override | ||
public void onConfigurationChanged(Configuration newConfig) { | ||
super.onConfigurationChanged(newConfig); | ||
Log.d(TAG, "Configuration changed: " + newConfig.toString()); | ||
|
||
// Check if the orientation has actually changed | ||
if (newConfig.orientation == lastKnownOrientation) { | ||
Log.d(TAG, "Orientation did not change, skipping broadcast."); | ||
return; | ||
} | ||
|
||
// Update the last known orientation | ||
lastKnownOrientation = newConfig.orientation; | ||
|
||
// Send the broadcast | ||
Intent intent = new Intent(ORIENTATION_CHANGED_ACTION); | ||
intent.setPackage(getPackageName()); | ||
sendBroadcast(intent); | ||
Log.d(TAG, "Broadcast sent: " + ORIENTATION_CHANGED_ACTION); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/shamanec/stream/IntentActionConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.shamanec.stream; | ||
|
||
public final class IntentActionConstants { | ||
|
||
public static final String ORIENTATION_CHANGED_ACTION = "com.shamanec.stream.ORIENTATION_CHANGED"; | ||
|
||
private IntentActionConstants() {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
id 'com.android.application' version '7.3.1' apply false | ||
id 'com.android.library' version '7.3.1' apply false | ||
id 'com.android.application' version '8.8.0' apply false | ||
id 'com.android.library' version '8.8.0' apply false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Thu Mar 02 10:05:18 EET 2023 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
distributionPath=wrapper/dists | ||
zipStorePath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME |