Skip to content

Commit

Permalink
Merge pull request #1315 from Rd4dev/PAINTROID-534
Browse files Browse the repository at this point in the history
PAINTROID-534: Refactored introPageViewAdapter to kotlin
  • Loading branch information
Lenkomotive authored Dec 29, 2023
2 parents 9d293a4 + 68be476 commit 4dbda82
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 62 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Paintroid: An image manipulation application for Android.
* Copyright (C) 2010-2015 The Catrobat Team
* (<http:></http:>//developer.catrobat.org/credits>)
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http:></http:>//www.gnu.org/licenses/>.
*/
package org.catrobat.paintroid.intro

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter

class IntroPageViewAdapter(val layouts: IntArray) : PagerAdapter() {

override fun instantiateItem(container: ViewGroup, position: Int): Any {
val inflater = LayoutInflater.from(container.context)
val view = inflater.inflate(layouts[position], container, false)
container.addView(view)
return view
}

override fun getCount(): Int = layouts.size

override fun isViewFromObject(view: View, obj: Any): Boolean = view === obj

override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
container.removeView(`object` as View)
}
}

0 comments on commit 4dbda82

Please sign in to comment.