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

Commit 72d7c20

Browse files
authored
Merge pull request #99 from amardeshbd/add-ted-talk-demo-view
Add ted talk demo view
2 parents c18ba16 + 68cede8 commit 72d7c20

17 files changed

+587
-13
lines changed

.idea/assetWizardSettings.xml

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
<activity
4141
android:name="com.hossainkhan.android.demo.ui.functionaldemo.MovieDetailsPreviewActivity"
4242
android:parentActivityName="com.hossainkhan.android.demo.ui.browse.LayoutBrowseActivity" />
43+
<activity
44+
android:name="com.hossainkhan.android.demo.ui.functionaldemo.TedTalkPlaybackActivity"
45+
android:parentActivityName="com.hossainkhan.android.demo.ui.browse.LayoutBrowseActivity" />
4346
</application>
4447

4548
</manifest>

app/src/main/java/com/hossainkhan/android/demo/data/LayoutDataStore.kt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,28 @@ class LayoutDataStore @Inject constructor(
176176
layoutResourceId = R.layout.demo_movie_details,
177177
thumbnailResourceId = R.drawable.spider_verse_poster,
178178
title = "Demo: Movie Details",
179-
description = "A demo screen containing movie details. Rotate device to see constraints in action.")
179+
description = "A demo screen containing movie details. Rotate device to see constraints in action."),
180+
181+
/*
182+
* This is a demo of TED Talk video playback screen.
183+
* ___________________
184+
* )=| | /
185+
* | TED Talks |====||
186+
* | |====||
187+
* | |+ \
188+
* -------------------
189+
* (--)
190+
* * *
191+
* * *
192+
* * *
193+
* * *
194+
* * *
195+
*/
196+
LayoutInformation(
197+
layoutResourceId = R.layout.demo_ted_talk_playback,
198+
thumbnailResourceId = R.drawable.ic_ted_talks_logo,
199+
title = "Demo: TED Talk Preview Screen",
200+
description = "A demo screen containing TED talks video playback screen with different controls.")
180201

181202

