Skip to content

Commit

Permalink
Merge branch 'main' into Dheeraj
Browse files Browse the repository at this point in the history
  • Loading branch information
nero002 authored Mar 9, 2021
2 parents 6e78558 + 3bd777e commit d92fec3
Show file tree
Hide file tree
Showing 23 changed files with 280 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/vyapar.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Vyapar-Clone/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Vyapar-Clone/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Vyapar-Clone/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Vyapar-Clone/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 29 additions & 4 deletions Vyapar-Clone/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
//id 'kotlin-kapt'
id 'kotlin-android-extensions'
}
apply plugin: 'dagger.hilt.android.plugin'

apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
Expand Down Expand Up @@ -42,6 +43,9 @@ android {
buildFeatures {
viewBinding true
}
composeOptions {
kotlinCompilerExtensionVersion '1.0.0-beta01'
}
}

dependencies {
Expand All @@ -57,6 +61,28 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'


implementation 'androidx.compose.ui:ui:1.0.0-beta01'
// Tooling support (Previews, etc.)
implementation 'androidx.compose.ui:ui-tooling:1.0.0-beta01'
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation 'androidx.compose.foundation:foundation:1.0.0-beta01'
// Material Design
implementation 'androidx.compose.material:material:1.0.0-beta01'
// Material design icons
implementation 'androidx.compose.material:material-icons-core:1.0.0-beta01'
implementation 'androidx.compose.material:material-icons-extended:1.0.0-beta01'
// Integration with activities
implementation 'androidx.activity:activity-compose:1.3.0-alpha03'
// Integration with ViewModels
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha02'
// Integration with observables
implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta01'
implementation 'androidx.compose.runtime:runtime-rxjava2:1.0.0-beta01'

// UI Tests
androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.0.0-beta01'


//coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
//retrofit2
Expand Down Expand Up @@ -102,5 +128,4 @@ dependencies {
implementation "com.airbnb.android:lottie:$lottieVersion"



}
1 change: 1 addition & 0 deletions Vyapar-Clone/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".di.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ package com.nero.vyapar

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.viewModels
import com.nero.vyapar.local.database.VyaparDatabase
import com.nero.vyapar.repository.ItemsRepository
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
val viewmodel: viewmodel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

viewmodel.data
}
}
36 changes: 36 additions & 0 deletions Vyapar-Clone/app/src/main/java/com/nero/vyapar/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.nero.vyapar.di

import android.app.Application
import androidx.room.Room
import com.nero.vyapar.local.database.VyaparDatabase
import com.nero.vyapar.repository.ItemsRepository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Inject
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class AppModule {

@Provides
@Singleton
fun provideDataBase(
app: Application
): VyaparDatabase {
return Room.databaseBuilder(app, VyaparDatabase::class.java, "VyaparDatabase")
.fallbackToDestructiveMigration().build()
}


@Provides
@Singleton
fun provideItemRepository(
database: VyaparDatabase
): ItemsRepository {
return ItemsRepository(database.getDAO())
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.nero.vyapar.di

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class MyApplication : Application() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.nero.vyapar.local.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import com.nero.vyapar.local.entity.ItemsEntity
import com.nero.vyapar.local.entity.PartyEntity
import com.nero.vyapar.local.entity.TransactionEntity

@Dao
interface VyaparDAO {

@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertItem(itemsEntity: ItemsEntity)

@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertParty(partyEntity: PartyEntity)

@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertTransaction(transactionEntity: TransactionEntity)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.nero.vyapar.local.database

import androidx.room.Database
import androidx.room.RoomDatabase
import com.nero.vyapar.local.dao.VyaparDAO
import com.nero.vyapar.local.entity.ItemsEntity
import com.nero.vyapar.local.entity.PartyEntity
import com.nero.vyapar.local.entity.TransactionEntity

@Database(
entities = [ItemsEntity::class, PartyEntity::class, TransactionEntity::class],
version = 1
)
abstract class VyaparDatabase : RoomDatabase() {
abstract fun getDAO(): VyaparDAO
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.nero.vyapar.local.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "ItemsTable")
data class ItemsEntity(
@ColumnInfo(name = "itemName") var name: String?,
@ColumnInfo(name = "type") var type: String?,
@ColumnInfo(name = "itemCode") var itemCode: String?,
@ColumnInfo(name = "sacCode") var sacCode: String?,
@ColumnInfo(name = "salePrice") var salePrice: Long?,
@ColumnInfo(name = "purchasePrice") var purchasePrice: Long?,
@ColumnInfo(name = "taxRate") var taxRate: Float?,
) {
@ColumnInfo(name = "id")
@PrimaryKey(autoGenerate = true)
var id: Int? = null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.nero.vyapar.local.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "partyTable")
data class PartyEntity(
@ColumnInfo(name = "partyName") var partyName: String?,
@ColumnInfo(name = "partyContactNumber") var partyContactNumber: String?,
@ColumnInfo(name = "partyBillingAddress") var partyBillingAddress: String?,

) {
@ColumnInfo(name = "id")
@PrimaryKey(autoGenerate = true)
var id: Int? = null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.nero.vyapar.local.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "transactionsTable")
data class TransactionEntity(
@ColumnInfo(name = "billNo") var billNo: Int?,
@ColumnInfo(name = "type") var type: String?,
@ColumnInfo(name = "partyName") var partyName: String?,
@ColumnInfo(name = "billedItemNames") var billedItemNames: String?,
@ColumnInfo(name = "billedItemQuantity") var billedItemQuantity: String?,
@ColumnInfo(name = "paidAmt") var paidAmt: Long?,
) {
@ColumnInfo(name = "id")
@PrimaryKey(autoGenerate = true)
var id: Int? = null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.nero.vyapar.presentation.componenets

/*import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material.Card
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.nero.vyapar.local.entity.ItemsEntity*/


/*
@Composable
fun ItemCard(itemEntity: ItemsEntity) {
Card(modifier = Modifier.height(65.dp)) {
Column(modifier = Modifier.fillMaxHeight()) {
Text(
text = "A day wandering through the sandhills " +
"in Shark Fin Cove, and a few of the " +
"sights I saw",
)
}
}
}
*/

/*
@Preview(showBackground = true)
@Composable
fun PreviewGreeting() {
ItemCard(ItemsEntity("cola", "product", "dfs", "dfs", 21, 80, 0.3f))
}*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.nero.vyapar.repository

import com.nero.vyapar.local.dao.VyaparDAO

class ItemsRepository(databaseDao: VyaparDAO) {
val data = "sda"
}
16 changes: 16 additions & 0 deletions Vyapar-Clone/app/src/main/java/com/nero/vyapar/viewmodel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.nero.vyapar

import androidx.lifecycle.ViewModel
import com.nero.vyapar.local.database.VyaparDatabase
import com.nero.vyapar.repository.ItemsRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class viewmodel @Inject constructor(
database: ItemsRepository
) : ViewModel() {

val data = database.data

}
Loading

0 comments on commit d92fec3

Please sign in to comment.