Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing the fetched Coordinate data #75

Merged
merged 1 commit into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/src/main/java/com/weather/weatherapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.karumi.dexter.PermissionToken
import com.karumi.dexter.listener.PermissionRequest
import com.karumi.dexter.listener.multi.MultiplePermissionsListener
import com.weather.Network.WeatherService
import com.weather.models.Coord
import com.weather.models.WeatherResponse
import kotlinx.coroutines.launch
import retrofit.*
Expand Down Expand Up @@ -174,6 +175,14 @@ class MainActivity : AppCompatActivity() {
true
}

R.id.coordinates -> {


showLocationDialog(this,mLatitude,mLongitude )

true
}


else -> super.onOptionsItemSelected(item)
}
Expand All @@ -197,6 +206,18 @@ class MainActivity : AppCompatActivity() {

}

fun showLocationDialog(context: Context, latitude: Double, longitude: Double) {
val builder = AlertDialog.Builder(context)
builder.setTitle("Coordinates")
val message = "Latitude: $latitude\nLongitude: $longitude"
builder.setMessage(message)
builder.setPositiveButton("OK") { dialog, _ ->
dialog.dismiss()
}
val dialog = builder.create()
dialog.show()
}


private fun Version() {
Toast.makeText(this@MainActivity,"Version of the applicationo is : 1.1.0", Toast.LENGTH_LONG).show()
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/baseline_location_pin_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2L12,2C8.13,2 5,5.13 5,9c0,1.74 0.5,3.37 1.41,4.84c0.95,1.54 2.2,2.86 3.16,4.4c0.47,0.75 0.81,1.45 1.17,2.26C11,21.05 11.21,22 12,22h0c0.79,0 1,-0.95 1.25,-1.5c0.37,-0.81 0.7,-1.51 1.17,-2.26c0.96,-1.53 2.21,-2.85 3.16,-4.4C18.5,12.37 19,10.74 19,9C19,5.13 15.87,2 12,2zM12,11.75c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5s2.5,1.12 2.5,2.5S13.38,11.75 12,11.75z"/>
</vector>
6 changes: 6 additions & 0 deletions app/src/main/res/menu/home_page_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@

/>

<item android:id="@+id/coordinates"
android:title="Coordinates data"
android:icon="@drawable/baseline_location_pin_24"

/>

</menu>
Loading