setup deep linking functionality for app.

This commit is contained in:
Brian Mwadime 2016-06-30 18:44:05 +03:00
Родитель ac4649b2ce
Коммит 41a740c464
3 изменённых файлов: 25 добавлений и 3 удалений

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Mozilla-DSO-Quiz-Application" external.system.module.version="0.1.1-SNAPSHOT" type="JAVA_MODULE" version="4"> <module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Mozilla-DSO-Quiz-Application" external.system.module.version="0.1.2-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle"> <facet type="android-gradle" name="Android-Gradle">
<configuration> <configuration>

Просмотреть файл

@ -19,6 +19,7 @@ import android.view.View;
import android.view.Window; import android.view.Window;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@ -152,7 +153,28 @@ public class TutorialSlideActivity extends AppCompatActivity implements LoaderMa
String recipeId = data.substring(data.lastIndexOf("/") + 1); String recipeId = data.substring(data.lastIndexOf("/") + 1);
Uri contentUri = DsoContract.Tutorials.CONTENT_URI.buildUpon() Uri contentUri = DsoContract.Tutorials.CONTENT_URI.buildUpon()
.appendPath(recipeId).build(); .appendPath(recipeId).build();
//showRecipe(contentUri); showTutorial(contentUri);
}
}
private void showTutorial(Uri tutorialUri) {
LOGD("Recipe Uri", tutorialUri.toString());
String[] projection = { DsoContract.Tutorials.TUTORIAL_ID,
DsoContract.Tutorials.TUTORIAL_TAG,
DsoContract.Tutorials.TUTORIAL_HEADER,
DsoContract.Tutorials.TUTORIAL_PHOTO_URL,
DsoContract.Tutorials.TUTORIAL_STEPS};
Cursor cursor = getContentResolver().query(tutorialUri, projection, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
// always close the cursor
cursor.close();
} else {
Toast toast = Toast.makeText(getApplicationContext(),
"No match for deep link " + tutorialUri.toString(),
Toast.LENGTH_SHORT);
toast.show();
} }
} }

Просмотреть файл

@ -13,7 +13,7 @@
############################################################################### ###############################################################################
# If versions end in odd numbers they are development builds, even versions are release candidates. # If versions end in odd numbers they are development builds, even versions are release candidates.
# The AndroidManifest.xml must also be updated currently. # The AndroidManifest.xml must also be updated currently.
version=0.1.1-SNAPSHOT version=0.1.2-SNAPSHOT
# Using these variables to sync dependency version numbers across sub-projects. # Using these variables to sync dependency version numbers across sub-projects.
android_support_lib_version = 23.4.0 android_support_lib_version = 23.4.0