Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Add ted talk demo view #99

Merged
merged 5 commits into from
Jun 2, 2019
Merged
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
12 changes: 3 additions & 9 deletions .idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<activity
android:name="com.hossainkhan.android.demo.ui.functionaldemo.MovieDetailsPreviewActivity"
android:parentActivityName="com.hossainkhan.android.demo.ui.browse.LayoutBrowseActivity" />
<activity
android:name="com.hossainkhan.android.demo.ui.functionaldemo.TedTalkPlaybackActivity"
android:parentActivityName="com.hossainkhan.android.demo.ui.browse.LayoutBrowseActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,28 @@ class LayoutDataStore @Inject constructor(
layoutResourceId = R.layout.demo_movie_details,
thumbnailResourceId = R.drawable.spider_verse_poster,
title = "Demo: Movie Details",
description = "A demo screen containing movie details. Rotate device to see constraints in action.")
description = "A demo screen containing movie details. Rotate device to see constraints in action."),

/*
* This is a demo of TED Talk video playback screen.
* ___________________
* )=| | /
* | TED Talks |====||
* | |====||
* | |+ \
* -------------------
* (--)
* * *
* * *
* * *
* * *
* * *
*/
LayoutInformation(
layoutResourceId = R.layout.demo_ted_talk_playback,
thumbnailResourceId = R.drawable.ic_ted_talks_logo,
title = "Demo: TED Talk Preview Screen",
description = "A demo screen containing TED talks video playback screen with different controls.")


/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.hossainkhan.android.demo.di

import com.hossainkhan.android.demo.ui.functionaldemo.MovieDetailsPreviewActivity
import com.hossainkhan.android.demo.ui.functionaldemo.TedTalkPlaybackActivity
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutChainStyleActivity
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutDimensionMinMaxActivity
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutGuidelineBarrierActivity
Expand All @@ -27,9 +28,9 @@ import dagger.Module
import dagger.android.ContributesAndroidInjector

