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

App: refactor to AndroidX, fix bug library #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gradle
.idea
*.iml
local.properties
22 changes: 13 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 29

defaultConfig {
applicationId "com.andrognito.pinlockviewapp"
minSdkVersion 11
targetSdkVersion 25
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionName "1.0.0"
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -20,8 +20,12 @@ android {
}

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

implementation project(':pinlockview')

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha04'

testImplementation 'junit:junit:4.12'
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme.NoActionBar">

<activity android:name=".SampleActivity">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.andrognito.pinlockviewapp;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import com.andrognito.pinlockview.IndicatorDots;
import com.andrognito.pinlockview.PinLockListener;
import com.andrognito.pinlockview.PinLockView;
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -15,6 +16,7 @@ buildscript {

allprojects {
repositories {
google()
jcenter()
}
}
Expand Down
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 @@
#Fri Mar 10 00:08:20 IST 2017
#Wed Feb 12 09:08:40 ICT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
19 changes: 10 additions & 9 deletions pinlockview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ext {
bintrayRepo = 'maven'
bintrayName = 'pin-lock-view'

publishedGroupId = 'com.andrognito.pinlockview'
publishedGroupId = 'com.andrognito.pinlockview-phongbm'
libraryName = 'pinlockview'
artifact = 'pinlockview'

Expand All @@ -26,12 +26,11 @@ ext {


android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 29

defaultConfig {
minSdkVersion 11
targetSdkVersion 25
minSdkVersion 21
targetSdkVersion 29
versionCode 5
versionName "2.1.0"
}
Expand All @@ -44,10 +43,12 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha04'

testImplementation 'junit:junit:4.12'
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* The customization options for the buttons in {@link PinLockView}
* passed to the {@link PinLockAdapter} to decorate the individual views
*
* <p>
* Created by aritraroy on 01/06/16.
*/
public class CustomizationOptionsBundle {
Expand Down Expand Up @@ -47,7 +47,7 @@ public void setButtonSize(int buttonSize) {
}

public Drawable getButtonBackgroundDrawable() {
return buttonBackgroundDrawable;
return buttonBackgroundDrawable.getConstantState().newDrawable();
}

public void setButtonBackgroundDrawable(Drawable buttonBackgroundDrawable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import android.animation.LayoutTransition;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.IntDef;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.IntDef;
import androidx.core.view.ViewCompat;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.andrognito.pinlockview;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

/**
* Created by aritraroy on 31/05/16.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.andrognito.pinlockview;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.util.AttributeSet;

import androidx.recyclerview.widget.GridLayoutManager;

/**
* Used to always maintain an LTR layout no matter what is the real device's layout direction
* to avoid an unwanted reversed direction in RTL devices
Expand All @@ -25,7 +26,7 @@ public LTRGridLayoutManager(Context context, int spanCount, int orientation, boo
}

@Override
protected boolean isLayoutRTL(){
protected boolean isLayoutRTL() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.os.Build;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

/**
* Created by aritraroy on 31/05/16.
Expand Down Expand Up @@ -74,13 +74,7 @@ private void configureNumberButtonHolder(NumberViewHolder holder, int position)
if (mCustomizationOptionsBundle != null) {
holder.mNumberButton.setTextColor(mCustomizationOptionsBundle.getTextColor());
if (mCustomizationOptionsBundle.getButtonBackgroundDrawable() != null) {
if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
holder.mNumberButton.setBackgroundDrawable(
mCustomizationOptionsBundle.getButtonBackgroundDrawable());
} else {
holder.mNumberButton.setBackground(
mCustomizationOptionsBundle.getButtonBackgroundDrawable());
}
holder.mNumberButton.setBackground(mCustomizationOptionsBundle.getButtonBackgroundDrawable());
}
holder.mNumberButton.setTextSize(TypedValue.COMPLEX_UNIT_PX,
mCustomizationOptionsBundle.getTextSize());
Expand Down Expand Up @@ -179,11 +173,11 @@ public void setCustomizationOptions(CustomizationOptionsBundle customizationOpti
}

public class NumberViewHolder extends RecyclerView.ViewHolder {
Button mNumberButton;
TextView mNumberButton;

public NumberViewHolder(final View itemView) {
super(itemView);
mNumberButton = (Button) itemView.findViewById(R.id.button);
mNumberButton = itemView.findViewById(R.id.button);
mNumberButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

/**
* Represents a numeric lock view which can used to taken numbers as input.
* The length of the input can be customized using {@link PinLockView#setPinLength(int)}, the default value being 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.DimenRes;
import android.support.annotation.DrawableRes;
import android.support.v4.content.ContextCompat;

import androidx.annotation.ColorRes;
import androidx.annotation.DimenRes;
import androidx.annotation.DrawableRes;
import androidx.core.content.ContextCompat;

/**
* Created by aritraroy on 10/06/16.
Expand Down
15 changes: 0 additions & 15 deletions pinlockview/src/main/res/layout-v21/layout_number_item.xml

This file was deleted.

6 changes: 3 additions & 3 deletions pinlockview/src/main/res/layout/layout_number_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
android:clipToPadding="false"
android:orientation="vertical">

<Button
<TextView
android:id="@+id/button"
android:layout_width="64dp"
android:layout_height="64dp"
android:background="?android:attr/selectableItemBackground"/>

android:background="?android:attr/selectableItemBackgroundBorderless"
android:gravity="center" />
</LinearLayout>