Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloamsilva committed Aug 5, 2018
1 parent 2ac83ee commit 141d75d
Show file tree
Hide file tree
Showing 45 changed files with 961 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

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

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

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

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

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

12 changes: 12 additions & 0 deletions .idea/runConfigurations.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
39 changes: 39 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "br.com.whatsappandroid.cursoandroid.whatsapp2"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// Firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
// Design
implementation 'com.android.support:design:28.0.0-beta01'
// Mascara de formatação
implementation 'com.github.rtoshiro.mflibrary:mflibrary:1.0.0'
}

apply plugin: 'com.google.gms.google-services'
55 changes: 55 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"project_info": {
"project_number": "265704152899",
"firebase_url": "https://whatsapp2-41b23.firebaseio.com",
"project_id": "whatsapp2-41b23",
"storage_bucket": "whatsapp2-41b23.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:265704152899:android:80b88204209220e7",
"android_client_info": {
"package_name": "br.com.whatsappandroid.cursoandroid.whatsapp2"
}
},
"oauth_client": [
{
"client_id": "265704152899-teb113ssp3lrmo359kc3qvmhkd8h777q.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "br.com.whatsappandroid.cursoandroid.whatsapp2",
"certificate_hash": "dfe5abb0df77c288d8f01cf6a9078fa5d6a90cf2"
}
},
{
"client_id": "265704152899-din5dentpg0a37hno8nh1n795lj3l2sn.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyB5SJD3KuzZhTHs4Ts3L1dZNM8uQm2Uyw4"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "265704152899-din5dentpg0a37hno8nh1n795lj3l2sn.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package br.com.whatsappandroid.cursoandroid.whatsapp2;

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.*;

/**
* Instrumented 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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("br.com.whatsappandroid.cursoandroid.whatsapp2", appContext.getPackageName());
}
}
22 changes: 22 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.whatsappandroid.cursoandroid.whatsapp2">

<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/AppTheme">
<activity android:name=".activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.LoginActivity"></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package br.com.whatsappandroid.cursoandroid.whatsapp2.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import br.com.whatsappandroid.cursoandroid.whatsapp2.R;

public class LoginActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package br.com.whatsappandroid.cursoandroid.whatsapp2.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

import br.com.whatsappandroid.cursoandroid.whatsapp2.R;

public class MainActivity extends AppCompatActivity {

private DatabaseReference referenciaFirebase = FirebaseDatabase.getInstance().getReference();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

referenciaFirebase.child("pontos").setValue(100);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package br.com.whatsappandroid.cursoandroid.whatsapp2.helper;

import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;

import java.util.ArrayList;
import java.util.List;

public class Permissao {

public static boolean validaPermissoes(int requestCode, Activity activity, String[] permissoes) {

if (Build.VERSION.SDK_INT >= 23) {

List<String> listaPermissoes = new ArrayList<String>();

/*Percorre as permissões passadas, verificando uma a uma
* se já tem a permissao liberada */
for (String permissao : permissoes) {
Boolean validaPermissao = ContextCompat.checkSelfPermission(activity, permissao) == PackageManager.PERMISSION_GRANTED;
if (!validaPermissao) listaPermissoes.add(permissao);
}

/*Caso a lista esteja vazia, não é necessário solicitar permissão*/
if (listaPermissoes.isEmpty()) return true;

String[] novasPermissoes = new String[listaPermissoes.size()];
listaPermissoes.toArray(novasPermissoes);

//Solicita permissão
ActivityCompat.requestPermissions(activity, novasPermissoes, requestCode);

}

return true;

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package br.com.whatsappandroid.cursoandroid.whatsapp2.helper;

import android.content.Context;
import android.content.SharedPreferences;

public class Preferencias {

private Context contexto;
private SharedPreferences preferences;
private final String NOME_ARQUIVO = "whatsapp.preferencias";
private final int MODE = 0;
private SharedPreferences.Editor editor;

public Preferencias( Context contextoParametro) {
contexto = contextoParametro;
preferences = contexto.getSharedPreferences(NOME_ARQUIVO, MODE );
editor = preferences.edit();
}

}
Loading

0 comments on commit 141d75d

Please sign in to comment.