Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Game Client Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Akamu
Game Client Android
Commits
4ccdaeff
Commit
4ccdaeff
authored
Oct 30, 2020
by
Niklas Fix
🎓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
#61
parent
be60e2f5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
161 additions
and
148 deletions
+161
-148
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/sections/ChallengeSection.kt
...adt/features/dashboard/duels/sections/ChallengeSection.kt
+1
-1
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/sections/FinishedDuelSection.kt
.../features/dashboard/duels/sections/FinishedDuelSection.kt
+2
-2
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/sections/RunningDuelSection.kt
...t/features/dashboard/duels/sections/RunningDuelSection.kt
+2
-2
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/viewholders/DuelSectionViewHolder.kt
...ures/dashboard/duels/viewholders/DuelSectionViewHolder.kt
+4
-1
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/viewholders/DuelViewHolder.kt
...dt/features/dashboard/duels/viewholders/DuelViewHolder.kt
+14
-3
app/src/main/res/layout/item_duel_list.xml
app/src/main/res/layout/item_duel_list.xml
+138
-139
No files found.
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/sections/ChallengeSection.kt
View file @
4ccdaeff
...
...
@@ -43,7 +43,7 @@ class ChallengeSection(
}
override
fun
onBindHeaderViewHolder
(
holder
:
RecyclerView
.
ViewHolder
?)
{
(
holder
as
DuelSectionViewHolder
).
bind
(
context
.
getString
(
R
.
string
.
challenges
))
(
holder
as
DuelSectionViewHolder
).
bind
(
context
.
getString
(
R
.
string
.
challenges
)
,
false
)
}
override
fun
getHeaderViewHolder
(
view
:
View
?):
RecyclerView
.
ViewHolder
{
...
...
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/sections/FinishedDuelSection.kt
View file @
4ccdaeff
...
...
@@ -29,7 +29,7 @@ class FinishedDuelSection(
}
override
fun
onBindItemViewHolder
(
holder
:
RecyclerView
.
ViewHolder
?,
position
:
Int
)
{
(
holder
as
DuelViewHolder
).
bind
(
sectionDuels
[
position
])
(
holder
as
DuelViewHolder
).
bind
(
sectionDuels
[
position
]
,
true
)
}
override
fun
getItemViewHolder
(
view
:
View
?):
RecyclerView
.
ViewHolder
{
...
...
@@ -42,7 +42,7 @@ class FinishedDuelSection(
}
override
fun
onBindHeaderViewHolder
(
holder
:
RecyclerView
.
ViewHolder
?)
{
(
holder
as
DuelSectionViewHolder
).
bind
(
context
.
getString
(
R
.
string
.
finished_duels
))
(
holder
as
DuelSectionViewHolder
).
bind
(
context
.
getString
(
R
.
string
.
finished_duels
)
,
true
)
}
override
fun
getHeaderViewHolder
(
view
:
View
?):
RecyclerView
.
ViewHolder
{
...
...
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/sections/RunningDuelSection.kt
View file @
4ccdaeff
...
...
@@ -29,7 +29,7 @@ class RunningDuelSection(
}
override
fun
onBindItemViewHolder
(
holder
:
RecyclerView
.
ViewHolder
?,
position
:
Int
)
{
(
holder
as
DuelViewHolder
).
bind
(
sectionDuels
[
position
])
(
holder
as
DuelViewHolder
).
bind
(
sectionDuels
[
position
]
,
false
)
}
override
fun
getItemViewHolder
(
view
:
View
?):
RecyclerView
.
ViewHolder
{
...
...
@@ -42,7 +42,7 @@ class RunningDuelSection(
}
override
fun
onBindHeaderViewHolder
(
holder
:
RecyclerView
.
ViewHolder
?)
{
(
holder
as
DuelSectionViewHolder
).
bind
(
context
.
getString
(
R
.
string
.
running_duels
))
(
holder
as
DuelSectionViewHolder
).
bind
(
context
.
getString
(
R
.
string
.
running_duels
)
,
false
)
}
override
fun
getHeaderViewHolder
(
view
:
View
?):
RecyclerView
.
ViewHolder
{
...
...
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/viewholders/DuelSectionViewHolder.kt
View file @
4ccdaeff
...
...
@@ -9,7 +9,10 @@ class DuelSectionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
private
var
mSectionName
:
TextView
=
itemView
.
findViewById
(
R
.
id
.
textView_duel_section_name
)
fun
bind
(
sectionName
:
String
)
{
fun
bind
(
sectionName
:
String
,
finished
:
Boolean
)
{
mSectionName
.
text
=
sectionName
if
(
finished
)
{
mSectionName
.
alpha
=
0.5f
}
}
}
\ No newline at end of file
app/src/main/java/de/akamu/tudarmstadt/features/dashboard/duels/viewholders/DuelViewHolder.kt
View file @
4ccdaeff
...
...
@@ -6,6 +6,8 @@ import android.view.View
import
android.widget.Button
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.cardview.widget.CardView
import
androidx.constraintlayout.widget.ConstraintLayout
import
androidx.recyclerview.widget.RecyclerView
import
de.akamu.tudarmstadt.R
import
de.akamu.tudarmstadt.features.dashboard.duels.listener.DuelClickListener
...
...
@@ -13,10 +15,16 @@ import de.akamu.tudarmstadt.model.Duel
import
de.akamu.tudarmstadt.model.DuelPlayer
import
de.akamu.tudarmstadt.util.AkamuResource
class
DuelViewHolder
(
itemView
:
View
,
var
context
:
Context
,
private
var
duelClickListener
:
DuelClickListener
,
private
var
ID_ME
:
Int
)
:
RecyclerView
.
ViewHolder
(
itemView
),
View
.
OnClickListener
{
class
DuelViewHolder
(
itemView
:
View
,
var
context
:
Context
,
private
var
duelClickListener
:
DuelClickListener
,
private
var
ID_ME
:
Int
)
:
RecyclerView
.
ViewHolder
(
itemView
),
View
.
OnClickListener
{
private
lateinit
var
mDuel
:
Duel
private
var
mCardParent
:
CardView
=
itemView
.
findViewById
(
R
.
id
.
CardParent
)
private
var
mOpponentName
:
TextView
=
itemView
.
findViewById
(
R
.
id
.
duel_item_opp_username
)
private
var
mOpponentTitle
:
TextView
=
itemView
.
findViewById
(
R
.
id
.
duel_item_opp_title
)
private
var
mOpponentAvatar
:
ImageView
=
itemView
.
findViewById
(
R
.
id
.
duel_item_opp_avatar
)
...
...
@@ -27,7 +35,7 @@ class DuelViewHolder(itemView: View, var context: Context, private var duelClick
buttonDuelAction
.
setOnClickListener
(
this
)
}
fun
bind
(
duel
:
Duel
)
{
fun
bind
(
duel
:
Duel
,
finished
:
Boolean
)
{
mDuel
=
duel
val
duelPlayers
=
duel
.
participants
...
...
@@ -35,7 +43,7 @@ class DuelViewHolder(itemView: View, var context: Context, private var duelClick
val
me
:
DuelPlayer
val
opp
:
DuelPlayer
if
(
duelPlayers
==
null
)
{
if
(
duelPlayers
==
null
)
{
return
}
...
...
@@ -58,6 +66,9 @@ class DuelViewHolder(itemView: View, var context: Context, private var duelClick
buttonDuelAction
.
text
=
getDuelButtonText
(
duel
,
me
,
opp
)
buttonDuelAction
.
background
=
getDuelButtonBackground
(
buttonDuelAction
.
text
)
if
(
finished
)
{
mCardParent
.
alpha
=
0.5f
}
}
private
fun
getDuelButtonText
(
duel
:
Duel
,
me
:
DuelPlayer
,
opp
:
DuelPlayer
):
CharSequence
?
{
...
...
app/src/main/res/layout/item_duel_list.xml
View file @
4ccdaeff
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"140dp"
app:cardUseCompatPadding=
"true"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/CardParent"
android:background=
"@color/white"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/ConstraintLayoutDuelAction"
android:layout_width=
"160dp"
android:layout_height=
"match_parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:id=
"@+id/duel_item_score"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:paddingStart=
"40dp"
android:paddingEnd=
"4dp"
android:text=
"28 : 23"
android:textAlignment=
"center"
android:textColor=
"@color/darkText"
android:textSize=
"22sp"
android:textStyle=
"bold"
android:maxLines=
"1"
app:layout_constraintBottom_toTopOf=
"@id/buttonDuelAction"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText,RtlSymmetry"
/>
<Button
android:id=
"@+id/buttonDuelAction"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"@color/colorPlayWon"
android:foreground=
"?selectableItemBackground"
android:paddingStart=
"20dp"
android:text=
"PLAY"
android:textAlignment=
"center"
android:textColor=
"@color/textWhite"
android:textSize=
"21sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"1.0"
tools:ignore=
"HardcodedText,RtlSymmetry"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id=
"@+id/DuelPolygonShit"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingEnd=
"95dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"RtlSymmetry"
>
<include
layout=
"@layout/item_duel_list_background"
/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/ConstraintLayoutOpponentInfo"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:padding=
"5dp"
app:layout_constraintEnd_toStartOf=
"@id/GuidelineNameConstraint"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:id=
"@+id/duel_item_opp_avatar"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_marginStart=
"4dp"
android:layout_marginTop=
"4dp"
android:contentDescription=
"@string/user_avatar"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/ConstraintLayoutOpponentInfo"
/>
<LinearLayout
android:id=
"@+id/LinearLayoutUserTitle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:orientation=
"vertical"
app:layout_constraintStart_toEndOf=
"@+id/duel_item_opp_avatar"
app:layout_constraintTop_toTopOf=
"@+id/duel_item_opp_avatar"
app:layout_constraintEnd_toEndOf=
"@id/ConstraintLayoutOpponentInfo"
>
<TextView
android:id=
"@+id/duel_item_opp_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:singleLine=
"true"
android:text=
"Man-in-the-middle"
android:textColor=
"@color/textWhite"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/duel_item_opp_username"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:singleLine=
"true"
android:text=
"@string/app_name"
android:textColor=
"@color/textWhite"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/GuidelineNameConstraint"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintGuide_end=
"125dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"140dp"
android:id=
"@+id/CardParent"
app:cardUseCompatPadding=
"true"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/ConstraintLayoutDuelAction"
android:layout_width=
"160dp"
android:layout_height=
"match_parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:id=
"@+id/duel_item_score"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:maxLines=
"1"
android:paddingStart=
"40dp"
android:paddingEnd=
"4dp"
android:text=
"28 : 23"
android:textAlignment=
"center"
android:textColor=
"@color/darkText"
android:textSize=
"22sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@id/buttonDuelAction"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText,RtlSymmetry"
/>
<Button
android:id=
"@+id/buttonDuelAction"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"@color/colorPlayWon"
android:foreground=
"?selectableItemBackground"
android:paddingStart=
"20dp"
android:text=
"PLAY"
android:textAlignment=
"center"
android:textColor=
"@color/textWhite"
android:textSize=
"21sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"1.0"
tools:ignore=
"HardcodedText,RtlSymmetry"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id=
"@+id/DuelPolygonShit"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingEnd=
"95dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"RtlSymmetry"
>
<include
layout=
"@layout/item_duel_list_background"
/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/ConstraintLayoutOpponentInfo"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:padding=
"5dp"
app:layout_constraintEnd_toStartOf=
"@id/GuidelineNameConstraint"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:id=
"@+id/duel_item_opp_avatar"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_marginStart=
"4dp"
android:layout_marginTop=
"4dp"
android:contentDescription=
"@string/user_avatar"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/ConstraintLayoutOpponentInfo"
/>
<LinearLayout
android:id=
"@+id/LinearLayoutUserTitle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:orientation=
"vertical"
app:layout_constraintEnd_toEndOf=
"@id/ConstraintLayoutOpponentInfo"
app:layout_constraintStart_toEndOf=
"@+id/duel_item_opp_avatar"
app:layout_constraintTop_toTopOf=
"@+id/duel_item_opp_avatar"
>
<TextView
android:id=
"@+id/duel_item_opp_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:singleLine=
"true"
android:text=
"Man-in-the-middle"
android:textColor=
"@color/textWhite"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/duel_item_opp_username"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:singleLine=
"true"
android:text=
"@string/app_name"
android:textColor=
"@color/textWhite"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/GuidelineNameConstraint"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintGuide_end=
"125dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment