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

Migrate to AndroidX. #46

Merged
merged 1 commit into from
Nov 8, 2019
Merged
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jdk:
before_install:
# Install SDK license so Android Gradle plugin can install deps.
- mkdir "$ANDROID_HOME/licenses" || true
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license"

install: true

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

dependencies {
implementation rootProject.ext.supportDesign
implementation deps.support.material

implementation project(':library')
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.vanniktech.textbuilder.FormableOptions;
import com.vanniktech.textbuilder.TextBuilder;

Expand All @@ -17,7 +17,7 @@ public class MainActivity extends AppCompatActivity {

setContentView(R.layout.activity_main);

final TextView textView1 = (TextView) findViewById(R.id.activityMainTextView1);
final TextView textView1 = findViewById(R.id.activityMainTextView1);
new TextBuilder(this)
.addText(R.string.some_text)
.addWhiteSpace()
Expand All @@ -27,7 +27,7 @@ public class MainActivity extends AppCompatActivity {
.addWhiteSpace()
.into(textView1);

final TextView textView2 = (TextView) findViewById(R.id.activityMainTextView2);
final TextView textView2 = findViewById(R.id.activityMainTextView2);
new TextBuilder(this)
.addFormableText("Terms of use and privacy terms")
.format("Terms of use")
Expand All @@ -44,7 +44,7 @@ public class MainActivity extends AppCompatActivity {

textView2.setMovementMethod(LinkMovementMethod.getInstance());

final TextView textView3 = (TextView) findViewById(R.id.activityMainTextView3);
final TextView textView3 = findViewById(R.id.activityMainTextView3);
new TextBuilder(this)
.addDrawable(R.drawable.ic_done_black_18dp)
.addWhiteSpace()
Expand Down
54 changes: 35 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ apply plugin: 'com.vanniktech.code.quality.tools'
apply plugin: 'com.vanniktech.android.junit.jacoco'

buildscript {
ext.deps = [
'support': [
'material': "com.google.android.material:material:1.1.0-beta01",
],
'fastLaneScreenGrab': "tools.fastlane:screengrab:1.2.0",
]

repositories {
mavenCentral()
google()
gradlePluginPortal()
}

dependencies {
classpath 'com.vanniktech:gradle-code-quality-tools-plugin:0.9.0'
classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.11.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.1.0'
classpath 'com.vanniktech:gradle-code-quality-tools-plugin:0.19.0'
classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.15.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.8.0'

classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath 'com.android.tools.build:gradle:3.6.0-beta02'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0'
}
}

Expand All @@ -34,31 +41,40 @@ codeQualityTools {
}
}

subprojects {
repositories {
mavenCentral()
google()
}
}

ext {
minSdkVersion = 15
compileSdkVersion = 27
targetSdkVersion = 27
compileSdkVersion = 28
targetSdkVersion = 28

supportLibraryVersion = '27.0.1'

versionCode = VERSION_CODE
versionName = VERSION_NAME

supportAnnotations = "com.android.support:support-annotations:$supportLibraryVersion"
supportCompat = "com.android.support:support-compat:$supportLibraryVersion"
supportDesign = "com.android.support:design:$supportLibraryVersion"
supportAnnotations = "androidx.annotation:annotation:1.0.0"
supportAppCompat = "androidx.appcompat:appcompat:1.1.0"

javaVersion = JavaVersion.VERSION_1_7
}

task wrapper(type: Wrapper) {
gradleVersion = '4.8'
wrapper {
gradleVersion = '5.6.2'
distributionType = Wrapper.DistributionType.ALL
}

subprojects {
repositories {
mavenCentral()
google()
jcenter()
}

task allDependencies(type: DependencyReportTask) {}

project.plugins.withId("com.android.library") {
// TODO replace with https://issuetracker.google.com/issues/72050365 once released.
project.android.libraryVariants.all {
it.generateBuildConfigProvider.configure { it.enabled = false }
}
}
}
23 changes: 0 additions & 23 deletions code_quality_tools/findbugs-filter.xml

This file was deleted.

5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=vanniktech
POM_DEVELOPER_NAME=Niklas Baudy
POM_DEVELOPER_NAME=Niklas Baudy

android.useAndroidX=true
android.enableJetifier=false
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-4.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 19 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
6 changes: 1 addition & 5 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
apply plugin: 'com.android.library'

afterEvaluate {
generateReleaseBuildConfig.enabled = false
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion as int

Expand All @@ -19,7 +15,7 @@ android {

dependencies {
api rootProject.ext.supportAnnotations
implementation rootProject.ext.supportCompat
implementation rootProject.ext.supportAppCompat
}

apply plugin: "com.vanniktech.maven.publish"
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.vanniktech.textbuilder;

import android.graphics.Typeface;
import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;
import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;

final class CustomSpan extends ClickableSpan {
private final boolean isBold;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.vanniktech.textbuilder;

import android.support.annotation.CheckResult;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.CheckResult;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
import static com.vanniktech.textbuilder.Preconditions.checkNotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.vanniktech.textbuilder;

import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
import android.text.SpannableStringBuilder;
import android.widget.TextView;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;

import static com.vanniktech.textbuilder.Preconditions.checkNotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.CheckResult;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v4.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.widget.TextView;
import androidx.annotation.CheckResult;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.core.content.ContextCompat;
import java.util.ArrayList;
import java.util.List;

Expand Down