Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ allprojects {
Then, add the library to your module `build.gradle`
```gradle
dependencies {
implementation 'com.github.faruktoptas:FancyShowCaseView:1.4.0'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.5.0'
}
```

Expand Down
12 changes: 11 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
namespace 'me.toptas.fancyshowcasesample'
compileSdkVersion compile_sdk_version

defaultConfig {
Expand Down Expand Up @@ -46,6 +46,16 @@ android {
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding = true
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,26 @@ import android.view.View
import android.view.animation.AnimationUtils
import android.widget.TextView

import kotlinx.android.synthetic.main.activity_main.*
import me.toptas.fancyshowcase.FancyShowCaseQueue
import me.toptas.fancyshowcase.FancyShowCaseView
import me.toptas.fancyshowcase.listener.OnViewInflateListener
import me.toptas.fancyshowcasesample.databinding.ActivityAnimatedBinding


class AnimatedActivity : BaseActivity() {


private lateinit var binding: ActivityAnimatedBinding
private lateinit var queue: FancyShowCaseQueue
private lateinit var fancyView: FancyShowCaseView
private lateinit var fancyView2: FancyShowCaseView

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_animated)
binding = ActivityAnimatedBinding.inflate(layoutInflater)
setContentView(binding.root)

fancyView = FancyShowCaseView.Builder(this)
.focusOn(btn_focus)
.focusOn(binding.btnFocus)
.customView(R.layout.layout_animated_view, object : OnViewInflateListener {
override fun onViewInflated(view: View) {
setAnimatedContent(view, fancyView)
Expand All @@ -49,15 +50,15 @@ class AnimatedActivity : BaseActivity() {
.build()

fancyView2 = FancyShowCaseView.Builder(this)
.focusOn(btn_focus2)
.focusOn(binding.btnFocus2)
.customView(R.layout.layout_animated_view, object : OnViewInflateListener {
override fun onViewInflated(view: View) {
setAnimatedContent(view, fancyView2)
}
})
.build()

btn_focus.setOnClickListener {
binding.btnFocus.setOnClickListener {
queue = FancyShowCaseQueue().apply {
add(fancyView)
add(fancyView2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import android.os.Bundle
import android.util.Log
import android.view.View

import kotlinx.android.synthetic.main.activity_queue.*
import me.toptas.fancyshowcase.FancyShowCaseQueue
import me.toptas.fancyshowcase.FancyShowCaseView
import me.toptas.fancyshowcase.listener.DismissListener
import me.toptas.fancyshowcase.listener.OnViewInflateListener
import me.toptas.fancyshowcasesample.databinding.ActivityQueueBinding

class CustomQueueActivity : BaseActivity() {

private lateinit var binding: ActivityQueueBinding
private lateinit var queue: FancyShowCaseQueue

private var mClickListener: View.OnClickListener = View.OnClickListener {
Expand All @@ -48,11 +49,12 @@ class CustomQueueActivity : BaseActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_queue)
binding = ActivityQueueBinding.inflate(layoutInflater)
setContentView(binding.root)

val fancyShowCaseView1 = FancyShowCaseView.Builder(this)
.title("First Queue Item")
.focusOn(btn_queue_1)
.focusOn(binding.btnQueue1)
.customView(R.layout.layout_my_custom_view, object : OnViewInflateListener {
override fun onViewInflated(view: View) {
view.findViewById<View>(R.id.btn_action_1).setOnClickListener(mClickListener)
Expand All @@ -64,7 +66,7 @@ class CustomQueueActivity : BaseActivity() {

val fancyShowCaseView2 = FancyShowCaseView.Builder(this)
.title("Second Queue Item")
.focusOn(btn_queue_2)
.focusOn(binding.btnQueue2)
.customView(R.layout.layout_my_custom_view, object : OnViewInflateListener {
override fun onViewInflated(view: View) {
view.findViewById<View>(R.id.btn_action_1).setOnClickListener(mClickListener)
Expand All @@ -76,7 +78,7 @@ class CustomQueueActivity : BaseActivity() {

val fancyShowCaseView3 = FancyShowCaseView.Builder(this)
.title("Third Queue Item")
.focusOn(btn_queue_3!!)
.focusOn(binding.btnQueue3)
.customView(R.layout.layout_my_custom_view, object : OnViewInflateListener {
override fun onViewInflated(view: View) {
view.findViewById<View>(R.id.btn_action_1).setOnClickListener(mClickListener)
Expand Down
58 changes: 30 additions & 28 deletions app/src/main/java/me/toptas/fancyshowcasesample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.Toast
import androidx.core.content.res.ResourcesCompat
import kotlinx.android.synthetic.main.activity_main.*
import me.toptas.fancyshowcase.FancyShowCaseView
import me.toptas.fancyshowcase.FocusShape
import me.toptas.fancyshowcase.listener.DismissListener
import me.toptas.fancyshowcase.listener.OnViewInflateListener
import me.toptas.fancyshowcasesample.databinding.ActivityMainBinding

class MainActivity : BaseActivity() {

private lateinit var binding: ActivityMainBinding
private var mFancyShowCaseView: FancyShowCaseView? = null

private var mClickListener: View.OnClickListener = View.OnClickListener {
Expand All @@ -49,17 +50,18 @@ class MainActivity : BaseActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

btn_simple.setOnClickListener {
binding.btnSimple.setOnClickListener {
FancyShowCaseView.Builder(this)
.title("No Focus")
.build()
.show()
}

//Shows a FancyShowCaseView that focus on a vie
btn_focus.setOnClickListener {
binding.btnFocus.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Circle Focus on View")
Expand All @@ -69,7 +71,7 @@ class MainActivity : BaseActivity() {

// Set title with spanned
val spanned: Spanned = Html.fromHtml("<font color='#ff0000'>Spanned</font>")
btn_spanned.setOnClickListener {
binding.btnSpanned.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title(spanned)
Expand All @@ -81,7 +83,7 @@ class MainActivity : BaseActivity() {
}

// Set title size
btn_title_size.setOnClickListener {
binding.btnTitleSize.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Title size")
Expand All @@ -91,7 +93,7 @@ class MainActivity : BaseActivity() {
}

// Set title typeface
btn_title_typeface.setOnClickListener {
binding.btnTitleTypeface.setOnClickListener {
val typeface =
ResourcesCompat.getFont(this, R.font.pacifico_regular)
FancyShowCaseView.Builder(this)
Expand All @@ -103,7 +105,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView with rounded rect focus shape
btn_rounded_rect.setOnClickListener {
binding.btnRoundedRect.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.focusShape(FocusShape.ROUNDED_RECTANGLE)
Expand All @@ -115,7 +117,7 @@ class MainActivity : BaseActivity() {


//Shows a FancyShowCaseView that focus on a view
btn_focus_dismiss_on_focus_area.setOnClickListener {
binding.btnFocusDismissOnFocusArea.setOnClickListener {
if (FancyShowCaseView.isVisible(this)) {
Toast.makeText(this, "Clickable button", Toast.LENGTH_SHORT).show()
FancyShowCaseView.hideCurrent(this)
Expand All @@ -130,7 +132,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView with rounded rect focus shape
btn_rounded_rect_dismiss_on_focus_area.setOnClickListener {
binding.btnRoundedRectDismissOnFocusArea.setOnClickListener {
if (FancyShowCaseView.isVisible(this)) {
Toast.makeText(this, "Clickable button", Toast.LENGTH_SHORT).show()
FancyShowCaseView.hideCurrent(this)
Expand All @@ -148,7 +150,7 @@ class MainActivity : BaseActivity() {
}

//Shows FancyShowCaseView with focusCircleRadiusFactor 1.5 and title gravity
btn_focus2.setOnClickListener {
binding.btnFocus2.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.focusCircleRadiusFactor(1.5)
Expand All @@ -160,7 +162,7 @@ class MainActivity : BaseActivity() {
}

//Shows FancyShowCaseView at specific position (round rectangle shape)
btn_rect_position.setOnClickListener {
binding.btnRectPosition.setOnClickListener {
FancyShowCaseView.Builder(this)
.title("Focus on larger view")
.focusRectAtPosition(260, 85, 480, 80)
Expand All @@ -180,7 +182,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView that focuses on a larger view
btn_focus_rect_color.setOnClickListener {
binding.btnFocusRectColor.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Focus on larger view")
Expand All @@ -194,7 +196,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView that has dashed rectangle border
btn_focus_dashed_rect.setOnClickListener {
binding.btnFocusDashedRect.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Focus with dashed line")
Expand All @@ -209,7 +211,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView that has dashed circle border
btn_focus_dashed_circle.setOnClickListener {
binding.btnFocusDashedCircle.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Focus with dashed line")
Expand All @@ -224,7 +226,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView with background color and title style
btn_background_color.setOnClickListener {
binding.btnBackgroundColor.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.backgroundColor(Color.parseColor("#AAff0000"))
Expand All @@ -235,7 +237,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView with border color
btn_border_color.setOnClickListener {
binding.btnBorderColor.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Focus border color can be changed")
Expand All @@ -247,7 +249,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView with custom enter, exit animations
btn_anim.setOnClickListener {
binding.btnAnim.setOnClickListener {
val enterAnimation = AnimationUtils.loadAnimation(this, R.anim.slide_in_top)
val exitAnimation = AnimationUtils.loadAnimation(this, R.anim.slide_out_bottom)

Expand All @@ -274,7 +276,7 @@ class MainActivity : BaseActivity() {
}

//Shows a FancyShowCaseView view custom view inflation
btn_custom_view.setOnClickListener {
binding.btnCustomView.setOnClickListener {
mFancyShowCaseView = FancyShowCaseView.Builder(this)
.focusOn(it)
.enableTouchOnFocusedView(true)
Expand All @@ -298,11 +300,11 @@ class MainActivity : BaseActivity() {

}

btn_custom_view2.setOnClickListener {
binding.btnCustomView2.setOnClickListener {
startActivity(Intent(this, AnimatedActivity::class.java))
}

btn_no_anim.setOnClickListener {
binding.btnNoAnim.setOnClickListener {
mFancyShowCaseView = FancyShowCaseView.Builder(this)
.focusOn(it)
.disableFocusAnimation()
Expand All @@ -311,31 +313,31 @@ class MainActivity : BaseActivity() {

}

btn_queue.setOnClickListener {
binding.btnQueue.setOnClickListener {
startActivity(Intent(this, QueueActivity::class.java))
}

btn_custom_queue.setOnClickListener {
binding.btnCustomQueue.setOnClickListener {
startActivity(Intent(this, CustomQueueActivity::class.java))
}

btn_another_activity.setOnClickListener {
binding.btnAnotherActivity.setOnClickListener {
startActivity(Intent(this, SecondActivity::class.java))
}

btn_recycler_view.setOnClickListener {
binding.btnRecyclerView.setOnClickListener {
startActivity(Intent(this, RecyclerViewActivity::class.java))
}

btn_scaled_view.setOnClickListener {
binding.btnScaledView.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Focus on Scaled View")
.build()
.show()
}

btn_focus_delay.setOnClickListener {
binding.btnFocusDelay.setOnClickListener {
FancyShowCaseView.Builder(this)
.title("Focus with delay")
.focusOn(it)
Expand All @@ -344,7 +346,7 @@ class MainActivity : BaseActivity() {
.show()
}

btn_show_once.setOnClickListener {
binding.btnShowOnce.setOnClickListener {
FancyShowCaseView.Builder(this)
.focusOn(it)
.title("Clean storage to see this again")
Expand Down
Loading