-
Notifications
You must be signed in to change notification settings - Fork 0
Merge develop into master #6
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
Open
dogtim
wants to merge
35
commits into
master
Choose a base branch
from
develop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
d3a31d9
Reduce warnings
dogtim 5cf1212
Practice the Koin component
dogtim 8539ae0
Refinement
dogtim 1d2670f
Add the use case of the View Stub
dogtim 6822db6
Merge commit '1d2670ffae032bdfd9ecc47cc8525deff37def87' into viewstub
dogtim 091f0b3
Merge pull request #5 from dogtim/viewstub
dogtim 01daa06
Fix app crash problem
dogtim 3300796
Fix unit test compile problem
dogtim 2071dec
Add unit test for "equal"
dogtim 7093823
Compare the "class" and "data"
dogtim 90c4d07
Create TabLayout for fun
dogtim e21f9d8
Create TabLayout for fun
dogtim 30de3fb
Create TabLayout for fun
dogtim 9637d12
Practice the parcelable
dogtim dbc2c28
Create codeball
dogtim 75f6433
Update codeball.yml
dogtim c71b43e
Export to video by a bitmap
dogtim 9e07efd
Make the bitmap scale to the mp4 setting
dogtim cb9f79c
Draw different bitmaps into video
dogtim 4e1de35
Clear previous frame by
dogtim 1b9d6d2
Move codes to view model
dogtim 681b0a0
Give State for showing the loading progress indicator
dogtim 3ebc94e
Rename Animation stuff to media
dogtim 4c406f5
Rename
dogtim b4ddfd5
Finish the espresso to test the ui result
dogtim ad22d70
Refine testing codes
dogtim 094c553
Create a testing application which we can inject the model we want to
dogtim 55a7513
Refine codes
dogtim ac176e1
Reorganize the codes
dogtim eecf888
Provide compose activity
dogtim 372f0c1
Integrate the preview function
dogtim d6e7102
Refine codes
dogtim adb5f51
Import the Flow for practicing
dogtim 7c14999
Update settings
dogtim afca790
temp
dogtim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Codeball | ||
| on: | ||
| pull_request: {} | ||
| pull_request_review_comment: | ||
| types: [created, edited] | ||
|
|
||
| jobs: | ||
| codeball_job: | ||
| runs-on: ubuntu-latest | ||
| name: Codeball | ||
| steps: | ||
| # Run Codeball on all new Pull Requests and Review Comments! 🚀 | ||
| # For customizations and more documentation, see https://github.com/sturdy-dev/codeball-action | ||
| - name: Codeball | ||
| uses: sturdy-dev/codeball-action@v2 | ||
| with: | ||
| approvePullRequests: "true" | ||
| labelPullRequestsWhenApproved: "true" | ||
| labelPullRequestsWhenReviewNeeded: "false" | ||
| failJobsWhenReviewNeeded: "false" | ||
| codeSuggestionsFromComments: "true" | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/src/androidTest/java/com/example/associate/training/MediaActivityTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package com.example.associate.training | ||
|
|
||
| import android.view.View | ||
| import androidx.test.espresso.Espresso.onView | ||
| import androidx.test.espresso.action.ViewActions.click | ||
| import androidx.test.espresso.assertion.ViewAssertions.matches | ||
| import androidx.test.espresso.matcher.ViewMatchers.* | ||
| import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
| import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
| import com.example.associate.training.media.MediaActivity | ||
| import com.google.android.material.progressindicator.CircularProgressIndicator | ||
| import org.hamcrest.Description | ||
| import org.hamcrest.Matchers.allOf | ||
| import org.hamcrest.TypeSafeMatcher | ||
| import org.junit.Assert.* | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
|
|
||
| @RunWith(AndroidJUnit4::class) | ||
| class MediaActivityTest { | ||
|
|
||
| @get:Rule | ||
| val activity = ActivityScenarioRule(MediaActivity::class.java) | ||
|
|
||
| @Test | ||
| fun testEncoding() { | ||
|
|
||
| val startTime = System.currentTimeMillis() | ||
| var clicked = false | ||
| val progressIndicator = onView(withId(R.id.progress_indicator)) | ||
| val button = onView(withId(R.id.export_to_video)) | ||
| while (!clicked && System.currentTimeMillis() - startTime < 10000) { | ||
| try { | ||
| button.check(matches(allOf(isClickable(), isDisplayed()))) | ||
| button.perform(click()) | ||
| // We need to wait for the progress indicator to be displayed because sometimes performing click is not working | ||
| progressIndicator.check(matches(object : TypeSafeMatcher<View>() { | ||
| override fun describeTo(description: Description?) { | ||
| description?.appendText("Indeterminate progress bar") | ||
| } | ||
|
|
||
| override fun matchesSafely(item: View?): Boolean { | ||
| return item is CircularProgressIndicator && item.isIndeterminate | ||
| } | ||
| })) | ||
| clicked = true | ||
| } catch (e: Throwable) { | ||
| Thread.sleep(100) | ||
| } | ||
| } | ||
|
|
||
| Thread.sleep(10000) // Wait for encoding to complete (adjust time as needed) | ||
|
|
||
| // Verify that the "Complete" Toast is displayed | ||
| onView(withId(R.id.content)).check(matches(withText("Complete"))) | ||
|
|
||
| } | ||
|
|
||
| } |
95 changes: 95 additions & 0 deletions
95
app/src/androidTest/java/com/example/associate/training/ParcelableTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package com.example.associate.training | ||
|
|
||
| import android.os.Parcel | ||
| import android.os.Parcelable | ||
| import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
| import org.junit.Assert.* | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
|
|
||
| /** | ||
| * To have a custom model object which implements the interface Parcelable in order to pass objects between components | ||
| * (activities, fragments, services, etc…) | ||
| * See [medium](https://medium.com/@dbottillo/android-junit-parcelable-model-test-37a2f2ae18b1). | ||
| */ | ||
| @RunWith(AndroidJUnit4::class) | ||
| class ParcelableTest { | ||
|
|
||
| @Test | ||
| fun object_equal() { | ||
| val book = Book("author", "title") | ||
|
|
||
| val parcel = Parcel.obtain() | ||
| book.writeToParcel(parcel, book.describeContents()) | ||
| parcel.setDataPosition(0) | ||
|
|
||
| val createdFromParcel = Book.createFromParcel(parcel) | ||
| assertEquals("author", createdFromParcel.author) | ||
| assertEquals("title", createdFromParcel.title) | ||
| } | ||
|
|
||
| @Test | ||
| fun test_subclass() { | ||
| val book = SubBook("author", "title", true) | ||
|
|
||
| val parcel = Parcel.obtain() | ||
| book.writeToParcel(parcel, book.describeContents()) | ||
| parcel.setDataPosition(0) | ||
|
|
||
| val createdFromParcel = SubBook.createFromParcel(parcel) | ||
| assertEquals("author", createdFromParcel.author) | ||
| assertEquals("title", createdFromParcel.title) | ||
| assertEquals(true, createdFromParcel.isAdult) | ||
| } | ||
| } | ||
|
|
||
| open class Book : Parcelable { | ||
| val author: String | ||
| val title: String | ||
|
|
||
| constructor(author: String, title: String) { | ||
| this.author = author | ||
| this.title = title | ||
| } | ||
|
|
||
| constructor(`in`: Parcel) { | ||
| author = `in`.readString().toString() | ||
| title = `in`.readString().toString() | ||
| } | ||
|
|
||
| override fun describeContents(): Int { | ||
| return 0 | ||
| } | ||
|
|
||
| override fun writeToParcel(dest: Parcel, flags: Int) { | ||
| dest.writeString(author) | ||
| dest.writeString(title) | ||
| } | ||
|
|
||
| companion object CREATOR : Parcelable.Creator<Book> { | ||
| override fun createFromParcel(parcel: Parcel) = Book(parcel) | ||
| override fun newArray(size: Int): Array<Book?> = arrayOfNulls(size) | ||
| } | ||
| } | ||
|
|
||
| class SubBook : Book { | ||
| var isAdult: Boolean = false | ||
|
|
||
| constructor(author: String, title: String, isAdult: Boolean) : super(author, title) { | ||
| this.isAdult = isAdult | ||
| } | ||
|
|
||
| constructor(`in`: Parcel) : super(`in`) { | ||
| isAdult = `in`.readBoolean() | ||
| } | ||
|
|
||
| override fun writeToParcel(dest: Parcel, flags: Int) { | ||
| super.writeToParcel(dest, flags) | ||
| dest.writeBoolean(isAdult) | ||
| } | ||
|
|
||
| companion object CREATOR : Parcelable.Creator<SubBook> { | ||
| override fun createFromParcel(parcel: Parcel) = SubBook(parcel) | ||
| override fun newArray(size: Int): Array<SubBook?> = arrayOfNulls(size) | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
app/src/androidTest/java/com/example/associate/training/core/InstrumentationTestRunner.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.example.associate.training.core | ||
|
|
||
| import android.app.Application | ||
| import android.content.Context | ||
| import androidx.test.runner.AndroidJUnitRunner | ||
|
|
||
| class InstrumentationTestRunner : AndroidJUnitRunner() { | ||
| override fun newApplication( | ||
| classLoader: ClassLoader?, | ||
| className: String?, | ||
| context: Context? | ||
| ): Application { | ||
| return super.newApplication(classLoader, TestApplication::class.java.name, context) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.