Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix part 135: Topic issues fixes #285

Merged
merged 97 commits into from
Nov 7, 2019
Merged
Changes from 1 commit
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
e2ed1c4
multiple tabs
nikitamarysolomanpvt Oct 7, 2019
089ea5a
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
nikitamarysolomanpvt Oct 14, 2019
43016b6
nit changes
nikitamarysolomanpvt Oct 17, 2019
3a1a350
nit changes
nikitamarysolomanpvt Oct 17, 2019
405a45e
nit changes
nikitamarysolomanpvt Oct 17, 2019
72c7360
nit changes
nikitamarysolomanpvt Oct 17, 2019
c5ffa61
nit changes
nikitamarysolomanpvt Oct 17, 2019
47e2efc
nit changes
nikitamarysolomanpvt Oct 17, 2019
b4ed9bb
nit changes
nikitamarysolomanpvt Oct 17, 2019
9dd39b9
nit changes
nikitamarysolomanpvt Oct 17, 2019
b2fca59
nit changes
nikitamarysolomanpvt Oct 17, 2019
f0cb60f
cust_args
nikitamarysolomanpvt Oct 18, 2019
2d21695
multiple tabs will getting topic id from home
nikitamarysolomanpvt Oct 29, 2019
93b889b
test cases,multiple tabs will getting topic id from home
nikitamarysolomanpvt Oct 29, 2019
3130323
nit
nikitamarysolomanpvt Oct 29, 2019
bbe7cf3
nit
nikitamarysolomanpvt Oct 29, 2019
046e297
nit
nikitamarysolomanpvt Oct 30, 2019
ba506ab
nit
nikitamarysolomanpvt Oct 30, 2019
6f228d1
nit
nikitamarysolomanpvt Oct 30, 2019
24be11b
separate test cases for all four tabs
nikitamarysolomanpvt Oct 30, 2019
bfa2b78
nit
nikitamarysolomanpvt Oct 30, 2019
0c6d5d8
nit
nikitamarysolomanpvt Oct 30, 2019
f8f84f1
nit
nikitamarysolomanpvt Oct 30, 2019
efae9f7
nit
nikitamarysolomanpvt Oct 30, 2019
1ecfc2f
nit
nikitamarysolomanpvt Oct 30, 2019
293aa52
nit
nikitamarysolomanpvt Oct 30, 2019
949f89e
nit
nikitamarysolomanpvt Oct 30, 2019
71ae233
nit
nikitamarysolomanpvt Oct 30, 2019
423dd37
Topic Overview see more click and tab switch
nikitamarysolomanpvt Oct 31, 2019
d3458e1
Topic Overview see more click and tab switch
nikitamarysolomanpvt Oct 31, 2019
032cfeb
Topic Overview see more click and tab switch
nikitamarysolomanpvt Oct 31, 2019
7084858
topic id todo's are implemented, test cases updated as per new data t…
nikitamarysolomanpvt Oct 31, 2019
bb42cf1
Topic Overview see more click and tab switch
nikitamarysolomanpvt Oct 31, 2019
b4b7763
nit
nikitamarysolomanpvt Oct 31, 2019
8c67e7e
nit
nikitamarysolomanpvt Oct 31, 2019
f4451ea
merged with develop
nikitamarysolomanpvt Oct 31, 2019
a598fc7
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
nikitamarysolomanpvt Oct 31, 2019
203a5a2
merged with base branch
nikitamarysolomanpvt Oct 31, 2019
f1e3b48
merged with base branch
nikitamarysolomanpvt Oct 31, 2019
ad38ec6
nit
nikitamarysolomanpvt Oct 31, 2019
e137f99
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
92a6b26
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
413b811
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
344e153
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
8545a66
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
2304174
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
d5041b9
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
4934518
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
3410a17
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
3e366b6
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
12da7e9
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
41903fb
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
2339b10
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
bd1949f
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
8599de6
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
edf1a95
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
f19daa8
revert back to develop
nikitamarysolomanpvt Oct 31, 2019
916ccc2
nit changes
nikitamarysolomanpvt Nov 2, 2019
afdabd5
nit changes,
nikitamarysolomanpvt Nov 2, 2019
549a0b1
nit changes
nikitamarysolomanpvt Nov 2, 2019
758b7e6
nit changes
nikitamarysolomanpvt Nov 2, 2019
5b7312a
nit changes
nikitamarysolomanpvt Nov 2, 2019
45bc1d6
nit changes
nikitamarysolomanpvt Nov 2, 2019
0d5c057
nit changes
nikitamarysolomanpvt Nov 2, 2019
33753cc
nit changes
nikitamarysolomanpvt Nov 4, 2019
89b274a
set title on the basis of selected topic in topic screen.other nit ch…
nikitamarysolomanpvt Nov 5, 2019
1827e95
nit
nikitamarysolomanpvt Nov 5, 2019
d21250e
Merge branches 'develop' and 'topic-player-multiple-tabs' of https://…
nikitamarysolomanpvt Nov 5, 2019
e0c6b06
Merge branches 'develop' and 'topic-player-multiple-tabs' of https://…
nikitamarysolomanpvt Nov 5, 2019
3230c2f
Merge branches 'develop' and 'topic-player-multiple-tabs' of https://…
nikitamarysolomanpvt Nov 5, 2019
9695194
nit
nikitamarysolomanpvt Nov 5, 2019
40e449e
nit
nikitamarysolomanpvt Nov 5, 2019
51350f2
nit
nikitamarysolomanpvt Nov 5, 2019
10593a7
nit
nikitamarysolomanpvt Nov 5, 2019
772f98c
Merge branches 'develop' and 'topic-player-multiple-tabs' of https://…
nikitamarysolomanpvt Nov 5, 2019
f6569ff
Merge branches 'develop' and 'topic-player-multiple-tabs' of https://…
nikitamarysolomanpvt Nov 5, 2019
bacebd2
nit in TopicFragmentPresenter changed var to val in line number 69
nikitamarysolomanpvt Nov 5, 2019
a0c01af
Merge branches 'develop' and 'topic_issues_fixs' of https://github.co…
nikitamarysolomanpvt Nov 5, 2019
7d44c0a
nit
nikitamarysolomanpvt Nov 5, 2019
8cede53
shorten stackoverflow link,testcase method name change
nikitamarysolomanpvt Nov 5, 2019
61fe4d5
nit changes suggested by Rajat
nikitamarysolomanpvt Nov 5, 2019
83ad843
merged with develop
nikitamarysolomanpvt Nov 6, 2019
1aa955e
nit
nikitamarysolomanpvt Nov 6, 2019
5a2508c
Merge branches 'topic-player-multiple-tabs' and 'topic_issues_fixs' o…
nikitamarysolomanpvt Nov 6, 2019
e6b4532
nit
nikitamarysolomanpvt Nov 6, 2019
f806cc8
used enum to set current tab in TopicFragmentPresenter.
nikitamarysolomanpvt Nov 6, 2019
aedfd66
Merge branches 'develop' and 'topic_issues_fixs' of https://github.co…
nikitamarysolomanpvt Nov 6, 2019
321496c
nit
nikitamarysolomanpvt Nov 7, 2019
79a5dcf
nit
nikitamarysolomanpvt Nov 7, 2019
534905e
nit
nikitamarysolomanpvt Nov 7, 2019
94240b2
nit
nikitamarysolomanpvt Nov 7, 2019
d122006
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
nikitamarysolomanpvt Nov 7, 2019
9faff37
nit
nikitamarysolomanpvt Nov 7, 2019
bb6f4ce
nit
nikitamarysolomanpvt Nov 7, 2019
5c6ebe7
nit
nikitamarysolomanpvt Nov 7, 2019
1cc1af3
nit
nikitamarysolomanpvt Nov 7, 2019
7e93850
Merge branches 'develop' and 'topic_issues_fixs' of https://github.co…
nikitamarysolomanpvt Nov 7, 2019
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
Prev Previous commit
Next Next commit
test cases,multiple tabs will getting topic id from home
Merge branch 'develop' of https://github.com/oppia/oppia-android into topic-player-multiple-tabs

# Conflicts:
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/org/oppia/app/player/state/StateFragmentPresenter.kt
#	domain/src/main/java/org/oppia/domain/exploration/ExplorationRetriever.kt
  • Loading branch information
nikitamarysolomanpvt committed Oct 29, 2019
commit 93b889b8636520809f1f6f5aac1f7c9ee55b705f
22 changes: 11 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -16,21 +16,21 @@
<activity android:name=".player.exploration.ExplorationActivity" />
<activity android:name=".topic.questionplayer.QuestionPlayerActivity" />
<activity android:name=".topic.TopicActivity"
android:theme="@style/OppiaTheme.NoActionBar"/>
android:theme="@style/OppiaThemeWithoutActionBar"> <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".player.audio.testing.AudioFragmentTestActivity" />
<activity android:name=".testing.InputInteractionViewTestActivity" />
<activity android:name=".profile.ProfileActivity" />
<activity android:name=".story.StoryActivity"/>
<activity android:name=".home.HomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".home.HomeActivity"/>

<activity
android:name=".splash.SplashActivity"
android:theme="@style/SplashScreenTheme" />
Original file line number Diff line number Diff line change
@@ -34,20 +34,19 @@ class TopicFragmentPresenter @Inject constructor(
): View? {
val binding = TopicFragmentBinding.inflate(inflater, container, /* attachToRoot= */ false)
binding.lifecycleOwner = fragment
viewPager = binding.root.findViewById(R.id.viewpager) as ViewPager
tabLayout = binding.root.findViewById(R.id.tabs) as TabLayout
setUpViewPager(viewPager,topicId)
viewPager = binding.root.findViewById(R.id.topic_tabs_viewpager) as ViewPager
tabLayout = binding.root.findViewById(R.id.topic_tabs_container) as TabLayout
setUpViewPager(viewPager, topicId)
return binding.root
}

