├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── drawable-v24
│ │ │ │ ├── cam.png
│ │ │ │ ├── person.png
│ │ │ │ ├── right.png
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── xml
│ │ │ │ └── filepaths.xml
│ │ │ ├── drawable
│ │ │ │ ├── fundo.xml
│ │ │ │ ├── fundo_cam.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── menu
│ │ │ │ ├── menu_lista_alunos.xml
│ │ │ │ └── menu_formulario.xml
│ │ │ └── layout
│ │ │ │ ├── content_lista_alunos.xml
│ │ │ │ ├── activity_formulario.xml
│ │ │ │ ├── activity_lista_alunos.xml
│ │ │ │ └── content_formulario.xml
│ │ ├── java
│ │ │ └── br
│ │ │ │ └── com
│ │ │ │ └── viniciusdeep
│ │ │ │ └── agenda
│ │ │ │ ├── modelo
│ │ │ │ └── Aluno.java
│ │ │ │ ├── FormularioHelper.java
│ │ │ │ ├── Dao
│ │ │ │ └── AlunoDao.java
│ │ │ │ ├── FormularioActivity.java
│ │ │ │ └── ListaAlunosActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── br
│ │ │ └── com
│ │ │ └── viniciusdeep
│ │ │ └── agenda
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── br
│ │ └── com
│ │ └── viniciusdeep
│ │ └── agenda
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── caches
│ └── build_file_checksums.ser
├── vcs.xml
├── runConfigurations.xml
├── gradle.xml
├── misc.xml
└── codeStyles
│ └── Project.xml
├── README.md
├── .gitignore
├── gradle.properties
├── LICENSE
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # -School-Attendance-List
2 | Project for teachers of basic education who want to give presence to the students of its class
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/cam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/drawable-v24/cam.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/person.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/drawable-v24/person.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/drawable-v24/right.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ViniciusDeep/-School-Attendance-List/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/filepaths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/fundo.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Agenda
3 | Settings
4 | Formulario
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Apr 07 11:16:49 BRT 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_lista_alunos.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/app/src/test/java/br/com/viniciusdeep/agenda/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package br.com.viniciusdeep.agenda;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_formulario.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/fundo_cam.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
18 | -
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/br/com/viniciusdeep/agenda/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package br.com.viniciusdeep.agenda;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("br.com.viniciusdeep.agenda", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 | defaultConfig {
6 | applicationId "br.com.viniciusdeep.agenda"
7 | minSdkVersion 19
8 | targetSdkVersion 27
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:27.1.1'
24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
25 | implementation 'com.android.support:design:27.1.1'
26 | testImplementation 'junit:junit:4.12'
27 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
28 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
29 | }
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Vinicius Mangueira
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_lista_alunos.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
17 |
18 |
19 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_formulario.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_lista_alunos.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/java/br/com/viniciusdeep/agenda/modelo/Aluno.java:
--------------------------------------------------------------------------------
1 | package br.com.viniciusdeep.agenda.modelo;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | public class Aluno implements Serializable {
7 | //Informar que ocorrerá uma transfêrencia binária
8 | private Long id;
9 | private String nome;
10 | private String endereco;
11 | private String telefone;
12 | private String site;
13 | private Double nota;
14 |
15 | public Long getId() {
16 | return id;
17 | }
18 |
19 | public void setId(Long id) {
20 | this.id = id;
21 | }
22 |
23 | public String getNome() {
24 | return nome;
25 | }
26 |
27 | public void setNome(String nome) {
28 | this.nome = nome;
29 | }
30 |
31 | public String getEndereco() {
32 | return endereco;
33 | }
34 |
35 | public void setEndereco(String endereco) {
36 | this.endereco = endereco;
37 | }
38 |
39 | public String getTelefone() {
40 | return telefone;
41 | }
42 |
43 | public void setTelefone(String telefone) {
44 | this.telefone = telefone;
45 | }
46 |
47 | public String getSite() {
48 | return site;
49 | }
50 |
51 | public void setSite(String site) {
52 | this.site = site;
53 | }
54 |
55 | public Double getNota() {
56 | return nota;
57 | }
58 |
59 | public void setNota(Double nota) {
60 | this.nota = nota;
61 | }
62 |
63 | @Override
64 | public String toString() {
65 | return getId() + " - " + getNome();
66 | }
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
32 |
33 |
34 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/br/com/viniciusdeep/agenda/FormularioHelper.java:
--------------------------------------------------------------------------------
1 | package br.com.viniciusdeep.agenda;
2 |
3 | import android.view.View;
4 | import android.widget.EditText;
5 | import android.widget.RatingBar;
6 |
7 | import br.com.viniciusdeep.agenda.modelo.Aluno;
8 |
9 | public class FormularioHelper {
10 |
11 |
12 | private final EditText campoNome;
13 | private final EditText campoEndereco;
14 | private final EditText campoTelefone;
15 | private final EditText campoSite;
16 | private final RatingBar campoNota;
17 | private Aluno aluno;
18 | public FormularioHelper(FormularioActivity activity) {
19 | campoNome = (EditText) activity.findViewById(R.id.formulario_nome);
20 | campoEndereco = (EditText) activity.findViewById(R.id.formulario_endereco);
21 | campoTelefone = (EditText) activity.findViewById(R.id.formulario_telefone);
22 | campoSite = (EditText) activity.findViewById(R.id.formulario_site);
23 | campoNota = (RatingBar) activity.findViewById(R.id.formulario_stars);
24 | aluno = new Aluno();
25 | }
26 |
27 |
28 | public Aluno pegaAluno() {
29 | aluno.setNome(campoNome.getText().toString());
30 | aluno.setEndereco(campoEndereco.getText().toString());
31 | aluno.setTelefone(campoTelefone.getText().toString());
32 | aluno.setSite(campoSite.getText().toString());
33 | aluno.setNota(Double.valueOf(campoNota.getProgress()));
34 |
35 | return aluno;
36 | }
37 |
38 |
39 | public void preencheFormulario(Aluno aluno) {
40 | campoNome.setText(aluno.getNome());
41 | campoEndereco.setText(aluno.getEndereco());
42 | campoTelefone.setText(aluno.getTelefone());
43 | campoSite.setText(aluno.getSite());
44 | campoNota.setProgress(aluno.getNota().intValue());
45 | this.aluno = aluno;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_formulario.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
39 |
40 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
60 |
61 |
65 |
66 |
70 |
71 |
75 |
76 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/app/src/main/java/br/com/viniciusdeep/agenda/Dao/AlunoDao.java:
--------------------------------------------------------------------------------
1 | package br.com.viniciusdeep.agenda.Dao;
2 |
3 | import android.content.ContentValues;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.database.sqlite.SQLiteDatabase;
7 | import android.database.sqlite.SQLiteOpenHelper;
8 | import android.support.annotation.NonNull;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | import br.com.viniciusdeep.agenda.modelo.Aluno;
14 |
15 | public class AlunoDao extends SQLiteOpenHelper{
16 |
17 |
18 | public AlunoDao(Context context) {
19 | super(context, "Agenda", null, 2);
20 | }
21 |
22 | @Override
23 | public void onCreate(SQLiteDatabase db) {
24 | String sql = "CREATE TABLE Alunos (id INTEGER PRIMARY KEY, nome TEXT NOT NULL, endereco TEXT, telefone TEXT, site TEXT, nota REAL)";
25 | db.execSQL(sql);
26 | }
27 |
28 | @Override
29 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
30 | String sql = "DROP TABLE IF EXISTS Alunos";
31 | db.execSQL(sql);
32 | onCreate(db);
33 | }
34 |
35 | public void insert(Aluno aluno) {
36 | SQLiteDatabase db = getWritableDatabase();
37 |
38 | ContentValues dados = getContentValues(aluno);
39 | db.insert("Alunos", null, dados);
40 | }
41 |
42 | @NonNull
43 | private ContentValues getContentValues(Aluno aluno) {
44 | ContentValues dados = new ContentValues();
45 | dados.put("nome", aluno.getNome());
46 | dados.put("site",aluno.getSite());
47 | dados.put("telefone",aluno.getTelefone());
48 | dados.put("endereco",aluno.getEndereco());
49 | dados.put("nota",aluno.getNota());
50 | return dados;
51 | }
52 |
53 | public List buscaAlunos() {
54 | String sql = "SELECT * FROM Alunos";
55 | SQLiteDatabase db = getReadableDatabase();
56 | Cursor c = db.rawQuery(sql, null);
57 | List alunos = new ArrayList();
58 | while (c.moveToNext()) {
59 | Aluno aluno = new Aluno();
60 | aluno.setId(c.getLong(c.getColumnIndex("id")));
61 | aluno.setNome(c.getString(c.getColumnIndex("nome")));
62 | aluno.setEndereco(c.getString(c.getColumnIndex("endereco")));
63 | aluno.setTelefone(c.getString(c.getColumnIndex("telefone")));
64 | aluno.setSite(c.getString(c.getColumnIndex("site")));
65 | aluno.setNota(c.getDouble(c.getColumnIndex("nota")));
66 | alunos.add(aluno); //Adicionando aluno criado
67 | }
68 | c.close();
69 | return alunos;
70 |
71 | }
72 |
73 |
74 | public void remove(Aluno aluno) {
75 | SQLiteDatabase db = getWritableDatabase();
76 |
77 | String[] params = {aluno.getId().toString()};
78 | db.delete("Alunos", "id = ?", params );
79 | }
80 |
81 | public void altera(Aluno aluno) {
82 | SQLiteDatabase db = getWritableDatabase();
83 |
84 | ContentValues dados = getContentValues(aluno);
85 |
86 | String[] params = {aluno.getId().toString()};
87 | db.update("Alunos", dados, "id = ?", params);
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/java/br/com/viniciusdeep/agenda/FormularioActivity.java:
--------------------------------------------------------------------------------
1 | package br.com.viniciusdeep.agenda;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.provider.MediaStore;
7 | import android.support.design.widget.FloatingActionButton;
8 | import android.support.design.widget.Snackbar;
9 | import android.support.v4.content.FileProvider;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.support.v7.widget.Toolbar;
12 | import android.view.Menu;
13 | import android.view.MenuInflater;
14 | import android.view.MenuItem;
15 | import android.view.View;
16 | import android.widget.Button;
17 | import android.widget.EditText;
18 | import android.widget.Toast;
19 |
20 | import java.io.File;
21 | import java.util.List;
22 |
23 | import br.com.viniciusdeep.agenda.Dao.AlunoDao;
24 | import br.com.viniciusdeep.agenda.modelo.Aluno;
25 |
26 | public class FormularioActivity extends AppCompatActivity {
27 |
28 |
29 | private FormularioHelper helper;
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_formulario);
35 | Toolbar toolbar = findViewById(R.id.toolbar);
36 | setSupportActionBar(toolbar);
37 | Intent intent = getIntent();
38 | Aluno aluno = (Aluno) intent.getSerializableExtra("aluno"); //Recuperar dados do aluno, e colocar na variável aluno na vaserialazable
39 | helper = new FormularioHelper(this);
40 | if(aluno != null) {
41 | helper.preencheFormulario(aluno);
42 | }
43 |
44 | Button button_image = (Button) findViewById(R.id.formulario_button_image);
45 | button_image.setOnClickListener(new View.OnClickListener() {
46 | @Override
47 | public void onClick(View v) {
48 | Intent intentImage = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
49 | String caminhoFoto = getExternalFilesDir(null) + "/"+ System.currentTimeMillis() +".jpg";
50 |
51 |
52 |
53 | File arquivoFoto = new File(caminhoFoto);
54 | // intentImage.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
55 | // intentImage.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
56 |
57 | intentImage.putExtra(MediaStore.EXTRA_OUTPUT,
58 | FileProvider.getUriForFile(FormularioActivity.this,
59 | BuildConfig.APPLICATION_ID + ".provider", arquivoFoto));
60 | startActivity(intentImage);
61 |
62 |
63 | }
64 | });
65 |
66 |
67 |
68 | }
69 |
70 |
71 | @Override
72 | public boolean onCreateOptionsMenu(Menu menu) {
73 | MenuInflater menuInflater = getMenuInflater();
74 | menuInflater.inflate(R.menu.menu_formulario, menu);
75 | return super.onCreateOptionsMenu(menu);
76 | }
77 |
78 |
79 | @Override
80 | public boolean onOptionsItemSelected(MenuItem item) {
81 | switch (item.getItemId()){
82 | case R.id.menu_ok:
83 | Aluno aluno = helper.pegaAluno();
84 | AlunoDao dao = new AlunoDao(this);
85 |
86 | if(aluno.getId() != null){
87 | dao.altera(aluno);
88 | }else{
89 | dao.insert(aluno);
90 | }
91 |
92 |
93 | dao.close();
94 | Toast.makeText(FormularioActivity.this, "Aluno " + aluno.getNome() + " salvo!", Toast.LENGTH_SHORT).show();
95 | finish();
96 | break;
97 | }
98 | return super.onOptionsItemSelected(item);
99 | }
100 |
101 |
102 |
103 |
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/java/br/com/viniciusdeep/agenda/ListaAlunosActivity.java:
--------------------------------------------------------------------------------
1 | package br.com.viniciusdeep.agenda;
2 |
3 | import android.Manifest;
4 | import android.content.Intent;
5 | import android.content.pm.PackageManager;
6 | import android.net.Uri;
7 | import android.os.Bundle;
8 | import android.provider.Browser;
9 | import android.support.annotation.NonNull;
10 | import android.support.design.widget.FloatingActionButton;
11 | import android.support.design.widget.Snackbar;
12 | import android.support.v4.app.ActivityCompat;
13 | import android.support.v7.app.AppCompatActivity;
14 | import android.support.v7.widget.Toolbar;
15 | import android.view.ContextMenu;
16 | import android.view.View;
17 | import android.view.Menu;
18 | import android.view.MenuItem;
19 | import android.webkit.WebChromeClient;
20 | import android.widget.AdapterView;
21 | import android.widget.ArrayAdapter;
22 | import android.widget.Button;
23 | import android.widget.EditText;
24 | import android.widget.ListView;
25 | import android.widget.Toast;
26 |
27 | import java.util.List;
28 |
29 | import br.com.viniciusdeep.agenda.Dao.AlunoDao;
30 | import br.com.viniciusdeep.agenda.modelo.Aluno;
31 |
32 |
33 | public class ListaAlunosActivity extends AppCompatActivity {
34 |
35 | private ListView listaAlunos;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | setContentView(R.layout.activity_lista_alunos);
41 | listaAlunos = (ListView) findViewById(R.id.lista_alunos);
42 | listaAlunos.setOnItemClickListener(new AdapterView.OnItemClickListener() {
43 | @Override
44 | public void onItemClick(AdapterView> list, View item, int position, long id) {
45 | Aluno aluno = (Aluno) listaAlunos.getItemAtPosition(position);
46 | Intent intent = new Intent(ListaAlunosActivity.this, FormularioActivity.class);
47 | intent.putExtra("aluno", aluno);//Enviar pra outra activity
48 | startActivity(intent);
49 |
50 | }
51 | }); //take to event in the item at the list
52 |
53 |
54 | // listaAlunos.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
55 | // @Override
56 | // public boolean onItemLongClick(AdapterView> lista, View item, int position, long id) {
57 | // Toast.makeText(ListaAlunosActivity.this, "Clique Longo", Toast.LENGTH_SHORT).show();
58 | // return false;// Passa pra frente outro evento
59 | // }
60 | // });
61 |
62 |
63 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
64 | setSupportActionBar(toolbar);
65 |
66 | Button novoAluno = (Button) findViewById(R.id.criarAluno);
67 | novoAluno.setOnClickListener(new View.OnClickListener() {
68 | @Override
69 | public void onClick(View v) {
70 | Intent intentVaiProFormulario = new Intent(ListaAlunosActivity.this, FormularioActivity.class);
71 | startActivity(intentVaiProFormulario);
72 | }
73 | });
74 | registerForContextMenu(listaAlunos);
75 | }
76 |
77 | private void chargeList() {
78 | AlunoDao dao = new AlunoDao(this);
79 | List alunos = dao.buscaAlunos();
80 | dao.close();
81 |
82 |
83 | ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, alunos);
84 | listaAlunos.setAdapter(adapter);
85 | }
86 |
87 | @Override
88 | protected void onResume() {
89 | super.onResume();
90 | chargeList();
91 | }
92 |
93 |
94 | @Override
95 | public void onCreateContextMenu(ContextMenu menu, View v, final ContextMenu.ContextMenuInfo menuInfo) {
96 | AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
97 | final Aluno aluno = (Aluno) listaAlunos.getItemAtPosition(info.position); //pegar aluno na lista
98 |
99 |
100 | String telefone = aluno.getTelefone();
101 | MenuItem itemSMS = menu.add("Enviar SMS");
102 | Intent intentSms = new Intent(Intent.ACTION_VIEW);
103 | intentSms.setData(Uri.parse("sms:" + telefone));
104 | itemSMS.setIntent(intentSms);
105 |
106 |
107 | MenuItem itemLigar = menu.add("Ligar para Aluno");
108 | itemLigar.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
109 | @Override
110 | public boolean onMenuItemClick(MenuItem item) {
111 |
112 |
113 |
114 |
115 | if (ActivityCompat.checkSelfPermission(ListaAlunosActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
116 | ActivityCompat.requestPermissions(ListaAlunosActivity.this, new String[]{Manifest.permission.CALL_PHONE}, 123);
117 |
118 |
119 | } else {
120 | Intent intentLigar = new Intent(Intent.ACTION_CALL);
121 | intentLigar.setData(Uri.parse("tel:" + aluno.getTelefone()));
122 | startActivity(intentLigar);
123 | }
124 |
125 | return false;
126 | }
127 | });
128 |
129 |
130 |
131 |
132 |
133 | MenuItem itemEndereco = menu.add("Mostrar Endereço no Mapa ");
134 | Intent intentEndereco = new Intent(Intent.ACTION_VIEW);
135 | intentEndereco.setData(Uri.parse("geo:0,0?q="+ aluno.getEndereco()));
136 | itemEndereco.setIntent(intentEndereco);
137 |
138 |
139 |
140 | MenuItem itemSite = menu.add("Visitar Site");
141 | Intent intentSite = new Intent(Intent.ACTION_VIEW); //intent implicita, quando quer aproveitar algo do celular, ou que o usuário vai colocar
142 | String site = aluno.getSite();
143 | if(!site.startsWith("http://")) {
144 | site = "http://" + site;
145 | }
146 | intentSite.setData(Uri.parse(site));
147 | itemSite.setIntent(intentSite);
148 |
149 |
150 |
151 |
152 |
153 |
154 | MenuItem deletar = menu.add("Deletar");
155 | deletar.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
156 | @Override
157 | public boolean onMenuItemClick(MenuItem item) {
158 |
159 | Toast.makeText(ListaAlunosActivity.this, "Aluno: " + aluno.getNome() + " Deletado", Toast.LENGTH_SHORT).show();
160 | AlunoDao dao = new AlunoDao(ListaAlunosActivity.this);
161 | dao.remove(aluno);
162 | dao.close();
163 |
164 | chargeList();
165 |
166 | return false;
167 | }
168 | });
169 | }
170 |
171 | // @Override
172 | // public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
173 | // super.onRequestPermissionsResult(requestCode, permissions, grantResults);
174 | // if(requestCode == 123) {
175 | //
176 | // }
177 | // } Metódo para manipular permissões, o request code é para verificar qual é a permissão, e executar caso for ela
178 | }
179 |
--------------------------------------------------------------------------------