Skip to content

Commit

Permalink
Migrate to AndroidX
Browse files Browse the repository at this point in the history
  • Loading branch information
Arek Olek committed Feb 1, 2019
1 parent 5e0048c commit 9d75f1a
Show file tree
Hide file tree
Showing 15 changed files with 290 additions and 93 deletions.
136 changes: 136 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "com.github.arekolek.phone"
minSdkVersion 23
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -25,14 +25,14 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation "io.reactivex.rxjava2:rxjava:2.1.14"
implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0'
implementation 'androidx.core:core-ktx:0.3'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "io.reactivex.rxjava2:rxjava:2.2.3"
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'com.jakewharton.timber:timber:4.7.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:27.1.1'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha03'
}
18 changes: 12 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.arekolek.phone">
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.arekolek.phone"
>

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

Expand All @@ -11,11 +13,13 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
>

<activity
android:name=".DialerActivity"
android:windowSoftInputMode="stateAlwaysVisible|adjustResize">
android:windowSoftInputMode="stateAlwaysVisible|adjustResize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -39,10 +43,12 @@

<service
android:name=".CallService"
android:permission="android.permission.BIND_INCALL_SERVICE">
android:permission="android.permission.BIND_INCALL_SERVICE"
>
<meta-data
android:name="android.telecom.IN_CALL_SERVICE_UI"
android:value="true" />
android:value="true"
/>
<intent-filter>
<action android:name="android.telecom.InCallService" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.telecom.Call
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.addTo
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/com/github/arekolek/phone/DialerActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package com.github.arekolek.phone
import android.Manifest.permission.CALL_PHONE
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.ActivityCompat.requestPermissions
import android.support.v4.content.PermissionChecker.PERMISSION_GRANTED
import android.support.v4.content.PermissionChecker.checkSelfPermission
import android.support.v7.app.AppCompatActivity
import android.telecom.TelecomManager
import android.telecom.TelecomManager.ACTION_CHANGE_DEFAULT_DIALER
import android.telecom.TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME
import androidx.core.content.systemService
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat.requestPermissions
import androidx.core.content.PermissionChecker.PERMISSION_GRANTED
import androidx.core.content.PermissionChecker.checkSelfPermission
import androidx.core.net.toUri
import kotlinx.android.synthetic.main.activity_dialer.*


class DialerActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -42,20 +42,20 @@ class DialerActivity : AppCompatActivity() {
}

override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
if (requestCode == REQUEST_PERMISSION && PERMISSION_GRANTED in grantResults) {
makeCall()
}
}

private fun offerReplacingDefaultDialer() {
if (systemService<TelecomManager>().defaultDialerPackage != packageName) {
if (getSystemService(TelecomManager::class.java).defaultDialerPackage != packageName) {
Intent(ACTION_CHANGE_DEFAULT_DIALER)
.putExtra(EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, packageName)
.let(::startActivity)
.putExtra(EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, packageName)
.let(::startActivity)
}
}

Expand Down
21 changes: 14 additions & 7 deletions app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:viewportWidth="108">
>
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000"
android:strokeWidth="1">
>
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
android:type="linear"
>
<item
android:color="#44000000"
android:offset="0.0" />
android:offset="0.0"
/>
<item
android:color="#00000000"
android:offset="1.0" />
android:offset="1.0"
/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000"
android:strokeWidth="1" />
/>
</vector>
Loading

0 comments on commit 9d75f1a

Please sign in to comment.