182203
/*

app/src/main/java/com/hossainkhan/android/demo/di/ActivityBindingModule.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.hossainkhan.android.demo.di
1818

1919
import com.hossainkhan.android.demo.ui.functionaldemo.MovieDetailsPreviewActivity
20+
import com.hossainkhan.android.demo.ui.functionaldemo.TedTalkPlaybackActivity
2021
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutChainStyleActivity
2122
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutDimensionMinMaxActivity
2223
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutGuidelineBarrierActivity
@@ -27,9 +28,9 @@ import dagger.Module
2728
import dagger.android.ContributesAndroidInjector
2829

2930
/**
30-
* We want Dagger.Android to create a Subcomponent which has a parent Component of whichever
31-
* module ActivityBindingModule is on, in our case that will be [DemoApplicationComponent].
32-
*
31+
* We want Dagger.Android to create a Subcomponent which has a parent Component of whichever
32+
* module ActivityBindingModule is on, in our case that will be [DemoApplicationComponent].
33+
*
3334
* The beautiful part about this setup is that you never need to tell [DemoApplicationComponent]
3435
* that it is going to have all these subcomponents nor do you need to tell these subcomponents
3536
* that [DemoApplicationComponent] exists.
@@ -78,4 +79,8 @@ abstract class ActivityBindingModule {
7879
@ActivityScope
7980
@ContributesAndroidInjector
8081
abstract fun layoutMovieDetailsPreviewActivity(): MovieDetailsPreviewActivity
82+
83+
@ActivityScope
84+
@ContributesAndroidInjector
85+
abstract fun layoutTedTalkPlaybackPreviewActivity(): TedTalkPlaybackActivity
8186
}

app/src/main/java/com/hossainkhan/android/demo/ui/browse/LayoutBrowseViewModel.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.hossainkhan.android.demo.R
2323
import com.hossainkhan.android.demo.data.AppDataStore
2424
import com.hossainkhan.android.demo.data.LayoutInformation
2525
import com.hossainkhan.android.demo.ui.functionaldemo.MovieDetailsPreviewActivity
26+
import com.hossainkhan.android.demo.ui.functionaldemo.TedTalkPlaybackActivity
2627
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutChainStyleActivity
2728
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutDimensionMinMaxActivity
2829
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutGuidelineBarrierActivity
@@ -73,6 +74,9 @@ class LayoutBrowseViewModel(
7374
R.layout.demo_movie_details -> {
7475
browseNavigator.loadLayoutPreview(MovieDetailsPreviewActivity::class.java, layoutResId)
7576
}
77+
R.layout.demo_ted_talk_playback -> {
78+
browseNavigator.loadLayoutPreview(TedTalkPlaybackActivity::class.java, layoutResId)
79+
}
7680
else -> {
7781
// By default it loads the preview activity with the layout requested.
7882
browseNavigator.loadLayoutPreview(layoutResId)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2019 Hossain Khan
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.hossainkhan.android.demo.ui.functionaldemo
18+
19+
import android.os.Bundle
20+
import android.view.View
21+
import android.widget.ImageButton
22+
import android.widget.Toast
23+
import com.hossainkhan.android.demo.R
24+
import com.hossainkhan.android.demo.ui.layoutpreview.LayoutPreviewBaseActivity
25+
26+
class TedTalkPlaybackActivity : LayoutPreviewBaseActivity() {
27+
private val generalClickListener = View.OnClickListener { view ->
28+
Toast.makeText(view.context, "You tapped on ${view}", Toast.LENGTH_SHORT).show()
29+
}
30+
31+
override fun onCreate(savedInstanceState: Bundle?) {
32+
super.onCreate(savedInstanceState)
33+
34+
// Apply generic toast listener to touchable views so that user gets feedback when they tap it
35+
applyToastListener(
36+
findViewById<ImageButton>(R.id.action_prev_track),
37+
findViewById<ImageButton>(R.id.action_rewind15),
38+
findViewById<ImageButton>(R.id.action_play_pause),
39+
findViewById<ImageButton>(R.id.action_forward15),
40+
findViewById<ImageButton>(R.id.action_next_track)
41+
)
42+
}
43+
44+
private fun applyToastListener(vararg views: View) {
45+
views.forEach {
46+
it.setOnClickListener(generalClickListener)
47+
}
48+
}
49+
}
Loading
Loading

app/src/main/res/drawable/circle.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!--
4+
~ Copyright (c) 2019 Hossain Khan
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
20+
android:shape="oval">
21+
22+
<size
23+
android:width="64dp"
24+
android:height="64dp" />
25+
26+
<solid android:color="@color/md_red_700" />
27+
</shape>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
~ Copyright (c) 2019 Hossain Khan
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector android:height="42dp" android:viewportHeight="24.0"
18+
android:viewportWidth="24.0" android:width="42dp" xmlns:android="http://schemas.android.com/apk/res/android">
19+
<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.5,0.4s0.2,0.4 0.2,0.6c0,0.2 0,0.4 -0.1,0.5s-0.2,0.3 -0.3,0.4 -0.3,0.2 -0.5,0.2 -0.4,0.1 -0.6,0.1c-0.2,0 -0.4,0 -0.5,-0.1s-0.3,-0.1 -0.5,-0.2 -0.2,-0.2 -0.3,-0.4 -0.1,-0.4 -0.1,-0.6h0.8v0.2s0.1,0.1 0.1,0.2 0.1,0.1 0.2,0.1h0.5s0.1,-0.1 0.2,-0.1 0.1,-0.1 0.1,-0.2v-0.5s-0.1,-0.1 -0.1,-0.2 -0.1,-0.1 -0.2,-0.1h-0.6v-0.7zM15.3,14.2c0,0.3 0,0.6 -0.1,0.8l-0.3,0.6s-0.3,0.3 -0.5,0.3 -0.4,0.1 -0.6,0.1 -0.4,0 -0.6,-0.1 -0.3,-0.2 -0.5,-0.3 -0.2,-0.3 -0.3,-0.6 -0.1,-0.5 -0.1,-0.8v-0.7c0,-0.3 0,-0.6 0.1,-0.8l0.3,-0.6s0.3,-0.3 0.5,-0.3 0.4,-0.1 0.6,-0.1 0.4,0 0.6,0.1 0.3,0.2 0.5,0.3 0.2,0.3 0.3,0.6 0.1,0.5 0.1,0.8v0.7zM14.4,13.4v-0.5s-0.1,-0.2 -0.1,-0.3 -0.1,-0.1 -0.2,-0.2 -0.2,-0.1 -0.3,-0.1 -0.2,0 -0.3,0.1l-0.2,0.2s-0.1,0.2 -0.1,0.3v2s0.1,0.2 0.1,0.3 0.1,0.1 0.2,0.2 0.2,0.1 0.3,0.1 0.2,0 0.3,-0.1l0.2,-0.2s0.1,-0.2 0.1,-0.3v-1.5zM4,13c0,4.4 3.6,8 8,8s8,-3.6 8,-8h-2c0,3.3 -2.7,6 -6,6s-6,-2.7 -6,-6 2.7,-6 6,-6v4l5,-5 -5,-5v4c-4.4,0 -8,3.6 -8,8z"/>
20+
</vector>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
~ Copyright (c) 2019 Hossain Khan
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector android:height="42dp" android:viewportHeight="24.0"
18+
android:viewportWidth="24.0" android:width="42dp" xmlns:android="http://schemas.android.com/apk/res/android">
19+
<path android:fillColor="#FF000000" android:pathData="M8,5v14l11,-7z"/>
20+
</vector>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
~ Copyright (c) 2019 Hossain Khan
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector android:height="42dp" android:viewportHeight="24.0"
18+
android:viewportWidth="24.0" android:width="42dp" xmlns:android="http://schemas.android.com/apk/res/android">
19+
<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,-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.5,0.4s0.2,0.4 0.2,0.6c0,0.2 0,0.4 -0.1,0.5s-0.2,0.3 -0.3,0.4 -0.3,0.2 -0.5,0.2 -0.4,0.1 -0.6,0.1c-0.2,0 -0.4,0 -0.5,-0.1s-0.3,-0.1 -0.5,-0.2 -0.2,-0.2 -0.3,-0.4 -0.1,-0.4 -0.1,-0.6h0.8v0.2s0.1,0.1 0.1,0.2 0.1,0.1 0.2,0.1h0.5s0.1,-0.1 0.2,-0.1 0.1,-0.1 0.1,-0.2v-0.5s-0.1,-0.1 -0.1,-0.2 -0.1,-0.1 -0.2,-0.1h-0.6v-0.7zM15.3,14.2c0,0.3 0,0.6 -0.1,0.8l-0.3,0.6s-0.3,0.3 -0.5,0.3 -0.4,0.1 -0.6,0.1 -0.4,0 -0.6,-0.1 -0.3,-0.2 -0.5,-0.3 -0.2,-0.3 -0.3,-0.6 -0.1,-0.5 -0.1,-0.8v-0.7c0,-0.3 0,-0.6 0.1,-0.8l0.3,-0.6s0.3,-0.3 0.5,-0.3 0.4,-0.1 0.6,-0.1 0.4,0 0.6,0.1 0.3,0.2 0.5,0.3 0.2,0.3 0.3,0.6 0.1,0.5 0.1,0.8v0.7zM14.5,13.4v-0.5c0,-0.1 -0.1,-0.2 -0.1,-0.3s-0.1,-0.1 -0.2,-0.2 -0.2,-0.1 -0.3,-0.1 -0.2,0 -0.3,0.1l-0.2,0.2s-0.1,0.2 -0.1,0.3v2s0.1,0.2 0.1,0.3 0.1,0.1 0.2,0.2 0.2,0.1 0.3,0.1 0.2,0 0.3,-0.1l0.2,-0.2s0.1,-0.2 0.1,-0.3v-1.5z"/>
20+
</vector>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--
2+
~ Copyright (c) 2019 Hossain Khan
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:width="42dp"
19+
android:height="42dp"
20+
android:viewportWidth="24.0"
21+
android:viewportHeight="24.0">
22+
<path
23+
android:fillColor="#FF000000"
24+
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
25+
</vector>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--
2+
~ Copyright (c) 2019 Hossain Khan
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:width="42dp"
19+
android:height="42dp"
20+
android:viewportWidth="24.0"
21+
android:viewportHeight="24.0">
22+
<path
23+
android:fillColor="#FF000000"
24+
android:pathData="M6,6h2v12L6,18zM9.5,12l8.5,6L18,6z"/>
25+
</vector>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
~ Copyright (c) 2019 Hossain Khan
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector android:alpha="0.9" android:height="44.544dp"
18+
android:viewportHeight="26.572" android:viewportWidth="71.607"
19+
android:width="120dp" xmlns:android="http://schemas.android.com/apk/res/android">
20+
<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"/>
21+
</vector>

0 commit comments

Comments
 (0)