View HorLayoutManager.kt
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
<androidx.recyclerview.widget.RecyclerView | |
android:id="@+id/storyModeRecyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center_vertical" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintTop_toTopOf="parent" /> | |
val layoutManager = | |
CarouselLayoutManager(CarouselLayoutManager.HORIZONTAL, true) |
View ItemClickSupport.java
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
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
public class ItemClickSupport { | |
private final RecyclerView mRecyclerView; | |
private OnItemClickListener mOnItemClickListener; | |
private OnItemLongClickListener mOnItemLongClickListener; | |
private View.OnClickListener mOnClickListener = new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { |
View MainActivity.java
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
import android.app.Activity; | |
import android.app.Application; | |
import android.arch.lifecycle.Observer; | |
import android.arch.lifecycle.ViewModelProviders; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.res.Configuration; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
import android.net.Uri; |
View activity_sandwich.xml
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" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true" | |
tools:context=".ScrollingActivity"> | |
<android.support.design.widget.AppBarLayout |
View content_sandwich.xml
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.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior"> | |
<android.support.constraint.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> |
View MyFile.java
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
private void addShortcut(String path1, String pdfName) { | |
File file = new File(path1); | |
if (file.exists()) { | |
Uri path = Uri.fromFile(file); | |
Intent shortcutIntent = new Intent(Intent.ACTION_VIEW); | |
shortcutIntent.setDataAndType(path, "application/pdf"); | |
Intent addIntent = new Intent(); | |
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); | |
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, pdfName); | |
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, |
View myUriFunction.java
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
Uri requiredUri = Uri.parse("https://developer.android.com/guide/components/intents-common.html").buildUpon() | |
.appendQueryParameter("utm_source","udacity") | |
.appendQueryParameter("utm_medium", "course") | |
.appendQueryParameter("utm_campaign", "android_basics") | |
.fragment("Phone") | |
.build(); |
View PinPdfFiles.java
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
//Pre-Oreo | |
private void addShortcut(String path1, String pdfName) { | |
File file = new File(path1); | |
if (file.exists()) { | |
Uri path = Uri.fromFile(file); | |
Intent shortcutIntent = new Intent(Intent.ACTION_VIEW); | |
shortcutIntent.setDataAndType(path, "application/pdf"); | |
Intent addIntent = new Intent(); | |
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); | |
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, pdfName); |