private fun setUpViewPager(viewPager: ViewPager, topicId: String?) {
val adapter = ViewPagerAdapter(fragment.fragmentManager!!, tabLayout.tabCount, topicId!!)
val adapter = ViewPagerAdapter(fragment.fragmentManager!!, tabIcons.size, topicId!!)
viewPager.adapter = adapter
tabLayout.addTab(tabLayout.newTab().setText(fragment.getString(R.string.overview)).setIcon(tabIcons[0]))
tabLayout.addTab(tabLayout.newTab().setText(fragment.getString(R.string.play)).setIcon(tabIcons[1]))
tabLayout.addTab(tabLayout.newTab().setText(fragment.getString(R.string.train)).setIcon(tabIcons[2]))
tabLayout.addTab(tabLayout.newTab().setText(fragment.getString(R.string.review)).setIcon(tabIcons[3]))
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL)
tabLayout.setupWithViewPager(viewPager)
tabLayout.getTabAt(0)!!.setText(fragment.getString(R.string.overview)).setIcon(tabIcons[0])
tabLayout.getTabAt(1)!!.setText(fragment.getString(R.string.play)).setIcon(tabIcons[1])
tabLayout.getTabAt(2)!!.setText(fragment.getString(R.string.train)).setIcon(tabIcons[2])
tabLayout.getTabAt(3)!!.setText(fragment.getString(R.string.review)).setIcon(tabIcons[3])
}
}
24 changes: 12 additions & 12 deletions app/src/main/java/org/oppia/app/topic/ViewPagerAdapter.kt
Original file line number Diff line number Diff line change
@@ -17,24 +17,24 @@ class ViewPagerAdapter(fm: FragmentManager, private val numOfTabs: Int, private
args.putString(TOPIC_ACTIVITY_TOPIC_ID_ARGUMENT_KEY, topicId)
when (position) {
0 -> {
val tab1 = TopicOverviewFragment()
tab1.arguments = args
return tab1
val topicOverviewTab = TopicOverviewFragment()
topicOverviewTab.arguments = args
return topicOverviewTab
}
1 -> {
val tab2 = TopicPlayFragment()
tab2.arguments = args
return tab2
val topicPlayTab = TopicPlayFragment()
topicPlayTab.arguments = args
return topicPlayTab
}
2 -> {
val tab3 = TopicTrainFragment()
tab3.arguments = args
return tab3
val topicTrainTab = TopicTrainFragment()
topicTrainTab.arguments = args
return topicTrainTab
}
3 -> {
val tab4 = TopicReviewFragment()
tab4.arguments = args
return tab4
val topicReviewTab = TopicReviewFragment()
topicReviewTab.arguments = args
return topicReviewTab
}
else -> return null
}
19 changes: 12 additions & 7 deletions app/src/main/res/layout/topic_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintBottom_toTopOf="@+id/viewpager"
app:layout_constraintBottom_toTopOf="@+id/topic_tabs_viewpager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:title="Topic"/>
app:title="Topic" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:id="@+id/topic_tabs_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabBackground="@color/colorPrimary"
app:tabGravity="fill"
app:tabIndicatorColor="@android:color/white"
app:tabIndicatorHeight="2dp"
app:tabMode="fixed"
app:tabTextColor="@android:color/white"/>
app:tabTextColor="@android:color/white" />
</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:id="@+id/topic_tabs_viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout"/>
app:layout_constraintTop_toBottomOf="@+id/appBarLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
12 changes: 7 additions & 5 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="OppiaTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>

<style name="OppiaThemeWithoutActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="SplashScreenTheme" parent="OppiaThemeWithoutActionBar">
<item name="android:windowBackground">@drawable/splash_page</item>
<item name="android:windowAnimationStyle">@style/FadeTransitionAnimation.Activity</item>
</style>
<!-- Base style for animations. This style specifies no animations. -->
<style name="FadeTransitionAnimation"/>
<style name="FadeTransitionAnimation" />
<!-- Standard animations for a full-screen window or activity. -->
<style name="FadeTransitionAnimation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/fade_in</item>
<item name="android:activityOpenExitAnimation">@anim/fade_out</item>
</style>

<style name="FullScreenDialogStyle" parent="Theme.AppCompat.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="colorPrimaryDark">@color/colorConceptToolbarHeading</item>
@@ -33,10 +39,6 @@
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>
<style name="OppiaTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<!-- STATE BUTTON ACTIVE STYLE -->
<style name="StateButtonActive" parent="TextAppearance.AppCompat.Widget.Button">
<item name="android:layout_width">wrap_content</item>
53 changes: 50 additions & 3 deletions app/src/sharedTest/java/org/oppia/app/topic/TopicActivityTest.kt
Original file line number Diff line number Diff line change
@@ -2,20 +2,35 @@ package org.oppia.app.topic

import android.app.Application
import android.content.Context
import android.content.res.Configuration
import androidx.annotation.UiThread
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import dagger.BindsInstance
import dagger.Component
import dagger.Module
import dagger.Provides
import kotlinx.coroutines.CoroutineDispatcher
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.Matchers.containsString
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.app.R
import org.oppia.app.home.HomeActivity
import org.oppia.app.recyclerview.RecyclerViewMatcher.Companion.atPosition
import org.oppia.util.threading.BackgroundDispatcher
import org.oppia.util.threading.BlockingDispatcher
import javax.inject.Singleton
@@ -25,9 +40,41 @@ import javax.inject.Singleton
class TopicActivityTest {

@Test
fun testTopicActivity_loadTopicFragment_hasDummyString() {
ActivityScenario.launch(TopicActivity::class.java).use {
onView(withId(R.id.dummy_text_view)).check(matches(withText("This is dummy TextView for testing")))
fun testTopicActivity_clickDummyButton_showsTopicAcitvityWithMultipleTabs_isTabLayoutDisplayed() {
ActivityScenario.launch(HomeActivity::class.java).use {
onView(withId(R.id.topic_button)).perform(click())
onView(withId(R.id.topic_tabs_container)).perform(click()).check(matches(isDisplayed()))
}
}

@Test
fun testTopicActivity_swipePage_hasSwipedPage() {
ActivityScenario.launch(HomeActivity::class.java).use {
onView(withId(R.id.topic_button)).perform(click())
onView(withId(R.id.topic_tabs_viewpager)).check(matches(isDisplayed()))
onView(withId(R.id.topic_tabs_viewpager)).perform(ViewActions.swipeLeft())
}
}

@Test
@UiThread
fun testTopicActivity_clickOnTabs_isTabSwitchAndContentMatched() {
ActivityScenario.launch(HomeActivity::class.java).use {
onView(withId(R.id.topic_button)).perform(click())
onView(
allOf(
withText("PLAY"),
isDescendantOfA(withId(R.id.topic_tabs_container))
)
).perform(click())
onView(withText("First Story")).check(matches(isDisplayed()))
onView(
allOf(
withText("TRAIN"),
isDescendantOfA(withId(R.id.topic_tabs_container))
)
).perform(click())
onView(withText("Master These Skills")).check(matches(isDisplayed()))
}
}