-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite custom listview class in kotlin & bump version
Signed-off-by: starry69 <[email protected]>
- Loading branch information
1 parent
e215d89
commit e488939
Showing
5 changed files
with
54 additions
and
51 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
49 changes: 0 additions & 49 deletions
49
app/src/main/java/com/starry/greenstash/others/ExpandableListView.java
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/starry/greenstash/others/ExpandableListView.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,32 @@ | ||
package com.starry.greenstash.others | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.widget.ListView | ||
|
||
class ExpandableListView : ListView { | ||
var isExpanded = false | ||
|
||
constructor(context: Context?) : super(context) | ||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) | ||
constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super( | ||
context, | ||
attrs, | ||
defStyle | ||
) | ||
|
||
public override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { | ||
// HACK! TAKE THAT ANDROID! | ||
if (isExpanded) { | ||
// Calculate entire height by providing a very large height hint. | ||
// But do not use the highest 2 bits of this integer; those are | ||
// reserved for the MeasureSpec mode. | ||
val expandSpec = MeasureSpec.makeMeasureSpec(Int.MAX_VALUE shr 2, MeasureSpec.AT_MOST) | ||
super.onMeasure(widthMeasureSpec, expandSpec) | ||
val params = layoutParams | ||
params.height = measuredHeight | ||
} else { | ||
super.onMeasure(widthMeasureSpec, heightMeasureSpec) | ||
} | ||
} | ||
} |
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,3 @@ | ||
- Some under the hood improvements & fixes. | ||
- Updated few dependencies. | ||
- We now have a telegram group! Join us at https://t.me/PotApps |