Skip to content

Commit

Permalink
update share btn
Browse files Browse the repository at this point in the history
  • Loading branch information
JahidHasanCO committed Aug 4, 2022
1 parent e273c9f commit 7e1a9bb
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 43 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added ART/home page.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ART/result page.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.SnapHelper
import com.cncoderx.wheelview.OnWheelChangedListener
import com.example.swipebutton_library.OnActiveListener
import dev.jahidhasanco.bmicalculator.R
import dev.jahidhasanco.bmicalculator.databinding.ActivityMainBinding
import dev.jahidhasanco.bmicalculator.presentation.adapter.WeightPickerAdapter
Expand All @@ -22,12 +21,12 @@ import travel.ithaka.android.horizontalpickerlib.PickerLayoutManager
class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding
val _binding get() = binding
private val _binding get() = binding

lateinit var weightAdapter: WeightPickerAdapter
var gender = 'M'
private lateinit var weightAdapter: WeightPickerAdapter
private var gender = 'M'
var height = 1
var weight = 50
private var weight = 50

private var doubleBackToExitPressedOnce = false

Expand All @@ -37,10 +36,10 @@ class MainActivity : AppCompatActivity() {

animationView()
// Gender
val titlesofGender: List<String> = listOf("F", "O", "M")
val titlesOfGender: List<String> = listOf("F", "O", "M")

_binding.genderWheelView.apply {
titles = titlesofGender
titles = titlesOfGender
elevation = 0f
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
isFocusedByDefault = true
Expand All @@ -49,7 +48,7 @@ class MainActivity : AppCompatActivity() {
focusedIndex = 2
}
_binding.genderWheelView.selectListener = {
gender = titlesofGender[it][0]
gender = titlesOfGender[it][0]
}


Expand Down Expand Up @@ -94,7 +93,7 @@ class MainActivity : AppCompatActivity() {

// Height
_binding.heightWheel.onWheelChangedListener =
OnWheelChangedListener { view, oldIndex, newIndex ->
OnWheelChangedListener { view, _, newIndex ->
val text = view.getItem(newIndex)
height = Integer.parseInt(text.toString())
// Toast.makeText(this,""+ text,Toast.LENGTH_SHORT).show()
Expand Down Expand Up @@ -145,7 +144,7 @@ class MainActivity : AppCompatActivity() {
}


fun getData(count: Int): List<String> {
private fun getData(count: Int): List<String> {
val data: MutableList<String> = ArrayList()
for (i in 0 until count) {
data.add(i.toString())
Expand Down Expand Up @@ -200,7 +199,7 @@ class MainActivity : AppCompatActivity() {
this.doubleBackToExitPressedOnce = true
Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show()

Handler(Looper.getMainLooper()).postDelayed(Runnable { doubleBackToExitPressedOnce = false }, 2000)
Handler(Looper.getMainLooper()).postDelayed({ doubleBackToExitPressedOnce = false }, 2000)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ package dev.jahidhasanco.bmicalculator.presentation.activity

import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.Handler
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ShareCompat
import androidx.core.content.ContentProviderCompat.requireContext
import androidx.core.content.ContextCompat
import androidx.core.view.drawToBitmap
import androidx.core.view.setPadding
Expand All @@ -26,12 +24,12 @@ import dev.jahidhasanco.bmicalculator.utils.saveBitmap
class ResultActivity : AppCompatActivity() {

private lateinit var binding: ActivityResultBinding
val _binding get() = binding
private val _binding get() = binding

var weight: Double = 0.0
var height: Double = 0.0
var result: Double = 0.0
var gender: Int = 0
private var weight: Double =1.0
private var height: Double = 1.0
private var result: Double = 0.0
private var gender: Int = 0

// handle permission dialog
private val requestLauncher =
Expand Down Expand Up @@ -223,6 +221,7 @@ class ResultActivity : AppCompatActivity() {

}

@SuppressLint("SetTextI18n")
private fun showResult() {

val solution = String.format("%.1f", result)
Expand Down
49 changes: 24 additions & 25 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
tools:context=".presentation.activity.MainActivity">



<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
Expand All @@ -30,31 +29,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<!-- <LinearLayout-->
<!-- android:id="@+id/linearLayout2"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:background="@drawable/rounded_dash_main"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/textView"-->
<!-- android:orientation="horizontal">-->

<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:src="@drawable/mike"-->
<!-- android:scaleType="fitCenter"-->
<!-- />-->

<!-- </LinearLayout>-->

<!-- main container -->
<!-- <LinearLayout-->
<!-- android:id="@+id/linearLayout2"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:background="@drawable/rounded_dash_main"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/textView"-->
<!-- android:orientation="horizontal">-->

<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:src="@drawable/mike"-->
<!-- android:scaleType="fitCenter"-->
<!-- />-->

<!-- </LinearLayout>-->

<!-- main container -->
<LinearLayout
android:layout_marginTop="1dp"
android:id="@+id/bodyContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:paddingBottom="50dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -70,10 +69,10 @@
android:orientation="vertical">

<LinearLayout
android:elevation="25dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_dash_main2"
android:elevation="25dp"
android:orientation="vertical">

<TextView
Expand Down Expand Up @@ -118,11 +117,11 @@
<!-- Weight Container />-->

<LinearLayout
android:elevation="25dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:background="@drawable/rounded_dash_main"
android:elevation="25dp"
android:orientation="vertical">

<LinearLayout
Expand Down Expand Up @@ -289,11 +288,11 @@
<!-- app:layout_constraintTop_toTopOf="parent" />-->

<com.example.swipebutton_library.SwipeButton
android:elevation="20dp"
android:id="@+id/start_button"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:elevation="20dp"
app:button_background_drawable="@drawable/circular_white_background"
app:button_background_padding="0dp"
app:button_background_src="@drawable/ic_pacman"
Expand Down

0 comments on commit 7e1a9bb

Please sign in to comment.