This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Laurislopata/edit profile #82
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9a2552e
Implemented edit username
laurislopata c3ea79d
Implemented edit handle
laurislopata f833e83
Updated manifest
laurislopata e86eed9
Refactored code
laurislopata 2bee84e
added username and password validation
laurislopata cb23122
added some google sign in tests
laurislopata 7038fa0
added some google sign in tests
laurislopata 9c06b1d
fixed codeclimate issues
laurislopata df15c78
fixed conflicts
laurislopata 0fa1bde
fixed conflicts
laurislopata d03ad41
fixing tests
laurislopata File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="ch.sdp.vibester"> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.MyApplication"> | ||
<activity | ||
android:name="ch.sdp.vibester.GamescreenActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".profile.ProfileSetup" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".MusicTemporary" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".GameSetupScreen" | ||
android:exported="false" /> | ||
<activity android:name=".scoreboard.ScoreBoardActivity" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity | ||
android:name=".WelcomeScreen" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".Register" | ||
android:exported="true" /> | ||
<activity | ||
android:name=".GreetingActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="ch.sdp.vibester"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.MyApplication"> | ||
<activity | ||
android:name=".GamescreenActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".profile.ProfileSetup" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".MusicTemporary" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".GameSetupScreen" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".scoreboard.ScoreBoardActivity" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity | ||
android:name=".WelcomeScreen" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".Register" | ||
android:exported="true" /> | ||
<activity | ||
android:name=".GreetingActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
package ch.sdp.vibester.profile | ||
|
||
import android.content.DialogInterface | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.widget.ImageView | ||
import android.text.InputType | ||
import android.widget.Button | ||
import android.widget.EditText | ||
import android.widget.TextView | ||
import androidx.appcompat.app.AlertDialog | ||
import ch.sdp.vibester.R | ||
const val EXTRA_ID = "userProfile" | ||
|
||
|
@@ -14,9 +18,38 @@ class ProfileSetup: AppCompatActivity() { | |
val bundle = intent.extras; | ||
val user: UserProfile = bundle?.getSerializable(EXTRA_ID) as UserProfile | ||
setupProfile(user) | ||
|
||
val editUsername = findViewById<Button>(R.id.editUser) | ||
val editHandle = findViewById<Button>(R.id.editHandle) | ||
|
||
editUsername.setOnClickListener { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
showDialog("Change username", "Enter new username", 0, R.id.username) | ||
} | ||
|
||
editHandle.setOnClickListener { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
showDialog("Change handle", "Enter new handle", 0, R.id.handle) | ||
} | ||
} | ||
|
||
private fun showDialog(title: String, hint: String, id: Int, textId: Int) { | ||
val builder: AlertDialog.Builder = AlertDialog.Builder(this) | ||
builder.setTitle(title) | ||
|
||
val input = EditText(this) | ||
input.hint = hint | ||
input.inputType = InputType.TYPE_CLASS_TEXT | ||
input.id = id | ||
|
||
builder.setView(input) | ||
builder.setPositiveButton("OK", DialogInterface.OnClickListener { _, _ -> | ||
findViewById<TextView>(textId).text = input.text.toString() | ||
}) | ||
builder.setNegativeButton("Cancel") { dialog, _ -> dialog.cancel() } | ||
builder.show() | ||
} | ||
|
||
fun setupProfile(user: UserProfile){ | ||
|
||
private fun setupProfile(user: UserProfile){ | ||
findViewById<TextView>(R.id.handle).text = user.handle | ||
findViewById<TextView>(R.id.username).text = user.username | ||
findViewById<TextView>(R.id.totalGames).text = user.totalGames.toString() | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc ?