-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("org.jetbrains.kotlin.android") | ||
} | ||
|
||
android { | ||
namespace = "com.rey.bunkkaro" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
applicationId = "com.rey.bunkkaro" | ||
minSdk = 21 | ||
targetSdk = 33 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
|
||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
buildFeatures{ | ||
viewBinding = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation ("com.github.blackfizz:eazegraph:1.2.2@aar") | ||
implementation ("com.nineoldandroids:library:2.4.0") | ||
implementation ("androidx.core:core-ktx:1.12.0") | ||
implementation ("androidx.appcompat:appcompat:1.6.1") | ||
implementation ("com.google.android.material:material:1.9.0") | ||
implementation ("androidx.constraintlayout:constraintlayout:2.1.4") | ||
implementation ("androidx.navigation:navigation-fragment-ktx:2.7.2") | ||
implementation ("androidx.navigation:navigation-ui-ktx:2.7.2") | ||
testImplementation ("junit:junit:4.13.2") | ||
androidTestImplementation ("androidx.test.ext:junit:1.1.5") | ||
androidTestImplementation ("androidx.test.espresso:espresso-core:3.5.1") | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.rey.bunkkaro | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.rey.bunkkaro", appContext.packageName) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Material3.Dark" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".HistoryActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".ContactMeActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".ItemActivity" | ||
android:exported="false" /> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.rey.bunkkaro | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import com.rey.bunkkaro.databinding.ActivityContactMeBinding | ||
|
||
class ContactMeActivity : AppCompatActivity() { | ||
private lateinit var binding :ActivityContactMeBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityContactMeBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
supportActionBar?.title = getString(R.string.contact_me) | ||
supportActionBar?.setDisplayHomeAsUpEnabled(true) | ||
binding.webView.loadUrl("https://github.com/Shreyassp002") | ||
} | ||
|
||
override fun onSupportNavigateUp(): Boolean { | ||
finish() | ||
return true | ||
} | ||
@Deprecated("Deprecated in Java") | ||
override fun onBackPressed() { | ||
if (binding.webView.canGoBack()) | ||
binding.webView.goBack() | ||
else | ||
finish() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.rey.bunkkaro | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.rey.bunkkaro.adapters.HistoryItemAdapter | ||
import com.rey.bunkkaro.database.ItemDatabaseHelper | ||
import com.rey.bunkkaro.databinding.ActivityHistoryBinding | ||
|
||
class HistoryActivity : AppCompatActivity() { | ||
private lateinit var binding:ActivityHistoryBinding | ||
private lateinit var itemDatabaseHelper: ItemDatabaseHelper | ||
private lateinit var adapter: HistoryItemAdapter | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityHistoryBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
supportActionBar?.setDisplayHomeAsUpEnabled(true) | ||
supportActionBar?.title = "History" | ||
|
||
itemDatabaseHelper = ItemDatabaseHelper(this) | ||
adapter = HistoryItemAdapter(this,itemDatabaseHelper.getAllHistory()) | ||
binding.historyView.adapter = adapter | ||
binding.historyView.layoutManager = LinearLayoutManager(this) | ||
} | ||
override fun onSupportNavigateUp(): Boolean { | ||
finish() | ||
return true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.rey.bunkkaro | ||
|
||
import android.os.Build | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.view.Menu | ||
import android.view.MenuItem | ||
import android.view.View | ||
import androidx.annotation.RequiresApi | ||
import androidx.appcompat.app.AlertDialog | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.rey.bunkkaro.adapters.HistoryItemAdapter | ||
import com.rey.bunkkaro.database.Item | ||
import com.rey.bunkkaro.database.ItemDatabaseHelper | ||
import com.rey.bunkkaro.databinding.ActivityItemBinding | ||
import org.eazegraph.lib.models.PieModel | ||
import kotlin.math.roundToInt | ||
|
||
class ItemActivity : AppCompatActivity() { | ||
private lateinit var binding: ActivityItemBinding | ||
private lateinit var itemDatabaseHelper: ItemDatabaseHelper | ||
private lateinit var subject: Item | ||
@RequiresApi(Build.VERSION_CODES.M) | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityItemBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
supportActionBar?.setDisplayHomeAsUpEnabled(true) | ||
|
||
itemDatabaseHelper = ItemDatabaseHelper(this) | ||
subject = itemDatabaseHelper.getItem(intent.getIntExtra("id",-1)) | ||
supportActionBar?.title = subject.title | ||
if (subject.totalLectures!=0) { | ||
binding.pieChart.addPieSlice( | ||
PieModel( | ||
(100 - subject.attendance), | ||
this.getColor(R.color.red) | ||
) | ||
) | ||
binding.pieChart.addPieSlice( | ||
PieModel( | ||
subject.attendance, | ||
this.getColor(R.color.green) | ||
) | ||
) | ||
}else{ | ||
binding.pieChart.addPieSlice( | ||
PieModel( | ||
100f, | ||
this.getColor(R.color.black) | ||
) | ||
) | ||
binding.percentageAttendance.visibility = View.GONE | ||
} | ||
|
||
binding.lecturesAttended.text = getString(R.string.total_lectures_attended,subject.lectureAttended) | ||
binding.lecturesConducted.text = getString(R.string.total_lectures_conducted,subject.totalLectures) | ||
binding.percentageAttendance.text = subject.attendance.roundToInt().toString() | ||
if (subject.attendance<75) | ||
binding.percentageAttendance.setTextColor(getColor(R.color.red)) | ||
val adapter = HistoryItemAdapter(this,itemDatabaseHelper.getHistory(subject.title)) | ||
binding.historyView.adapter = adapter | ||
binding.historyView.layoutManager = LinearLayoutManager(this) | ||
} | ||
override fun onCreateOptionsMenu(menu: Menu?): Boolean { | ||
menuInflater.inflate(R.menu.item_menu,menu) | ||
return true | ||
} | ||
override fun onOptionsItemSelected(item: MenuItem): Boolean { | ||
when(item.itemId){ | ||
R.id.delete ->{ | ||
val dialog = AlertDialog.Builder(this) | ||
dialog.setTitle("Do you want to delete ${subject.title}?") | ||
dialog.setCancelable(false) | ||
dialog.setPositiveButton("Delete") { _, i -> | ||
itemDatabaseHelper.deleteItem(subject.id) | ||
finish() | ||
} | ||
dialog.setNegativeButton("No") { _, _ -> } | ||
dialog.create().show() | ||
return true | ||
} | ||
} | ||
return super.onOptionsItemSelected(item) | ||
} | ||
override fun onSupportNavigateUp(): Boolean { | ||
finish() | ||
return true | ||
} | ||
} |