/**
* We want Dagger.Android to create a Subcomponent which has a parent Component of whichever
* module ActivityBindingModule is on, in our case that will be [DemoApplicationComponent].
*
* We want Dagger.Android to create a Subcomponent which has a parent Component of whichever
* module ActivityBindingModule is on, in our case that will be [DemoApplicationComponent].
*
* The beautiful part about this setup is that you never need to tell [DemoApplicationComponent]
* that it is going to have all these subcomponents nor do you need to tell these subcomponents
* that [DemoApplicationComponent] exists.
Expand Down Expand Up @@ -78,4 +79,8 @@ abstract class ActivityBindingModule {
@ActivityScope
@ContributesAndroidInjector
abstract fun layoutMovieDetailsPreviewActivity(): MovieDetailsPreviewActivity

@ActivityScope
@ContributesAndroidInjector
abstract fun layoutTedTalkPlaybackPreviewActivity(): TedTalkPlaybackActivity
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.hossainkhan.android.demo.R
import com.hossainkhan.android.demo.data.AppDataStore
import com.hossainkhan.android.demo.data.LayoutInformation
import com.hossainkhan.android.demo.ui.functionaldemo.MovieDetailsPreviewActivity
import com.hossainkhan.android.demo.ui.functionaldemo.TedTalkPlaybackActivity
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutChainStyleActivity
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutDimensionMinMaxActivity
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutGuidelineBarrierActivity
Expand Down Expand Up @@ -73,6 +74,9 @@ class LayoutBrowseViewModel(
R.layout.demo_movie_details -> {
browseNavigator.loadLayoutPreview(MovieDetailsPreviewActivity::class.java, layoutResId)
}
R.layout.demo_ted_talk_playback -> {
browseNavigator.loadLayoutPreview(TedTalkPlaybackActivity::class.java, layoutResId)
}
else -> {
// By default it loads the preview activity with the layout requested.
browseNavigator.loadLayoutPreview(layoutResId)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2019 Hossain Khan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hossainkhan.android.demo.ui.functionaldemo

import android.os.Bundle
import android.view.View
import android.widget.ImageButton
import android.widget.Toast
import com.hossainkhan.android.demo.R
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutPreviewBaseActivity

class TedTalkPlaybackActivity : LayoutPreviewBaseActivity() {
private val generalClickListener = View.OnClickListener { view ->
Toast.makeText(view.context, "You tapped on ${view}", Toast.LENGTH_SHORT).show()
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// Apply generic toast listener to touchable views so that user gets feedback when they tap it
applyToastListener(
findViewById<ImageButton>(R.id.action_prev_track),
findViewById<ImageButton>(R.id.action_rewind15),
findViewById<ImageButton>(R.id.action_play_pause),
findViewById<ImageButton>(R.id.action_forward15),
findViewById<ImageButton>(R.id.action_next_track)
)
}

private fun applyToastListener(vararg views: View) {
views.forEach {
it.setOnClickListener(generalClickListener)
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions app/src/main/res/drawable/circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright (c) 2019 Hossain Khan
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">

<size
android:width="64dp"
android:height="64dp" />

<solid android:color="@color/md_red_700" />
</shape>
20 changes: 20 additions & 0 deletions app/src/main/res/drawable/ic_forward_30_black_42dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
~ Copyright (c) 2019 Hossain Khan
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<vector android:height="42dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="42dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M9.6,13.5h0.4c0.2,0 0.4,-0.1 0.5,-0.2s0.2,-0.2 0.2,-0.4v-0.2s-0.1,-0.1 -0.1,-0.2 -0.1,-0.1 -0.2,-0.1h-0.5s-0.1,0.1 -0.2,0.1 -0.1,0.1 -0.1,0.2v0.2h-1c0,-0.2 0,-0.3 0.1,-0.5s0.2,-0.3 0.3,-0.4 0.3,-0.2 0.4,-0.2 0.4,-0.1 0.5,-0.1c0.2,0 0.4,0 0.6,0.1s0.3,0.1 0.5,0.2 0.2,0.2 0.3,0.4 0.1,0.3 0.1,0.5v0.3s-0.1,0.2 -0.1,0.3 -0.1,0.2 -0.2,0.2 -0.2,0.1 -0.3,0.2c0.2,0.1 0.4,0.2 0.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!--
~ Copyright (c) 2019 Hossain Khan
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<vector android:height="42dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="42dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M8,5v14l11,-7z"/>
</vector>
20 changes: 20 additions & 0 deletions app/src/main/res/drawable/ic_replay_30_black_42dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
~ Copyright (c) 2019 Hossain Khan
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<vector android:height="42dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="42dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,5L12,1L7,6l5,5L12,7c3.3,0 6,2.7 6,6s-2.7,6 -6,6 -6,-2.7 -6,-6L4,13c0,4.4 3.6,8 8,8s8,-3.6 8,-8 -3.6,-8 -8,-8zM9.6,13.5h0.4c0.2,0 0.4,-0.1 0.5,-0.2s0.2,-0.2 0.2,-0.4v-0.2s-0.1,-0.1 -0.1,-0.2 -0.1,-0.1 -0.2,-0.1h-0.5s-0.1,0.1 -0.2,0.1 -0.1,0.1 -0.1,0.2v0.2h-1c0,-0.2 0,-0.3 0.1,-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v-1.5z"/>
</vector>
25 changes: 25 additions & 0 deletions app/src/main/res/drawable/ic_skip_next_black_42dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright (c) 2019 Hossain Khan
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="42dp"
android:height="42dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
</vector>
25 changes: 25 additions & 0 deletions app/src/main/res/drawable/ic_skip_previous_black_42dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
~ Copyright (c) 2019 Hossain Khan
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="42dp"
android:height="42dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M6,6h2v12L6,18zM9.5,12l8.5,6L18,6z"/>
</vector>
21 changes: 21 additions & 0 deletions app/src/main/res/drawable/ic_ted_talks_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
~ Copyright (c) 2019 Hossain Khan
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<vector android:alpha="0.9" android:height="44.544dp"
android:viewportHeight="26.572" android:viewportWidth="71.607"
android:width="120dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ed1c24" android:pathData="M0,7.08h6.893v19.41h8.64L15.533,7.08h6.91v-7.08L0,0v7.08zM23.359,26.572h22.464v-7.066L31.938,19.506v-2.686l13.885,0.011L45.823,9.795L31.938,9.795L31.938,7.096l13.885,-0.009v-7.086L23.359,0.001v26.571zM59.903,0L46.685,0v26.489L58.34,26.489c9.051,0 13.267,-5.173 13.267,-13.311 -0.001,-6.687 -3.053,-13.178 -11.704,-13.178zM57.903,19.732h-3.359L54.544,6.7h2.778c5.779,0 6.289,4.696 6.289,6.368 0,2.489 -0.728,6.664 -5.708,6.664z"/>
</vector>
Loading