Skip to content

Commit 25c51c2

Browse files
Multiline text fixed throughout the app (#124)
* Fixes #122: multiline text fixed throughout the app * Doc update in AuthInterceptor
1 parent 5a75231 commit 25c51c2

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

app/src/main/java/com/github/code/gambit/data/remote/interceptor/AuthInterceptor.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@ import kotlinx.coroutines.Dispatchers
99
import kotlinx.coroutines.withContext
1010
import java.lang.Exception
1111

12+
/**
13+
* Use as auth interceptor for validating auth request and returning response
14+
* @author Danish Jamal [https://github.com/danishjamal104]
15+
* @param [context] The context in which interceptor is to be used
16+
*/
1217
class AuthInterceptor
1318
constructor(val context: Context) : InternetCheck(context) {
1419

20+
/**
21+
* Checks the internet connectivity and calls the requested function
22+
* @param [T] generic type to be returned by function
23+
* @param [call] lambda function called when intern is available
24+
*/
1525
private suspend fun <T> authRequest(call: suspend () -> T): T {
1626
val a = withContext(Dispatchers.IO) { hasActiveInternetConnection() }
1727
if (!a) {
@@ -20,6 +30,12 @@ constructor(val context: Context) : InternetCheck(context) {
2030
return call.invoke()
2131
}
2232

33+
/**
34+
* Checks for the credential validation and internet availability using [authRequest]
35+
*
36+
* @param [T] generic type returned by auth request
37+
* @param [B] generic type to be returned by [ServiceResult]
38+
*/
2339
suspend fun <T, B> authRequest(call: suspend () -> T, result: (res: T) -> ServiceResult<B>): ServiceResult<B> {
2440
return try {
2541
val response = authRequest { call.invoke() }

app/src/main/res/layout/fragment_login.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@
3737
android:layout_height="wrap_content"
3838
android:layout_marginTop="16dp"
3939
android:hint="@string/username"
40-
app:endIconMode="clear_text"
41-
>
40+
app:endIconMode="clear_text">
4241

4342
<com.google.android.material.textfield.TextInputEditText
4443
style="@style/input_theme.editText"
4544
android:layout_width="match_parent"
4645
android:layout_height="match_parent"
47-
android:maxLines="1"/>
46+
android:inputType="textEmailAddress"/>
4847
</com.google.android.material.textfield.TextInputLayout>
4948

5049
<com.google.android.material.textfield.TextInputLayout

app/src/main/res/layout/fragment_profile.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
android:layout_height="wrap_content"
5050
android:fontFamily="sans-serif-medium"
5151
android:gravity="center_horizontal"
52-
android:inputType="textNoSuggestions"
52+
android:inputType="textPersonName"
5353
android:letterSpacing="0.1"
5454
android:lines="1"
5555
android:textSize="24sp"

app/src/main/res/layout/fragment_sign_up.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
<com.google.android.material.textfield.TextInputEditText
4646
style="@style/input_theme.editText"
4747
android:layout_width="match_parent"
48-
android:layout_height="match_parent" />
48+
android:layout_height="match_parent"
49+
android:inputType="textPersonName"/>
4950
</com.google.android.material.textfield.TextInputLayout>
5051

5152
<com.google.android.material.textfield.TextInputLayout

app/src/main/res/layout/search_layout.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
app:startIconDrawable="@drawable/ic_baseline_search_24">
2525

2626
<com.google.android.material.textfield.TextInputEditText
27+
style="@style/input_theme.editText"
2728
android:layout_width="match_parent"
2829
android:layout_height="wrap_content"
29-
android:singleLine="true" />
30+
android:inputType="text"/>
3031

3132
</com.google.android.material.textfield.TextInputLayout>
3233

0 commit comments

Comments
 (0)