Skip to content

Commit

Permalink
added about page, fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pawank0411 committed Mar 21, 2020
1 parent 8747c61 commit 674fd92
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 32 deletions.
50 changes: 26 additions & 24 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
package="india.coronavirus.fight">

<uses-permission android:name="android.permission.INTERNET" />
<!-- <uses-permission android:name="android.permission.VIBRATE" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
<!-- <uses-permission android:name="android.permission.VIBRATE" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->


<application
Expand All @@ -24,6 +24,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".About" />

<service
android:name=".APIService"
android:enabled="true"
Expand All @@ -32,28 +34,28 @@
android:process=":service"
android:stopWithTask="false" />

<!-- <receiver-->
<!-- android:name=".Notification"-->
<!-- android:enabled="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- <action android:name="android.intent.action.USER_PRESENT" />-->
<!-- <action android:name="android.intent.action.PACKAGE_RESTARTED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name=".Restarter"-->
<!-- android:enabled="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- <action android:name="android.intent.action.USER_PRESENT" />-->
<!-- <action android:name="android.intent.action.PACKAGE_RESTARTED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->

<!-- <meta-data-->
<!-- android:name="com.google.android.gms.version"-->
<!-- android:value="@integer/google_play_services_version" />-->
<!-- <receiver-->
<!-- android:name=".Notification"-->
<!-- android:enabled="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- <action android:name="android.intent.action.USER_PRESENT" />-->
<!-- <action android:name="android.intent.action.PACKAGE_RESTARTED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name=".Restarter"-->
<!-- android:enabled="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- <action android:name="android.intent.action.USER_PRESENT" />-->
<!-- <action android:name="android.intent.action.PACKAGE_RESTARTED" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->

<!-- <meta-data-->
<!-- android:name="com.google.android.gms.version"-->
<!-- android:value="@integer/google_play_services_version" />-->
</application>

</manifest>
59 changes: 59 additions & 0 deletions app/src/main/java/india/coronavirus/fight/About.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package india.coronavirus.fight;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.textview.MaterialTextView;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentChange;
import com.google.firebase.firestore.FirebaseFirestore;

public class About extends AppCompatActivity {
private boolean update;

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
MaterialTextView check = findViewById(R.id.update_available);
MaterialTextView pawan = findViewById(R.id.pawan);
MaterialTextView sppedx = findViewById(R.id.speedx);
CollectionReference apiCollection = FirebaseFirestore.getInstance().collection("update");
apiCollection.addSnapshotListener((queryDocumentSnapshots, e) -> {
if (queryDocumentSnapshots != null) {
for (DocumentChange documentChange : queryDocumentSnapshots.getDocumentChanges()) {
update = documentChange.getDocument().getBoolean("available");
if (update) {
check.setVisibility(View.VISIBLE);
check.setText(Html.fromHtml("<u>Update Available : </u>"));
}

}
}
});
pawan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse("https://pawan0411.github.io/");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});

sppedx.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse("https://github.com/TheSpeedX");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});

}
}
24 changes: 24 additions & 0 deletions app/src/main/java/india/coronavirus/fight/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
import android.content.SharedPreferences;
import android.os.Bundle;
import android.provider.Settings;
import android.view.Menu;
import android.view.MenuItem;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.MenuCompat;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
Expand All @@ -20,6 +24,8 @@
import com.google.firebase.firestore.FirebaseFirestore;
import com.onesignal.OneSignal;

import java.util.Objects;

public class MainActivity extends AppCompatActivity {
private NavController navController;
private String api;
Expand Down Expand Up @@ -75,6 +81,24 @@ protected void onCreate(Bundle savedInstanceState) {
// }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.nav, menu);
Objects.requireNonNull(getSupportActionBar()).setElevation(0);
MenuCompat.setGroupDividerEnabled(menu, true);
return true;
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.about_app) {
Intent intent = new Intent(this, About.class);
startActivity(intent);
return (true);
}
return (super.onOptionsItemSelected(item));
}

@Override
public boolean onSupportNavigateUp() {
return navController.navigateUp();
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/information.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- drawable/information.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" />
</vector>
70 changes: 70 additions & 0 deletions app/src/main/res/layout/about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.textview.MaterialTextView
android:id="@+id/materialTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="@string/this_app_is_about_updates_related_to_coronavirus_in_india"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/update_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/update"
android:textColor="@android:color/black"
android:textSize="15sp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/materialTextView" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/materialTextView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Developed and Maintained By : "
android:textColor="@android:color/black"
android:textSize="15sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/update_available" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/pawan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="99dp"
android:layout_marginTop="15dp"
android:text="@string/pawan0411"
android:textColor="@android:color/black"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/materialTextView2" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/speedx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/speedx"
android:textColor="@android:color/black"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/pawan"
app:layout_constraintTop_toBottomOf="@+id/materialTextView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
7 changes: 7 additions & 0 deletions app/src/main/res/menu/nav.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/about_app"
android:icon="@drawable/information"
android:title="@string/about" />
</menu>
21 changes: 13 additions & 8 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<resources>
<string name="app_name">covid19 India</string>
<string name="title_home">Home</string>
<string name="title_dashboard">News</string>
<string name="title_notifications">Helpline</string>
<string name="title_guides">Guides</string>
<string name="title_statewise">State Stats</string>
<string name="prediction"><u>Predicted infection rate</u></string>
<string name="the_helpline_number_for_corona_virus_91_11_23978046_toll_free_no_1075">The Helpline Number for corona–virus : +91–11–23978046 Toll Free No: 1075</string>
<string name="app_name">COVID19 India</string>
<string name="title_home">Home</string>
<string name="title_dashboard">News</string>
<string name="title_notifications">Helpline</string>
<string name="title_guides">Guides</string>
<string name="title_statewise">State Stats</string>
<string name="prediction"><u>Predicted infection rate</u></string>
<string name="the_helpline_number_for_corona_virus_91_11_23978046_toll_free_no_1075">The Helpline Number for corona–virus : +91–11–23978046 Toll Free No: 1075</string>
<string name="about">About</string>
<string name="pawan0411"><u>Pawan0411</u></string>
<string name="speedx"><u>SpeedX</u></string>
<string name="update"><u>Update Available : </u></string>
<string name="this_app_is_about_updates_related_to_coronavirus_in_india">This app is about updates related to coronavirus in India.</string>
</resources>

0 comments on commit 674fd92

Please sign in to comment.