This file contains 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
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
View createdView = inflater.inflate(R.layout.fragment_discover_movie, container, false); | |
mainGrid = (GridView)createdView.findViewById(R.id.mainGrid); | |
mainGrid.setNumColumns(2); | |
mcAdapter = new MovieCoverAdapter(getActivity(),new ArrayList<MovieModel>()); | |
mainGrid.setAdapter(mcAdapter); | |
return createdView; | |
} |
This file contains 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
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginBottom="4dp" | |
android:layout_marginLeft="4dp" | |
android:layout_marginRight="4dp" | |
android:layout_marginTop="4dp" | |
android:clickable="true" | |
android:focusable="true" | |
android:foreground="?selectableItemBackground"> |
This file contains 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
// Na classe MainActivity.java. | |
Toast.makeText(this, getString(R.string.score_app),Toast.LENGTH_SHORT).show(); | |
// No arquivo res/values/strings.xml. | |
<string name="score_app">This button will launch the Score app!</string> |
This file contains 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
// No arquivo res/values/styles.xml. | |
<style name="ButtonStyle"> | |
<item name="android:layout_width">270dp</item> | |
<item name="android:layout_height">70dp</item> | |
<item name="android:textSize">20dp</item> | |
<item name="android:layout_centerHorizontal">true</item> | |
</style> | |
// No arquivo content_main.xml. | |
<?xml version="1.0" encoding="utf-8"?> |
This file contains 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
// Definição do método que chega se há conexão com a Internet. | |
public Boolean hasConnection(Activity activity) { | |
ConnectivityManager connectivityManager = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); | |
Boolean hasConnection = connectivityManager.getActiveNetworkInfo() != null; | |
return hasConnection; | |
} | |
public void tellJoke(View view) { | |
// ----- Trecho de código que deve ser adicionado. -----> | |
if (hasConnection(this)) { |
This file contains 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
// Definição do método que chega se há conexão com a Internet. | |
public Boolean hasConnection(Activity activity) { | |
ConnectivityManager connectivityManager = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); | |
Boolean hasConnection = connectivityManager.getActiveNetworkInfo() != null; | |
return hasConnection; | |
} | |
public void tellJoke() { | |
// ----- Trecho de código que deve ser adicionado. -----> | |
if (hasConnection(this)) { |
This file contains 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"?> | |
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/scrollview" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical"> |
This file contains 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"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:padding="@dimen/activity_margin" | |
tools:context=".EditorActivity"> |
This file contains 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 com.example.android.drones.data; | |
import android.content.Context; | |
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
import com.example.android.drones.data.DroneContract.DroneEntry; | |
/** |
OlderNewer