Skip to content

Commit b0a9f0b

Browse files
committed
1. Migrated to AndroidX.
2. Added new Fragment class for Date and Time Picker.
1 parent 0c75891 commit b0a9f0b

File tree

65 files changed

+1702
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1702
-142
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ apply plugin: 'com.github.dcendents.android-maven'
99
group = 'com.github.amitjangid80'
1010

1111
android {
12-
compileSdkVersion 28
12+
compileSdkVersion 29
1313

1414
defaultConfig {
1515
minSdkVersion 19
16-
targetSdkVersion 28
17-
versionCode 42 // this indicates the number of releases of library
18-
versionName "1.6.3" // this indicates the current version of library
16+
targetSdkVersion 29
17+
versionCode 57// this indicates the number of releases of library
18+
versionName "1.7.3" // this indicates the current version of library
1919
}
2020

2121
buildTypes {
@@ -43,10 +43,10 @@ dependencies {
4343
implementation fileTree(include: ['*.jar'], dir: 'libs')
4444

4545
// Android library dependencies
46-
implementation "com.android.support:design:$supportLibraryVersion"
47-
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
48-
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
49-
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
46+
implementation 'androidx.cardview:cardview:1.0.0'
47+
implementation 'androidx.appcompat:appcompat:1.1.0'
48+
implementation 'com.google.android.material:material:1.0.0'
49+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
5050

5151
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
5252
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
2121

2222
<provider
23-
android:name="android.support.v4.content.FileProvider"
23+
android:name="androidx.core.content.FileProvider"
2424
android:authorities="${applicationId}.provider"
2525
android:exported="false"
2626
android:grantUriPermissions="true">

app/src/main/java/com/amit/anim/AnimUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
import android.app.Activity;
55
import android.content.Context;
66
import android.os.Build;
7-
import android.support.annotation.AnimRes;
8-
import android.support.annotation.NonNull;
97
import android.util.Log;
108
import android.view.View;
119
import android.view.ViewGroup;
1210
import android.view.animation.Animation;
1311
import android.view.animation.AnimationUtils;
1412
import android.view.animation.Transformation;
1513

14+
import androidx.annotation.AnimRes;
15+
import androidx.annotation.NonNull;
16+
1617
import com.amit.R;
1718

1819
/**

app/src/main/java/com/amit/anim/EaseInterpolator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.amit.anim;
22

33
import android.animation.TimeInterpolator;
4-
import android.support.annotation.NonNull;
4+
5+
import androidx.annotation.NonNull;
56

67
/**
78
* Created by Amit Jangid on 21,May,2018

app/src/main/java/com/amit/anim/EaseProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.amit.anim;
22

3-
import android.support.annotation.NonNull;
3+
import androidx.annotation.NonNull;
44

55
/**
66
* Created by Amit Jangid on 21,May,2018

app/src/main/java/com/amit/api/ApiServices.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
import android.content.Context;
44
import android.graphics.Bitmap;
55
import android.graphics.BitmapFactory;
6-
import android.support.annotation.NonNull;
7-
import android.support.v4.util.Pair;
6+
7+
import androidx.annotation.NonNull;
8+
import androidx.core.util.Pair;
89
import android.util.Log;
910

1011
import com.amit.utilities.SharedPreferenceData;

app/src/main/java/com/amit/dialog/AlertDialogBox.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import android.graphics.Color;
66
import android.graphics.drawable.ColorDrawable;
77
import android.graphics.drawable.GradientDrawable;
8-
import android.support.annotation.ColorInt;
9-
import android.support.annotation.DrawableRes;
108
import android.view.View;
119
import android.view.Window;
1210
import android.widget.Button;
1311
import android.widget.ImageView;
1412
import android.widget.TextView;
1513

14+
import androidx.annotation.ColorInt;
15+
import androidx.annotation.DrawableRes;
16+
1617
import com.amit.R;
1718

1819
import static com.amit.dialog.Anim.POP;

app/src/main/java/com/amit/drawables/CircularRevealAnimDrawable.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
import android.view.animation.DecelerateInterpolator;
1717

1818
/**
19-
* Created by Leandro Ferreira on 22/09/16.
20-
* <p>
2119
* An animation of the 'Done' status. It makes a circular reveal of a background color and the
2220
* than show the image passed in the constructor.
2321
*/

app/src/main/java/com/amit/img_picker/ImagePicker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.amit.img_picker
33
import android.app.Activity
44
import android.content.Intent
55
import android.os.Bundle
6-
import android.support.v4.app.Fragment
6+
import androidx.fragment.app.Fragment
77
import com.amit.img_picker.constant.ImageProvider
88
import com.amit.img_picker.listener.ResultListener
99
import com.amit.img_picker.util.DialogHelper

app/src/main/java/com/amit/img_picker/ImagePickerActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import android.app.Activity
44
import android.content.Intent
55
import android.net.Uri
66
import android.os.Bundle
7-
import android.support.v4.app.FragmentActivity
7+
import androidx.fragment.app.FragmentActivity
88
import com.amit.img_picker.constant.ImageProvider
99
import com.amit.img_picker.provider.CameraProvider
1010
import com.amit.img_picker.provider.CompressionProvider

app/src/main/java/com/amit/img_picker/provider/CameraProvider.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package com.amit.img_picker.provider
33
import android.Manifest
44
import android.app.Activity
55
import android.content.Intent
6-
import android.support.v4.app.ActivityCompat
6+
import androidx.core.app.ActivityCompat
77
import com.amit.R
88
import com.amit.img_picker.ImagePickerActivity
99
import com.amit.img_picker.util.FileUtil
1010
import com.amit.img_picker.util.IntentUtils
11-
import com.amit.img_picker.util.PermissionUtil
12-
import com.amit.img_picker.util.PermissionUtil.isPermissionGranted
11+
import com.amit.permission.PermissionUtil
12+
import com.amit.permission.PermissionUtil.isPermissionGranted
1313
import java.io.File
1414

1515
/**

app/src/main/java/com/amit/img_picker/provider/GalleryProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package com.amit.img_picker.provider
33
import android.Manifest
44
import android.app.Activity
55
import android.content.Intent
6-
import android.support.v4.app.ActivityCompat
6+
import androidx.core.app.ActivityCompat
77
import com.amit.R
88
import com.amit.img_picker.ImagePickerActivity
99
import com.amit.img_picker.util.IntentUtils
10-
import com.amit.img_picker.util.PermissionUtil
10+
import com.amit.permission.PermissionUtil
1111
import com.yalantis.ucrop.util.FileUtils
1212
import java.io.File
1313

app/src/main/java/com/amit/img_picker/util/DialogHelper.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.amit.img_picker.util
22

3+
import android.app.AlertDialog
34
import android.content.Context
4-
import android.support.v7.app.AlertDialog
5+
56
import android.view.LayoutInflater
67
import com.amit.R
78
import com.amit.img_picker.constant.ImageProvider
@@ -11,13 +12,11 @@ import kotlinx.android.synthetic.main.dialog_choose_app.view.*
1112
/**
1213
* Created by AMIT JANGID on 18/02/2019.
1314
**/
14-
internal object DialogHelper
15-
{
15+
internal object DialogHelper {
1616
/**
1717
* Show Image Provide Picker Dialog. This will streamline the code to pick/capture image
18-
**/
19-
fun showChooseAppDialog(context: Context, listener: ResultListener<ImageProvider>)
20-
{
18+
**/
19+
fun showChooseAppDialog(context: Context, listener: ResultListener<ImageProvider>) {
2120
val layoutInflater = LayoutInflater.from(context)
2221
val customView = layoutInflater.inflate(R.layout.dialog_choose_app, null)
2322

app/src/main/java/com/amit/img_picker/util/ImageUtil.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ object ImageUtil
126126
val ratioY = actualHeight / options.outHeight.toFloat()
127127

128128
scaleMatrix.setScale(ratioX, ratioY, middleX, middleY)
129-
canvas.matrix = scaleMatrix
129+
canvas.setMatrix(scaleMatrix)
130+
// canvas.matrix = scaleMatrix
130131

131132
canvas.drawBitmap(bmp!!, middleX - bmp.width / 2,
132133
middleY - bmp.height / 2, Paint(Paint.FILTER_BITMAP_FLAG))

app/src/main/java/com/amit/img_picker/util/IntentUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import android.content.Intent
55
import android.net.Uri
66
import android.os.Build
77
import android.provider.MediaStore
8-
import android.support.v4.content.FileProvider
8+
import androidx.core.content.FileProvider
99
import com.amit.R
1010
import java.io.File
1111

app/src/main/java/com/amit/iv/CircularImageView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
import android.graphics.drawable.BitmapDrawable;
1414
import android.graphics.drawable.Drawable;
1515
import android.net.Uri;
16-
import android.support.annotation.Nullable;
17-
import android.support.v7.widget.AppCompatImageView;
1816
import android.util.AttributeSet;
1917
import android.view.MotionEvent;
2018

19+
import androidx.annotation.Nullable;
20+
import androidx.appcompat.widget.AppCompatImageView;
21+
2122
import com.amit.R;
2223

2324
public class CircularImageView extends AppCompatImageView

app/src/main/java/com/amit/iv/SquareImageView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.amit.iv;
22

33
import android.content.Context;
4-
import android.support.v7.widget.AppCompatImageView;
54
import android.util.AttributeSet;
65

6+
import androidx.appcompat.widget.AppCompatImageView;
7+
78
/*
89
* Created by AMIT JANGID on 20-Mar-18.
910
*/

app/src/main/java/com/amit/iv/TouchImageView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
import android.graphics.Matrix;
55
import android.graphics.PointF;
66
import android.graphics.drawable.Drawable;
7-
import android.support.v7.widget.AppCompatImageView;
87
import android.util.AttributeSet;
98
import android.util.Log;
109
import android.view.MotionEvent;
1110
import android.view.ScaleGestureDetector;
1211
import android.view.View;
1312

13+
import androidx.appcompat.widget.AppCompatImageView;
14+
1415
/**
1516
* Created by AMIT JANGID
1617
* 2018 April 17 - Tuesday - 01:08 PM

app/src/main/java/com/amit/location/GeoLocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import android.location.LocationManager;
1010
import android.os.Build;
1111
import android.provider.Settings;
12-
import android.support.v4.app.ActivityCompat;
12+
import androidx.core.app.ActivityCompat;
1313
import android.text.TextUtils;
1414
import android.util.Log;
1515

app/src/main/java/com/amit/location/MyLocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import android.os.Build;
1010
import android.os.Bundle;
1111
import android.provider.Settings;
12-
import android.support.v4.app.ActivityCompat;
12+
import androidx.core.app.ActivityCompat;
1313
import android.text.TextUtils;
1414
import android.util.Log;
1515

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package com.amit.menus
2+
3+
import android.content.Context
4+
import android.graphics.drawable.Drawable
5+
import android.os.Build
6+
import android.util.AttributeSet
7+
import android.util.Log
8+
import androidx.appcompat.content.res.AppCompatResources
9+
import androidx.core.graphics.drawable.DrawableCompat
10+
import com.amit.R
11+
import com.google.android.material.navigation.NavigationView
12+
13+
/**
14+
* Created by AMIT JANGID on 2019-12-09.
15+
* Copyright (c) 2019 Amit Jangid. All rights reserved.
16+
*
17+
* It creates Material navigation menu for application. The menu contents can be populated by a
18+
* menu resource file.
19+
**/
20+
class MaterialNavigationView @JvmOverloads constructor(
21+
context: Context, attrs: AttributeSet, defStyleAttr: Int = R.style.Widget_NavigationView) :
22+
NavigationView(context, attrs, defStyleAttr)
23+
{
24+
private var itemStyle: Int = ITEM_STYLE_DEFAULT
25+
26+
init
27+
{
28+
// Init item style
29+
val a = context.theme.obtainStyledAttributes(attrs, R.styleable.MaterialNavigationView, 0 ,0)
30+
itemStyle = a.getInteger(R.styleable.MaterialNavigationView_itemStyle, ITEM_STYLE_DEFAULT)
31+
32+
// Recycling style attributes
33+
a.recycle()
34+
35+
// Setting the Background to the Navigation Item
36+
itemBackground = navigationItemBackground()
37+
}
38+
39+
/**
40+
* Method is used to get item style
41+
* @return Int value of Item style. It will be one of the below
42+
* @see ITEM_STYLE_ROUND_RIGHT (1)
43+
* @see ITEM_STYLE_ROUND_RECTANGLE (2)
44+
**/
45+
fun getItemStyle(): Int
46+
{
47+
return itemStyle
48+
}
49+
50+
/**
51+
* Method is used to set item style
52+
* @param itemStyle is value of Item style. It will be one of the below
53+
* @see ITEM_STYLE_ROUND_RIGHT (1)
54+
* @see ITEM_STYLE_ROUND_RECTANGLE (2)
55+
**/
56+
fun setItemStyle(itemStyle: Int)
57+
{
58+
if (itemStyle == ITEM_STYLE_ROUND_RIGHT || itemStyle == ITEM_STYLE_ROUND_RECTANGLE || itemStyle == ITEM_STYLE_DEFAULT)
59+
{
60+
this.itemStyle = itemStyle
61+
itemBackground = navigationItemBackground()
62+
}
63+
else
64+
{
65+
Log.e(javaClass.name, context.getString(R.string.illegal_arg_message))
66+
}
67+
}
68+
69+
private fun navigationItemBackground(): Drawable?
70+
{
71+
// Set resources
72+
val resources = when(itemStyle)
73+
{
74+
ITEM_STYLE_DEFAULT -> R.drawable.navigation_item_background_default
75+
ITEM_STYLE_ROUND_RIGHT -> R.drawable.navigation_item_background_rounded_right
76+
else -> R.drawable.navigation_item_background_rounded_rect
77+
}
78+
79+
var background = AppCompatResources.getDrawable(context, resources)
80+
81+
if (background != null)
82+
{
83+
val tint = AppCompatResources.getColorStateList(context, R.color.navigation_item_background_tint)
84+
background = DrawableCompat.wrap(background.mutate())
85+
86+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
87+
{
88+
background.setTintList(tint)
89+
}
90+
else
91+
{
92+
DrawableCompat.setTintList(background, tint)
93+
}
94+
}
95+
96+
return background
97+
}
98+
99+
companion object
100+
{
101+
const val ITEM_STYLE_DEFAULT = 1
102+
const val ITEM_STYLE_ROUND_RIGHT = 2
103+
const val ITEM_STYLE_ROUND_RECTANGLE = 3
104+
}
105+
}

0 commit comments

Comments
 (0)