├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── patryk1007
│ │ └── example
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── patryk1007
│ │ │ └── example
│ │ │ ├── Example2Activity.java
│ │ │ ├── Example3Activity.java
│ │ │ ├── ExampleActivity.java
│ │ │ ├── ExampleAlphaActivity.java
│ │ │ └── MenuActivity.java
│ └── res
│ │ ├── drawable
│ │ ├── charge_battery.png
│ │ ├── circle_with_shadow.png
│ │ ├── drop.png
│ │ ├── heart.png
│ │ ├── icone.png
│ │ ├── icone2.png
│ │ ├── icone3.png
│ │ └── mess.png
│ │ ├── layout
│ │ ├── activity_example.xml
│ │ ├── activity_example2.xml
│ │ ├── activity_example3.xml
│ │ ├── activity_example_alpha.xml
│ │ └── activity_menu.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── patryk1007
│ └── example
│ └── ExampleUnitTest.java
├── build.gradle
├── demo
├── demo1.gif
├── demo2.gif
├── demo3.gif
└── google_play.png
├── fillme_lib
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── CMakeLists.txt
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── patryk1007
│ │ └── fillme
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ │ └── native-lib.cpp
│ ├── java
│ │ └── com
│ │ │ └── patryk1007
│ │ │ └── fillme
│ │ │ ├── FillMe.java
│ │ │ ├── calculations
│ │ │ ├── AllShapesLinesCalculations.java
│ │ │ ├── ConvexLinesCalculation.java
│ │ │ ├── FloodFillLinesCalculationAsync.java
│ │ │ ├── FloodFillLinesCalculationSync.java
│ │ │ └── LinesCalculation.java
│ │ │ ├── enums
│ │ │ └── FillMode.java
│ │ │ ├── listeners
│ │ │ ├── OnFillChangeListener.java
│ │ │ └── OnFillLineCalculationListener.java
│ │ │ └── models
│ │ │ └── FillLine.java
│ └── res
│ │ └── values
│ │ ├── attrs.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── patryk1007
│ └── fillme
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FillMe
2 | We are very pleased to present FillMe, the library to fill literally every shape with color.
3 |
4 | Enjoy! :)
5 |
6 |  
7 |
8 | ### Try now
9 |
10 | [](https://play.google.com/store/apps/details?id=com.patryk1007.fillme)
11 |
12 | # Usage
13 |
14 | Add the FillMe view the same way like other Android views.
15 |
16 | ```xml
17 |
29 |
30 | ```
31 | # Download
32 |
33 | compile 'com.patryk1007:fillme_lib:1.0'
34 |
35 |
36 | # Attributes
37 |
38 |
39 | | attr | description |Default
40 | |:---|:---|:---|
41 | | fmImage | set drawable resource id, e.g. app:fmImage="@drawable/my_super_image" |-|
42 | | fmAlphaLevel | the view detects a shape's lines by checking alpha color, manage this value if your shape has shadows, range: 0-255 | 122 |
43 | | fmFillHorizontalPercent | set the horizontal fill in percents, range: 0-1| 0 |
44 | | fmFillVerticalPercent | set the vertical fill, in percents, range: 0-1| 0 |
45 | | fmFillByTouch | set changing fill percent by touch image, values: none; horizontal; vertical; both; | none |
46 | | fmConvexFigure | set true if shape is convex| true |
47 | | fmAsyncCalculation | if the image is big - calculation takes time, set the value to true to avoid problems with stop the main thread ( used only if shape is concave)| true |
48 | | fmFillColour | set a fill color as int value| #00ff00 |
49 |
50 | # LICENSE
51 |
52 | ```
53 | Copyright (C) 2018 patryk1007
54 |
55 | Licensed under the Apache License, Version 2.0 (the "License");
56 | you may not use this file except in compliance with the License.
57 | You may obtain a copy of the License at
58 |
59 | http://www.apache.org/licenses/LICENSE-2.0
60 |
61 | Unless required by applicable law or agreed to in writing, software
62 | distributed under the License is distributed on an "AS IS" BASIS,
63 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64 | See the License for the specific language governing permissions and
65 | limitations under the License.
66 | ```
67 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion '26.0.2'
6 | defaultConfig {
7 | applicationId "com.patryk1007.fillme"
8 | minSdkVersion 14
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.4.0'
28 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
29 | testCompile 'junit:junit:4.12'
30 | compile project(path: ':fillme_lib')
31 | }
32 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/patrykmolka/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/patryk1007/example/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.example;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.patryk1007.fillme", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/patryk1007/example/Example2Activity.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.example;
2 |
3 | import android.graphics.BitmapFactory;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.widget.CheckBox;
7 | import android.widget.CompoundButton;
8 |
9 | import com.patryk1007.fillme.FillMe;
10 | import com.patryk1007.fillme.enums.FillMode;
11 |
12 | public class Example2Activity extends AppCompatActivity {
13 |
14 | CheckBox fillVertical;
15 | CheckBox fillHorizontal;
16 | FillMe fillMeView;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_example2);
22 | initView();
23 | }
24 |
25 | private void initView() {
26 | fillMeView = (FillMe) findViewById(R.id.fill_me_view);
27 | fillMeView.setConvexFigure(false);
28 | fillMeView.setFillMode(FillMode.BOTH);
29 | fillMeView.setFillPercentHorizontalAndVertical(1.0f, 1.0f);
30 | fillMeView.setImage(BitmapFactory.decodeResource(getResources(),
31 | R.drawable.mess));
32 |
33 | fillVertical = (CheckBox) findViewById(R.id.fill_vertical_checkbox);
34 | fillVertical.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
35 | @Override
36 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
37 | fillMeView.setFillMode(getMode());
38 | }
39 | });
40 |
41 | fillHorizontal = (CheckBox) findViewById(R.id.fill_horizontal_checkbox);
42 | fillHorizontal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
43 | @Override
44 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
45 | fillMeView.setFillMode(getMode());
46 | }
47 | });
48 |
49 | }
50 |
51 | private FillMode getMode() {
52 | if (fillVertical.isChecked() && fillHorizontal.isChecked()) {
53 | return FillMode.BOTH;
54 | }
55 | if (fillVertical.isChecked()) {
56 | return FillMode.VERTICAL;
57 | }
58 | if (fillHorizontal.isChecked()) {
59 | return FillMode.HORIZONTAL;
60 | }
61 | return FillMode.NONE;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/patryk1007/example/Example3Activity.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.example;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | public class Example3Activity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_example3);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/patryk1007/example/ExampleActivity.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.example;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.widget.SeekBar;
7 | import android.widget.TextView;
8 |
9 | import com.patryk1007.fillme.FillMe;
10 | import com.patryk1007.fillme.listeners.OnFillChangeListener;
11 |
12 | public class ExampleActivity extends AppCompatActivity {
13 |
14 | SeekBar fillVertical;
15 | SeekBar fillHorizontal;
16 | TextView fillVerticalInfo;
17 | TextView fillHorizontalInfo;
18 | FillMe fillMeView;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_example);
24 | initView();
25 | }
26 |
27 | private void initView() {
28 | fillHorizontalInfo = (TextView) findViewById(R.id.fill_horizontal_info);
29 | fillVerticalInfo = (TextView) findViewById(R.id.fill_vertical_info);
30 |
31 | fillMeView = (FillMe) findViewById(R.id.fill_me_view);
32 | fillMeView.setImageDrawableId(R.drawable.icone);
33 | fillMeView.setFillPercentHorizontalAndVertical(0, 0);
34 |
35 | fillMeView.setOnFillChangeListener(new OnFillChangeListener() {
36 | @Override
37 | public void onHorizontalValueChange(float fillPercent, int fillPx) {
38 | fillHorizontalInfo.setText(String.format(getString(R.string.fill_horizontal_info), String.valueOf(fillPercent), String.valueOf(fillPx)));
39 | }
40 |
41 | @Override
42 | public void onVerticalValueChange(float fillPercent, int fillPx) {
43 | fillVerticalInfo.setText(String.format(getString(R.string.fill_vertical_info), String.valueOf(fillPercent), String.valueOf(fillPx)));
44 | }
45 | });
46 |
47 | fillVertical = (SeekBar) findViewById(R.id.fill_vertical_percent);
48 | fillVertical.setMax(100);
49 | fillVertical.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
50 | @Override
51 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
52 | fillMeView.setFillPercentVertical(progress / 100.0f);
53 | }
54 |
55 | @Override
56 | public void onStartTrackingTouch(SeekBar seekBar) {
57 |
58 | }
59 |
60 | @Override
61 | public void onStopTrackingTouch(SeekBar seekBar) {
62 |
63 | }
64 | });
65 |
66 | fillHorizontal = (SeekBar) findViewById(R.id.fill_horizontal_percent);
67 | fillHorizontal.setMax(100);
68 | fillHorizontal.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
69 | @Override
70 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
71 | fillMeView.setFillPercentHorizontal(progress / 100.0f);
72 | }
73 |
74 | @Override
75 | public void onStartTrackingTouch(SeekBar seekBar) {
76 |
77 | }
78 |
79 | @Override
80 | public void onStopTrackingTouch(SeekBar seekBar) {
81 |
82 | }
83 | });
84 |
85 | findViewById(R.id.colour_blue).setOnClickListener(new View.OnClickListener() {
86 | @Override
87 | public void onClick(View v) {
88 | fillMeView.setFillColour(0xff0099cc);
89 | }
90 | });
91 |
92 | findViewById(R.id.colour_red).setOnClickListener(new View.OnClickListener() {
93 | @Override
94 | public void onClick(View v) {
95 | fillMeView.setFillColour(0xffff4444);
96 | }
97 | });
98 |
99 | findViewById(R.id.colour_green).setOnClickListener(new View.OnClickListener() {
100 | @Override
101 | public void onClick(View v) {
102 | fillMeView.setFillColour(0xff99cc00);
103 | }
104 | });
105 |
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/app/src/main/java/com/patryk1007/example/ExampleAlphaActivity.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.example;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.SeekBar;
6 | import android.widget.TextView;
7 |
8 | import com.patryk1007.fillme.FillMe;
9 |
10 | public class ExampleAlphaActivity extends AppCompatActivity {
11 |
12 | SeekBar fillHorizontal;
13 | TextView alphaLevelInfo;
14 | FillMe fillMeView;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_example_alpha);
20 | initView();
21 | }
22 |
23 | private void initView() {
24 | alphaLevelInfo = (TextView) findViewById(R.id.fill_horizontal_info);
25 |
26 | fillMeView = (FillMe) findViewById(R.id.fill_me_view);
27 | fillMeView.setImageDrawableId(R.drawable.circle_with_shadow);
28 |
29 | fillHorizontal = (SeekBar) findViewById(R.id.fill_horizontal_percent);
30 | fillHorizontal.setMax(255);
31 | fillHorizontal.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
32 | @Override
33 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
34 | fillMeView.setAlphaLevel(progress);
35 | alphaLevelInfo.setText(String.format(getString(R.string.fill_alpha_info), String.valueOf(progress)));
36 | }
37 |
38 | @Override
39 | public void onStartTrackingTouch(SeekBar seekBar) {
40 |
41 | }
42 |
43 | @Override
44 | public void onStopTrackingTouch(SeekBar seekBar) {
45 |
46 | }
47 | });
48 |
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/patryk1007/example/MenuActivity.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.example;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 |
9 | public class MenuActivity extends AppCompatActivity {
10 |
11 |
12 | @Override
13 | protected void onCreate(@Nullable Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_menu);
16 |
17 | findViewById(R.id.example1_button).setOnClickListener(new View.OnClickListener() {
18 | @Override
19 | public void onClick(View v) {
20 | startActivity(new Intent(MenuActivity.this, ExampleActivity.class));
21 | }
22 | });
23 |
24 | findViewById(R.id.example2_button).setOnClickListener(new View.OnClickListener() {
25 | @Override
26 | public void onClick(View v) {
27 | startActivity(new Intent(MenuActivity.this, Example2Activity.class));
28 | }
29 | });
30 |
31 | findViewById(R.id.example3_button).setOnClickListener(new View.OnClickListener() {
32 | @Override
33 | public void onClick(View v) {
34 | startActivity(new Intent(MenuActivity.this, Example3Activity.class));
35 | }
36 | });
37 | findViewById(R.id.example_alpha_button).setOnClickListener(new View.OnClickListener() {
38 | @Override
39 | public void onClick(View v) {
40 | startActivity(new Intent(MenuActivity.this, ExampleAlphaActivity.class));
41 | }
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/charge_battery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/charge_battery.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circle_with_shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/circle_with_shadow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/drop.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/heart.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/icone.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icone2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/icone2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icone3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/icone3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/mess.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/drawable/mess.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_example.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
28 |
29 |
36 |
37 |
42 |
43 |
48 |
49 |
55 |
56 |
62 |
63 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_example2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
25 |
26 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_example3.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
15 |
16 |
28 |
29 |
40 |
41 |
44 |
45 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_example_alpha.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
26 |
27 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FillMe
3 | Convex Figure
4 | Fill Vertical by touch
5 | Fill Horizontal by touch
6 | Vertical: %1$s%%, %2$spx
7 | Horizontal: %1$s%%, %2$spx
8 | Alpha: %1$s
9 |
10 | Example 1
11 | Example 2
12 | Example 3
13 | Example Alpha
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/patryk1007/example/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.example;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.1.51'
5 | repositories {
6 | jcenter()
7 | google()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | jcenter()
21 | google()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/demo/demo1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/demo/demo1.gif
--------------------------------------------------------------------------------
/demo/demo2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/demo/demo2.gif
--------------------------------------------------------------------------------
/demo/demo3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/demo/demo3.gif
--------------------------------------------------------------------------------
/demo/google_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/demo/google_play.png
--------------------------------------------------------------------------------
/fillme_lib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/fillme_lib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | compileSdkVersion 26
6 | buildToolsVersion '26.0.2'
7 |
8 | defaultConfig {
9 | minSdkVersion 14
10 | targetSdkVersion 26
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | externalNativeBuild {
24 | cmake {
25 | path 'src/CMakeLists.txt'
26 | }
27 | }
28 | }
29 |
30 | dependencies {
31 | compile fileTree(dir: 'libs', include: ['*.jar'])
32 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
33 | exclude group: 'com.android.support', module: 'support-annotations'
34 | })
35 | compile 'com.android.support:appcompat-v7:26.+'
36 | testCompile 'junit:junit:4.12'
37 | compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
38 | }
39 | repositories {
40 | mavenCentral()
41 | }
42 |
--------------------------------------------------------------------------------
/fillme_lib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/patrykmolka/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/fillme_lib/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Sets the minimum version of CMake required to build your native library.
2 | # This ensures that a certain set of CMake features is available to
3 | # your build.
4 |
5 | cmake_minimum_required(VERSION 3.4.1)
6 |
7 | # Specifies a library name, specifies whether the library is STATIC or
8 | # SHARED, and provides relative paths to the source code. You can
9 | # define multiple libraries by adding multiple add.library() commands,
10 | # and CMake builds them for you. When you build your app, Gradle
11 | # automatically packages shared libraries with your APK.
12 |
13 | add_library( # Specifies the name of the library.
14 | native-lib
15 |
16 | # Sets the library as a shared library.
17 | SHARED
18 |
19 | # Provides a relative path to your source file(s).
20 | main/cpp/native-lib.cpp )
--------------------------------------------------------------------------------
/fillme_lib/src/androidTest/java/com/patryk1007/fillme/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.patryk1007.fillme.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/cpp/native-lib.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | extern "C" {
4 | JNIEXPORT jbooleanArray JNICALL
5 | Java_com_patryk1007_fillme_calculations_AllShapesLinesCalculations_invokeNativeFunction(
6 | JNIEnv *env, jobject instance,
7 | jintArray inJNIArray, jint width, jint height, jint alphaLevel) {
8 |
9 | jint *pixels = env->GetIntArrayElements(inJNIArray, false);
10 | jsize pointsSize = width * height;
11 | jbooleanArray filledPointsObject = env->NewBooleanArray(pointsSize);
12 | jboolean *filledPoints = env->GetBooleanArrayElements(filledPointsObject, false);
13 |
14 | int currentItem = 0, lastFilledField = 0;
15 | int newPixIndex;
16 | int *checkPointsArray = new int[pointsSize];
17 |
18 | checkPointsArray[lastFilledField] = 0;
19 | jint currentPixIndex;
20 |
21 | do {
22 | currentPixIndex = checkPointsArray[currentItem];
23 | currentItem++;
24 | newPixIndex = currentPixIndex + 1;
25 |
26 | if (newPixIndex < pointsSize) {
27 | if (!filledPoints[newPixIndex]) {
28 | filledPoints[newPixIndex] = 1;
29 | if ((pixels[newPixIndex] >> 24 & 0xff) <= alphaLevel ||
30 | currentPixIndex < width) {
31 | lastFilledField++;
32 | checkPointsArray[lastFilledField] = newPixIndex;
33 | }
34 | }
35 |
36 | newPixIndex = currentPixIndex + width;
37 | if (newPixIndex < pointsSize) {
38 | if (!filledPoints[newPixIndex]) {
39 | filledPoints[newPixIndex] = 1;
40 | if ((pixels[newPixIndex] >> 24 & 0xff) <= alphaLevel ||
41 | currentPixIndex % width == 0) {
42 | lastFilledField++;
43 | checkPointsArray[lastFilledField] = newPixIndex;
44 | }
45 | }
46 | }
47 | }
48 |
49 | newPixIndex = currentPixIndex - 1;
50 | if (newPixIndex > 0) {
51 | if (!filledPoints[newPixIndex]) {
52 | filledPoints[newPixIndex] = 1;
53 | if ((pixels[newPixIndex] >> 24 & 0xff) <= alphaLevel) {
54 | lastFilledField++;
55 | checkPointsArray[lastFilledField] = newPixIndex;
56 | }
57 | }
58 |
59 | newPixIndex = currentPixIndex - width;
60 | if (newPixIndex > 0) {
61 | if (!filledPoints[newPixIndex]) {
62 | filledPoints[newPixIndex] = 1;
63 | if ((pixels[newPixIndex] >> 24 & 0xff) <= alphaLevel) {
64 | lastFilledField++;
65 | checkPointsArray[lastFilledField] = newPixIndex;
66 | }
67 | }
68 | }
69 | }
70 | } while (lastFilledField >= currentItem);
71 | delete[] checkPointsArray;
72 | return filledPointsObject;
73 | }
74 | }
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/FillMe.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapFactory;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.Paint;
10 | import android.graphics.drawable.BitmapDrawable;
11 | import android.graphics.drawable.Drawable;
12 | import android.util.AttributeSet;
13 | import android.util.Log;
14 | import android.view.MotionEvent;
15 | import android.view.View;
16 |
17 | import com.patryk1007.fillme.calculations.ConvexLinesCalculation;
18 | import com.patryk1007.fillme.calculations.FloodFillLinesCalculationAsync;
19 | import com.patryk1007.fillme.calculations.FloodFillLinesCalculationSync;
20 | import com.patryk1007.fillme.calculations.LinesCalculation;
21 | import com.patryk1007.fillme.enums.FillMode;
22 | import com.patryk1007.fillme.listeners.OnFillChangeListener;
23 | import com.patryk1007.fillme.listeners.OnFillLineCalculationListener;
24 | import com.patryk1007.fillme.models.FillLine;
25 |
26 | import java.util.ArrayList;
27 | import java.util.Calendar;
28 |
29 | public class FillMe extends View {
30 |
31 | public static final int DEFAULT_ALPHA_LEVEL = 122;//0-255
32 |
33 | private Bitmap image;
34 | private int alphaLevel = DEFAULT_ALPHA_LEVEL;
35 | private float fillPercentVertical;
36 | private float fillPercentHorizontal;
37 | private FillMode fillMode;
38 | private boolean convexFigure;
39 | private boolean asyncCalculation;
40 | private int fillColour = Color.GREEN;
41 |
42 | private int width;
43 | private int height;
44 | private Paint paint = new Paint();
45 | private ArrayList fillLines = new ArrayList<>();
46 |
47 | public FillMe(Context context) {
48 | super(context);
49 | paint.setColor(fillColour);
50 | }
51 |
52 | public FillMe(Context context, AttributeSet attrs) {
53 | super(context, attrs);
54 | getAttr(attrs);
55 | paint.setColor(fillColour);
56 | }
57 |
58 | private void getAttr(AttributeSet attrs) {
59 | TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.FillMe);
60 | asyncCalculation = typedArray.getBoolean(R.styleable.FillMe_fmAsyncCalculation, true);
61 | setImageDrawable(typedArray.getDrawable(R.styleable.FillMe_fmImage));
62 | setConvexFigure(typedArray.getBoolean(R.styleable.FillMe_fmConvexFigure, true));
63 | alphaLevel = (typedArray.getInt(R.styleable.FillMe_fmAlphaLevel, DEFAULT_ALPHA_LEVEL));
64 | this.fillColour = typedArray.getInt(R.styleable.FillMe_fmFillColour, fillColour);
65 | paint.setColor(fillColour);
66 | float percentFillHorizontal = typedArray.getFloat(R.styleable.FillMe_fmFillHorizontalPercent, -1);
67 | float percentFillVertical = typedArray.getFloat(R.styleable.FillMe_fmFillVerticalPercent, -1);
68 | setFillPercentHorizontalAndVertical(percentFillHorizontal, percentFillVertical);
69 | fillMode = (FillMode.fromId(typedArray.getInt(R.styleable.FillMe_fmFillByTouch, FillMode.NONE.getValue())));
70 | typedArray.recycle();
71 |
72 | }
73 |
74 | @Override
75 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
76 | int widthMode = MeasureSpec.getMode(widthMeasureSpec);
77 | int widthSize = MeasureSpec.getSize(widthMeasureSpec);
78 | int heightMode = MeasureSpec.getMode(heightMeasureSpec);
79 | int heightSize = MeasureSpec.getSize(heightMeasureSpec);
80 |
81 | if (image != null) {
82 | if (widthMode == MeasureSpec.EXACTLY) {
83 | width = widthSize;
84 | } else if (widthMode == MeasureSpec.AT_MOST) {
85 | width = image.getWidth();
86 | } else {
87 | width = image.getWidth();
88 | }
89 |
90 | if (heightMode == MeasureSpec.EXACTLY) {
91 | height = heightSize;
92 | } else if (heightMode == MeasureSpec.AT_MOST) {
93 | height = image.getHeight();
94 | } else {
95 | height = image.getHeight();
96 | }
97 |
98 | if (image.getWidth() != width || image.getHeight() != height) {
99 | updateDrawable();
100 | }
101 | } else {
102 | width = widthSize;
103 | height = heightSize;
104 | }
105 |
106 | setMeasuredDimension(width, height);
107 | }
108 |
109 | @Override
110 | public boolean onTouchEvent(MotionEvent event) {
111 | if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
112 | int fillX = -1;
113 | int fillVertical = -1;
114 | if (fillMode == FillMode.BOTH || fillMode == FillMode.HORIZONTAL) {
115 | fillX = (int) event.getX();
116 | }
117 | if (fillMode == FillMode.BOTH || fillMode == FillMode.VERTICAL) {
118 | fillVertical = (int) event.getY();
119 | }
120 | fillPixelXY(fillX, fillVertical);
121 | return true;
122 | } else {
123 | return super.onTouchEvent(event);
124 | }
125 | }
126 |
127 | @Override
128 | protected void onDraw(Canvas canvas) {
129 | if (image != null) {
130 | long timeStart = Calendar.getInstance().getTimeInMillis();
131 | fillShape(canvas);
132 | Log.d("SPEED_TEST2", "Line: " + (Calendar.getInstance().getTimeInMillis() - timeStart));
133 | canvas.drawBitmap(image, 0, 0, null);
134 | }
135 | }
136 |
137 |
138 | private LinesCalculation initCalculationManager() {
139 | if (isConvexFigure()) {
140 | return new ConvexLinesCalculation();
141 | }
142 | if (asyncCalculation) {
143 | return new FloodFillLinesCalculationAsync();
144 | }
145 | return new FloodFillLinesCalculationSync();
146 | }
147 |
148 | public Bitmap getImage() {
149 | return image;
150 | }
151 |
152 | public void setImage(Bitmap image) {
153 | this.image = image;
154 | requestLayout();
155 | }
156 |
157 | public void setImageDrawableId(int drawableId) {
158 | setImage(BitmapFactory.decodeResource(getResources(), drawableId));
159 | }
160 |
161 | public void setImageDrawable(Drawable drawable) {
162 | if (drawable != null) {
163 | setImage(((BitmapDrawable) drawable).getBitmap());
164 | }
165 | }
166 |
167 | public int getAlphaLevel() {
168 | return alphaLevel;
169 | }
170 |
171 | public void setAlphaLevel(int alphaLevel) {
172 | this.alphaLevel = alphaLevel;
173 | updateDrawable();
174 | postInvalidate();
175 | }
176 |
177 | public boolean isConvexFigure() {
178 | return convexFigure;
179 | }
180 |
181 | public void setConvexFigure(boolean convexFigure) {
182 | if (this.convexFigure != convexFigure && image != null) {
183 | this.convexFigure = convexFigure;
184 | updateDrawable();
185 | this.postInvalidate();
186 | }
187 | }
188 |
189 | public boolean isAsyncCalculation() {
190 | return asyncCalculation;
191 | }
192 |
193 | public void setSyncCalculation(boolean asyncCalculation) {
194 | this.asyncCalculation = asyncCalculation;
195 | }
196 |
197 | public int getFillPixelVertical() {
198 | return (int) (fillPercentVertical * height);
199 | }
200 |
201 | public void setFillPixelVertical(int fillPixelVertical) {
202 | fillVertical(fillPixelVertical);
203 | }
204 |
205 | public int getFillPixelHorizontal() {
206 | return (int) (fillPercentHorizontal * width);
207 | }
208 |
209 | public void setFillPixelHorizontal(int fillPixelHorizontal) {
210 | fillHorizontal(fillPixelHorizontal);
211 | }
212 |
213 | public void setFillPercentHorizontal(float percentX) {
214 | percentX = percentX > 1.0f ? 1.0f : percentX;
215 | percentX = percentX < 0 ? 0 : percentX;
216 | fillHorizontal((int) (width * percentX));
217 | }
218 |
219 | public float getFillPercentHorizontal() {
220 | return fillPercentHorizontal;
221 | }
222 |
223 | public FillMode getFillMode() {
224 | return fillMode;
225 | }
226 |
227 | public void setFillMode(FillMode fillMode) {
228 | this.fillMode = fillMode;
229 | }
230 |
231 | public void setFillPercentVertical(float percentY) {
232 | percentY = percentY > 1.0f ? 1.0f : percentY;
233 | percentY = percentY < 0 ? 0 : percentY;
234 | fillVertical((int) (height * percentY));
235 | }
236 |
237 | public void setFillPercentHorizontalAndVertical(float percentHorizontal, float percentVertical) {
238 | percentHorizontal = percentHorizontal > 1.0f ? 1.0f : percentHorizontal;
239 | percentVertical = percentVertical > 1.0f ? 1.0f : percentVertical;
240 |
241 | if (percentHorizontal >= 0) {
242 | fillPercentHorizontal = percentHorizontal;
243 | onFillChangeListener.onHorizontalValueChange(percentHorizontal, (int) (width * percentHorizontal));
244 | }
245 | if (percentVertical >= 0) {
246 | fillPercentVertical = 1.0f - percentVertical;
247 | onFillChangeListener.onVerticalValueChange(percentVertical, (int) (height * percentVertical));
248 | }
249 |
250 | if (fillPercentHorizontal >= 0 || fillPercentVertical >= 0) {
251 | this.postInvalidate();
252 | }
253 | }
254 |
255 | public float getFillPercentVertical() {
256 | return fillPercentVertical;
257 | }
258 |
259 | public int getFillColour() {
260 | return fillColour;
261 | }
262 |
263 | public void setFillColour(int fillColour) {
264 | this.fillColour = fillColour;
265 | paint.setColor(fillColour);
266 | this.postInvalidate();
267 | }
268 |
269 | public void setOnFillChangeListener(OnFillChangeListener onFillChangeListener) {
270 | this.onFillChangeListener = onFillChangeListener;
271 | }
272 |
273 | private void fillHorizontal(int x) {
274 | setFillPercentHorizontalAndVertical(x / (float) width, -1);
275 | }
276 |
277 | private void fillVertical(int y) {
278 | setFillPercentHorizontalAndVertical(-1, y / (float) height);
279 | }
280 |
281 | private void fillPixelXY(int horizontal, int vertical) {
282 | float horizontalPercent = horizontal >= 0 ? (horizontal / (float) width) : horizontal;
283 | float verticalPercent = vertical >= 0 ? 1 - (vertical / (float) height) : vertical;
284 | setFillPercentHorizontalAndVertical(horizontalPercent, verticalPercent);
285 | }
286 |
287 | private void updateDrawable() {
288 | if (image != null && width > 0 && height > 0) {
289 | image = Bitmap.createScaledBitmap(image, width, height, false);
290 | fillLines = new ArrayList<>();
291 | initCalculationManager().startCalculation(image, alphaLevel, onFillLineCalculationListener);
292 | }
293 | }
294 |
295 | private void fillShape(Canvas canvas) {
296 | int lineSize = fillLines.size();
297 | int fillPixelVertical = getFillPixelVertical();
298 | int fillPixelHorizontal = getFillPixelHorizontal();
299 | for (int i = lineSize - 1; i >= 0; i--) {
300 | FillLine fillLine = fillLines.get(i);
301 | if (fillLine.getStartY() >= fillPixelVertical) {
302 | if (fillLine.getStartX() < fillPixelHorizontal) {
303 | canvas.drawLine(fillLine.getStartX(), fillLine.getStartY(), fillLine.getEndX() > fillPixelHorizontal ? fillPixelHorizontal : fillLine.getEndX(), fillLine.getEndY(), paint);
304 | }
305 | } else {
306 | return;
307 | }
308 | }
309 | }
310 |
311 | private OnFillLineCalculationListener onFillLineCalculationListener = new OnFillLineCalculationListener() {
312 | @Override
313 | public void onCompleted(ArrayList points) {
314 | fillLines = points;
315 | invalidate();
316 | }
317 | };
318 |
319 | private OnFillChangeListener onFillChangeListener = new OnFillChangeListener() {
320 | @Override
321 | public void onHorizontalValueChange(float fillPercent, int fillPx) {
322 |
323 | }
324 |
325 | @Override
326 | public void onVerticalValueChange(float fillPercent, int fillPx) {
327 |
328 | }
329 | };
330 |
331 | }
332 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/calculations/AllShapesLinesCalculations.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.calculations;
2 |
3 | import android.graphics.Bitmap;
4 | import android.util.Log;
5 |
6 | import com.patryk1007.fillme.models.FillLine;
7 |
8 | import java.util.ArrayDeque;
9 | import java.util.ArrayList;
10 | import java.util.Calendar;
11 | import java.util.Queue;
12 |
13 | public class AllShapesLinesCalculations {
14 |
15 |
16 | private native boolean[] invokeNativeFunction(int[] points, int width, int height, int alphaLevel);
17 |
18 | public ArrayList calculate(Bitmap image, int alphaLevel){
19 | long startTime = Calendar.getInstance().getTimeInMillis();
20 | int width = image.getWidth();
21 | int height = image.getHeight();
22 |
23 | int pointsSize = width * height;
24 | int[] pixels = new int[pointsSize];
25 | image.getPixels(pixels, 0, width, 0, 0, width, height);
26 |
27 | Queue pointQueue = new ArrayDeque<>();
28 | pointQueue.add(0);
29 |
30 |
31 | long startCalculation = Calendar.getInstance().getTimeInMillis();
32 |
33 | System.loadLibrary("native-lib");
34 | boolean[] filledPoints = invokeNativeFunction(pixels, width, height, alphaLevel);
35 |
36 | long endCalculation = Calendar.getInstance().getTimeInMillis();
37 |
38 | ArrayList points = new ArrayList<>();
39 | boolean lastState = false;
40 | boolean state;
41 | FillLine fillLine = new FillLine();
42 | int pointsLength = filledPoints.length;
43 | for (int x = 0; x < pointsLength; x++) {
44 | state = filledPoints[x];
45 | if (lastState != state) {
46 | if (!state) {
47 | fillLine.setStartX(x % width);
48 | fillLine.setStartY(x / width);
49 | } else {
50 | if (fillLine.getStartX() != -1) {
51 | fillLine.setEndX(x % width);
52 | fillLine.setEndY(x / width);
53 | points.add(fillLine);
54 | fillLine = new FillLine();
55 | }
56 | }
57 | lastState = state;
58 | }
59 | }
60 | Log.d("ASYNCCALCULATION", " Total: " + (Calendar.getInstance().getTimeInMillis() - startTime)
61 | + " Calculation: " + (endCalculation - startCalculation)
62 | + " Points: " + (Calendar.getInstance().getTimeInMillis() - endCalculation)
63 | + " " + points.size());
64 | return points;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/calculations/ConvexLinesCalculation.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.calculations;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Color;
5 |
6 | import com.patryk1007.fillme.listeners.OnFillLineCalculationListener;
7 | import com.patryk1007.fillme.models.FillLine;
8 |
9 | import java.util.ArrayList;
10 |
11 | public class ConvexLinesCalculation implements LinesCalculation {
12 |
13 | private OnFillLineCalculationListener listener;
14 | private int alphaLevel;
15 |
16 | @Override
17 | public void startCalculation(Bitmap image, int alphaLevel, OnFillLineCalculationListener listener) {
18 | this.listener = listener;
19 | this.alphaLevel = alphaLevel;
20 | if(image!=null) {
21 | calculateConvexFigure(image);
22 | }
23 | }
24 |
25 | private void calculateConvexFigure(Bitmap bitmap) {
26 | boolean line;
27 | int width = bitmap.getWidth();
28 | int height = bitmap.getHeight();
29 |
30 | int[] pixels = new int[width * height];
31 | bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
32 |
33 | ArrayList fillLines = new ArrayList<>();
34 | for (int y = 0; y < height; y++) {
35 | line = false;
36 | FillLine fillLine = new FillLine();
37 | for (int x = 0; x < width; x++) {
38 | int currentPixel = pixels[x + width * y];
39 | boolean currentPix = Color.alpha(currentPixel) > alphaLevel;
40 | if (line != currentPix) {
41 | if (currentPix) {
42 | if (fillLine.getStartX() == -1) {
43 | fillLine.setStartX(x);
44 | fillLine.setStartY(y);
45 | } else {
46 | fillLine.setEndX(x);
47 | fillLine.setEndY(y);
48 | }
49 | }
50 | }
51 | line = currentPix;
52 | }
53 | if (fillLine.getEndX() != -1) {
54 | fillLines.add(fillLine);
55 | }
56 | }
57 | listener.onCompleted(fillLines);
58 | }
59 |
60 | }
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/calculations/FloodFillLinesCalculationAsync.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.calculations;
2 |
3 | import android.graphics.Bitmap;
4 | import android.os.AsyncTask;
5 |
6 | import com.patryk1007.fillme.listeners.OnFillLineCalculationListener;
7 | import com.patryk1007.fillme.models.FillLine;
8 |
9 | import java.util.ArrayList;
10 |
11 | public class FloodFillLinesCalculationAsync extends AsyncTask> implements LinesCalculation {
12 |
13 | private OnFillLineCalculationListener asyncListener;
14 | private int alphaLevel;
15 |
16 | @Override
17 | public void startCalculation(Bitmap image, int alphaLevel, OnFillLineCalculationListener listener) {
18 | asyncListener = listener;
19 | this.alphaLevel = alphaLevel;
20 | if (image != null) {
21 | this.execute(image);
22 | }
23 | }
24 |
25 |
26 | @Override
27 | protected ArrayList doInBackground(Bitmap... images) {
28 | Bitmap image = images[0];
29 | return new AllShapesLinesCalculations().calculate(image, alphaLevel);
30 | }
31 |
32 | @Override
33 | protected void onPostExecute(ArrayList result) {
34 | asyncListener.onCompleted(result);
35 | }
36 | }
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/calculations/FloodFillLinesCalculationSync.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.calculations;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import com.patryk1007.fillme.listeners.OnFillLineCalculationListener;
6 |
7 | public class FloodFillLinesCalculationSync implements LinesCalculation {
8 |
9 | @Override
10 | public void startCalculation(Bitmap image, int alphaLevel, OnFillLineCalculationListener listener) {
11 | listener.onCompleted(new AllShapesLinesCalculations().calculate(image, alphaLevel));
12 | }
13 | }
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/calculations/LinesCalculation.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.calculations;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import com.patryk1007.fillme.listeners.OnFillLineCalculationListener;
6 |
7 | public interface LinesCalculation {
8 |
9 | void startCalculation(Bitmap image, int alphaLevel, OnFillLineCalculationListener listener);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/enums/FillMode.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.enums;
2 |
3 | public enum FillMode {
4 | NONE(0), HORIZONTAL(1), VERTICAL(2), BOTH(3);
5 |
6 | private final int id;
7 |
8 | FillMode(int id) {
9 | this.id = id;
10 | }
11 |
12 | public int getValue() {
13 | return id;
14 | }
15 |
16 | public static FillMode fromId(int id) {
17 | for (FillMode mode : values()) {
18 | if (mode.getValue() == id) {
19 | return mode;
20 | }
21 | }
22 | return NONE;
23 | }
24 | }
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/listeners/OnFillChangeListener.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.listeners;
2 |
3 | public interface OnFillChangeListener {
4 |
5 | /**
6 | * A callback that notifies clients when the fill horizontal level has been changed.
7 | * @param fillPercent Current fill lever in percent (0-1)
8 | * @param fillPx Current fill lever in pixels
9 | */
10 | void onHorizontalValueChange(float fillPercent, int fillPx);
11 |
12 | /**
13 | * A callback that notifies clients when the fill vertical level has been changed.
14 | * @param fillPercent Current fill lever in percent (0-1)
15 | * @param fillPx Current fill lever in pixels
16 | */
17 | void onVerticalValueChange(float fillPercent, int fillPx);
18 | }
19 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/listeners/OnFillLineCalculationListener.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.listeners;
2 |
3 |
4 | import com.patryk1007.fillme.models.FillLine;
5 |
6 | import java.util.ArrayList;
7 |
8 | public interface OnFillLineCalculationListener {
9 |
10 | void onCompleted(ArrayList points);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/java/com/patryk1007/fillme/models/FillLine.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme.models;
2 |
3 | public class FillLine {
4 |
5 | private int startX = -1;
6 | private int startY = -1;
7 | private int endX = -1;
8 | private int endY = -1;
9 |
10 | public FillLine() {
11 | }
12 |
13 | public FillLine(int startX, int startY, int endX, int endY) {
14 | this.startX = startX;
15 | this.startY = startY;
16 | this.endX = endX;
17 | this.endY = endY;
18 | }
19 |
20 | public int getStartX() {
21 | return startX;
22 | }
23 |
24 | public void setStartX(int startX) {
25 | this.startX = startX;
26 | }
27 |
28 | public void setStartXY(int x, int y){
29 | this.startX = x;
30 | this.startY = y;
31 | }
32 |
33 | public void setEndXY(int x, int y){
34 | this.endX = x;
35 | this.endY = y;
36 | }
37 |
38 | public int getStartY() {
39 | return startY;
40 | }
41 |
42 | public void setStartY(int startY) {
43 | this.startY = startY;
44 | }
45 |
46 | public int getEndX() {
47 | return endX;
48 | }
49 |
50 | public void setEndX(int endX) {
51 | this.endX = endX;
52 | }
53 |
54 | public int getEndY() {
55 | return endY;
56 | }
57 |
58 | public void setEndY(int endY) {
59 | this.endY = endY;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/fillme_lib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FillMe
3 |
4 |
--------------------------------------------------------------------------------
/fillme_lib/src/test/java/com/patryk1007/fillme/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.patryk1007.fillme;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/patryk1007/Fillme/df4c28ebc9f3ebc002f102fb7cf6bbb5be1d09a9/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Nov 25 16:39:50 CET 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':fillme_lib'
2 |
--------------------------------------------------------------------------------