Skip to content

Commit c61252a

Browse files
committed
Initial public version
0 parents  commit c61252a

File tree

89 files changed

+17552
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+17552
-0
lines changed

.buckconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

.eslintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
'no-bitwise': ["error", { "int32Hint": true }],
5+
};

.flowconfig

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
10+
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
14+
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
17+
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
20+
21+
[include]
22+
23+
[libs]
24+
node_modules/react-native/interface.js
25+
node_modules/react-native/flow/
26+
27+
[options]
28+
emoji=true
29+
30+
esproposal.optional_chaining=enable
31+
esproposal.nullish_coalescing=enable
32+
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
36+
37+
munge_underscores=true
38+
39+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
40+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
41+
42+
suppress_type=$FlowIssue
43+
suppress_type=$FlowFixMe
44+
suppress_type=$FlowFixMeProps
45+
suppress_type=$FlowFixMeState
46+
47+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
50+
51+
[lints]
52+
sketchy-null-number=warn
53+
sketchy-null-mixed=warn
54+
sketchy-number=warn
55+
untyped-type-import=warn
56+
nonstrict-import=warn
57+
deprecated-type=warn
58+
unsafe-getters-setters=warn
59+
unnecessary-invariant=warn
60+
signature-verification-failure=warn
61+
deprecated-utility=error
62+
63+
[strict]
64+
deprecated-type
65+
nonstrict-import
66+
sketchy-null
67+
unclear-type
68+
unsafe-getters-setters
69+
untyped-import
70+
untyped-type-import
71+
72+
[version]
73+
^0.122.0

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

.gitignore

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
24+
# Android/IntelliJ
25+
#
26+
build/
27+
.idea
28+
.gradle
29+
local.properties
30+
*.iml
31+
32+
# node.js
33+
#
34+
node_modules/
35+
npm-debug.log
36+
yarn-error.log
37+
38+
# BUCK
39+
buck-out/
40+
\.buckd/
41+
*.keystore
42+
!debug.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/

.prettierrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
tabWidth: 4,
7+
endOfLine: 'auto'
8+
};

