This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
forked from openintents/filemanager
-
Notifications
You must be signed in to change notification settings - Fork 44
Show number of items #83
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
491424c
Add String literals for directory items
pavlospt 1e232b2
Add getNumberOfItems() on FileHolder
pavlospt 4817b75
Use FileHolder.getNumberOfItems() to display # of directory items
pavlospt 75daff3
Fix formatting
pavlospt f51ace2
Add tests for # of items in a directory
pavlospt 2a6261d
Fixed issues from PR feedback
pavlospt 4642109
Format SeesAssertions
183a37b
Prepare for merge
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 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
This file contains 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
39 changes: 39 additions & 0 deletions
39
app/src/androidTest/java/com/veniosg/dir/test/matcher/FileHolderHasSizeInfo.java
This file contains 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,39 @@ | ||
package com.veniosg.dir.test.matcher; | ||
|
||
import android.support.test.InstrumentationRegistry; | ||
import com.veniosg.dir.mvvm.model.FileHolder; | ||
import org.hamcrest.Factory; | ||
import org.hamcrest.FeatureMatcher; | ||
import org.hamcrest.Matcher; | ||
|
||
import static android.support.test.InstrumentationRegistry.getTargetContext; | ||
import static org.hamcrest.core.IsEqual.equalTo; | ||
|
||
public class FileHolderHasSizeInfo<T> extends FeatureMatcher<T, String> { | ||
private FileHolderHasSizeInfo(Matcher<? super String> hasFileHolderMatcher) { | ||
super(hasFileHolderMatcher, "with getSizeInfo()", "getSizeInfo()"); | ||
} | ||
|
||
@Override | ||
protected String featureValueOf(T actual) { | ||
if (actual instanceof FileHolder) { | ||
return ((FileHolder) actual).getSizeInfo(getTargetContext()); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
/** | ||
* Creates a matcher that matches any examined object whose <code>toString</code> method | ||
* returns a value equalTo the specified string. | ||
* <p/> | ||
* For example: | ||
* <pre>assertThat(true, hasToString("TRUE"))</pre> | ||
* | ||
* @param expectedSizeInfo the expected toString result | ||
*/ | ||
@Factory | ||
public static <T> Matcher<T> hasSizeInfo(String expectedSizeInfo) { | ||
return new FileHolderHasSizeInfo<>(equalTo(expectedSizeInfo)); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<plurals name="num_of_directory_items" translatable="false"> | ||
<item quantity="zero">@string/zero_items</item> | ||
<item quantity="one">@string/one_item</item> | ||
<item quantity="other">@string/more_items</item> | ||
</plurals> | ||
</resources> |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this file but point to strings in strings.xml. If it's allowed, this should be marked as
translatable=false
.e.g.
<item quantity="zero">@string/no_items</item>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!