Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Android 15 #75

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ jobs:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'Prepare for release') }}
steps:
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this specific distribution?

- name: Show java
run: |
echo $JAVA_HOME
echo $PATH
java -version
- uses: actions/checkout@v2

- name: Cache Gradle Files
Expand All @@ -20,11 +30,6 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-

- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: '17'

- name: Build
run: ./gradlew build

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/merge-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ jobs:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
steps:
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Show java
run: |
echo $JAVA_HOME
echo $PATH
java -version
- name: Checkout Repo
uses: actions/checkout@v2

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/publish-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont we need a checkout action anymore? im particularly worried about this action since you can't test run it afaik


- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Show java
run: |
echo $JAVA_HOME
echo $PATH
java -version
- uses: actions/checkout@v2

- name: Build
run: ./gradlew build
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
classpath 'com.android.tools.build:gradle:8.7.2'
}
}

Expand All @@ -24,8 +24,8 @@ subprojects {
}

ext {
compileSdkVersion = 31
buildToolsVersion = '31.0.0'
compileSdkVersion = 35
buildToolsVersion = '35.0.0'
minSdkVersion = 21
targetSdkVersion = 30
targetSdkVersion = 35
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ android.useAndroidX=true

GROUP_ID=com.linkedin.shaky
VERSION_NAME=3.0.7-SNAPSHOT
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
15 changes: 10 additions & 5 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'signing'
// Ideally AGP should provide sources and javadoc integration for their components:
// https://issuetracker.google.com/issues/145670440
tasks.register("sourcesJar", Jar) {
classifier 'sources'
getArchiveClassifier()
from android.sourceSets.main.java.srcDirs
}

Expand All @@ -16,7 +16,7 @@ tasks.register("javadoc", Javadoc) {

tasks.register("javadocJar", Jar) {
dependsOn javadoc
classifier 'javadoc'
getArchiveClassifier()
from javadoc.destinationDir
}

Expand All @@ -26,10 +26,15 @@ afterEvaluate {
publishing {
publications {
maven(MavenPublication) {
from components.release

artifact sourcesJar
artifact javadocJar
artifact(tasks.sourcesJar) {
classifier = 'sources'
}
artifact(tasks.javadocJar) {
classifier = 'javadoc'
}

artifact('build/outputs/aar/shaky-release.aar')

pom {
name = 'Shaky'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions shaky-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
namespace 'com.linkedin.android.shaky.app'
}

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions shaky-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.linkedin.android.shaky.app"
xmlns:android="http://schemas.android.com/apk/res/android"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- for MultipleAttachmentShakeDelegate example -->
<uses-permission android:name="android.permission.READ_LOGS"
Expand All @@ -16,7 +15,8 @@

<activity
android:name=".ShakyDemo"
android:label="@string/app_name">
android:label="@string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.app.Activity;
import android.app.Application;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
Expand All @@ -40,15 +41,16 @@ protected void onCreate(Bundle savedInstanceState) {
int color = Color.rgb(random.nextInt(RGB_MAX), random.nextInt(RGB_MAX), random.nextInt(RGB_MAX));
tv.setBackgroundColor(color);

boolean isApi35OrAbove = Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM;
findViewById(R.id.theme_checkbox).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v instanceof CheckBox) {
CheckBox checkBox = (CheckBox) v;
ShakyApplication application = (ShakyApplication) getApplication();
if (checkBox.isChecked()) {
application.setShakyTheme(R.style.ShakyChristmasTheme);
application.setShakyPopupTheme(R.style.ShakyChristmasPopupTheme);
application.setShakyTheme(isApi35OrAbove ? R.style.ShakyChristmasTheme_Api35: R.style.ShakyChristmasTheme);
application.setShakyPopupTheme(isApi35OrAbove ? R.style.ShakyChristmasPopupTheme_Api35 : R.style.ShakyChristmasPopupTheme);
} else {
application.setShakyTheme(null);
application.setShakyPopupTheme(null);
Expand Down
31 changes: 31 additions & 0 deletions shaky-sample/src/main/res/values-v35/styles_v35.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="ShakyChristmasToolbarTheme.Api35" parent="@style/ShakyBaseToolbarTheme.Api35">
<item name="android:background">@color/red</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyChristmasAlertDialogTheme.Api35" parent="ShakyBaseAlertDialogTheme.Api35">
<item name="android:colorBackground">@color/green</item>
<item name="android:colorAccent">@color/light_red</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyChristmasImageEditorButtonTheme.Api35" parent="ShakyBaseImageEditorButtonTheme.Api35">
<item name="android:backgroundTint">@color/red</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyChristmasTheme.Api35" parent="ShakyChristmasTheme">
<item name="shakyToolbarTheme">@style/ShakyChristmasToolbarTheme.Api35</item>
<item name="shakyImageEditorButtonTheme">@style/ShakyChristmasImageEditorButtonTheme.Api35</item>
<item name="shakyAlertDialogTheme">@style/ShakyChristmasAlertDialogTheme.Api35</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyChristmasPopupTheme.Api35" parent="ShakyChristmasPopupTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

</resources>
13 changes: 6 additions & 7 deletions shaky/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply from: "$rootDir/gradle/publishing.gradle"

android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileSdk rootProject.ext.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -12,8 +12,6 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}

buildTypes {
Expand All @@ -23,11 +21,12 @@ android {
}
}

lintOptions {
abortOnError true
}

resourcePrefix 'shaky_'
namespace 'com.linkedin.android.shaky'
lint {
abortOnError true
}
}

dependencies {
Expand All @@ -41,5 +40,5 @@ dependencies {

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
testImplementation 'org.robolectric:robolectric:4.9.2'
testImplementation 'org.robolectric:robolectric:4.14-beta-1'
}
3 changes: 1 addition & 2 deletions shaky/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest package="com.linkedin.android.shaky"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:supportsRtl="true">
<activity android:name="com.linkedin.android.shaky.FeedbackActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -72,7 +73,8 @@ public static Intent newIntent(@NonNull Context context,
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setTheme(R.style.ShakyBaseTheme);
boolean isApi35OrAbove = Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM;
setTheme(isApi35OrAbove? R.style.ShakyBaseTheme_Api35: R.style.ShakyBaseTheme);

setContentView(R.layout.shaky_feedback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.ContextThemeWrapper;
Expand Down Expand Up @@ -61,10 +62,11 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
// We have to pass some kind of theme to Alert.Builder's constructor, as the Context-only
// constructor makes different assumptions about the theme passed to it
final AlertDialog.Builder builder;
boolean isApi35OrAbove = Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM;
if (theme != FeedbackActivity.MISSING_RESOURCE) {
builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.ShakyBasePopupTheme), theme);
builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), isApi35OrAbove? R.style.ShakyBasePopupTheme_Api35 : R.style.ShakyBasePopupTheme), theme);
} else {
builder = new AlertDialog.Builder(getActivity(), R.style.ShakyBasePopupTheme);
builder = new AlertDialog.Builder(getActivity(), isApi35OrAbove? R.style.ShakyBasePopupTheme_Api35 : R.style.ShakyBasePopupTheme);
}

View popupView = View.inflate(builder.getContext(),
Expand Down
37 changes: 37 additions & 0 deletions shaky/src/main/res/values-v35/shaky_styles_v35.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="ShakyBaseAlertDialogTheme.Api35" parent="ShakyBaseAlertDialogTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyBaseEditTextTheme.Api35" parent="ShakyBaseEditTextTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyBaseSpinnerTheme.Api35" parent="ShakyBaseSpinnerTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyBaseToolbarTheme.Api35" parent="ShakyBaseToolbarTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyBaseImageEditorButtonTheme.Api35" parent="ShakyBaseImageEditorButtonTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

<style name="ShakyBaseTheme.Api35" parent="ShakyBaseTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
<!-- AlertDialog -->
<item name="shakyAlertDialogTheme">@style/ShakyBaseAlertDialogTheme.Api35</item>
<item name="shakyImageEditorButtonTheme">@style/ShakyBaseImageEditorButtonTheme.Api35</item>

<item name="alertDialogTheme">?attr/shakyAlertDialogTheme</item>
<item name="materialAlertDialogTheme">?attr/shakyAlertDialogTheme</item>
</style>

<style name="ShakyBasePopupTheme.Api35" parent="ShakyBasePopupTheme">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>
</resources>
Loading