-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
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,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 26 | ||
buildToolsVersion "26.0.1" | ||
defaultConfig { | ||
applicationId "br.com.fiap.appjobcomb" | ||
minSdkVersion 19 | ||
targetSdkVersion 26 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support:appcompat-v7:26.+' | ||
compile 'com.android.support.constraint:constraint-layout:1.0.2' | ||
testCompile 'junit:junit:4.12' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in C:\Users\Diego Ferreira\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# 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,26 @@ | ||
package br.com.fiap.appjobcomb; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("br.com.fiap.appjobcomb", appContext.getPackageName()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="br.com.fiap.appjobcomb"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="JobComb" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".SplashScreenActivity" | ||
android:theme="@style/AppCompat.FullScreen"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".LoginActivity"> | ||
<intent-filter> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".ListaUsuariosActivity" /> | ||
<activity android:name=".FormularioActivity"></activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package br.com.fiap.appjobcomb.DAO; | ||
|
||
import android.content.ContentValues; | ||
import android.content.Context; | ||
import android.database.Cursor; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.database.sqlite.SQLiteOpenHelper; | ||
import android.support.annotation.NonNull; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import br.com.fiap.appjobcomb.Modelo.Usuario; | ||
|
||
/** | ||
* Created by Diego Ferreira on 08/10/2017. | ||
*/ | ||
|
||
public class UsuarioDAO extends SQLiteOpenHelper{ | ||
|
||
public UsuarioDAO(Context context){ | ||
super(context, "Jobcomb", null, 1);} | ||
|
||
@Override | ||
public void onCreate(SQLiteDatabase db) { | ||
String sql = "CREATE TABLE Usuarios (id INTEGER PRIMARY KEY, nome TEXT NOT NULL, sobrenome TEXT, cidade TEXT, pais TEXT, nomeGit TEXT, nomeLinkedin TEXT, site TEXT, sexo TEXT, dataNascimento TEXT, dataCadastro TEXT)"; | ||
db.execSQL(sql); | ||
} | ||
|
||
@Override | ||
public void onUpgrade(SQLiteDatabase db, int bancoAntigo, int bancoNovo) { | ||
String sql = "DROP TABLE IF EXISTS Usuarios;"; | ||
db.execSQL(sql); | ||
onCreate(db); | ||
} | ||
|
||
public void insere(Usuario usuario){ | ||
SQLiteDatabase db = getWritableDatabase(); | ||
|
||
ContentValues dados = pegaDadosUsuario(usuario); | ||
db.insert("Usuario", null, dados); | ||
} | ||
|
||
public List<Usuario> buscaUsuario(){ | ||
String sql = "SELECT * FROM Usuarios order by nome;"; | ||
SQLiteDatabase db = getReadableDatabase(); | ||
Cursor c = db.rawQuery(sql, null); | ||
|
||
List<Usuario> usuarios = new ArrayList<>(); | ||
while (c.moveToNext()){ | ||
Usuario usuario = new Usuario(); | ||
usuario.setId(c.getLong(c.getColumnIndex("id"))); | ||
usuario.setNome(c.getString(c.getColumnIndex("nome"))); | ||
usuario.setSobrenome(c.getString(c.getColumnIndex("sobrenome"))); | ||
usuario.setCidade(c.getString(c.getColumnIndex("cidade"))); | ||
usuario.setPais(c.getString(c.getColumnIndex("pais"))); | ||
usuario.setNomeGit(c.getString(c.getColumnIndex("nomeGIt"))); | ||
usuario.setNomeLinkedin(c.getString(c.getColumnIndex("nomeLinkedin"))); | ||
usuario.setSite(c.getString(c.getColumnIndex("site"))); | ||
usuario.setSexo(c.getString(c.getColumnIndex("sexo"))); | ||
usuario.setDataNascimento(c.getString(c.getColumnIndex("dataNascimento"))); | ||
usuario.setDataCadastro(c.getString(c.getColumnIndex("dataCadastro"))); | ||
usuarios.add(usuario); | ||
} | ||
|
||
c.close(); | ||
return usuarios; | ||
} | ||
|
||
public void deleta(Usuario usuario){ | ||
SQLiteDatabase db = getWritableDatabase(); | ||
String [] params = {String.valueOf(usuario.getId())}; | ||
db.delete("Usuarios", "id = ?", params); | ||
} | ||
|
||
public void altera(Usuario usuario){ | ||
SQLiteDatabase db = getWritableDatabase(); | ||
|
||
ContentValues dados = pegaDadosUsuario(usuario); | ||
|
||
String [] params = {String.valueOf(usuario.getId())}; | ||
db.update("Usuarios", dados, "id = ?", params); | ||
|
||
} | ||
|
||
@NonNull | ||
private ContentValues pegaDadosUsuario(Usuario usuario) { | ||
ContentValues dados = new ContentValues(); | ||
dados.put("nome", usuario.getNome()); | ||
dados.put("sobrenome", usuario.getSobrenome()); | ||
dados.put("cidade", usuario.getCidade()); | ||
dados.put("pais", usuario.getPais()); | ||
dados.put("nomeGit", usuario.getNomeGit()); | ||
dados.put("nomeLinkedin", usuario.getNomeLinkedin()); | ||
dados.put("site", usuario.getSite()); | ||
dados.put("sexo", usuario.getSexo()); | ||
dados.put("dataNascimento", usuario.getDataNascimento()); | ||
dados.put("dataCadastro", usuario.getDataCadastro()); | ||
return dados; | ||
|
||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|