-
Notifications
You must be signed in to change notification settings - Fork 2
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 #181 from alexandr7035/develop
Release v5.0. - Implement contributions grid (Github-like) - Bug fixes
- Loading branch information
Showing
43 changed files
with
877 additions
and
62 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
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
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
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
30 changes: 30 additions & 0 deletions
30
app/src/main/java/by/alexandr7035/gitstat/core/ContributionCellView.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,30 @@ | ||
package by.alexandr7035.gitstat.core | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.View | ||
|
||
// Use it with one side with WRAP_CONTENT | ||
class ContributionCellView: View { | ||
constructor(context: Context): super(context) | ||
constructor(context: Context, attrs: AttributeSet): super(context, attrs) | ||
|
||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { | ||
|
||
val widthMode = MeasureSpec.getMode(widthMeasureSpec) | ||
val heightMode = MeasureSpec.getMode(heightMeasureSpec) | ||
|
||
val widthSize = MeasureSpec.getSize(widthMeasureSpec) | ||
val heightSize = MeasureSpec.getSize(heightMeasureSpec) | ||
|
||
if (widthMode == MeasureSpec.EXACTLY && heightMode != MeasureSpec.EXACTLY) { | ||
setMeasuredDimension(widthSize, widthSize) | ||
} | ||
else if(heightMode == MeasureSpec.EXACTLY && widthMode != MeasureSpec.EXACTLY) { | ||
setMeasuredDimension(heightSize, heightSize) | ||
} | ||
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
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
app/src/main/java/by/alexandr7035/gitstat/data/local/dao/ContributionsDao.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
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
12 changes: 12 additions & 0 deletions
12
app/src/main/java/by/alexandr7035/gitstat/data/local/model/ContributionYearWithMonths.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,12 @@ | ||
package by.alexandr7035.gitstat.data.local.model | ||
|
||
import androidx.room.Embedded | ||
import androidx.room.Relation | ||
|
||
class ContributionYearWithMonths( | ||
@Embedded | ||
val year: ContributionsYearEntity, | ||
|
||
@Relation(parentColumn = "id", entityColumn = "yearId", entity = ContributionsMonthEntity::class) | ||
val contributionMonths: List<ContributionsMonthWithDays> | ||
) |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/by/alexandr7035/gitstat/data/local/model/ContributionsMonthEntity.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,13 @@ | ||
package by.alexandr7035.gitstat.data.local.model | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "contribution_months") | ||
data class ContributionsMonthEntity( | ||
// Save here "year"+ "month number". | ||
// E.g. 2020 + 01 -> 202001 | ||
@PrimaryKey | ||
val id: Int, | ||
val yearId: Int | ||
) |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/by/alexandr7035/gitstat/data/local/model/ContributionsMonthWithDays.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,11 @@ | ||
package by.alexandr7035.gitstat.data.local.model | ||
|
||
import androidx.room.Embedded | ||
import androidx.room.Relation | ||
|
||
class ContributionsMonthWithDays( | ||
@Embedded | ||
val month: ContributionsMonthEntity, | ||
|
||
@Relation(parentColumn = "id", entityColumn = "monthId", entity = ContributionDayEntity::class) | ||
val contributionDays: List<ContributionDayEntity>) |
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
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
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
Oops, something went wrong.