Skip to content

Commit

Permalink
Added Library Support
Browse files Browse the repository at this point in the history
Signed-off-by: Sanju S <spikeysanju98@gmail.com>
  • Loading branch information
Spikeysanju committed Mar 14, 2020
1 parent 9185dbd commit 425c1f4
Show file tree
Hide file tree
Showing 34 changed files with 947 additions and 54 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

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

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':motiontoast')
}
4 changes: 2 additions & 2 deletions app/src/main/java/www/sanju/motiontoast/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class MainActivity : AppCompatActivity() , View.OnClickListener {
}
R.id.infoBtn ->{

MotionToast.createToast(
MotionToast.createColorToast(
this, "Welcome back sanju!",
MotionToast.TOAST_INFO,
MotionToast.TOAST_NO_INTERNET,
MotionToast.GRAVITY_BOTTOM,
MotionToast.LONG_DURATION,
ResourcesCompat.getFont(this,R.font.helvetica_regular))
Expand Down
17 changes: 9 additions & 8 deletions app/src/main/res/layout/full_color_toast.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_toast_layout"
android:id="@+id/color_toast_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="10dp"
android:background="@color/info_color">
android:background="@drawable/toast_round_background"
android:backgroundTint="@color/warning_color">


<ImageView
android:id="@+id/custom_toast_image"
android:id="@+id/color_toast_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginStart="15dp"
android:background="@drawable/color_view_background"
android:src="@drawable/ic_info_blue" />

android:padding="5dp"
android:src="@drawable/ic_warning_yellow"
android:background="@drawable/color_view_background" />

<LinearLayout
android:layout_width="wrap_content"
Expand All @@ -28,7 +29,7 @@


<TextView
android:id="@+id/custom_toast_text"
android:id="@+id/color_toast_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/custom_toast_image"
Expand All @@ -40,7 +41,7 @@
android:textStyle="bold" />

<TextView
android:id="@+id/custom_toast_description"
android:id="@+id/color_toast_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/custom_toast_image"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/motion_toast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="20dp"
android:id="@+id/custom_toast_layout_2"
android:id="@+id/motion_toast_view"
android:background="@android:color/white">

<View
Expand Down
34 changes: 0 additions & 34 deletions app/src/main/res/layout/simple_toast.xml

This file was deleted.

2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
1 change: 1 addition & 0 deletions motiontoast/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
41 changes: 41 additions & 0 deletions motiontoast/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'


apply plugin: 'com.github.dcendents.android-maven'
group 'spikeysanju'
version = '1.0'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"

defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Empty file added motiontoast/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions motiontoast/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package www.sanju.motiontoast

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("www.sanju.motiontoast.test", appContext.packageName)
}
}
1 change: 1 addition & 0 deletions motiontoast/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest package="www.sanju.motiontoast" />
Loading

0 comments on commit 425c1f4

Please sign in to comment.