This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package codingpizza.com.cda7 | |
import android.os.Bundle | |
import android.support.v4.app.Fragment | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import android.widget.Button | |
import android.widget.EditText |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package codingpizza.com.cda7 | |
import android.support.v4.app.FragmentManager | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
class MainActivity : AppCompatActivity(), LoginFragment.onSignUpSelectedListener { | |
private var mFragmentManager: FragmentManager? = null | |
private var mLoginFragment: LoginFragment? = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 27 | |
defaultConfig { | |
applicationId "codingpizza.com.cda8" | |
minSdkVersion 16 | |
targetSdkVersion 27 | |
versionCode 1 | |
versionName "1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface PizzaService { | |
@GET("/pizzas") | |
Call<List<Pizza>> listPizzas(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Retrofit retrofit = new Retrofit.Builder() | |
.baseUrl(BASE_URL) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PizzaService pizzaService = retrofit.create(PizzaService.class); | |
Call<List<Pizza>> pizzaList = pizzaService.listPizzas(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.codingpizza.cda8"> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:roundIcon="@mipmap/ic_launcher_round" | |
android:supportsRtl="true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pizzaList.enqueue(new Callback<List<Pizza>>() { | |
@Override | |
public void onResponse(Call<List<Pizza>> call, Response<List<Pizza>> response) { | |
if (response.isSuccessful()){ | |
Log.d(TAG, "onResponse: Respuesta Exitosa!"); | |
for (Pizza pizza : response.body()) { | |
Log.d(TAG, "Pizza con el nombre \n "+pizza.getName() | |
+ "Y descripcion \n "+pizza.getDescription()); | |
} | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface PizzaService { | |
@GET("/pizzas") | |
fun listPizzas(): Call<List<Pizza>> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val retrofit = Retrofit.Builder() | |
.baseUrl(BASE_URL) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build() |