Skip to content

Commit

Permalink
migrate to androidx
Browse files Browse the repository at this point in the history
  • Loading branch information
Cutta committed Apr 2, 2019
1 parent 9a05d62 commit b25dcdc
Show file tree
Hide file tree
Showing 16 changed files with 293 additions and 353 deletions.
19 changes: 10 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
applicationId "cuneyt.example.com.gifview"
minSdkVersion 15
targetSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
Expand All @@ -20,13 +22,12 @@ android {
}
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile project(':library')

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation project(':library')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package cuneyt.example.com.gifview;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
public class ApplicationTest {

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package cuneyt.example.com.gifview.Activities;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -31,17 +31,17 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);


gifView = (GifView) findViewById(R.id.gif1);
pauseButton = (Button) findViewById(R.id.button_gif_pause);
playButton = (Button) findViewById(R.id.button_gif_play);
nextButton = (Button) findViewById(R.id.button_gif_next);
dialogButton = (Button) findViewById(R.id.button_dialog);
fragmentButton = (Button) findViewById(R.id.fragment);
toastButton = (Button) findViewById(R.id.toast);
gifView = findViewById(R.id.gif1);
pauseButton = findViewById(R.id.button_gif_pause);
playButton = findViewById(R.id.button_gif_play);
nextButton = findViewById(R.id.button_gif_next);
dialogButton = findViewById(R.id.button_dialog);
fragmentButton = findViewById(R.id.fragment);
toastButton = findViewById(R.id.toast);


fragmentButton.setOnClickListener(new OnClickListener() {
Expand Down Expand Up @@ -120,9 +120,6 @@ public void onClick(View v) {
openDialog();
}
});



}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cuneyt.example.com.gifview.Fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -15,7 +15,6 @@
*/
public class GifFragment extends Fragment {
private String TAG;
private LayoutInflater inflater;
private static int instanceCount;

@Override
Expand All @@ -27,7 +26,6 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

this.inflater = inflater;
return inflater.inflate(R.layout.fragment_layout, container, false);
}

Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_loading_gifs.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?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"
android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context=".Activities.MainActivity">

<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
<com.google.android.material.appbar.AppBarLayout android:layout_height="wrap_content"
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>

<include layout="@layout/content_loading_gifs" />

</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context=".Activities.MainActivity">

<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
<com.google.android.material.appbar.AppBarLayout android:layout_height="wrap_content"
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
<androidx.appcompat.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>

<include layout="@layout/content_main" />

</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/content_loading_gifs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main" tools:context=".Activities.MainActivity">

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
package cuneyt.example.com.gifview;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}

}
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.21'
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:3.4.0-rc03'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -15,6 +22,10 @@ allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Oct 04 18:36:47 EEST 2015
#Tue Apr 02 14:21:35 EET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
14 changes: 9 additions & 5 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 28

defaultConfig {
minSdkVersion 15
targetSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionName "1.2"
}
buildTypes {
release {
Expand All @@ -18,5 +19,8 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package com.cunoraz.gifview.library;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
public class ApplicationTest {

}
Loading

0 comments on commit b25dcdc

Please sign in to comment.