Skip to content

Commit

Permalink
Merge pull request #20 from itsyourap/itsyourap-ui-update
Browse files Browse the repository at this point in the history
[fix]: Nav Bar header margin
  • Loading branch information
Sbiswas001 authored Jun 20, 2024
2 parents 7c94e25 + beb2299 commit 7a05479
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 93 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/sayan/apps/numplex/FeedbackFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ class FeedbackFragment : Fragment(), View.OnClickListener {
val feedbackText = feedbackEditText.text.toString()
val ratingValue = ratingBar.rating.toDouble()

if (ratingValue < 1) {
Toast.makeText(requireActivity(), "Please provide a rating!", Toast.LENGTH_SHORT)
.show()
return
}

val account = GoogleSignIn.getLastSignedInAccount(requireActivity())
val userId = account?.email ?: "defaultUserId"

Expand Down
74 changes: 37 additions & 37 deletions app/src/main/java/sayan/apps/numplex/NumplexFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,49 +116,49 @@ class NumplexFragment : Fragment(), View.OnClickListener {

private fun showProperties() {
var result = ""
result += if (isEven(num)) "Number is Even\n" else "Number is Odd\n"
result += "Number of digits is ${digitCount(num)}\n"
result += "Sum of digits is ${digitSum(num)}\n"
result += "Reverse of number is ${reverse(num)}\n"
result += "Prime factorization of number is ${primeFactorization(num)}\n"
result += "Prime factors are ${primeFactors(num).toSet().joinToString(separator = ", ")}\n"
result += "Number of prime factors is ${primeFactors(num).toSet().size}\n"
result += "Sum of prime factors is ${primeFactors(num).toSet().sum()}\n"
result += "Factors of $num are ${factors(num).toSet().joinToString(separator = ", ")}\n"
result += "Number of factors is ${factors(num).toSet().size}\n"
result += "Sum of factors is ${factors(num).toSet().sum()}\n"
result += "$num is ${if (!isPrimeNumber(num)) "a Composite" else "not a Composite"} number\n"
result += "Binary representation is ${decimalToBin(num)}\n"
result += "Octal representation is ${decimalToOct(num)}\n"
result += "Hexadecimal representation is ${decimalToHex(num)}\n"
result += "$num is ${if (isPalindrome(num)) "a Palindrome" else "not a Palindrome"} number\n"
result += "$num is ${if (isNivenNumber(num)) "a Niven" else "not a Niven"} number\n"
result += "$num is ${if (isEmirpNumber(num)) "an Emirp" else "not an Emirp"} Number\n"
result += "$num is ${
result += if (isEven(num)) "Number is Even\n" else "Number is Odd\n"
result += "Number of digits is ${digitCount(num)}\n"
result += "Sum of digits is ${digitSum(num)}\n"
result += "Reverse of number is ${reverse(num)}\n"
result += "Prime factorization of number is ${primeFactorization(num)}\n"
result += "Prime factors are ${primeFactors(num).toSet().joinToString(separator = ", ")}\n"
result += "Number of prime factors is ${primeFactors(num).toSet().size}\n"
result += "Sum of prime factors is ${primeFactors(num).toSet().sum()}\n"
result += "Factors of $num are ${factors(num).toSet().joinToString(separator = ", ")}\n"
result += "Number of factors is ${factors(num).toSet().size}\n"
result += "Sum of factors is ${factors(num).toSet().sum()}\n"
result += "$num is ${if (!isPrimeNumber(num)) "a Composite" else "not a Composite"} number\n"
result += "Binary representation is ${decimalToBin(num)}\n"
result += "Octal representation is ${decimalToOct(num)}\n"
result += "Hexadecimal representation is ${decimalToHex(num)}\n"
result += "$num is ${if (isPalindrome(num)) "a Palindrome" else "not a Palindrome"} number\n"
result += "$num is ${if (isNivenNumber(num)) "a Niven" else "not a Niven"} number\n"
result += "$num is ${if (isEmirpNumber(num)) "an Emirp" else "not an Emirp"} Number\n"
result += "$num is ${
if (isAbundantNumber(num) <= 0) "not an Abundant number " else "an Abundant number with Abundance ${
isAbundantNumber(
num
)
}"
} \n"
result += "$num is ${if (isTechNumber(num)) "a Tech" else "not a Tech"} number\n"
result += "$num is ${if (isDisariumNumber(num)) "a Disarium" else "not a Disarium"} number\n"
result += "$num is ${if (isPronicNumber(num)) "a Pronic" else "not a Pronic"} number\n"
result += "$num is ${if (isAutomorphicNumber(num)) "an Automorphic" else "not an Automorphic"} number\n"
result += "$num is ${if (isKaprekarNumber(num)) "a Kaprekar" else "not a Kaprekar"} number\n"
result += "$num is ${if (isSpecialNumber(num)) "a Special" else "not a Special"} number\n"
result += "$num is ${if (isLucasNumber(num)) "a Lucas" else "not a Lucas"} number\n"
result += "$num is ${if (isSmithNumber(num)) "a Smith" else "not a Smith"} number\n"
result += "$num is ${if (isArmstrongNumber(num)) "an Armstrong" else "not an Armstrong"} number.\n"
result += "$num is ${if (isFibonacciNumber(num)) "a Fibonacci" else "not a Fibonacci"} number\n"
result += "$num is ${if (isCircularPrimeNumber(num)) "a Circular Prime" else "not a Circular Prime"} number\n"
result += "$num is ${if (isPalindrome(num) && isPrimeNumber(num)) "a Prime Palindrome" else "not a Prime Palindrome"} number\n"
result += "$num is ${if (isFermatNumber(num)) "a Fermat" else "not a Fermat"} number\n"
result += "$num is ${if (isUglyNumber(num)) "an Ugly" else "not an Ugly"} number\n"
result += "$num is ${if (isNeonNumber(num)) "a Neon" else "not a Neon"} number\n"
result += "$num is ${if (isSpyNumber(num)) "a Spy" else "not a Spy"} number\n"
result += "$num is ${if (isHappyNumber(num)) "a Happy" else "not a Happy"} number\n"
result += "$num is ${if (isDuckNumber(num)) "a Duck" else "not a Duck"} number\n"
result += "$num is ${if (isTechNumber(num)) "a Tech" else "not a Tech"} number\n"
result += "$num is ${if (isDisariumNumber(num)) "a Disarium" else "not a Disarium"} number\n"
result += "$num is ${if (isPronicNumber(num)) "a Pronic" else "not a Pronic"} number\n"
result += "$num is ${if (isAutomorphicNumber(num)) "an Automorphic" else "not an Automorphic"} number\n"
result += "$num is ${if (isKaprekarNumber(num)) "a Kaprekar" else "not a Kaprekar"} number\n"
result += "$num is ${if (isSpecialNumber(num)) "a Special" else "not a Special"} number\n"
result += "$num is ${if (isLucasNumber(num)) "a Lucas" else "not a Lucas"} number\n"
result += "$num is ${if (isSmithNumber(num)) "a Smith" else "not a Smith"} number\n"
result += "$num is ${if (isArmstrongNumber(num)) "an Armstrong" else "not an Armstrong"} number.\n"
result += "$num is ${if (isFibonacciNumber(num)) "a Fibonacci" else "not a Fibonacci"} number\n"
result += "$num is ${if (isCircularPrimeNumber(num)) "a Circular Prime" else "not a Circular Prime"} number\n"
result += "$num is ${if (isPalindrome(num) && isPrimeNumber(num)) "a Prime Palindrome" else "not a Prime Palindrome"} number\n"
result += "$num is ${if (isFermatNumber(num)) "a Fermat" else "not a Fermat"} number\n"
result += "$num is ${if (isUglyNumber(num)) "an Ugly" else "not an Ugly"} number\n"
result += "$num is ${if (isNeonNumber(num)) "a Neon" else "not a Neon"} number\n"
result += "$num is ${if (isSpyNumber(num)) "a Spy" else "not a Spy"} number\n"
result += "$num is ${if (isHappyNumber(num)) "a Happy" else "not a Happy"} number\n"
result += "$num is ${if (isDuckNumber(num)) "a Duck" else "not a Duck"} number\n"
display.text = result
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="15dp"
android:layout_marginTop="30dp"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header"
app:menu="@menu/nav_menu" />
Expand Down
37 changes: 20 additions & 17 deletions app/src/main/res/layout/fragment_feedback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".FeedbackFragment">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="30dp"
android:id="@+id/feedbackPage"
tools:ignore="UselessParent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feed_title"
android:textSize="40sp"
android:layout_gravity="center"
android:layout_marginTop="25dp"
android:layout_marginBottom="10dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -51,14 +44,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/fb_feedback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="feedback"
android:hint="@string/feed_hint"
android:inputType="textMultiLine"
android:layout_marginVertical="8dp"/>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="8dp"
android:hint="@string/feed_hint"

app:boxCornerRadiusBottomStart="15dp"
app:boxCornerRadiusBottomEnd="15dp"
app:boxCornerRadiusTopEnd="15dp"
app:boxCornerRadiusTopStart="15dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/fb_feedback"
style="@style/ThemeOverlay.Material3.TextInputEditText.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="feedback"
android:inputType="textMultiLine" />
</com.google.android.material.textfield.TextInputLayout>

<Button
android:id="@+id/btn_submit"
Expand Down
86 changes: 48 additions & 38 deletions app/src/main/res/layout/fragment_numplex.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,97 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".NumplexFragment">

<LinearLayout
android:id="@+id/numplexPage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/numplexPage"
tools:context=".NumplexActivity">
<EditText
android:id="@+id/input_number"

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textField"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="40dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:autofillHints="number"
android:background="@drawable/margin_shape"
android:hint="@string/enter_a_number"
android:inputType="numberDecimal"
android:textColorHint="#575454"
android:textColor="@color/black"
android:textSize="25sp">
</EditText>
app:boxCornerRadiusBottomStart="15dp"
app:boxCornerRadiusBottomEnd="15dp"
app:boxCornerRadiusTopEnd="15dp"
app:boxCornerRadiusTopStart="15dp">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/input_number"
style="@style/ThemeOverlay.Material3.TextInputEditText.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="number"
android:inputType="numberDecimal"
android:textSize="25sp" />
</com.google.android.material.textfield.TextInputLayout>


<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:gravity="center">
android:weightSum="1">

<Button
android:id="@+id/show_properties"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
style="@style/Widget.Material3.Button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="18sp"
android:layout_weight="1"
android:layout_margin="10dp"
android:backgroundTint="#028408"
android:textColor="@color/white"
android:text="@string/show_properties" />
android:layout_weight="0.5"
android:padding="10dp"
android:text="@string/show_properties"
android:textSize="18sp" />

<Button
android:id="@+id/clear_properties"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="10dp"
android:textSize="18sp"
android:layout_weight="1"
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="0.5"
android:backgroundTint="#B80000"
android:padding="10dp"
android:text="@string/clear"
android:textColor="@color/white"
android:layout_margin="10dp"
android:text="@string/clear" />
android:textSize="18sp" />
</LinearLayout>

<Button
android:id="@+id/random_properties"
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_gravity="center"
android:textColor="@color/white"
android:layout_margin="10dp"
android:backgroundTint="#9C27B0"
android:text="@string/random" />
android:text="@string/random"
android:textSize="20sp" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textSize="20sp"
android:id="@+id/answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="">
</TextView>
android:text="@string/empty_text"
android:textSize="20sp"
android:paddingStart="5dp"
android:paddingEnd="5dp"/>
</ScrollView>
</LinearLayout>

Expand Down

0 comments on commit 7a05479

Please sign in to comment.