Skip to content

Commit

Permalink
support androidx
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed May 26, 2019
1 parent 0aceee6 commit 77e56ea
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 34 deletions.
18 changes: 13 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.butterknife'

android {

Expand All @@ -15,6 +15,9 @@ android {

versionCode 1
versionName "1.0"
javaCompileOptions {
annotationProcessorOptions.includeCompileClasspath = true
}
}

buildTypes {
Expand All @@ -23,12 +26,17 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar'])
def viewDependencies = rootProject.ext.viewDependencies
apt viewDependencies.apt_butterKnife
compile viewDependencies.butterKnife
compile project(':waveview')
annotationProcessor viewDependencies.apt_butterKnife
implementation viewDependencies.butterKnife
implementation androidDependencies.appcompat_v7
implementation project(':waveview')
}
6 changes: 4 additions & 2 deletions app/src/main/java/com/shuyu/app/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.shuyu.app;


import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.widget.FrameLayout;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;

import butterknife.BindView;
import butterknife.ButterKnife;

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/shuyu/app/MainFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
Expand All @@ -15,10 +13,12 @@
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.czt.mp3recorder.MP3Recorder;
import com.shuyu.waveview.AudioPlayer;
import com.shuyu.waveview.AudioWaveView;
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/shuyu/app/WavePlayActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.SeekBar;

import androidx.appcompat.app.AppCompatActivity;

import com.piterwilson.audio.MP3RadioStreamDelegate;
import com.piterwilson.audio.MP3RadioStreamPlayer;
import com.shuyu.waveview.AudioWaveView;
Expand Down
14 changes: 10 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ apply from: 'dependencies.gradle'
buildscript {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
}
}

allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
google()
}
}

Expand Down
22 changes: 10 additions & 12 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@ allprojects {

ext {
//Android
androidBuildToolsVersion = "23.0.1"
androidBuildToolsVersion = "28.0.3"
androidMinSdkVersion = 16
androidTargetSdkVersion = 22
androidCompileSdkVersion = 22
supportLibraryVersion = '24.2.0'
otherLibraryVersion = '22.2.1'
androidTargetSdkVersion = 28
androidCompileSdkVersion = 28
supportLibraryVersion = '1.0.0-beta01'

//ViewLibraries
butterKnifeVersion = '8.2.1'
videocache = '2.6.4'
butterKnifeVersion = '10.1.0'
videocache = '2.7.1'

androidDependencies = [
recyclerView: "com.android.support:recyclerview-v7:${supportLibraryVersion}",
appcompat_v7: "com.android.support:appcompat-v7:${otherLibraryVersion}",
cardview_v7 : "com.android.support:cardview-v7:23.2.0",
support_v4 : "com.android.support:support-v4:${supportLibraryVersion}",
design : "com.android.support:design:${otherLibraryVersion}",
recyclerView: "androidx.recyclerview:recyclerview:${supportLibraryVersion}",
appcompat_v7: "androidx.appcompat:appcompat:${supportLibraryVersion}",
support_v4 : "androidx.legacy:legacy-support-v4:${supportLibraryVersion}",
design : "com.google.android.material:material:${supportLibraryVersion}",
]

viewDependencies = [
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ org.gradle.jvmargs=-Xmx1536m
BINTRAY_USER=
BINTRAY_KEY=
PROJ_GROUP=com.shuyu
PROJ_VERSION=1.0.5
PROJ_VERSION=2.0.0
PROJ_NAME=AudioRecord
PROJ_WEBSITEURL=https://github.com/CarGuo/RecordWave
PROJ_ISSUETRACKERURL=
Expand All @@ -33,3 +33,6 @@ DEVELOPER_ID=guo
DEVELOPER_NAME=guoshuyu
DEVELOPER_EMAIL=359369982@qq.com


android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
9 changes: 6 additions & 3 deletions waveview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ android {
jniLibs.srcDirs = ['libs']
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar'])

def viewDependencies = rootProject.ext.viewDependencies
compile androidDependencies.appcompat_v7
compile viewDependencies.videocache
implementation viewDependencies.videocache
}

//apply from: '../bintray.gradle'
3 changes: 1 addition & 2 deletions waveview/src/main/java/com/shuyu/waveview/AudioWaveView.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.graphics.PorterDuff;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -157,7 +156,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
}

@Override
protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (visibility == VISIBLE && mBackgroundBitmap == null) {
ViewTreeObserver vto = getViewTreeObserver();
Expand Down

0 comments on commit 77e56ea

Please sign in to comment.