.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 pappnu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Random List Picker
2+
3+
React Native Android application for picking random names from lists.
4+
5+
## Functionality
6+
7+
The app let's you construct lists, which can include names and other lists. Random picking can be done from any list. Randomization settings can be specified on a list by list basis. If a list includes another list and the other list gets picked by randomization, the random picking is also done on the picked list using that list's settings, unless otherwise specified.
8+
9+
Other included features are:
10+
11+
- Weight lists and items
12+
- Include/exclude lists and items from randomization
13+
- Edit lists and items by long pressing
14+
- Import (JSON/TXT) and export (JSON) lists and items
15+
- Export (JSON/TXT) randomization results
16+
- Look at previous randomization results
17+
18+
## Randomization settings
19+
20+
The randomization can be customized using the following settings:
21+
22+
### Number of items to pick
23+
24+
&nbsp;&nbsp;&nbsp;&nbsp; How many items and/or lists are picked from the list.
25+
26+
### Number of items is a recursive limit
27+
28+
&nbsp;&nbsp;&nbsp;&nbsp; Specifies, if the previous limit should apply to sublists also.
29+
30+
### Pick unique names
31+
32+
&nbsp;&nbsp;&nbsp;&nbsp; Prevents picking multiple identical names. Doesn't differentiate between lists and items.
33+
34+
### Pick unique recursively
35+
36+
&nbsp;&nbsp;&nbsp;&nbsp; Specifies, if the previous setting should apply to sublists also. Applies only when pick unique items is also set.
37+
38+
### Combine sublists
39+
40+
&nbsp;&nbsp;&nbsp;&nbsp; When randomizing, items and lists in lists one level down are considered to be part of the current list.
41+
42+
### Combine sublists recursively
43+
44+
&nbsp;&nbsp;&nbsp;&nbsp; When randomizing, items in all sublists are considered to be part of the current list. Applies only when combine sublists is also set.
45+
46+
### Ignore empty lists
47+
48+
&nbsp;&nbsp;&nbsp;&nbsp; Empty lists won't be picked. List with only unactive
49+
items counts as empty.
50+
51+
### Ignore empty lists recursively
52+
53+
&nbsp;&nbsp;&nbsp;&nbsp; Specifies, if the previous setting should apply to sublists also. Applies only when ignore empty lists is also set.
54+
55+
### Ignore weights
56+
57+
&nbsp;&nbsp;&nbsp;&nbsp; Doesn't apply weighting.
58+
59+
### Ignore weights recursively
60+
61+
&nbsp;&nbsp;&nbsp;&nbsp; Specifies, if the previous setting should apply to sublists also. Applies only when ignore weights is also set.
62+
63+
### Deactivate picked items
64+
65+
&nbsp;&nbsp;&nbsp;&nbsp; Deactivates items (not lists) that get random picked.
66+
67+
## Importing and exporting
68+
69+
Imported text files are assumed to include names separated by line breaks. All names from a text file are added as items.
70+
71+
Imported JSON objects have to include a "name" key. If a JSON object also has an "items" key, it will be added as a list. Otherwise the JSON object will be added as an item. An example of a valid JSON with all supported keys included is available below:
72+
73+
```
74+
[{
75+
"name": "Name of list",
76+
"active": true,
77+
"weight": 1,
78+
"numToPick": 10,
79+
"numToPickRecursive": false,
80+
"pickUnique": false,
81+
"pickUniqueRecursive": false,
82+
"combineLists": false,
83+
"combineListsRecursive": false,
84+
"deactivateAfterRandomization": false,
85+
"ignoreEmptyLists": true,
86+
"ignoreEmptyListsRecursive": false,
87+
"ignoreWeights": false,
88+
"ignoreWeightsRecursive": false,
89+
"items": [{
90+
"name": "Name of sublist",
91+
"active": true,
92+
"weight": 1,
93+
"numToPick": 10,
94+
"numToPickRecursive": false,
95+
"pickUnique": false,
96+
"pickUniqueRecursive": false,
97+
"combineLists": false,
98+
"combineListsRecursive": false,
99+
"deactivateAfterRandomization": false,
100+
"ignoreEmptyLists": true,
101+
"ignoreEmptyListsRecursive": true,
102+
"ignoreWeights": false,
103+
"ignoreWeightsRecursive": false,
104+
"items": [{
105+
"name": "Name of sublist item 1",
106+
"active": true,
107+
"weight": 1
108+
}, {
109+
"name": "Name of sublist item 2",
110+
"active": true,
111+
"weight": 1
112+
}]
113+
},
114+
{
115+
"name": "Name of list item",
116+
"active": true,
117+
"weight": 1
118+
}]
119+
}]
120+
```
121+
122+
## Development environment
123+
124+
Requires React Native: <https://reactnative.dev/docs/environment-setup>.
125+
126+
1. Clone this repository.
127+
2. In the cloned repository run `npm install`.
128+
129+
Before building a release android app, configure the release key: <https://reactnative.dev/docs/signed-apk-android>.
130+
131+
## Credits
132+
133+
An [icon](https://www.flaticon.com/free-icon/dice_250752) made by [Retinaicons](https://www.flaticon.com/authors/retinaicons) from [Flaticon](https://www.flaticon.com/) is used in the app's icon.
134+
135+
## License
136+
137+
MIT.

__tests__/App-test.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

android/app/_BUCK

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
13+
lib_deps = []
14+
15+
create_aar_targets(glob(["libs/*.aar"]))
16+
17+
create_jar_targets(glob(["libs/*.jar"]))
18+
19+
android_library(
20+
name = "all-libs",
21+
exported_deps = lib_deps,
22+
)
23+
24+
android_library(
25+
name = "app-code",
26+
srcs = glob([
27+
"src/main/java/**/*.java",
28+
]),
29+
deps = [
30+
":all-libs",
31+
":build_config",
32+
":res",
33+
],
34+
)
35+
36+
android_build_config(
37+
name = "build_config",
38+
package = "com.randomlistpicker",
39+
)
40+
41+
android_resource(
42+
name = "res",
43+
package = "com.randomlistpicker",
44+
res = "src/main/res",
45+
)
46+
47+
android_binary(
48+
name = "app",
49+
keystore = "//android/keystores:debug",
50+
manifest = "src/main/AndroidManifest.xml",
51+
package_type = "debug",
52+
deps = [
53+
":app-code",
54+
],
55+
)

0 commit comments

Comments
 (0)