Skip to content

Commit

Permalink
Merge pull request #3 from z3ntu/androidx
Browse files Browse the repository at this point in the history
Migrate to AndroidX
  • Loading branch information
mgursch authored May 7, 2021
2 parents 9926a43 + c2df55d commit 9768cc9
Show file tree
Hide file tree
Showing 15 changed files with 136 additions and 122 deletions.
25 changes: 9 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@ language: android
jdk: oraclejdk8
android:
components:
- build-tools-25.0.2
- android-25
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
install:
- echo y | android update sdk -u -a -t tools
- echo y | android update sdk -u -a -t platform-tools
- echo y | android update sdk -u -a -t build-tools-25.0.2
- echo y | android update sdk -u -a -t android-25
- echo y | android update sdk -u -a -t extra-google-m2repository
- echo y | android update sdk -u -a -t extra-android-m2repository
- tools
- platform-tools
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- touch $HOME/.android/repositories.cfg
- yes | sdkmanager "platforms;android-29"
- yes | sdkmanager "build-tools;29.0.0"
script:
- "./gradlew build"
before_cache:
Expand All @@ -36,4 +29,4 @@ deploy:
provider: script
script: "./gradlew bintrayUpload"
on:
tags: true
tags: true
9 changes: 4 additions & 5 deletions a3utilities/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ group = 'at.allaboutapps.a3utilities'
version = '1.0.3'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 30

archivesBaseName = 'a3utilities'

defaultConfig {
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 30
}
}

Expand Down Expand Up @@ -63,5 +62,5 @@ artifacts {
}

dependencies {
compile "com.android.support:recyclerview-v7:$supportLibVersion"
}
implementation 'androidx.recyclerview:recyclerview:1.1.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import android.content.Context;
import android.graphics.BitmapFactory;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import android.graphics.Point;
import android.net.ConnectivityManager;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.TypedValue;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresPermission;

/** Utilities for version checks and pixel sizes. */
public class A3Device {
Expand Down Expand Up @@ -70,6 +71,7 @@ public static boolean isApiLevelSupported(int apiLevel) {
* @param ctx the application context
* @return the current network state, true if online, false if ctx == null or otherwise.
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
public static boolean isOnline(@Nullable Context ctx) {

if (ctx == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresPermission;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresPermission;

/**
* This class provides some methods to create standard intents for email, phone, web and methods to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.NonNull;

/** Show or hide the keyboard. */
public class A3SoftInput {
Expand Down
20 changes: 9 additions & 11 deletions a3utilitiesproject/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 30
defaultConfig {
applicationId "at.allaboutapps.a3utilitiesproject"
minSdkVersion 19
targetSdkVersion 25
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
Expand All @@ -20,13 +19,12 @@ android {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':a3utilities')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
implementation project(':a3utilities')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.2.0'
testImplementation 'junit:junit:4.13'
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package at.allaboutapps.a3utilitiesproject;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import androidx.appcompat.app.AppCompatActivity;
import at.allaboutapps.a3utilities.A3Device;
import at.allaboutapps.a3utilitiesproject.vh.ExampleActivityViewHolder;

Expand Down
4 changes: 2 additions & 2 deletions a3utilitiesproject/src/main/res/layout/activity_example.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand All @@ -10,4 +10,4 @@
<include layout="@layout/content_example"/>


</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
10 changes: 4 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,13 +17,10 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

ext {
supportLibVersion = "25.3.1"
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Apr 21 13:51:20 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Loading

0 comments on commit 9768cc9

Please sign in to comment.