Skip to content

Commit

Permalink
Migrated widget module from Java to Kotlin (#5940)
Browse files Browse the repository at this point in the history
* Rename .java to .kt

* Migrated widget module to Kotlin
  • Loading branch information
Saifuddin53 authored Nov 20, 2024
1 parent 0fdb004 commit cb4ffd8
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 237 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.gson.Gson;

import fr.free.nrw.commons.actions.PageEditClient;
import fr.free.nrw.commons.explore.categories.CategoriesModule;
import fr.free.nrw.commons.navtab.MoreBottomSheetFragment;
import fr.free.nrw.commons.navtab.MoreBottomSheetLoggedOutFragment;
Expand Down

This file was deleted.

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 app/src/main/java/fr/free/nrw/commons/widget/PicOfDayAppWidget.java

This file was deleted.

Loading

0 comments on commit cb4ffd8

Please sign in to comment.