Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Haider committed Sep 2, 2022
0 parents commit 4b8acae
Show file tree
Hide file tree
Showing 75 changed files with 2,676 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

.gradle/
.ides/
.idea/
1 change: 1 addition & 0 deletions OnBoardingBubbles/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
38 changes: 38 additions & 0 deletions OnBoardingBubbles/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}

android {
compileSdk 30

defaultConfig {
minSdk 21
targetSdk 30

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

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.1.0-alpha09'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
Empty file.
21 changes: 21 additions & 0 deletions OnBoardingBubbles/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
5 changes: 5 additions & 0 deletions OnBoardingBubbles/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mohsin.onboardingbubbles">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.mohsin.onboardingbubbles

import android.animation.ObjectAnimator
import android.animation.PropertyValuesHolder
import android.view.View
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import android.view.animation.ScaleAnimation

object AnimationUtils {

fun getScaleAnimation(offset: Int, duration: Int): Animation {
val anim = ScaleAnimation(
0f, 1f, // Start and end values for the X axis scaling
0f, 1f, // Start and end values for the Y axis scaling
Animation.RELATIVE_TO_SELF, 0.5f, // Pivot point of X scaling
Animation.RELATIVE_TO_SELF, 0.5f
) // Pivot point of Y scaling
anim.fillAfter = true
anim.startOffset = offset.toLong()
anim.duration = duration.toLong()
return anim
}

fun getFadeInAnimation(offset: Int, duration: Int): Animation {
val fadeIn = AlphaAnimation(0f, 1f)
fadeIn.startOffset = offset.toLong()
fadeIn.interpolator = DecelerateInterpolator()
fadeIn.duration = duration.toLong()
return fadeIn
}

fun setBouncingAnimation(view: View, offset: Int, duration: Int): View {

val objAnim = ObjectAnimator.ofPropertyValuesHolder(
view,
PropertyValuesHolder.ofFloat("scaleX", 1.05f),
PropertyValuesHolder.ofFloat("scaleY", 1.05f)
)
objAnim.duration = duration.toLong()
objAnim.startDelay = offset.toLong()
objAnim.repeatCount = ObjectAnimator.INFINITE
objAnim.repeatMode = ObjectAnimator.REVERSE
objAnim.start()
return view
}

fun setAnimationToView(view: View, animation: Animation): View {
view.startAnimation(animation)
return view
}
}
Loading

0 comments on commit 4b8acae

Please sign in to comment.