-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated widget module from Java to Kotlin (#5940)
* Rename .java to .kt * Migrated widget module to Kotlin
- Loading branch information
1 parent
0fdb004
commit cb4ffd8
Showing
7 changed files
with
224 additions
and
237 deletions.
There are no files selected for viewing
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
48 changes: 0 additions & 48 deletions
48
app/src/main/java/fr/free/nrw/commons/widget/HeightLimitedRecyclerView.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
app/src/main/java/fr/free/nrw/commons/widget/HeightLimitedRecyclerView.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,43 @@ | ||
package fr.free.nrw.commons.widget | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.util.DisplayMetrics | ||
|
||
import androidx.annotation.Nullable | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
|
||
/** | ||
* Created by Ilgaz Er on 8/7/2018. | ||
*/ | ||
class HeightLimitedRecyclerView : RecyclerView { | ||
private var height: Int = 0 | ||
|
||
constructor(context: Context) : super(context) { | ||
initializeHeight(context) | ||
} | ||
|
||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { | ||
initializeHeight(context) | ||
} | ||
|
||
constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) { | ||
initializeHeight(context) | ||
} | ||
|
||
private fun initializeHeight(context: Context) { | ||
val displayMetrics = DisplayMetrics() | ||
(context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics) | ||
height = displayMetrics.heightPixels | ||
} | ||
|
||
override fun onMeasure(widthSpec: Int, heightSpec: Int) { | ||
val limitedHeightSpec = MeasureSpec.makeMeasureSpec( | ||
(height * 0.3).toInt(), | ||
MeasureSpec.AT_MOST | ||
) | ||
super.onMeasure(widthSpec, limitedHeightSpec) | ||
} | ||
} |
181 changes: 0 additions & 181 deletions
181
app/src/main/java/fr/free/nrw/commons/widget/PicOfDayAppWidget.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.