Skip to content

Commit

Permalink
Fixed minor bugs and unwanted crash issue in Library
Browse files Browse the repository at this point in the history
  • Loading branch information
Jumman04 committed Nov 9, 2023
1 parent 6b546d0 commit cae5fee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Binary file modified J-Slider-release.aar
Binary file not shown.
15 changes: 9 additions & 6 deletions J-Slider/src/main/java/com/jummania/j_slider/JSlider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ class JSlider @JvmOverloads constructor(

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {

var measureSpec = heightMeasureSpec
val mode = MeasureSpec.getMode(measureSpec)
if (mode == MeasureSpec.UNSPECIFIED || mode == MeasureSpec.AT_MOST) {
super.onMeasure(widthMeasureSpec, measureSpec)
Expand All @@ -422,15 +421,15 @@ class JSlider @JvmOverloads constructor(
val h = child.measuredHeight
if (h > height) height = h
}
measureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
}
super.onMeasure(widthMeasureSpec, measureSpec)
super.onMeasure(
widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
)
} else super.onMeasure(widthMeasureSpec, heightMeasureSpec)
}
}

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {

var measureSpec = heightMeasureSpec
measureSpec = heightMeasureSpec
val mode = MeasureSpec.getMode(measureSpec)
if (mode == MeasureSpec.UNSPECIFIED || mode == MeasureSpec.AT_MOST) {
super.onMeasure(widthMeasureSpec, measureSpec)
Expand All @@ -447,4 +446,8 @@ class JSlider @JvmOverloads constructor(
}
super.onMeasure(widthMeasureSpec, measureSpec)
}

companion object {
private var measureSpec: Int = 0
}
}
4 changes: 2 additions & 2 deletions app/src/main/java/com/jummania/jummaniaslider/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class MainActivity : AppCompatActivity() {
// jSlider.setSlideAnimation(AnimationTypes.DEPTH_SLIDE)
jSlider.setSlider(Slider())


}

private inner class Slider : JSlider.Slide() {
Expand All @@ -42,7 +41,8 @@ class MainActivity : AppCompatActivity() {
val textView: TextView = view.findViewById(R.id.text_view)
val imageView: ImageView = view.findViewById(R.id.image_view)

Picasso.get().load("https://img.youtube.com/vi/" + list.id + "/sddefault.jpg")
Picasso.get()
.load("https://jummania.com/App/BanglaNatokSamahar/Images/Cover%20Photo.jpg")
.error(R.drawable.default_error).placeholder(R.drawable.default_loading)
.into(imageView)
textView.text = list.title
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<com.jummania.j_slider.JSlider
android:id="@+id/jSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="188dp"
app:indicatorPaddingBottom="22dp"
app:slidingDuration="2222" />

Expand Down

0 comments on commit cae5fee

Please sign in to comment.