| publicclassHomeextendsAppCompatActivityimplementsIHome, LocationListener { | |
| Toolbartoolbar; | |
| TextViewmTitle; | |
| LocationManagerlocationManager; | |
| StringlocationNow = ""; | |
| doublelan, lat; | |
| TextViewsignOut; | |
| @Override | |
| protectedvoidonCreate(BundlesavedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| mTitle = findViewById(R.id.toolbar_title); | |
| toolbar = findViewById(R.id.my_toolbar); | |
| setSupportActionBar(toolbar); | |
| signOut = findViewById(R.id.sign_out); | |
| signOut.setOnClickListener(newView.OnClickListener() { | |
| @Override | |
| publicvoidonClick(Viewview) { | |
| Intentintent = newIntent(Home.this, Login.class); | |
| startActivity(intent); | |
| finish(); | |
| } | |
| }); | |
| ActionBarab = getSupportActionBar(); | |
| if (ab != null) { | |
| ab.setDisplayHomeAsUpEnabled(false); | |
| } | |
| ab.setDisplayShowTitleEnabled(false); | |
| BottomNavigationViewbottomNavigationView = findViewById(R.id.bottom_nav); | |
| bottomNavigationView.setBackgroundColor(getResources().getColor(R.color.bottom_bar)); | |
| NavHostFragmentnavHostFragment = (NavHostFragment) getSupportFragmentManager() | |
| .findFragmentById(R.id.fragment); | |
| NavigationUI.setupWithNavController(bottomNavigationView, navHostFragment.getNavController()); | |
| } | |
| @Override | |
| protectedvoidonResume() { | |
| super.onResume(); | |
| getLocation(); | |
| } | |
| @Override | |
| publicvoidonChangeToolbarTitle(Stringtitle) { | |
| mTitle.setText(title); | |
| } | |
| privatevoidgetLocation() { | |
| try { | |
| locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
| if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | |
| // TODO: Consider calling | |
| // Activity#requestPermissions | |
| // here to request the missing permissions, and then overriding | |
| // public void onRequestPermissionsResult(int requestCode, String[] permissions, | |
| // int[] grantResults) | |
| // to handle the case where the user grants the permission. See the documentation | |
| // for Activity#requestPermissions for more details. | |
| return; | |
| } | |
| } | |
| locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 5000, 5, this); | |
| } catch (SecurityExceptione) { | |
| e.printStackTrace(); | |
| } | |
| } | |
| @Override | |
| publicvoidonLocationChanged(Locationlocation) { | |
| locationNow = String.valueOf(location.getLongitude()); | |
| locationNow = locationNow + " : "; | |
| locationNow = locationNow + String.valueOf(location.getLatitude()); | |
| Toast.makeText(this, locationNow, Toast.LENGTH_SHORT).show(); | |
| lan = location.getLongitude(); | |
| lat = location.getLatitude(); | |
| getAddress(lat, lan); | |
| } | |
| @Override | |
| publicvoidonStatusChanged(Strings, inti, Bundlebundle) { | |
| } | |
| @Override | |
| publicvoidonProviderEnabled(Strings) { | |
| } | |
| @Override | |
| publicvoidonProviderDisabled(Strings) { | |
| } | |
| voidgetAddress(doublelatitude, doublelongitude) { | |
| Geocodergeocoder; | |
| List<Address> addresses; | |
| geocoder = newGeocoder(this, Locale.getDefault()); | |
| try { | |
| addresses = geocoder.getFromLocation(latitude, longitude, 1); | |
| Stringaddress = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex() | |
| Stringcity = addresses.get(0).getLocality(); | |
| Stringstate = addresses.get(0).getAdminArea(); | |
| Stringcountry = addresses.get(0).getCountryName(); | |
| StringpostalCode = addresses.get(0).getPostalCode(); | |
| StringknownName = addresses.get(0).getFeatureName();// Here 1 represent max location result to returned, by documents it recommended 1 to 5 | |
| Log.d("addresssss", address); | |
| } catch (IOExceptione) { | |
| e.printStackTrace(); | |
| } | |
| } | |
| } |
| <?xml version="1.0" encoding="utf-8"?> | |
| <RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:background="#16B1B6"> | |
| <ScrollViewandroid:layout_width="match_parent" | |
| android:layout_height="match_parent"> | |
| <RelativeLayout | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:background="#16B1B6" | |
| android:padding="8dp"> | |
| <TextView | |
| android:id="@+id/take_photo" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_centerHorizontal="true" | |
| android:layout_marginLeft="4dp" | |
| android:layout_marginTop="16dp" | |
| android:text="Take a photo" | |
| android:textColor="#fff" | |
| android:textSize="18sp" | |
| android:textStyle="bold" /> | |
| <ImageButton | |
| android:id="@+id/camera_btn" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_below="@id/take_photo" | |
| android:layout_centerHorizontal="true" | |
| android:layout_marginTop="8dp" | |
| android:background="#00000000" | |
| android:padding="8dp" | |
| android:src="@drawable/cam" /> | |
| <ImageView | |
| android:id="@+id/img_taken" | |
| android:layout_width="400dp" | |
| android:layout_height="300dp" | |
| android:layout_below="@id/camera_btn" | |
| android:layout_centerHorizontal="true" | |
| android:layout_marginTop="8dp" | |
| android:src="@drawable/new_back" /> | |
| <Button | |
| android:id="@+id/btn_upload" | |
| android:layout_width="100dp" | |
| android:layout_height="wrap_content" | |
| android:layout_below="@+id/img_taken" | |
| android:layout_alignParentStart="true" | |
| android:layout_marginStart="58dp" | |
| android:layout_marginTop="75dp" | |
| android:background="@drawable/border" | |
| android:elevation="0dp" | |
| android:text="Upload" | |
| android:textAllCaps="false" | |
| android:textColor="#fff" /> | |
| <Button | |
| android:id="@+id/btn_cancel" | |
| android:layout_width="100dp" | |
| android:layout_height="wrap_content" | |
| android:layout_below="@+id/img_taken" | |
| android:layout_alignParentEnd="true" | |
| android:layout_marginTop="75dp" | |
| android:layout_marginEnd="58dp" | |
| android:layout_marginBottom="87dp" | |
| android:background="@drawable/border" | |
| android:elevation="0dp" | |
| android:text="Cancel" | |
| android:textAllCaps="false" | |
| android:textColor="#fff" /> | |
| </RelativeLayout> | |
| </ScrollView> | |
| </RelativeLayout> |


Idea Brief:
The solution is an app which can help citizen to report afire through an image and provide the location of the fire through allowing theGPS to know his location while reporting. The app is verifying the existence of firethrough comparison of images in big database by image processing and machinelearning. Our app trying to connect people together by sending notificationsabout the fire to all people who have the app nearby the location of fire.Additionally, our app is trying to provide a fire trend and a secure path byaugmented reality to people near the fire.