Skip to content

Commit

Permalink
Init Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceTrindade committed Mar 9, 2022
0 parents commit 67f9fe0
Show file tree
Hide file tree
Showing 51 changed files with 1,154 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
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
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.

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

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

20 changes: 20 additions & 0 deletions .idea/gradle.xml

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

28 changes: 28 additions & 0 deletions .idea/misc.xml

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

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

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

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
64 changes: 64 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id("androidx.navigation.safeargs")
}

android {
compileSdk 32

defaultConfig {
applicationId "com.example.InformalBusinessDictionary"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled 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 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation "androidx.cardview:cardview:1.0.0"

def fragment_version = "1.4.1"
implementation "androidx.fragment:fragment-ktx:$fragment_version"

def nav_version = "2.3.5"
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")
implementation("androidx.navigation:navigation-compose:2.4.0-rc01")

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

//glide
implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
1 change: 1 addition & 0 deletions app/src/androidTest/java
Submodule java added at 411c5e
23 changes: 23 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.InformalBusinessDictionary">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.InformalBussinesDictionary">
<activity
android:name="com.example.InformalBusinessDictionary.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,60 @@
package com.example.InformalBusinessDictionary

import com.example.InformalBusinessDictionary.Models.Terms

class DataSource {

companion object {

fun createData(): ArrayList<Terms> {

val list = ArrayList<Terms>()

list.add(
Terms(
1987,
"budget",
"Orçamento, verba, despesa"
)
)

list.add(
Terms(
1231,
"Approach",
"Abordagem, aproximação"
)
)

list.add(
Terms(
1790,
"soft skills",
"aptidões naturais e comportamentais"
)
)

list.add(
Terms(
1547,
"hard skills",
"aptidões que podem ser aprendidas por meio de qualificações"
)
)

list.add(
Terms(
1447,
"hard skills",
"aptidões que podem ser aprendidas por meio de qualificações"
)
)



return list

}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.example.InformalBusinessDictionary

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.View
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.list_terms.*

class ListTermsFragment : Fragment(R.layout.list_terms) {

private lateinit var termsAdapter: TermsAdapter

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupAdapter()
addDataSource()
}

private fun addDataSource() {
val dataSource = DataSource.createData()
this.termsAdapter.setData(dataSource)
this.termsAdapter.setData(dataSource)
}

private fun setupAdapter() {
//precisa passar a variavel
this.termsAdapter = TermsAdapter { term ->
findNavController().navigate(R.id.firstDestinationToTranslateTermDialog)
}
termsRecyclerView.layoutManager = LinearLayoutManager(context)
termsRecyclerView.adapter = this.termsAdapter
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.InformalBusinessDictionary

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.navigation.ui.setupActionBarWithNavController

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupActionBarWithNavController()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.InformalBusinessDictionary.Models

data class Terms(
var id: Long,
var term: String,
var translate: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.example.InformalBusinessDictionary

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.InformalBusinessDictionary.Models.Terms
import kotlinx.android.synthetic.main.row_layout_term.view.*

class TermsAdapter(private val onItemClicked : (Terms) -> Unit): RecyclerView.Adapter<RecyclerView.ViewHolder>() {

private var items: List<Terms> = ArrayList()

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return TermsViewHolder(
LayoutInflater.from(parent.context).inflate(R.layout.row_layout_term, parent, false)
)
}

override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {

when(holder) {
is TermsViewHolder -> {
holder.bind(items[position], onItemClicked)
}
}
}

override fun getItemCount(): Int {
return items.size
}

fun setData(term: List<Terms>){
this.items = term
this.items = term
this.items = term
}

class TermsViewHolder constructor(
itemView: View
): RecyclerView.ViewHolder(itemView){

private val termTitle = itemView.term_title
private val termTranslate = itemView.term_translate

fun bind(terms: Terms, onItemClicked : (Terms) -> Unit) {

termTitle.text = terms.term
termTranslate.text = terms.translate

itemView.setOnClickListener{
onItemClicked(terms)
}


}

}

}
Loading

0 comments on commit 67f9fe0

Please sign in to comment.