Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-81
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-81
2022-81
Commits
8226a8dd
Commit
8226a8dd
authored
Nov 10, 2022
by
Salika Madhushanka W.J
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'IT19129372_2' into 'master'
add it19129372 part See merge request
!4
parents
15680fad
ecf1aea5
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
2155 additions
and
20 deletions
+2155
-20
.idea/gradle.xml
.idea/gradle.xml
+1
-1
.idea/misc.xml
.idea/misc.xml
+19
-0
.idea/runConfigurations.xml
.idea/runConfigurations.xml
+0
-10
app/build.gradle
app/build.gradle
+4
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+35
-2
app/src/main/java/com/example/eketha/Fertilizer.java
app/src/main/java/com/example/eketha/Fertilizer.java
+180
-0
app/src/main/java/com/example/eketha/FertilizerGuidence.java
app/src/main/java/com/example/eketha/FertilizerGuidence.java
+91
-0
app/src/main/java/com/example/eketha/LoadingClass.java
app/src/main/java/com/example/eketha/LoadingClass.java
+34
-0
app/src/main/java/com/example/eketha/MainActivity.java
app/src/main/java/com/example/eketha/MainActivity.java
+7
-7
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaHome.java
...main/java/com/example/eketha/PaddyArea/PaddyAreaHome.java
+46
-0
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaResult.java
...in/java/com/example/eketha/PaddyArea/PaddyAreaResult.java
+90
-0
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaText.java
...main/java/com/example/eketha/PaddyArea/PaddyAreaText.java
+53
-0
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_01.java
...n/java/com/example/eketha/PaddyArea/PaddyAreaView_01.java
+135
-0
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_02.java
...n/java/com/example/eketha/PaddyArea/PaddyAreaView_02.java
+150
-0
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_03.java
...n/java/com/example/eketha/PaddyArea/PaddyAreaView_03.java
+174
-0
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_04.java
...n/java/com/example/eketha/PaddyArea/PaddyAreaView_04.java
+132
-0
app/src/main/java/com/example/eketha/fertilizerHome.java
app/src/main/java/com/example/eketha/fertilizerHome.java
+40
-0
app/src/main/ml/bmodelTO.tflite
app/src/main/ml/bmodelTO.tflite
+0
-0
app/src/main/res/drawable/back.png
app/src/main/res/drawable/back.png
+0
-0
app/src/main/res/layout/activity_fertilizer.xml
app/src/main/res/layout/activity_fertilizer.xml
+91
-0
app/src/main/res/layout/activity_fertilizer_guidence.xml
app/src/main/res/layout/activity_fertilizer_guidence.xml
+260
-0
app/src/main/res/layout/activity_fertilizer_home.xml
app/src/main/res/layout/activity_fertilizer_home.xml
+116
-0
app/src/main/res/layout/activity_paddy_area_home.xml
app/src/main/res/layout/activity_paddy_area_home.xml
+43
-0
app/src/main/res/layout/activity_paddy_area_result.xml
app/src/main/res/layout/activity_paddy_area_result.xml
+59
-0
app/src/main/res/layout/activity_paddy_area_text.xml
app/src/main/res/layout/activity_paddy_area_text.xml
+46
-0
app/src/main/res/layout/activity_paddy_area_view01.xml
app/src/main/res/layout/activity_paddy_area_view01.xml
+28
-0
app/src/main/res/layout/activity_paddy_area_view02.xml
app/src/main/res/layout/activity_paddy_area_view02.xml
+100
-0
app/src/main/res/layout/activity_paddy_area_view03.xml
app/src/main/res/layout/activity_paddy_area_view03.xml
+83
-0
app/src/main/res/layout/activity_paddy_area_view04.xml
app/src/main/res/layout/activity_paddy_area_view04.xml
+103
-0
app/src/main/res/layout/custom_loading_bar.xml
app/src/main/res/layout/custom_loading_bar.xml
+35
-0
No files found.
.idea/gradle.xml
View file @
8226a8dd
...
...
@@ -4,7 +4,7 @@
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<option
name=
"testRunner"
value=
"
PLATFORM
"
/>
<option
name=
"testRunner"
value=
"
GRADLE
"
/>
<option
name=
"distributionType"
value=
"DEFAULT_WRAPPED"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"modules"
>
...
...
.idea/misc.xml
View file @
8226a8dd
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"DesignSurface"
>
<option
name=
"filePathToZoomLevelMap"
>
<map>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_fertilizer.xml"
value=
"0.31384615384615383"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_fertilizer_guidence.xml"
value=
"0.25089605734767023"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_fertilizer_home.xml"
value=
"0.31384615384615383"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_growth_detect.xml"
value=
"0.2552083333333333"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_main.xml"
value=
"0.2552083333333333"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_paddy_area_home.xml"
value=
"0.31384615384615383"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_paddy_area_result.xml"
value=
"0.31384615384615383"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_paddy_area_text.xml"
value=
"0.31384615384615383"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_paddy_area_view01.xml"
value=
"0.3212962962962963"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_paddy_area_view02.xml"
value=
"0.3212962962962963"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_paddy_area_view03.xml"
value=
"0.3212962962962963"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/activity_paddy_area_view04.xml"
value=
"0.3212962962962963"
/>
<entry
key=
"..\:/Users/binuk/Desktop/GitLab11_09/2022-81/app/src/main/res/layout/custom_loading_bar.xml"
value=
"0.31384615384615383"
/>
</map>
</option>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_11"
default=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
...
...
.idea/runConfigurations.xml
deleted
100644 → 0
View file @
15680fad
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
app/build.gradle
View file @
8226a8dd
...
...
@@ -64,6 +64,9 @@ android {
noCompress
"tflite"
//noCompress "lite"
}
buildFeatures
{
mlModelBinding
true
}
}
dependencies
{
...
...
@@ -79,6 +82,7 @@ dependencies {
implementation
'org.tensorflow:tensorflow-lite-support:0.1.0'
implementation
'org.tensorflow:tensorflow-lite-metadata:0.1.0'
implementation
'com.squareup.retrofit2:retrofit:2.3.0'
implementation
'com.google.android.gms:play-services-location:20.0.0'
implementation
'com.squareup.retrofit2:converter-gson:2.3.0'
implementation
(
'org.tensorflow:tensorflow-lite:0.0.0-nightly'
)
{
changing
=
true
}
implementation
(
'org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly'
)
{
changing
=
true
}
...
...
app/src/main/AndroidManifest.xml
View file @
8226a8dd
...
...
@@ -13,6 +13,8 @@
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<application
android:allowBackup=
"true"
...
...
@@ -21,7 +23,38 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.EKetha"
>
<activity
android:name=
".SplashScreen"
<activity
android:name=
".PaddyArea.PaddyAreaView_04"
android:exported=
"false"
/>
<activity
android:name=
".PaddyArea.PaddyAreaView_03"
android:exported=
"false"
/>
<activity
android:name=
".PaddyArea.PaddyAreaView_02"
android:exported=
"false"
/>
<activity
android:name=
".PaddyArea.PaddyAreaView_01"
android:exported=
"false"
/>
<activity
android:name=
".PaddyArea.PaddyAreaText"
android:exported=
"false"
/>
<activity
android:name=
".PaddyArea.PaddyAreaResult"
android:exported=
"false"
/>
<activity
android:name=
".PaddyArea.PaddyAreaHome"
android:exported=
"false"
/>
<activity
android:name=
".fertilizerHome"
android:exported=
"false"
/>
<activity
android:name=
".FertilizerGuidence"
android:exported=
"false"
/>
<activity
android:name=
".Fertilizer"
android:exported=
"false"
/>
<activity
android:name=
".SplashScreen"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
@@ -36,7 +69,7 @@
<activity
android:name=
".growthHome"
/>
<activity
android:name=
".Growth"
/>
<activity
android:name=
".Register"
/>
<activity
android:name=
".Login"
/>
<activity
android:name=
".Login"
/>
<activity
android:name=
".MainActivity"
/>
<provider
...
...
app/src/main/java/com/example/eketha/Fertilizer.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.Manifest
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.graphics.Bitmap
;
import
android.media.ThumbnailUtils
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.provider.MediaStore
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.example.eketha.PaddyArea.PaddyAreaHome
;
import
com.example.eketha.ml.BmodelTO
;
import
org.tensorflow.lite.DataType
;
import
org.tensorflow.lite.support.tensorbuffer.TensorBuffer
;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
public
class
Fertilizer
extends
AppCompatActivity
{
private
Button
camera
,
gallery
,
area
;
private
ImageView
imageView
;
private
TextView
result
;
private
int
imageSize
=
256
;
private
String
fertilizerType
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_fertilizer
);
camera
=
findViewById
(
R
.
id
.
button
);
gallery
=
findViewById
(
R
.
id
.
button2
);
area
=
findViewById
(
R
.
id
.
button3
);
result
=
findViewById
(
R
.
id
.
result
);
imageView
=
findViewById
(
R
.
id
.
imageView
);
area
.
setEnabled
(
false
);
camera
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
M
)
@Override
public
void
onClick
(
View
view
)
{
if
(
checkSelfPermission
(
Manifest
.
permission
.
CAMERA
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
Intent
cameraIntent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
startActivityForResult
(
cameraIntent
,
3
);
}
else
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
CAMERA
},
100
);
}
}
});
gallery
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
cameraIntent
=
new
Intent
(
Intent
.
ACTION_PICK
,
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
);
startActivityForResult
(
cameraIntent
,
1
);
}
});
area
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
Fertilizer
.
this
,
PaddyAreaHome
.
class
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
startActivity
(
intent
);
}
});
}
public
void
classifyImage
(
Bitmap
image
){
try
{
BmodelTO
model
=
BmodelTO
.
newInstance
(
getApplicationContext
());
// Creates inputs for reference.
TensorBuffer
inputFeature0
=
TensorBuffer
.
createFixedSize
(
new
int
[]{
1
,
256
,
256
,
3
},
DataType
.
FLOAT32
);
ByteBuffer
byteBuffer
=
ByteBuffer
.
allocateDirect
(
4
*
imageSize
*
imageSize
*
3
);
byteBuffer
.
order
(
ByteOrder
.
nativeOrder
());
int
[]
intValues
=
new
int
[
imageSize
*
imageSize
];
image
.
getPixels
(
intValues
,
0
,
image
.
getWidth
(),
0
,
0
,
image
.
getWidth
(),
image
.
getHeight
());
int
pixel
=
0
;
//iterate over each pixel and extract R, G, and B values. Add those values individually to the byte buffer.
for
(
int
i
=
0
;
i
<
imageSize
;
i
++){
for
(
int
j
=
0
;
j
<
imageSize
;
j
++){
int
val
=
intValues
[
pixel
++];
// RGB
byteBuffer
.
putFloat
(((
val
>>
16
)
&
0xFF
)
*
(
1
.
f
/
1
));
byteBuffer
.
putFloat
(((
val
>>
8
)
&
0xFF
)
*
(
1
.
f
/
1
));
byteBuffer
.
putFloat
((
val
&
0xFF
)
*
(
1
.
f
/
1
));
}
}
inputFeature0
.
loadBuffer
(
byteBuffer
);
// Runs model inference and gets result.
BmodelTO
.
Outputs
outputs
=
model
.
process
(
inputFeature0
);
TensorBuffer
outputFeature0
=
outputs
.
getOutputFeature0AsTensorBuffer
();
float
[]
confidences
=
outputFeature0
.
getFloatArray
();
// find the index of the class with the biggest confidence.
int
maxPos
=
0
;
float
maxConfidence
=
0
;
for
(
int
i
=
0
;
i
<
confidences
.
length
;
i
++)
{
if
(
confidences
[
i
]
>
maxConfidence
)
{
maxConfidence
=
confidences
[
i
];
maxPos
=
i
;
}
}
String
[]
classes
=
{
"Muriate of Potash (MOP)"
,
"Triple Super Phosphate (TSP)"
,
"Urea"
,
"Zinc Sulphate"
};
result
.
setText
(
classes
[
maxPos
]);
if
(
classes
[
maxPos
]
==
"Muriate of Potash (MOP)"
){
Toast
.
makeText
(
getApplicationContext
(),
"1"
,
Toast
.
LENGTH_SHORT
).
show
();
fertilizerType
=
"1"
;
}
else
if
(
classes
[
maxPos
]
==
"Triple Super Phosphate (TSP)"
){
Toast
.
makeText
(
getApplicationContext
(),
"2"
,
Toast
.
LENGTH_SHORT
).
show
();
fertilizerType
=
"2"
;
}
else
if
(
classes
[
maxPos
]
==
"Urea"
){
Toast
.
makeText
(
getApplicationContext
(),
"3"
,
Toast
.
LENGTH_SHORT
).
show
();
fertilizerType
=
"3"
;
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"3"
,
Toast
.
LENGTH_SHORT
).
show
();
fertilizerType
=
"4"
;
}
area
.
setEnabled
(
true
);
// Releases model resources if no longer used.
model
.
close
();
}
catch
(
IOException
e
)
{
// TODO Handle the exception
}
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
if
(
resultCode
==
RESULT_OK
){
if
(
requestCode
==
3
){
Bitmap
image
=
(
Bitmap
)
data
.
getExtras
().
get
(
"data"
);
int
dimension
=
Math
.
min
(
image
.
getWidth
(),
image
.
getHeight
());
image
=
ThumbnailUtils
.
extractThumbnail
(
image
,
dimension
,
dimension
);
imageView
.
setImageBitmap
(
image
);
image
=
Bitmap
.
createScaledBitmap
(
image
,
imageSize
,
imageSize
,
false
);
classifyImage
(
image
);
}
else
{
Uri
dat
=
data
.
getData
();
Bitmap
image
=
null
;
try
{
image
=
MediaStore
.
Images
.
Media
.
getBitmap
(
this
.
getContentResolver
(),
dat
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
imageView
.
setImageBitmap
(
image
);
image
=
Bitmap
.
createScaledBitmap
(
image
,
imageSize
,
imageSize
,
false
);
classifyImage
(
image
);
}
}
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/FertilizerGuidence.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.widget.TextView
;
public
class
FertilizerGuidence
extends
AppCompatActivity
{
TextView
area
,
feild_01
,
feild_02
,
feild_03
,
feild_04
,
fType
,
pArea
;
private
String
areaResult
,
fertilizerType
;
private
int
fertilizerTypeInt
,
areaResultInt
,
areaResultIntFinal
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_fertilizer_guidence
);
areaResult
=
getIntent
().
getStringExtra
(
"areaResult"
);
// areaResult = getIntent().getStringExtra("areaResultC");
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
fType
=
findViewById
(
R
.
id
.
fType
);
pArea
=
findViewById
(
R
.
id
.
pArea
);
//table
feild_01
=
findViewById
(
R
.
id
.
feild_01
);
feild_02
=
findViewById
(
R
.
id
.
feild_02
);
feild_03
=
findViewById
(
R
.
id
.
feild_03
);
feild_04
=
findViewById
(
R
.
id
.
feild_04
);
fertilizerTypeInt
=
Integer
.
valueOf
(
fertilizerType
);
areaResultInt
=
Integer
.
valueOf
(
areaResult
);
if
(
areaResultInt
==
0
){
areaResultInt
=
1
;
}
if
(
fertilizerTypeInt
==
1
)
{
int
week3
=
areaResultInt
*
25
;
String
week3s
=
Integer
.
toString
(
week3
);
int
week4
=
areaResultInt
*
35
;
String
week4s
=
Integer
.
toString
(
week4
);
feild_01
.
setText
(
""
);
feild_02
.
setText
(
""
);
feild_03
.
setText
(
week3s
);
feild_04
.
setText
(
week4s
);
}
else
if
(
fertilizerTypeInt
==
2
)
{
int
week1
=
areaResultInt
*
55
;
String
week1s
=
Integer
.
toString
(
week1
);
feild_01
.
setText
(
week1s
);
feild_02
.
setText
(
""
);
feild_03
.
setText
(
""
);
feild_04
.
setText
(
""
);
}
else
if
(
fertilizerTypeInt
==
3
)
{
int
week2
=
areaResultInt
*
50
;
String
week2s
=
Integer
.
toString
(
week2
);
int
week3
=
areaResultInt
*
75
;
String
week3s
=
Integer
.
toString
(
week3
);
int
week4
=
areaResultInt
*
65
;
String
week4s
=
Integer
.
toString
(
week4
);
feild_01
.
setText
(
""
);
feild_02
.
setText
(
week2s
);
feild_03
.
setText
(
week3s
);
feild_04
.
setText
(
week4s
);
}
else
if
(
fertilizerTypeInt
==
4
){
int
week1
=
areaResultInt
*
5
;
String
week1s
=
Integer
.
toString
(
week1
);
feild_01
.
setText
(
week1s
);
feild_02
.
setText
(
""
);
feild_03
.
setText
(
""
);
feild_04
.
setText
(
""
);
}
// TableView tableView = findViewById(R.id.table_data_view);
//
// String[] header = {"1","2","3","4"};
// String[][] data = {{"aa","aa","aa","aa"},{"aa","aa","aa","aa"}};
//
// tableView.setHeaderAdapter(new SimpleTableHeaderAdapter(this,header));
// tableView.setDataAdapter(new SimpleTableDataAdapter(this,data));
// area = findViewById(R.id.area);
// area.setText(fertilizerType);
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/LoadingClass.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.view.LayoutInflater
;
public
class
LoadingClass
{
private
Activity
activity
;
private
AlertDialog
dialog
;
public
LoadingClass
(
Activity
myActivity
){
activity
=
myActivity
;
}
public
void
startLoadingDialog
(){
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
activity
);
LayoutInflater
inflater
=
activity
.
getLayoutInflater
();
builder
.
setView
(
inflater
.
inflate
(
R
.
layout
.
custom_loading_bar
,
null
));
// builder.setCancelable(true);
dialog
=
builder
.
create
();
dialog
.
show
();
}
public
void
dismissDialog
(){
dialog
.
dismiss
();
}
}
app/src/main/java/com/example/eketha/MainActivity.java
View file @
8226a8dd
...
...
@@ -51,13 +51,13 @@ public class MainActivity extends AppCompatActivity {
// }
// });
//
//
cardView3.setOnClickListener(new View.OnClickListener() {
//
@Override
//
public void onClick(View view) {
//
Intent intent = new Intent(getApplicationContext(),fertilizerHome.class);
//
startActivity(intent);
//
}
//
});
cardView3
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
getApplicationContext
(),
fertilizerHome
.
class
);
startActivity
(
intent
);
}
});
cardView4
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaHome.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha.PaddyArea
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
com.example.eketha.R
;
public
class
PaddyAreaHome
extends
AppCompatActivity
{
Button
bt1
,
bt2
,
bt3
;
private
String
fertilizerType
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_paddy_area_home
);
// bt1 = findViewById(R.id.bt_1);
bt2
=
findViewById
(
R
.
id
.
bt_2
);
bt3
=
findViewById
(
R
.
id
.
bt_3
);
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
bt2
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
PaddyAreaHome
.
this
,
PaddyAreaView_01
.
class
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
startActivity
(
intent
);
}
});
bt3
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
PaddyAreaHome
.
this
,
PaddyAreaText
.
class
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
startActivity
(
intent
);
}
});
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaResult.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha.PaddyArea
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.example.eketha.FertilizerGuidence
;
import
com.example.eketha.R
;
public
class
PaddyAreaResult
extends
AppCompatActivity
{
Button
btLocation
,
nxt1
,
navigateFertiGuidence
;
TextView
area
,
d1
,
d2
;
private
String
distance1
,
lon4
,
lat4
,
lon3
,
lat3
;
private
int
distance
;
private
double
lol
,
loll
,
lol1
,
loll1
;
private
String
fertilizerType
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_paddy_area_result
);
distance1
=
getIntent
().
getStringExtra
(
"distance1"
);
lat3
=
getIntent
().
getStringExtra
(
"lat3"
);
lon3
=
getIntent
().
getStringExtra
(
"lon3"
);
lat4
=
getIntent
().
getStringExtra
(
"lat4"
);
lon4
=
getIntent
().
getStringExtra
(
"lon4"
);
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
navigateFertiGuidence
=
findViewById
(
R
.
id
.
navigateFertiGuidence
);
area
=
findViewById
(
R
.
id
.
area
);
// d1 = findViewById(R.id.d1);
// d2 = findViewById(R.id.d2);
// d1.setText(distance1);
int
x
=
Integer
.
valueOf
(
distance1
);
lol
=
Double
.
valueOf
(
lat3
);
loll
=
Double
.
valueOf
(
lon3
);
lol1
=
Double
.
valueOf
(
lat4
);
loll1
=
Double
.
valueOf
(
lon4
);
distance
=
calculateDistanceInKilometer
(
lol
,
loll
,
lol1
,
loll1
);
// distance = calculateDistanceInKilometer(6.713408110319169,79.91602709961393,6.713184955531217,79.91592511089544);
int
a
=
distance
*
x
;
int
hect
=
a
/
10000
;
// d2.setText(String.valueOf(distance));
area
.
setText
(
String
.
valueOf
(
a
)
+
"m"
);
navigateFertiGuidence
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
PaddyAreaResult
.
this
,
FertilizerGuidence
.
class
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
intent
.
putExtra
(
"areaResult"
,
String
.
valueOf
(
hect
));
startActivity
(
intent
);
}
});
}
public
final
static
double
AVERAGE_RADIUS_OF_EARTH_KM
=
6371
;
public
int
calculateDistanceInKilometer
(
double
userLat
,
double
userLng
,
double
venueLat
,
double
venueLng
)
{
double
latDistance
=
Math
.
toRadians
(
userLat
-
venueLat
);
double
lngDistance
=
Math
.
toRadians
(
userLng
-
venueLng
);
double
a
=
Math
.
sin
(
latDistance
/
2
)
*
Math
.
sin
(
latDistance
/
2
)
+
Math
.
cos
(
Math
.
toRadians
(
userLat
))
*
Math
.
cos
(
Math
.
toRadians
(
venueLat
))
*
Math
.
sin
(
lngDistance
/
2
)
*
Math
.
sin
(
lngDistance
/
2
);
double
c
=
2
*
Math
.
atan2
(
Math
.
sqrt
(
a
),
Math
.
sqrt
(
1
-
a
));
double
r
=
(
AVERAGE_RADIUS_OF_EARTH_KM
*
c
)
*
1000
;
int
x
=
(
int
)
r
*
1
;
return
x
;
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaText.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha.PaddyArea
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
com.example.eketha.FertilizerGuidence
;
import
com.example.eketha.R
;
public
class
PaddyAreaText
extends
AppCompatActivity
{
EditText
paddyValue
;
Button
addPaddyValue
,
navigateFertiGuidence
;
private
String
fertilizerType
;
private
String
areaResult
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_paddy_area_text
);
paddyValue
=
findViewById
(
R
.
id
.
paddyValue
);
addPaddyValue
=
findViewById
(
R
.
id
.
addPaddyValue
);
navigateFertiGuidence
=
findViewById
(
R
.
id
.
navigateFertiGuidence
);
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
navigateFertiGuidence
.
setEnabled
(
false
);
addPaddyValue
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Toast
.
makeText
(
getApplicationContext
(),
paddyValue
.
getText
(),
Toast
.
LENGTH_SHORT
).
show
();
areaResult
=
paddyValue
.
getText
().
toString
();
navigateFertiGuidence
.
setEnabled
(
true
);
}
});
navigateFertiGuidence
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
PaddyAreaText
.
this
,
FertilizerGuidence
.
class
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
intent
.
putExtra
(
"areaResult"
,
areaResult
);
startActivity
(
intent
);
}
});
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_01.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha.PaddyArea
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.location.LocationListener
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.example.eketha.LoadingClass
;
import
com.example.eketha.R
;
import
com.google.android.gms.location.FusedLocationProviderClient
;
import
java.util.List
;
import
java.util.Timer
;
import
java.util.TimerTask
;
public
class
PaddyAreaView_01
extends
AppCompatActivity
implements
LocationListener
{
Button
btLocation
,
n
;
TextView
tvLatitude
,
tvLongitude
;
FusedLocationProviderClient
fusedLocationProviderClient
;
LocationManager
locationManager
;
private
String
l
,
ll
;
private
String
fertilizerType
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_paddy_area_view01
);
btLocation
=
findViewById
(
R
.
id
.
bt_location
);
n
=
findViewById
(
R
.
id
.
bt_location1
);
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
n
.
setEnabled
(
false
);
final
LoadingClass
loadingClass
=
new
LoadingClass
(
PaddyAreaView_01
.
this
);
//Runtime permissions
if
(
ContextCompat
.
checkSelfPermission
(
PaddyAreaView_01
.
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
){
ActivityCompat
.
requestPermissions
(
PaddyAreaView_01
.
this
,
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
100
);
}
btLocation
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
//create method
getLocation
();
loadingClass
.
startLoadingDialog
();
new
Timer
().
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
// this code will be executed after 2 seconds
loadingClass
.
dismissDialog
();
}
},
25000
);
}
});
n
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
lol
();
}
});
}
@SuppressLint
(
"MissingPermission"
)
private
void
getLocation
()
{
try
{
locationManager
=
(
LocationManager
)
getApplicationContext
().
getSystemService
(
LOCATION_SERVICE
);
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
5000
,
5
,
this
::
onLocationChanged
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
@Override
public
void
onLocationChanged
(
@NonNull
Location
location
)
{
l
=
String
.
valueOf
(
location
.
getLongitude
());
ll
=
String
.
valueOf
(
location
.
getLatitude
());
n
.
setEnabled
(
true
);
}
public
void
lol
(){
Intent
intent
=
new
Intent
(
PaddyAreaView_01
.
this
,
PaddyAreaView_02
.
class
);
intent
.
putExtra
(
"lat"
,
l
);
intent
.
putExtra
(
"lon"
,
ll
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
startActivity
(
intent
);
}
// @Override
// public void onLocationChanged(@NonNull List<Location> locations) {
// LocationListener.super.onLocationChanged(locations);
// }
// @Override
// public void onFlushComplete(int requestCode) {
// LocationListener.super.onFlushComplete(requestCode);
// }
//
// @Override
// public void onStatusChanged(String provider, int status, Bundle extras) {
// LocationListener.super.onStatusChanged(provider, status, extras);
// }
//
// @Override
// public void onProviderEnabled(@NonNull String provider) {
// LocationListener.super.onProviderEnabled(provider);
// }
//
// @Override
// public void onProviderDisabled(@NonNull String provider) {
// LocationListener.super.onProviderDisabled(provider);
// }
}
\ No newline at end of file
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_02.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha.PaddyArea
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.example.eketha.LoadingClass
;
import
com.example.eketha.R
;
import
com.google.android.gms.location.FusedLocationProviderClient
;
import
com.google.android.gms.location.LocationListener
;
import
java.util.Timer
;
import
java.util.TimerTask
;
public
class
PaddyAreaView_02
extends
AppCompatActivity
implements
LocationListener
{
Button
btLocation
,
nxt1
;
TextView
tvLatitude
,
tvLongitude
,
lt
,
lg
,
ff
;
FusedLocationProviderClient
fusedLocationProviderClient2
;
private
String
lon
,
lat
,
l
,
ll
;
private
boolean
t
;
private
int
distance
;
private
double
lon2
,
lat2
,
lol
,
loll
;
LocationManager
locationManager
;
private
String
fertilizerType
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_paddy_area_view02
);
btLocation
=
findViewById
(
R
.
id
.
bt_location2
);
nxt1
=
findViewById
(
R
.
id
.
nxt1
);
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
nxt1
.
setEnabled
(
false
);
final
LoadingClass
loadingClass
=
new
LoadingClass
(
PaddyAreaView_02
.
this
);
// tvLatitude = findViewById(R.id.tv_latitude2);
// tvLongitude = findViewById(R.id.tv_longitude2);
// lt = findViewById(R.id.tv_lt);
// lg = findViewById(R.id.tv_lg);
// ff = findViewById(R.id.ff);
lat
=
getIntent
().
getStringExtra
(
"lat"
);
lon
=
getIntent
().
getStringExtra
(
"lon"
);
// tvLatitude.setText(lat);
// tvLongitude.setText(lon);
//Runtime permissions
if
(
ContextCompat
.
checkSelfPermission
(
PaddyAreaView_02
.
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
){
ActivityCompat
.
requestPermissions
(
PaddyAreaView_02
.
this
,
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
100
);
}
btLocation
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
//create method
getLocation
();
loadingClass
.
startLoadingDialog
();
new
Timer
().
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
// this code will be executed after 2 seconds
loadingClass
.
dismissDialog
();
}
},
25000
);
}
});
nxt1
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
chg
();
}
});
}
@SuppressLint
(
"MissingPermission"
)
private
void
getLocation
()
{
try
{
locationManager
=
(
LocationManager
)
getApplicationContext
().
getSystemService
(
LOCATION_SERVICE
);
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
5000
,
5
,
this
::
onLocationChanged
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
@Override
public
void
onLocationChanged
(
@NonNull
Location
location
)
{
// lt.setText(String.valueOf(location.getLatitude()));
// lg.setText(String.valueOf(location.getLongitude()));
l
=
String
.
valueOf
(
location
.
getLongitude
());
ll
=
String
.
valueOf
(
location
.
getLatitude
());
nxt1
.
setEnabled
(
true
);
}
private
void
chg
()
{
Intent
intent
=
new
Intent
(
PaddyAreaView_02
.
this
,
PaddyAreaView_03
.
class
);
intent
.
putExtra
(
"lat1"
,
lat
);
intent
.
putExtra
(
"lon1"
,
lon
);
intent
.
putExtra
(
"lat2"
,
ll
);
intent
.
putExtra
(
"lon2"
,
l
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
startActivity
(
intent
);
}
public
final
static
double
AVERAGE_RADIUS_OF_EARTH_KM
=
6371
;
public
int
calculateDistanceInKilometer
(
double
userLat
,
double
userLng
,
double
venueLat
,
double
venueLng
)
{
double
latDistance
=
Math
.
toRadians
(
userLat
-
venueLat
);
double
lngDistance
=
Math
.
toRadians
(
userLng
-
venueLng
);
double
a
=
Math
.
sin
(
latDistance
/
2
)
*
Math
.
sin
(
latDistance
/
2
)
+
Math
.
cos
(
Math
.
toRadians
(
userLat
))
*
Math
.
cos
(
Math
.
toRadians
(
venueLat
))
*
Math
.
sin
(
lngDistance
/
2
)
*
Math
.
sin
(
lngDistance
/
2
);
double
c
=
2
*
Math
.
atan2
(
Math
.
sqrt
(
a
),
Math
.
sqrt
(
1
-
a
));
double
r
=
(
AVERAGE_RADIUS_OF_EARTH_KM
*
c
)
*
1000
;
int
x
=
(
int
)
r
*
1
;
return
x
;
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_03.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha.PaddyArea
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.example.eketha.LoadingClass
;
import
com.example.eketha.R
;
import
com.google.android.gms.location.LocationListener
;
import
java.util.Timer
;
import
java.util.TimerTask
;
public
class
PaddyAreaView_03
extends
AppCompatActivity
implements
LocationListener
{
Button
btLocation
,
nxt1
,
nxt2
;
TextView
tv_latitude2
,
tv_longitude2
,
tv_lt
,
tv_lg
,
tv_lt1
,
tv_lg1
,
ff
;
private
String
lon1
,
lat1
,
lon2
,
lat2
,
lon3
,
lat3
,
p
;
LocationManager
locationManager
;
private
int
distance
;
private
double
lol
,
loll
,
lol1
,
loll1
;
private
String
fertilizerType
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_paddy_area_view03
);
lat1
=
getIntent
().
getStringExtra
(
"lat1"
);
lon1
=
getIntent
().
getStringExtra
(
"lon1"
);
lat2
=
getIntent
().
getStringExtra
(
"lat2"
);
lon2
=
getIntent
().
getStringExtra
(
"lon2"
);
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
lol
=
Double
.
valueOf
(
lat1
);
loll
=
Double
.
valueOf
(
lon1
);
lol1
=
Double
.
valueOf
(
lat2
);
loll1
=
Double
.
valueOf
(
lon2
);
Log
.
i
(
"gg"
,
lat1
);
Log
.
i
(
"gg"
,
lon1
);
Log
.
i
(
"gg"
,
lat2
);
Log
.
i
(
"gg"
,
lon2
);
btLocation
=
findViewById
(
R
.
id
.
bt_location3
);
nxt1
=
findViewById
(
R
.
id
.
nxt1
);
ff
=
findViewById
(
R
.
id
.
ff
);
nxt2
=
findViewById
(
R
.
id
.
nxt2
);
// tv_lt1 = findViewById(R.id.tv_lt1);
// tv_lg1 = findViewById(R.id.tv_lg1);
nxt2
.
setEnabled
(
false
);
final
LoadingClass
loadingClass
=
new
LoadingClass
(
PaddyAreaView_03
.
this
);
//Runtime permissions
if
(
ContextCompat
.
checkSelfPermission
(
PaddyAreaView_03
.
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
){
ActivityCompat
.
requestPermissions
(
PaddyAreaView_03
.
this
,
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
100
);
}
btLocation
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
//create method
getLocation
();
loadingClass
.
startLoadingDialog
();
new
Timer
().
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
// this code will be executed after 2 seconds
loadingClass
.
dismissDialog
();
}
},
25000
);
}
});
nxt1
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
chg
();
}
});
nxt2
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
naviagte
();
}
});
}
private
void
naviagte
()
{
Intent
intent
=
new
Intent
(
PaddyAreaView_03
.
this
,
PaddyAreaView_04
.
class
);
intent
.
putExtra
(
"distance1"
,
String
.
valueOf
(
distance
));
intent
.
putExtra
(
"lat3"
,
lat3
);
intent
.
putExtra
(
"lon3"
,
lon3
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
startActivity
(
intent
);
}
@SuppressLint
(
"MissingPermission"
)
private
void
getLocation
()
{
try
{
locationManager
=
(
LocationManager
)
getApplicationContext
().
getSystemService
(
LOCATION_SERVICE
);
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
5000
,
5
,
this
::
onLocationChanged
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
@Override
public
void
onLocationChanged
(
@NonNull
Location
location
)
{
// tv_lt1.setText(String.valueOf(location.getLatitude()));
// tv_lg1.setText(String.valueOf(location.getLongitude()));
lon3
=
String
.
valueOf
(
location
.
getLongitude
());
lat3
=
String
.
valueOf
(
location
.
getLatitude
());
nxt2
.
setEnabled
(
true
);
}
private
void
chg
()
{
distance
=
calculateDistanceInKilometer
(
loll
,
lol
,
lol1
,
loll1
);
// distance = calculateDistanceInKilometer(6.927079,79.861244,6.7132734,79.9160491);
// distance = calculateDistanceInKilometer(6.713408110319169,79.91602709961393,6.713184955531217,79.91592511089544);
ff
.
setText
(
String
.
valueOf
(
distance
));
}
public
final
static
double
AVERAGE_RADIUS_OF_EARTH_KM
=
6371
;
public
int
calculateDistanceInKilometer
(
double
userLat
,
double
userLng
,
double
venueLat
,
double
venueLng
)
{
double
latDistance
=
Math
.
toRadians
(
userLat
-
venueLat
);
double
lngDistance
=
Math
.
toRadians
(
userLng
-
venueLng
);
double
a
=
Math
.
sin
(
latDistance
/
2
)
*
Math
.
sin
(
latDistance
/
2
)
+
Math
.
cos
(
Math
.
toRadians
(
userLat
))
*
Math
.
cos
(
Math
.
toRadians
(
venueLat
))
*
Math
.
sin
(
lngDistance
/
2
)
*
Math
.
sin
(
lngDistance
/
2
);
double
c
=
2
*
Math
.
atan2
(
Math
.
sqrt
(
a
),
Math
.
sqrt
(
1
-
a
));
double
r
=
(
AVERAGE_RADIUS_OF_EARTH_KM
*
c
)
*
1000
;
int
x
=
(
int
)
r
*
1
;
return
x
;
}
private
static
double
toRad
(
double
value
)
{
return
value
*
Math
.
PI
/
180
;
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/PaddyArea/PaddyAreaView_04.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha.PaddyArea
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.location.Location
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.example.eketha.LoadingClass
;
import
com.example.eketha.R
;
import
com.google.android.gms.location.LocationListener
;
import
java.util.Timer
;
import
java.util.TimerTask
;
public
class
PaddyAreaView_04
extends
AppCompatActivity
implements
LocationListener
{
Button
btLocation
,
nxt1
;
TextView
tv_lt1
,
tv_lg1
,
tv_lt2
,
tv_lg2
,
d1
,
d2
;
private
String
dstance1
,
lon3
,
lat3
,
lon4
,
lat4
;
LocationManager
locationManager
;
private
String
fertilizerType
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_paddy_area_view04
);
dstance1
=
getIntent
().
getStringExtra
(
"distance1"
);
lat3
=
getIntent
().
getStringExtra
(
"lat3"
);
lon3
=
getIntent
().
getStringExtra
(
"lon3"
);
fertilizerType
=
getIntent
().
getStringExtra
(
"fertilizerType"
);
btLocation
=
findViewById
(
R
.
id
.
bt_location3
);
nxt1
=
findViewById
(
R
.
id
.
nxt1
);
// tv_lt1 = findViewById(R.id.tv_lt1);
// tv_lg1 = findViewById(R.id.tv_lg1);
// d1 = findViewById(R.id.distance1);
// tv_lt2 = findViewById(R.id.tv_lt2);
// tv_lg2 = findViewById(R.id.tv_lg2);
// tv_lt1.setText(lat3);
// tv_lg1.setText(lon3);
// d1.setText(dstance1);
nxt1
.
setEnabled
(
false
);
final
LoadingClass
loadingClass
=
new
LoadingClass
(
PaddyAreaView_04
.
this
);
//Runtime permissions
if
(
ContextCompat
.
checkSelfPermission
(
PaddyAreaView_04
.
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
){
ActivityCompat
.
requestPermissions
(
PaddyAreaView_04
.
this
,
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
100
);
}
btLocation
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
getLocation
();
loadingClass
.
startLoadingDialog
();
new
Timer
().
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
// this code will be executed after 2 seconds
loadingClass
.
dismissDialog
();
}
},
25000
);
}
});
nxt1
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
navigate
();
}
});
}
private
void
navigate
()
{
Intent
intent
=
new
Intent
(
PaddyAreaView_04
.
this
,
PaddyAreaResult
.
class
);
intent
.
putExtra
(
"distance1"
,
dstance1
);
intent
.
putExtra
(
"lat3"
,
lat3
);
intent
.
putExtra
(
"lon3"
,
lon3
);
intent
.
putExtra
(
"lat4"
,
lat4
);
intent
.
putExtra
(
"lon4"
,
lon4
);
intent
.
putExtra
(
"fertilizerType"
,
fertilizerType
);
startActivity
(
intent
);
}
@Override
public
void
onLocationChanged
(
@NonNull
Location
location
)
{
// tv_lt2.setText(String.valueOf(location.getLatitude()));
// tv_lg2.setText(String.valueOf(location.getLongitude()));
lon4
=
String
.
valueOf
(
location
.
getLongitude
());
lat4
=
String
.
valueOf
(
location
.
getLatitude
());
nxt1
.
setEnabled
(
true
);
}
@SuppressLint
(
"MissingPermission"
)
private
void
getLocation
()
{
try
{
locationManager
=
(
LocationManager
)
getApplicationContext
().
getSystemService
(
LOCATION_SERVICE
);
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
5000
,
5
,
this
::
onLocationChanged
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
app/src/main/java/com/example/eketha/fertilizerHome.java
0 → 100644
View file @
8226a8dd
package
com.example.eketha
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
com.example.eketha.PaddyArea.PaddyAreaHome
;
public
class
fertilizerHome
extends
AppCompatActivity
{
private
LinearLayout
layer1
,
layer2
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_fertilizer_home
);
layer1
=
findViewById
(
R
.
id
.
layer2
);
layer2
=
findViewById
(
R
.
id
.
layer3
);
layer1
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
getApplicationContext
(),
Fertilizer
.
class
);
startActivity
(
intent
);
}
});
layer2
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
getApplicationContext
(),
PaddyAreaHome
.
class
);
startActivity
(
intent
);
}
});
}
}
\ No newline at end of file
app/src/main/ml/bmodelTO.tflite
0 → 100644
View file @
8226a8dd
File added
app/src/main/res/drawable/back.png
0 → 100644
View file @
8226a8dd
223 KB
app/src/main/res/layout/activity_fertilizer.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".Fertilizer"
>
<Button
android:id=
"@+id/button3"
android:layout_width=
"300dp"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentBottom=
"true"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"50dp"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"50dp"
android:layout_marginBottom=
"14dp"
android:background=
"@drawable/round_bg"
android:text=
"Area"
android:textAllCaps=
"false"
android:textSize=
"21sp"
android:textStyle=
"bold"
/>
<Button
android:id=
"@+id/button"
android:layout_width=
"300dp"
android:layout_height=
"wrap_content"
android:layout_above=
"@+id/button2"
android:layout_alignParentStart=
"true"
android:layout_alignParentEnd=
"true"
android:layout_marginStart=
"50dp"
android:layout_marginEnd=
"50dp"
android:background=
"@drawable/round_bg"
android:text=
"Take Picture"
android:textAllCaps=
"false"
android:textSize=
"21sp"
android:textStyle=
"bold"
/>
<Button
android:id=
"@+id/button2"
android:layout_width=
"300dp"
android:layout_height=
"wrap_content"
android:layout_alignParentStart=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentBottom=
"true"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"50dp"
android:layout_marginTop=
"3dp"
android:layout_marginEnd=
"50dp"
android:layout_marginBottom=
"65dp"
android:background=
"@drawable/round_bg"
android:text=
"Launch Gallery"
android:textAllCaps=
"false"
android:textSize=
"21sp"
android:textStyle=
"bold"
/>
<ImageView
android:layout_width=
"370sp"
android:layout_height=
"370sp"
android:layout_centerHorizontal=
"true"
android:id=
"@+id/imageView"
android:layout_marginTop=
"10sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:text=
"Classified as:"
android:textStyle=
"bold"
android:textSize=
"20sp"
android:id=
"@+id/classified"
android:layout_below=
"@+id/imageView"
android:layout_marginTop=
"10sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:text=
""
android:textColor=
"#C30000"
android:textStyle=
"bold"
android:textSize=
"27sp"
android:id=
"@+id/result"
android:layout_below=
"@+id/classified"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/activity_fertilizer_guidence.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
android:background=
"@drawable/back"
tools:context=
".FertilizerGuidence"
>
<!-- <de.codecrafters.tableview.TableView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:id="@+id/table_data_view"-->
<!-- app:tableView_columnCount="4"/>-->
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"2dp"
android:text=
"Recommended Fertilizer Dosage"
android:textColor=
"@color/black"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<TableLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@android:color/white"
android:layout_margin=
"20dp"
>
<!-- Table Heading -->
<TableRow
android:background=
"@color/cardview_dark_background"
>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"Age Group"
android:textColor=
"@android:color/white"
android:padding=
"10sp"
android:textSize=
"14sp"
android:layout_weight=
"3"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"Time"
android:textColor=
"@android:color/white"
android:padding=
"10sp"
android:textSize=
"14sp"
android:layout_weight=
"4"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"Dose Kg"
android:textColor=
"@android:color/white"
android:padding=
"10sp"
android:textSize=
"14sp"
android:layout_weight=
"2"
android:gravity=
"center_horizontal"
/>
</TableRow>
<!-- Table Data -->
<TableRow>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"For 3 months"
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"3"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"Basic"
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"4"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
""
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"2"
android:gravity=
"center_horizontal"
android:id=
"@+id/feild_01"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
" "
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"3"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"2nd week"
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"4"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
""
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"2"
android:gravity=
"center_horizontal"
android:id=
"@+id/feild_02"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
" "
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"3"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"4nd week"
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"4"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
""
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"2"
android:gravity=
"center_horizontal"
android:id=
"@+id/feild_03"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
" "
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"3"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"6th week"
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"4"
android:gravity=
"center_horizontal"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
""
android:padding=
"10sp"
android:textSize=
"12sp"
android:layout_weight=
"2"
android:gravity=
"center_horizontal"
android:id=
"@+id/feild_04"
/>
</TableRow>
</TableLayout>
<TextView
android:id=
"@+id/fType"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
""
android:textAlignment=
"textStart"
android:textColor=
"@color/black"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/pArea"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
""
android:textAlignment=
"textStart"
android:textColor=
"@color/black"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="0"-->
<!-- android:id="@+id/d2"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="0"-->
<!-- android:id="@+id/area"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_fertilizer_home.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
tools:context=
".fertilizerHome"
>
<LinearLayout
android:id=
"@+id/layer1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"150dp"
android:layout_height=
"150dp"
android:layout_marginLeft=
"120dp"
android:layout_marginTop=
"30dp"
app:srcCompat=
"@drawable/logo"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:text=
"Fertilizer Home"
android:textColor=
"@color/black"
android:layout_marginTop=
"10dp"
android:layout_marginLeft=
"100dp"
android:textSize=
"30dp"
/>
</LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width=
"match_parent"
android:layout_height=
"173dp"
android:layout_marginRight=
"30dp"
app:cardCornerRadius=
"8dp"
android:layout_marginTop=
"30dp"
android:layout_marginLeft=
"30dp"
>
<LinearLayout
android:id=
"@+id/layer2"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:background=
"@color/black"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:layout_marginLeft=
"30dp"
android:layout_marginTop=
"20dp"
android:layout_marginRight=
"30dp"
>
<ImageView
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"10dp"
app:srcCompat=
"@drawable/logo"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"24dp"
android:layout_marginLeft=
"20dp"
android:layout_marginTop=
"36dp"
android:textColor=
"@color/white"
android:text=
"Fertilizer Type"
/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width=
"match_parent"
android:layout_height=
"173dp"
android:layout_marginRight=
"30dp"
app:cardCornerRadius=
"8dp"
android:layout_marginTop=
"30dp"
android:layout_marginLeft=
"30dp"
>
<LinearLayout
android:id=
"@+id/layer3"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:background=
"@color/black"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:layout_marginLeft=
"30dp"
android:layout_marginTop=
"20dp"
android:layout_marginRight=
"30dp"
>
<ImageView
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"10dp"
app:srcCompat=
"@drawable/logo"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"24dp"
android:layout_marginLeft=
"20dp"
android:layout_marginTop=
"36dp"
android:textColor=
"@color/white"
android:text=
"Paddy Area"
/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_paddy_area_home.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:background=
"@drawable/back"
tools:context=
".PaddyArea.PaddyAreaHome"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Choose the preferred method to the Area of the Paddy"
android:textSize=
"15sp"
android:textStyle=
"bold"
android:textAlignment=
"center"
android:textColor=
"@color/black"
android:layout_marginTop=
"16dp"
/>
<!-- <Button-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/bt_1"-->
<!-- android:text="Image"/>-->
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/bt_2"
android:text=
"Location"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/bt_3"
android:text=
"Input"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_paddy_area_result.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
android:background=
"@drawable/back"
tools:context=
".PaddyArea.PaddyAreaResult"
>
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="0"-->
<!-- android:id="@+id/d1"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="0"-->
<!-- android:id="@+id/d2"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"Paddy Area"
android:textColor=
"@color/black"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"0"
android:id=
"@+id/area"
android:textColor=
"@color/black"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/navigateFertiGuidence"
android:text=
"Get Recommendation"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_paddy_area_text.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:background=
"@drawable/back"
tools:context=
".PaddyArea.PaddyAreaText"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Insert Paddy area in Hectare(ha)"
android:textSize=
"15sp"
android:textStyle=
"bold"
android:textAlignment=
"center"
android:textColor=
"@color/black"
android:layout_marginTop=
"16dp"
/>
<EditText
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAlignment=
"center"
android:textColor=
"@color/black"
android:id=
"@+id/paddyValue"
android:text=
""
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/addPaddyValue"
android:text=
"ADD"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/navigateFertiGuidence"
android:text=
"Get Recommendation"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_paddy_area_view01.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:background=
"@drawable/back"
tools:context=
".PaddyArea.PaddyAreaView_01"
>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/bt_location"
android:text=
"Get Location"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/bt_location1"
android:text=
"next"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_paddy_area_view02.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:background=
"@drawable/back"
tools:context=
".PaddyArea.PaddyAreaView_02"
>
<Button
android:id=
"@+id/bt_location2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Get Location 2"
/>
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="Latitude 01"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_latitude2"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="Longitude 01"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold"-->
<!-- android:textColor="@color/black"-->
<!-- android:layout_marginTop="16dp"/>-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_longitude2"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="Latitude 02"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lt"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="Longitude 02"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold"-->
<!-- android:textColor="@color/black"-->
<!-- android:layout_marginTop="16dp"/>-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lg"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/ff"-->
<!-- android:text="m"-->
<!-- android:textSize="24sp" />-->
<Button
android:id=
"@+id/nxt1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Next"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_paddy_area_view03.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:background=
"@drawable/back"
tools:context=
".PaddyArea.PaddyAreaView_03"
>
<Button
android:id=
"@+id/nxt1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Result - 1"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Distance 1"
android:textSize=
"24sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/ff"
android:text=
"m"
android:textSize=
"24sp"
/>
<Button
android:id=
"@+id/bt_location3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Get Location 3"
/>
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="Latitude 03"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lt1"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="Longitude 03"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold"-->
<!-- android:textColor="@color/black"-->
<!-- android:layout_marginTop="16dp"/>-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lg1"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<Button
android:id=
"@+id/nxt2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Next"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_paddy_area_view04.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
android:gravity=
"center"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:background=
"@drawable/back"
tools:context=
".PaddyArea.PaddyAreaView_04"
>
<Button
android:id=
"@+id/bt_location3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Get Location 4"
/>
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="Latitude 03"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lt1"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="Longitude 03"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold"-->
<!-- android:textColor="@color/black"-->
<!-- android:layout_marginTop="16dp"/>-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lg1"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:text="Latitude 04"-->
<!-- android:textColor="@color/black"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lt2"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="Longitude 04"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold"-->
<!-- android:textColor="@color/black"-->
<!-- android:layout_marginTop="16dp"/>-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/tv_lg2"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/distance1"-->
<!-- android:text="0.0"-->
<!-- android:textSize="24sp" />-->
<Button
android:id=
"@+id/nxt1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Get Result"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/custom_loading_bar.xml
0 → 100644
View file @
8226a8dd
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"50dp"
>
<ProgressBar
android:id=
"@+id/progressBar"
style=
"?android:attr/progressBarStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.498"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.114"
/>
<TextView
android:id=
"@+id/textView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:textAlignment=
"center"
android:text=
"Please wait till we record your Current LOCATION!"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.498"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/progressBar"
app:layout_constraintVertical_bias=
"0.039"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment