Skip to content

Commit

Permalink
Merge pull request #75 from Suryansh1720001/Coordinates_data
Browse files Browse the repository at this point in the history
Showing the fetched Coordinate data
  • Loading branch information
NehaVns authored Feb 11, 2024
2 parents 1d143d5 + 20d5602 commit 3c19277
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
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>

0 comments on commit 3c19277

Please sign in to comment.