Skip to content

Commit

Permalink
Merge branch 'develop' into deprecate-mailinglist
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHenning authored Dec 27, 2024
2 parents addf06e + adcfefd commit e70946a
Show file tree
Hide file tree
Showing 62 changed files with 626 additions and 400 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -325,7 +325,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -459,7 +459,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -580,7 +580,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v2
- uses: actions/cache@v4
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v2
- uses: actions/cache@v4
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
id: test_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -285,7 +285,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v2
- uses: actions/cache@v4
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache
with:
path: ~/.gradle
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-jars-{{ checksum "build.gradle" }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v2
- uses: actions/cache@v4
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
if: ${{ steps.track_commits.outputs.new_commits == 'true' }}
id: cache
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v2
- uses: actions/cache@v4
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v2
- uses: actions/cache@v4
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v2
- uses: actions/cache@v4
id: test_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Deploy to Wiki

on:
pull_request:
paths:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ class ClassroomListActivity :
)
}

override fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String) {
override fun routeToTopic(profileId: ProfileId, classroomId: String, topicId: String) {
startActivity(
createTopicActivityIntent(this, internalProfileId, classroomId, topicId)
createTopicActivityIntent(this, profileId, classroomId, topicId)
)
}

override fun routeToTopicPlayStory(
internalProfileId: Int,
profileId: ProfileId,
classroomId: String,
topicId: String,
storyId: String
) {
startActivity(
createTopicPlayStoryActivityIntent(
this,
internalProfileId,
profileId,
classroomId,
topicId,
storyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class ClassroomListFragmentPresenter @Inject constructor(
/** Routes to the play story view for the first story in the given topic summary. */
fun onTopicSummaryClicked(topicSummary: TopicSummary) {
routeToTopicPlayStoryListener.routeToTopicPlayStory(
profileId.internalId,
profileId,
topicSummary.classroomId,
topicSummary.topicId,
topicSummary.firstStoryId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.oppia.android.app.completedstorylist
import androidx.appcompat.app.AppCompatActivity
import org.oppia.android.app.home.RouteToTopicPlayStoryListener
import org.oppia.android.app.model.CompletedStory
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.shim.IntentFactoryShim
import org.oppia.android.app.viewmodel.ObservableViewModel
import org.oppia.android.domain.translation.TranslationController
Expand Down Expand Up @@ -32,22 +33,22 @@ class CompletedStoryItemViewModel(
/** Called when user clicks on CompletedStoryItem. */
fun onCompletedStoryItemClicked() {
routeToTopicPlayStory(
internalProfileId,
ProfileId.newBuilder().setInternalId(internalProfileId).build(),
completedStory.classroomId,
completedStory.topicId,
completedStory.storyId
)
}

override fun routeToTopicPlayStory(
internalProfileId: Int,
profileId: ProfileId,
classroomId: String,
topicId: String,
storyId: String
) {
val intent = intentFactoryShim.createTopicPlayStoryActivityIntent(
activity.applicationContext,
internalProfileId,
profileId.internalId,
classroomId,
topicId,
storyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void setLayoutMarginStart(@NonNull View view, float marginStart) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
MarginLayoutParamsCompat.setMarginStart(params, (int) marginStart);
view.requestLayout();
view.setLayoutParams(params);
}
}

Expand All @@ -25,7 +25,7 @@ public static void setLayoutMarginEnd(@NonNull View view, float marginEnd) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
MarginLayoutParamsCompat.setMarginEnd(params, (int) marginEnd);
view.requestLayout();
view.setLayoutParams(params);
}
}

Expand All @@ -36,7 +36,6 @@ public static void setLayoutMarginTop(@NonNull View view, float marginTop) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
params.topMargin = (int) marginTop;
view.setLayoutParams(params);
view.requestLayout();
}
}

Expand All @@ -47,22 +46,6 @@ public static void setLayoutMarginBottom(@NonNull View view, float marginBottom)
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
params.bottomMargin = (int) marginBottom;
view.setLayoutParams(params);
view.requestLayout();
}
}

/** Used to set a margin for views. */
@BindingAdapter("layoutMargin")
public static void setLayoutMargin(@NonNull View view, float margin) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
params.setMargins(
(int) margin,
(int) margin,
(int) margin,
(int) margin
);
view.requestLayout();
}
}
}
8 changes: 4 additions & 4 deletions app/src/main/java/org/oppia/android/app/home/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ class HomeActivity :
title = resourceHandler.getStringInLocale(R.string.home_activity_title)
}

override fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String) {
override fun routeToTopic(profileId: ProfileId, classroomId: String, topicId: String) {
startActivity(
TopicActivity.createTopicActivityIntent(this, internalProfileId, classroomId, topicId)
TopicActivity.createTopicActivityIntent(this, profileId, classroomId, topicId)
)
}

override fun routeToTopicPlayStory(
internalProfileId: Int,
profileId: ProfileId,
classroomId: String,
topicId: String,
storyId: String
) {
startActivity(
TopicActivity.createTopicPlayStoryActivityIntent(
this,
internalProfileId,
profileId,
classroomId,
topicId,
storyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class HomeFragmentPresenter @Inject constructor(

fun onTopicSummaryClicked(topicSummary: TopicSummary) {
routeToTopicPlayStoryListener.routeToTopicPlayStory(
internalProfileId,
ProfileId.newBuilder().setInternalId(internalProfileId).build(),
topicSummary.classroomId,
topicSummary.topicId,
topicSummary.firstStoryId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.oppia.android.app.home

import org.oppia.android.app.model.ProfileId

/** Listener for when an activity should route to a topic. */
interface RouteToTopicListener {
fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String)
fun routeToTopic(profileId: ProfileId, classroomId: String, topicId: String)
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.oppia.android.app.home

import org.oppia.android.app.model.ProfileId

/** Listener for when an activity should route to a story-item in TopicPlay tab. */
interface RouteToTopicPlayStoryListener {
fun routeToTopicPlayStory(
internalProfileId: Int,
profileId: ProfileId,
classroomId: String,
topicId: String,
storyId: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModel
import org.oppia.android.R
import org.oppia.android.app.home.RouteToTopicPlayStoryListener
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.PromotedStory
import org.oppia.android.app.viewmodel.ObservableViewModel
import org.oppia.android.domain.translation.TranslationController
Expand Down Expand Up @@ -62,7 +63,7 @@ class PromotedStoryViewModel(

fun clickOnStoryTile() {
routeToTopicPlayStoryListener.routeToTopicPlayStory(
internalProfileId,
ProfileId.newBuilder().setInternalId(internalProfileId).build(),
promotedStory.classroomId,
promotedStory.topicId,
promotedStory.storyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.lifecycle.ViewModel
import org.oppia.android.R
import org.oppia.android.app.home.RouteToTopicListener
import org.oppia.android.app.model.EphemeralTopic
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.shim.IntentFactoryShim
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.viewmodel.ObservableViewModel
Expand All @@ -27,7 +28,11 @@ class OngoingTopicItemViewModel(
}

fun onTopicItemClicked() {
routeToTopic(internalProfileId, topic.classroomId, topic.topicId)
routeToTopic(
profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build(),
classroomId = topic.classroomId,
topicId = topic.topicId
)
}

fun computeStoryCountText(): String {
Expand All @@ -36,7 +41,7 @@ class OngoingTopicItemViewModel(
)
}

override fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String) {
override fun routeToTopic(profileId: ProfileId, classroomId: String, topicId: String) {
val intent = intentFactoryShim.createTopicActivityIntent(
activity.applicationContext,
internalProfileId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class ExplorationActivityPresenter @Inject constructor(
activity.startActivity(
TopicActivity.createTopicActivityIntent(
context,
profileId.internalId,
profileId,
classroomId,
topicId
)
Expand Down
Loading

0 comments on commit e70946a

Please sign in to comment.