Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions DesafioAppProva/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.iml
.gradle
/local.properties\
*/.idea
gradlew.bat
.DS_Store
/build
/captures
.externalNativeBuild
libs/
src/main/res/drawable/
1 change: 1 addition & 0 deletions DesafioAppProva/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
67 changes: 67 additions & 0 deletions DesafioAppProva/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.felipemiranda.desafioappprova"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

def SupportLibrary = '26.1.0'
def ButterKnife = '8.8.1'
def JUNIT = '4.12'
def EspressoCore = '3.0.1'
def Glide = '4.2.0'
def Gson = '2.8.2'
def GsonConverter = '2.3.0'
def Retrofit = '2.3.0'
def MultiDex = '1.0.2'
def Okhttp = '3.8.1'
def OkhttpInterceptor = '3.8.1'
def Fresco = '1.3.0'

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:${SupportLibrary}"
implementation "com.android.support:support-v4:${SupportLibrary}"
implementation "com.android.support:design:${SupportLibrary}"
implementation "com.android.support:support-v4:${SupportLibrary}"
implementation "com.android.support:multidex:${MultiDex}"

compile "com.jakewharton:butterknife:${ButterKnife}"
annotationProcessor "com.jakewharton:butterknife-compiler:${ButterKnife}"

compile "com.google.code.gson:gson:${Gson}"
compile "com.squareup.retrofit2:converter-gson:${GsonConverter}"

compile "com.github.bumptech.glide:glide:${Glide}"

compile "com.squareup.retrofit2:retrofit:${Retrofit}"

compile "com.squareup.okhttp3:okhttp:${Okhttp}"
compile "com.squareup.okhttp3:logging-interceptor:${OkhttpInterceptor}"

compile "com.facebook.fresco:fresco:${Fresco}"

testImplementation "junit:junit:${JUNIT}"
androidTestImplementation("com.android.support.test.espresso:espresso-core:${EspressoCore}", {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
25 changes: 25 additions & 0 deletions DesafioAppProva/app/proguard-rules.pro
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 /Users/felipemiranda/Library/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 com.felipemiranda.desafioappprova;

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("com.felipemiranda.desafioappprova", appContext.getPackageName());
}
}
29 changes: 29 additions & 0 deletions DesafioAppProva/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.felipemiranda.desafioappprova">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".AppProvaApplication"
android:allowBackup="true"
android:icon="@mipmap/appprova"
android:label="@string/app_name"
android:roundIcon="@mipmap/appprova"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.home.HomeActivity"
android:screenOrientation="portrait">
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.felipemiranda.desafioappprova;

import android.app.Application;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.multidex.MultiDex;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.felipemiranda.desafioappprova.network.InternetConnection;

/**
* Created by felipemiranda on 26/10/17.
*/

public class AppProvaApplication extends Application implements InternetConnection {

private static AppProvaApplication mInstance;

@Override
public void onCreate() {
super.onCreate();

Fresco.initialize(this);

MultiDex.install(this);

mInstance = this;
}

public static AppProvaApplication getInstance() {
return mInstance;
}

@Override
public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm != null ? cm.getActiveNetworkInfo() : null;
return netInfo != null && netInfo.isConnectedOrConnecting();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.felipemiranda.desafioappprova;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.felipemiranda.desafioappprova.ui.home.HomeActivity;
import com.felipemiranda.desafioappprova.utils.Utils;

import butterknife.BindView;

/**
* Created by felipemiranda on 27/10/17.
*/

public class SplashActivity extends AppCompatActivity {

private static final long DELAY = 1500;

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

new Handler().postDelayed(this::openHomeActivity, DELAY);
}

private void openHomeActivity() {
Intent intent = new Intent(this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
overridePendingTransition(0, 0);
finish();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package com.felipemiranda.desafioappprova.model;


import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
* Created by felipemiranda on 26/10/17.
*/

public class Item implements Serializable {

private String name;
@SerializedName("full_name")
private String full_name;
private Owner owner;
private String description;
@SerializedName("stargazers_count")
private Integer stargazers_count;
@SerializedName("forks_count")
private Integer forks_count;
@SerializedName("pulls_url")
private String pulls_url;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getFull_name() {
return full_name;
}

public void setFull_name(String full_name) {
this.full_name = full_name;
}

public Owner getOwner() {
return owner;
}

public void setOwner(Owner owner) {
this.owner = owner;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public Integer getStargazers_count() {
return stargazers_count;
}

public void setStargazers_count(Integer stargazers_count) {
this.stargazers_count = stargazers_count;
}

public Integer getForks_count() {
return forks_count;
}

public void setForks_count(Integer forks_count) {
this.forks_count = forks_count;
}

public String getPulls_url() {
return pulls_url;
}

public void setPulls_url(String pulls_url) {
this.pulls_url = pulls_url;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.felipemiranda.desafioappprova.model;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
* Created by felipemiranda on 27/10/17.
*/

public class ItemDetail implements Serializable {

private String title;
private Owner user;
@SerializedName("created_at")
private String created_at;
private String body;
@SerializedName("html_url")
private String html_url;

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public Owner getUser() {
return user;
}

public void setUser(Owner user) {
this.user = user;
}

public String getCreated_at() {
return created_at;
}

public void setCreated_at(String created_at) {
this.created_at = created_at;
}

public String getBody() {
return body;
}

public void setBody(String body) {
this.body = body;
}

public String getHtml_url() {
return html_url;
}

public void setHtml_url(String html_url) {
this.html_url = html_url;
}
}
Loading