-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a61907
commit a91cb7f
Showing
59 changed files
with
2,410 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed | ||
plugins { | ||
alias(libs.plugins.com.android.application) | ||
alias(libs.plugins.org.jetbrains.kotlin.android) | ||
} | ||
|
||
android { | ||
namespace = "com.helloyanis.rucoycalculator" | ||
compileSdk = 33 | ||
|
||
defaultConfig { | ||
applicationId = "com.helloyanis.rucoycalculator" | ||
minSdk = 24 | ||
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(libs.core.ktx) | ||
implementation(libs.appcompat) | ||
implementation(libs.material) | ||
implementation(libs.constraintlayout) | ||
implementation(libs.lifecycle.livedata.ktx) | ||
implementation(libs.lifecycle.viewmodel.ktx) | ||
implementation(libs.navigation.fragment.ktx) | ||
implementation(libs.navigation.ui.ktx) | ||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.test.ext.junit) | ||
androidTestImplementation(libs.espresso.core) | ||
implementation("androidx.datastore:datastore-preferences:1.0.0") | ||
implementation("androidx.datastore:datastore-preferences-rxjava2:1.0.0") | ||
implementation("androidx.datastore:datastore-preferences-rxjava3:1.0.0") | ||
implementation("androidx.datastore:datastore-preferences:1.0.0") | ||
implementation("androidx.datastore:datastore-preferences-rxjava2:1.0.0") | ||
implementation("androidx.datastore:datastore-preferences-rxjava3:1.0.0") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
24 changes: 24 additions & 0 deletions
24
src/app/src/androidTest/java/com/helloyanis/rucoycalculator/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.helloyanis.rucoycalculator | ||
|
||
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.helloyanis.rucoycalculator", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<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:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.RucoyCalculator" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
35 changes: 35 additions & 0 deletions
35
src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.helloyanis.rucoycalculator | ||
|
||
import android.os.Bundle | ||
import com.google.android.material.bottomnavigation.BottomNavigationView | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.navigation.findNavController | ||
import androidx.navigation.ui.AppBarConfiguration | ||
import androidx.navigation.ui.setupActionBarWithNavController | ||
import androidx.navigation.ui.setupWithNavController | ||
import com.helloyanis.rucoycalculator.databinding.ActivityMainBinding | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
private lateinit var binding: ActivityMainBinding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
binding = ActivityMainBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
val navView: BottomNavigationView = binding.navView | ||
|
||
val navController = findNavController(R.id.nav_host_fragment_activity_main) | ||
// Passing each menu ID as a set of Ids because each | ||
// menu should be considered as top level destinations. | ||
val appBarConfiguration = AppBarConfiguration( | ||
setOf( | ||
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications | ||
) | ||
) | ||
setupActionBarWithNavController(navController, appBarConfiguration) | ||
navView.setupWithNavController(navController) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/app/src/main/java/com/helloyanis/rucoycalculator/ui/ptrain/PtrainFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.helloyanis.rucoycalculator.ui.ptrain | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.ViewModelProvider | ||
import com.helloyanis.rucoycalculator.databinding.PtrainBinding | ||
|
||
class PtrainFragment : Fragment() { | ||
|
||
private var _binding: PtrainBinding? = null | ||
|
||
// This property is only valid between onCreateView and | ||
// onDestroyView. | ||
private val binding get() = _binding!! | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
val ptrainViewModel = | ||
ViewModelProvider(this).get(PtrainViewModel::class.java) | ||
|
||
_binding = PtrainBinding.inflate(inflater, container, false) | ||
val root: View = binding.root | ||
|
||
val textView: TextView = binding.textDashboard | ||
ptrainViewModel.text.observe(viewLifecycleOwner) { | ||
textView.text = it | ||
} | ||
return root | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/app/src/main/java/com/helloyanis/rucoycalculator/ui/ptrain/PtrainViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.helloyanis.rucoycalculator.ui.ptrain | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class PtrainViewModel : ViewModel() { | ||
|
||
private val _text = MutableLiveData<String>().apply { | ||
value = "Power training calculation coming soon!" | ||
} | ||
val text: LiveData<String> = _text | ||
} |
80 changes: 80 additions & 0 deletions
80
src/app/src/main/java/com/helloyanis/rucoycalculator/ui/skull/SkullFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.helloyanis.rucoycalculator.ui.skull | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.text.Editable | ||
import android.text.TextWatcher | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.EditText | ||
import android.widget.TextView | ||
import android.widget.Toast | ||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.dataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.preferencesDataStore | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.ViewModelProvider | ||
import com.helloyanis.rucoycalculator.R | ||
import com.helloyanis.rucoycalculator.databinding.SkullBinding | ||
|
||
|
||
class SkullFragment : Fragment() { | ||
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "data") | ||
private var _binding: SkullBinding? = null | ||
private val binding get() = _binding!! | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
_binding = SkullBinding.inflate(inflater, container, false) | ||
setalldisplays("No data") | ||
val editTextNumber = binding.root.findViewById<EditText>(R.id.editTextNumber) | ||
|
||
// Ajoutez un écouteur de texte à votre EditText | ||
editTextNumber.addTextChangedListener(object : TextWatcher { | ||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { | ||
|
||
} | ||
|
||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | ||
|
||
} | ||
|
||
override fun afterTextChanged(s: Editable?) { | ||
val userInput = s.toString() | ||
if (userInput.isNotEmpty()) { | ||
calcskull(userInput.toInt()) | ||
} | ||
} | ||
}) | ||
|
||
return binding.root | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
private fun setalldisplays(string: String){ | ||
binding.root.findViewById<TextView>(R.id.whiteskullvalue).text = string | ||
binding.root.findViewById<TextView>(R.id.yellowskullvalue).text = string | ||
binding.root.findViewById<TextView>(R.id.orangeskullvalue).text = string | ||
binding.root.findViewById<TextView>(R.id.redskullvalue).text = string | ||
binding.root.findViewById<TextView>(R.id.blackskullvalue).text = string | ||
} | ||
private fun calcskull(int: Int) { | ||
if(int<1){ | ||
setalldisplays("Invalid data") | ||
}else{ | ||
binding.root.findViewById<TextView>(R.id.whiteskullvalue).text = (int*50).toString() + "G needed\n"+(int*50).toString()+"G lost" | ||
binding.root.findViewById<TextView>(R.id.yellowskullvalue).text = (int*150).toString() + "G needed\n" + (int*150).toString() +"G lost" | ||
binding.root.findViewById<TextView>(R.id.orangeskullvalue).text = (int*600).toString() + "G needed \n" + (int*450) + "G lost" | ||
binding.root.findViewById<TextView>(R.id.redskullvalue).text = (int*1950).toString() + "G needed\n" + (int*1350) + "G lost" | ||
binding.root.findViewById<TextView>(R.id.blackskullvalue).text = (int*6000).toString() + "G needed\n" + (int*4050) + "G lost" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/app/src/main/java/com/helloyanis/rucoycalculator/ui/skull/SkullViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.helloyanis.rucoycalculator.ui.skull | ||
|
||
import androidx.lifecycle.ViewModel | ||
|
||
class SkullViewModel : ViewModel() { | ||
|
||
} |
Oops, something went wrong.