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

Update gradle and add namespaces #493

Merged
merged 11 commits into from
Jan 20, 2025
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Build with Gradle
run: ./gradlew build
7 changes: 4 additions & 3 deletions androidbrowserhelper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ apply plugin: 'maven-publish'
def VERSION = "2.5.0";

android {
namespace "com.google.androidbrowserhelper"
compileSdkVersion 31

defaultConfig {
Expand All @@ -39,8 +40,8 @@ android {
}

compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

testOptions {
Expand All @@ -60,7 +61,7 @@ dependencies {

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.0.0'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'org.robolectric:robolectric:4.12.2'

androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
Expand Down
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:8.7.3'
}
}

allprojects {
repositories {
google()
jcenter()

maven {
url = "https://linkedin.jfrog.io/artifactory/open-source/"
content {
includeGroup 'com.linkedin.dexmaker'
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion demos/custom-tabs-example-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "org.chromium.customtabsdemos"
compileSdkVersion 33
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "org.chromium.customtabsdemos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,8 @@ protected void onStop() {
@Override
public void onClick(View v) {
int viewId = v.getId();
switch (viewId) {
case R.id.start_custom_tab:
openCustomTab();
break;
default:
//Unknown View Clicked
if (viewId == R.id.start_custom_tab) {
openCustomTab();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int position)

@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {
position = viewHolder.getAdapterPosition();
final ActivityDesc activityDesc = mActivityDescs.get(position);
String title = activityDesc.mTitle;
String description = activityDesc.mDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,8 @@ private void unbindCustomTabsService() {
@Override
public void onClick(View v) {
int viewId = v.getId();
switch (viewId) {
case R.id.start_custom_tab:
openCustomTab();
break;
default:
// Unknown View Clicked
if (viewId == R.id.start_custom_tab) {
openCustomTab();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

package org.chromium.customtabsdemos;

import static org.chromium.customtabsdemos.R.*;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
Expand Down Expand Up @@ -60,13 +62,9 @@ protected void onNewIntent(Intent intent) {
@Override
public void onClick(View v) {
int viewId = v.getId();
switch (viewId) {
case R.id.create_notification:
createAndShowNotification();
finish();
break;
default:
//Unknown view clicked
if (viewId == R.id.create_notification) {
createAndShowNotification();
finish();
}
}

Expand All @@ -81,7 +79,7 @@ private void createAndShowNotification() {
}
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this, CT_NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.abc_popup_background_mtrl_mult)
.setSmallIcon(androidx.appcompat.R.drawable.abc_popup_background_mtrl_mult)
.setContentTitle(getString(R.string.notification_title))
.setContentText(getString(R.string.notification_text));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,8 @@ protected void onStop() {
@Override
public void onClick(View v) {
int viewId = v.getId();
switch (viewId) {
case R.id.start_custom_tab:
openCustomTab();
break;
default:
// Unknown View Clicked
if (viewId == R.id.start_custom_tab) {
openCustomTab();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,14 @@ public void onCustomTabsDisconnected() {
public void onClick(View view) {
int viewId = view.getId();
Uri uri = Uri.parse(mUrlEditText.getText().toString());
switch (viewId) {
case R.id.button_may_launch_url:
customTabActivityHelper.mayLaunchUrl(uri, null, null);
break;
case R.id.start_custom_tab:
CustomTabsIntent customTabsIntent =
new CustomTabsIntent.Builder(customTabActivityHelper.getSession())
.build();
CustomTabActivityHelper.openCustomTab(
this, customTabsIntent, uri, new WebviewFallback());
break;
default:
//Unkown View Clicked
if (viewId == R.id.button_may_launch_url) {
customTabActivityHelper.mayLaunchUrl(uri, null, null);
} else if (viewId == R.id.start_custom_tab) {
CustomTabsIntent customTabsIntent =
new CustomTabsIntent.Builder(customTabActivityHelper.getSession())
.build();
CustomTabActivityHelper.openCustomTab(
this, customTabsIntent, uri, new WebviewFallback());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,11 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onClick(View v) {
int viewId = v.getId();

switch (viewId) {
case R.id.start_custom_tab:
String url = mUrlEditText.getText().toString();
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();
CustomTabActivityHelper.openCustomTab(
this, customTabsIntent, Uri.parse(url), new WebviewFallback());
break;
default:
//Unknown View Clicked
if (viewId == R.id.start_custom_tab) {
String url = mUrlEditText.getText().toString();
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();
CustomTabActivityHelper.openCustomTab(
this, customTabsIntent, Uri.parse(url), new WebviewFallback());
}
}
}
2 changes: 1 addition & 1 deletion demos/custom-tabs-headers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.androidbrowserhelper.demos.customtabsheaders"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.androidbrowserhelper.demos.customtabsheaders"
Expand Down
2 changes: 1 addition & 1 deletion demos/custom-tabs-navigation-callbacks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.androidbrowserhelper.demos.customtabssession"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.androidbrowserhelper.demos.customtabsnavigationcallbacks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.androidbrowserhelper.demos.customtabssession">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
Expand Down
2 changes: 1 addition & 1 deletion demos/custom-tabs-oauth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.androidbrowserhelper.demos.customtabsoauth"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.androidbrowserhelper.demos.customtabsoauth"
Expand Down
2 changes: 1 addition & 1 deletion demos/custom-tabs-session/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.androidbrowserhelper.demos.customtabssession"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.androidbrowserhelper.demos.customtabssession"
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-basic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.browser.examples.twa_basic"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.browser.examples.twa_basic"
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-custom-launcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.androidbrowserhelper.demo"
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.google.androidbrowserhelper"
minSdkVersion 23
Expand Down
3 changes: 1 addition & 2 deletions demos/twa-custom-launcher/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.google.androidbrowserhelper.demo">
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-firebase-analytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ buildscript {
}

android {
namespace "com.google.androidbrowserhelper.demos.twa_firebase_analytics"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.androidbrowserhelper.demos.twa_firebase_analytics"
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-location-delegation/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.browser.examples.twa_location_delegation"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.browser.examples.twa_location_delegation"
Expand Down
4 changes: 2 additions & 2 deletions demos/twa-multi-domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.browser.examples.twa_multi_domain"
compileSdkVersion 31
buildToolsVersion "30.0.3"



defaultConfig {
applicationId "com.google.browser.examples.twa_multi_domain"
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-notification-delegation/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'

android {
namespace 'com.google.androidbrowserhelper.demos.twa_notification_delegation'
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.androidbrowserhelper.demos.twa_notification_delegation"
Expand Down
1 change: 1 addition & 0 deletions demos/twa-offline-first/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
}

android {
namespace "com.google.androidbrowserhelper.demos.twa_offline_first"
compileSdkVersion 31

defaultConfig {
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-orientation/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.browser.examples.twa_orientation"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.browser.examples.twa_orientation"
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-play-billing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def appId = "com.google.androidbrowserhelper.demos.playbilling"
// def appId = "dev.conn.drink"

android {
namespace "com.google.androidbrowserhelper.demos.playbilling"
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId appId
minSdkVersion 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void launch(View view) {
Intent intent = new Intent(this, LauncherActivity.class);

intent.setData(
Uri.parse("https://beer.conn.dev?client_version=" + BuildConfig.VERSION_CODE));
Uri.parse("https://beer.conn.dev")
);

startActivity(intent);
}
Expand Down
1 change: 1 addition & 0 deletions demos/twa-post-message/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
}

android {
namespace "com.google.androidbrowserhelper.demos.twapostmessage"
// If you are changing this to below 31 you will need to ask for Permission
// for notification to work.
compileSdkVersion 33
Expand Down
2 changes: 2 additions & 0 deletions demos/twa-post-message/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.androidbrowserhelper.demos.twapostmessage">

<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
Expand Down
2 changes: 1 addition & 1 deletion demos/twa-web-share-target/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
apply plugin: 'com.android.application'

android {
namespace "com.google.androidbrowserhelper.webshare"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.google.androidbrowserhelper.webshare"
Expand Down
Loading
Loading