-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1315 from Rd4dev/PAINTROID-534
PAINTROID-534: Refactored introPageViewAdapter to kotlin
- Loading branch information
Showing
2 changed files
with
45 additions
and
62 deletions.
There are no files selected for viewing
62 changes: 0 additions & 62 deletions
62
Paintroid/src/main/java/org/catrobat/paintroid/intro/IntroPageViewAdapter.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
Paintroid/src/main/java/org/catrobat/paintroid/intro/IntroPageViewAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |