Skip to content

Commit cb4ffd8

Browse files
authored
Migrated widget module from Java to Kotlin (commons-app#5940)
* Rename .java to .kt * Migrated widget module to Kotlin
1 parent 0fdb004 commit cb4ffd8

File tree

7 files changed

+224
-237
lines changed

7 files changed

+224
-237
lines changed

app/src/main/java/fr/free/nrw/commons/di/CommonsApplicationComponent.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.google.gson.Gson;
44

5-
import fr.free.nrw.commons.actions.PageEditClient;
65
import fr.free.nrw.commons.explore.categories.CategoriesModule;
76
import fr.free.nrw.commons.navtab.MoreBottomSheetFragment;
87
import fr.free.nrw.commons.navtab.MoreBottomSheetLoggedOutFragment;

app/src/main/java/fr/free/nrw/commons/widget/HeightLimitedRecyclerView.java

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package fr.free.nrw.commons.widget
2+
3+
import android.app.Activity
4+
import android.content.Context
5+
import android.util.AttributeSet
6+
import android.util.DisplayMetrics
7+
8+
import androidx.annotation.Nullable
9+
import androidx.recyclerview.widget.RecyclerView
10+
11+
12+
/**
13+
* Created by Ilgaz Er on 8/7/2018.
14+
*/
15+
class HeightLimitedRecyclerView : RecyclerView {
16+
private var height: Int = 0
17+
18+
constructor(context: Context) : super(context) {
19+
initializeHeight(context)
20+
}
21+
22+
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
23+
initializeHeight(context)
24+
}
25+
26+
constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) {
27+
initializeHeight(context)
28+
}
29+
30+
private fun initializeHeight(context: Context) {
31+
val displayMetrics = DisplayMetrics()
32+
(context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics)
33+
height = displayMetrics.heightPixels
34+
}
35+
36+
override fun onMeasure(widthSpec: Int, heightSpec: Int) {
37+
val limitedHeightSpec = MeasureSpec.makeMeasureSpec(
38+
(height * 0.3).toInt(),
39+
MeasureSpec.AT_MOST
40+
)
41+
super.onMeasure(widthSpec, limitedHeightSpec)
42+
}
43+
}

app/src/main/java/fr/free/nrw/commons/widget/PicOfDayAppWidget.java

Lines changed: 0 additions & 181 deletions
This file was deleted.

0 commit comments

Comments
 (0)