Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-129
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
2021-129
2021-129
Commits
9c1ffa66
Commit
9c1ffa66
authored
Nov 23, 2021
by
dilshan-98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integrated
parent
a3ea3bd0
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
393 additions
and
64 deletions
+393
-64
.idea/misc.xml
.idea/misc.xml
+1
-1
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/BackgroundCustomization.java
...tphotoeditor/ImageProcessing/BackgroundCustomization.java
+26
-21
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Backgroundupload.java
...pp/smartphotoeditor/ImageProcessing/Backgroundupload.java
+4
-4
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Blur.java
...n/java/com/app/smartphotoeditor/ImageProcessing/Blur.java
+5
-5
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Bokeh.java
.../java/com/app/smartphotoeditor/ImageProcessing/Bokeh.java
+4
-3
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Constants.java
...a/com/app/smartphotoeditor/ImageProcessing/Constants.java
+1
-1
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Cut.java
...in/java/com/app/smartphotoeditor/ImageProcessing/Cut.java
+4
-4
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/MedBlur.java
...ava/com/app/smartphotoeditor/ImageProcessing/MedBlur.java
+4
-3
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/RetrofitClient.java
.../app/smartphotoeditor/ImageProcessing/RetrofitClient.java
+1
-1
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Selectedit.java
.../com/app/smartphotoeditor/ImageProcessing/Selectedit.java
+4
-5
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Splashedit.java
.../com/app/smartphotoeditor/ImageProcessing/Splashedit.java
+4
-4
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Vignette.java
...va/com/app/smartphotoeditor/ImageProcessing/Vignette.java
+4
-3
app/src/main/java/com/app/smartphotoeditor/activities/EditorActivity.java
...a/com/app/smartphotoeditor/activities/EditorActivity.java
+330
-9
No files found.
.idea/misc.xml
View file @
9c1ffa66
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
_8"
default=
"tru
e"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
1"
default=
"fals
e"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
</component>
<component
name=
"ProjectType"
>
<component
name=
"ProjectType"
>
...
...
app/src/main/AndroidManifest.xml
View file @
9c1ffa66
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
<activity
android:name=
".ImageProcessing.MedBlur"
/>
<activity
android:name=
".ImageProcessing.MedBlur"
/>
<activity
android:name=
".ImageProcessing.BackgroundCustomization"
/>
<activity
android:name=
".ImageProcessing.BackgroundCustomization"
/>
<activity
android:name=
".ImageProcessing.Bokeh"
/>
<activity
android:name=
".ImageProcessing.Bokeh"
/>
<activity
android:name=
".ImageProcessing.Vignette"
/>
<meta-data
<meta-data
...
...
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/BackgroundCustomization.java
View file @
9c1ffa66
...
@@ -31,6 +31,7 @@ import java.io.ByteArrayOutputStream;
...
@@ -31,6 +31,7 @@ import java.io.ByteArrayOutputStream;
import
java.io.File
;
import
java.io.File
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
okhttp3.FormBody
;
import
okhttp3.MediaType
;
import
okhttp3.MediaType
;
import
okhttp3.MultipartBody
;
import
okhttp3.MultipartBody
;
import
okhttp3.OkHttpClient
;
import
okhttp3.OkHttpClient
;
...
@@ -42,7 +43,9 @@ public class BackgroundCustomization extends AppCompatActivity
...
@@ -42,7 +43,9 @@ public class BackgroundCustomization extends AppCompatActivity
private
Button
btnedit
,
btnselectimage
;
private
Button
btnedit
,
btnselectimage
;
private
static
final
String
UPLOAD_IMAGE_URL
=
"http://10.0.2.2:5000/upload"
;
//private static final String UPLOAD_IMAGE_URL = "http://10.0.2.2:5000/upload";
private
static
final
String
UPLOAD_IMAGE_URL
=
"http://2989-112-134-170-172.ngrok.io/upload"
;
ImageView
image
;
ImageView
image
;
String
f_path
,
filePath
,
fileExtn
;
String
f_path
,
filePath
,
fileExtn
;
String
f_extension
;
String
f_extension
;
...
@@ -67,7 +70,7 @@ public class BackgroundCustomization extends AppCompatActivity
...
@@ -67,7 +70,7 @@ public class BackgroundCustomization extends AppCompatActivity
btnedit
=
(
Button
)
findViewById
(
R
.
id
.
btnedit
);
btnedit
=
(
Button
)
findViewById
(
R
.
id
.
btnedit
);
image
=
findViewById
(
R
.
id
.
img
);
image
=
findViewById
(
R
.
id
.
img
);
displayFileChoose
();
//
displayFileChoose();
...
@@ -78,12 +81,12 @@ public class BackgroundCustomization extends AppCompatActivity
...
@@ -78,12 +81,12 @@ public class BackgroundCustomization extends AppCompatActivity
{
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
if
(
filePath
==
null
)
// if(filePath==null)
{
// {
Toast
.
makeText
(
BackgroundCustomization
.
this
,
"Select An Image"
,
Toast
.
LENGTH_LONG
).
show
();
//Toast.makeText(BackgroundCustomization.this,"Select An Image", Toast.LENGTH_LONG).show();
}
else
{
//}else{
//****
progress
=
new
ProgressDialog
(
BackgroundCustomization
.
this
);
progress
=
new
ProgressDialog
(
BackgroundCustomization
.
this
);
progress
.
setTitle
(
"Uploading"
);
progress
.
setTitle
(
"Uploading"
);
progress
.
setMessage
(
"Please Wait..."
);
progress
.
setMessage
(
"Please Wait..."
);
...
@@ -94,11 +97,13 @@ public class BackgroundCustomization extends AppCompatActivity
...
@@ -94,11 +97,13 @@ public class BackgroundCustomization extends AppCompatActivity
f_path
=
filePath
;
f_path
=
filePath
;
f_extension
=
fileExtn
;
f_extension
=
fileExtn
;
try
try
{
{
if
(
fileExtn
.
equals
(
"img"
)
||
fileExtn
.
equals
(
"jpg"
)
||
fileExtn
.
equals
(
"jpeg"
)
||
fileExtn
.
equals
(
"gif"
)
||
fileExtn
.
equals
(
"png"
))
{
//
if(fileExtn.equals("img") || fileExtn.equals("jpg") || fileExtn.equals("jpeg") || fileExtn.equals("gif") || fileExtn.equals("png")) {
Toast
.
makeText
(
BackgroundCustomization
.
this
,
filePath
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(BackgroundCustomization.this, filePath, Toast.LENGTH_SHORT).show();
Thread
t
=
new
Thread
(
new
Runnable
()
Thread
t
=
new
Thread
(
new
Runnable
()
{
{
...
@@ -108,20 +113,20 @@ public class BackgroundCustomization extends AppCompatActivity
...
@@ -108,20 +113,20 @@ public class BackgroundCustomization extends AppCompatActivity
//To upload the image to server
//To upload the image to server
String
input
=
convert
(
ImageList
.
getInstance
().
getCurrentBitmap
());
String
input
=
convert
(
ImageList
.
getInstance
().
getCurrentBitmap
());
System
.
out
.
println
(
input
);
System
.
out
.
println
(
input
);
File
file
=
new
File
(
f_path
);
//
File file = new File(f_path);
String
content_type
=
MimeTypeMap
.
getSingleton
().
getMimeTypeFromExtension
(
f_extension
);
//
String content_type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(f_extension);
OkHttpClient
okHttpClient
=
new
OkHttpClient
().
newBuilder
()
OkHttpClient
okHttpClient
=
new
OkHttpClient
().
newBuilder
()
.
connectTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
connectTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
build
();
.
build
();
RequestBody
file_body
=
RequestBody
.
create
(
MediaType
.
parse
(
content_type
),
file
);
//RequestBody file_body = RequestBody.create(MediaType.parse(content_type), file);
RequestBody
request_body
=
new
FormBody
.
Builder
()
RequestBody
request_body
=
new
MultipartBody
.
Builder
()
.
add
(
"image"
,
input
)
.
setType
(
MultipartBody
.
FORM
)
//.addFormDataPart("image", f_path.substring(f_path.lastIndexOf("/") +1), file_body)
.
addFormDataPart
(
"type"
,
content_type
)
.
addFormDataPart
(
"image"
,
f_path
.
substring
(
f_path
.
lastIndexOf
(
"/"
)
+
1
),
file_body
)
.
build
();
.
build
();
Request
request
=
new
Request
.
Builder
()
Request
request
=
new
Request
.
Builder
()
...
@@ -145,14 +150,14 @@ public class BackgroundCustomization extends AppCompatActivity
...
@@ -145,14 +150,14 @@ public class BackgroundCustomization extends AppCompatActivity
}
}
});
});
t
.
start
();
t
.
start
();
}
else
//
}else
{
//
{
}
//
}
}
catch
(
Exception
e
)
}
catch
(
Exception
e
)
{
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
//******
}
//
}
}
}
});
});
...
...
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Backgroundupload.java
View file @
9c1ffa66
...
@@ -38,7 +38,7 @@ public class Backgroundupload extends AppCompatActivity {
...
@@ -38,7 +38,7 @@ public class Backgroundupload extends AppCompatActivity {
private
Button
btncutprocess
,
btnselectimage
;
private
Button
btncutprocess
,
btnselectimage
;
ImageView
image
;
ImageView
image
;
private
static
final
String
UPLOAD_IMAGE_URL
=
"http://
10.0.2.2:5000/upload
"
;
private
static
final
String
UPLOAD_IMAGE_URL
=
"http://
727a-112-134-169-152.ngrok.io/uploadbg
"
;
String
f_path
,
filePath
,
fileExtn
;
String
f_path
,
filePath
,
fileExtn
;
String
f_extension
;
String
f_extension
;
ProgressDialog
progress
;
ProgressDialog
progress
;
...
@@ -136,11 +136,11 @@ public class Backgroundupload extends AppCompatActivity {
...
@@ -136,11 +136,11 @@ public class Backgroundupload extends AppCompatActivity {
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
retrofit2
.
Response
<
ResponseBody
>
response
)
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
retrofit2
.
Response
<
ResponseBody
>
response
)
{
{
try
{
try
{
String
s
=
response
.
body
().
string
();
//
String s = response.body().string();
Toast
.
makeText
(
Backgroundupload
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(Backgroundupload.this, s, Toast.LENGTH_LONG).show();
progress
.
dismiss
();
progress
.
dismiss
();
openCutActivity
();
openCutActivity
();
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Blur.java
View file @
9c1ffa66
...
@@ -9,6 +9,7 @@ import android.widget.Button;
...
@@ -9,6 +9,7 @@ import android.widget.Button;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.activities.EditorActivity
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
...
@@ -33,20 +34,19 @@ public class Blur extends AppCompatActivity {
...
@@ -33,20 +34,19 @@ public class Blur extends AppCompatActivity {
.
networkPolicy
(
NetworkPolicy
.
NO_CACHE
)
.
networkPolicy
(
NetworkPolicy
.
NO_CACHE
)
.
memoryPolicy
(
MemoryPolicy
.
NO_CACHE
)
.
memoryPolicy
(
MemoryPolicy
.
NO_CACHE
)
.
resize
(
300
,
300
)
.
resize
(
300
,
300
)
.
into
(
imgView
);
.
into
(
imgView
);
//
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
open
SelecteditAc
tivity
();
open
EditorAci
tivity
();
}
}
});
});
}
}
public
void
openSelecteditActivity
()
public
void
openEditorAcitivity
()
{
{
Intent
intent
=
new
Intent
(
this
,
EditorActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
Selectedit
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Bokeh.java
View file @
9c1ffa66
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.activities.EditorActivity
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
...
@@ -38,13 +39,13 @@ public class Bokeh extends AppCompatActivity {
...
@@ -38,13 +39,13 @@ public class Bokeh extends AppCompatActivity {
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
open
Selectedit
Acitivity
();
open
Editor
Acitivity
();
}
}
});
});
}
}
public
void
open
Selectedit
Acitivity
()
{
public
void
open
Editor
Acitivity
()
{
Intent
intent
=
new
Intent
(
this
,
Selectedit
.
class
);
Intent
intent
=
new
Intent
(
this
,
EditorActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
...
...
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Constants.java
View file @
9c1ffa66
...
@@ -3,6 +3,6 @@ package com.app.smartphotoeditor.ImageProcessing;
...
@@ -3,6 +3,6 @@ package com.app.smartphotoeditor.ImageProcessing;
public
class
Constants
{
public
class
Constants
{
// This should be replaced with the server link when server starts running
// This should be replaced with the server link when server starts running
public
static
final
String
IMGLINK
=
"
4e11-112-134-169-3
2"
;
public
static
final
String
IMGLINK
=
"
727a-112-134-169-15
2"
;
}
}
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Cut.java
View file @
9c1ffa66
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.activities.EditorActivity
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
...
@@ -38,14 +39,13 @@ public class Cut extends AppCompatActivity {
...
@@ -38,14 +39,13 @@ public class Cut extends AppCompatActivity {
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
open
SelecteditAc
tivity
();
open
EditorAci
tivity
();
}
}
});
});
}
}
public
void
openSelecteditActivity
()
public
void
openEditorAcitivity
()
{
{
Intent
intent
=
new
Intent
(
this
,
EditorActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
Selectedit
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/MedBlur.java
View file @
9c1ffa66
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.activities.EditorActivity
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
...
@@ -38,13 +39,13 @@ public class MedBlur extends AppCompatActivity {
...
@@ -38,13 +39,13 @@ public class MedBlur extends AppCompatActivity {
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
open
Selectedit
Acitivity
();
open
Editor
Acitivity
();
}
}
});
});
}
}
public
void
open
Selectedit
Acitivity
()
{
public
void
open
Editor
Acitivity
()
{
Intent
intent
=
new
Intent
(
this
,
Selectedit
.
class
);
Intent
intent
=
new
Intent
(
this
,
EditorActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/RetrofitClient.java
View file @
9c1ffa66
...
@@ -9,7 +9,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
...
@@ -9,7 +9,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
public
class
RetrofitClient
{
public
class
RetrofitClient
{
// private static final String baseurl="http://10.0.2.15:5000";
// private static final String baseurl="http://10.0.2.15:5000";
private
static
final
String
baseurl
=
"http://
4e11-112-134-169-3
2.ngrok.io"
;
private
static
final
String
baseurl
=
"http://
727a-112-134-169-15
2.ngrok.io"
;
private
static
RetrofitClient
mInstance
;
private
static
RetrofitClient
mInstance
;
private
Retrofit
retrofit
;
private
Retrofit
retrofit
;
...
...
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Selectedit.java
View file @
9c1ffa66
...
@@ -44,7 +44,7 @@ public class Selectedit extends AppCompatActivity {
...
@@ -44,7 +44,7 @@ public class Selectedit extends AppCompatActivity {
Picasso
Picasso
.
get
()
.
get
()
.
load
(
"https:///"
+
Constants
.
IMGLINK
+
".ngrok.io/static/
masked
.jpg"
)
.
load
(
"https:///"
+
Constants
.
IMGLINK
+
".ngrok.io/static/
theimage
.jpg"
)
.
placeholder
(
R
.
drawable
.
progress_bar_material
)
.
placeholder
(
R
.
drawable
.
progress_bar_material
)
.
resize
(
300
,
300
)
.
resize
(
300
,
300
)
.
networkPolicy
(
NetworkPolicy
.
NO_CACHE
)
.
networkPolicy
(
NetworkPolicy
.
NO_CACHE
)
...
@@ -82,7 +82,6 @@ public class Selectedit extends AppCompatActivity {
...
@@ -82,7 +82,6 @@ public class Selectedit extends AppCompatActivity {
try
{
try
{
String
s
=
response
.
body
().
string
();
String
s
=
response
.
body
().
string
();
Toast
.
makeText
(
Selectedit
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
Selectedit
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
progress
.
dismiss
();
openBlurActivity
();
openBlurActivity
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -126,11 +125,11 @@ public class Selectedit extends AppCompatActivity {
...
@@ -126,11 +125,11 @@ public class Selectedit extends AppCompatActivity {
@Override
@Override
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
Response
<
ResponseBody
>
response
)
{
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
Response
<
ResponseBody
>
response
)
{
try
{
try
{
String
s
=
response
.
body
().
string
();
//
String s = response.body().string();
Toast
.
makeText
(
Selectedit
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(Selectedit.this, s, Toast.LENGTH_LONG).show();
progress
.
dismiss
();
progress
.
dismiss
();
openBokehActivity
();
openBokehActivity
();
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
...
...
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Splashedit.java
View file @
9c1ffa66
...
@@ -9,6 +9,7 @@ import android.widget.Button;
...
@@ -9,6 +9,7 @@ import android.widget.Button;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.activities.EditorActivity
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
...
@@ -41,14 +42,13 @@ public class Splashedit extends AppCompatActivity {
...
@@ -41,14 +42,13 @@ public class Splashedit extends AppCompatActivity {
@Override
@Override
public
void
onClick
(
View
v
)
public
void
onClick
(
View
v
)
{
{
open
SelecteditAc
tivity
();
open
EditorAci
tivity
();
}
}
});
});
}
}
public
void
openSelecteditActivity
()
public
void
openEditorAcitivity
()
{
{
Intent
intent
=
new
Intent
(
this
,
EditorActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
Selectedit
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/app/smartphotoeditor/ImageProcessing/Vignette.java
View file @
9c1ffa66
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
...
@@ -9,6 +9,7 @@ import android.widget.ImageView;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.R
;
import
com.app.smartphotoeditor.activities.EditorActivity
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.MemoryPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.NetworkPolicy
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
...
@@ -38,13 +39,13 @@ public class Vignette extends AppCompatActivity {
...
@@ -38,13 +39,13 @@ public class Vignette extends AppCompatActivity {
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btnBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
open
Selectedit
Acitivity
();
open
Editor
Acitivity
();
}
}
});
});
}
}
public
void
open
Selectedit
Acitivity
()
{
public
void
open
Editor
Acitivity
()
{
Intent
intent
=
new
Intent
(
this
,
Selectedit
.
class
);
Intent
intent
=
new
Intent
(
this
,
EditorActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/app/smartphotoeditor/activities/EditorActivity.java
View file @
9c1ffa66
package
com.app.smartphotoeditor.activities
;
package
com.app.smartphotoeditor.activities
;
import
android.app.ProgressDialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BitmapFactory
;
...
@@ -16,6 +18,11 @@ import androidx.appcompat.app.AppCompatActivity;
...
@@ -16,6 +18,11 @@ import androidx.appcompat.app.AppCompatActivity;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.app.smartphotoeditor.ImageProcessing.Backgroundupload
;
import
com.app.smartphotoeditor.ImageProcessing.RetrofitClient
;
import
com.app.smartphotoeditor.ImageProcessing.Selectedit
;
import
com.app.smartphotoeditor.ImageProcessing.Vignette
;
import
com.app.smartphotoeditor.config.ImageList
;
import
com.app.smartphotoeditor.config.ImageList
;
import
com.app.smartphotoeditor.ImageProcessing.BackgroundCustomization
;
import
com.app.smartphotoeditor.ImageProcessing.BackgroundCustomization
;
...
@@ -42,6 +49,16 @@ import org.opencv.core.Mat;
...
@@ -42,6 +49,16 @@ import org.opencv.core.Mat;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.concurrent.TimeUnit
;
import
okhttp3.FormBody
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
okhttp3.RequestBody
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
public
class
EditorActivity
extends
AppCompatActivity
public
class
EditorActivity
extends
AppCompatActivity
...
@@ -59,6 +76,10 @@ public class EditorActivity extends AppCompatActivity
...
@@ -59,6 +76,10 @@ public class EditorActivity extends AppCompatActivity
private
ArrayList
<
View
>
viewsInDisplay
=
new
ArrayList
<>();
private
ArrayList
<
View
>
viewsInDisplay
=
new
ArrayList
<>();
private
static
final
String
UPLOAD_IMAGE_URL
=
"http://727a-112-134-169-152.ngrok.io/upload"
;
ProgressDialog
progress
;
@Override
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
...
@@ -92,7 +113,57 @@ public class EditorActivity extends AppCompatActivity
...
@@ -92,7 +113,57 @@ public class EditorActivity extends AppCompatActivity
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_editor
);
setContentView
(
R
.
layout
.
activity_editor
);
progress
=
new
ProgressDialog
(
EditorActivity
.
this
);
progress
.
setTitle
(
"Uploading"
);
progress
.
setMessage
(
"Please Wait..."
);
progress
.
show
();
progress
.
setCancelable
(
false
);
progress
.
setCanceledOnTouchOutside
(
false
);
try
{
Thread
t
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
String
input
=
convert
(
ImageList
.
getInstance
().
getCurrentBitmap
());
System
.
out
.
println
(
input
);
OkHttpClient
okHttpClient
=
new
OkHttpClient
().
newBuilder
()
.
connectTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
320
,
TimeUnit
.
SECONDS
)
.
build
();
RequestBody
request_body
=
new
FormBody
.
Builder
()
.
add
(
"image"
,
input
)
.
build
();
Request
request
=
new
Request
.
Builder
()
.
url
(
UPLOAD_IMAGE_URL
)
.
post
(
request_body
)
.
build
();
try
{
okHttpClient
.
newCall
(
request
).
execute
();
progress
.
dismiss
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
progress
.
dismiss
();
}
}
});
t
.
start
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
tools_rv
=
findViewById
(
R
.
id
.
tools_rv
);
tools_rv
=
findViewById
(
R
.
id
.
tools_rv
);
...
@@ -114,19 +185,224 @@ public class EditorActivity extends AppCompatActivity
...
@@ -114,19 +185,224 @@ public class EditorActivity extends AppCompatActivity
intent
=
new
Intent
(
getApplicationContext
(),
RestorationActivity
.
class
);
intent
=
new
Intent
(
getApplicationContext
(),
RestorationActivity
.
class
);
else
if
(
clickedPos
==
5
)
else
if
(
clickedPos
==
5
)
intent
=
new
Intent
(
getApplicationContext
(),
LowLightEnhanceActivity
.
class
);
intent
=
new
Intent
(
getApplicationContext
(),
LowLightEnhanceActivity
.
class
);
else
if
(
clickedPos
==
6
)
else
if
(
clickedPos
==
6
)
{
intent
=
new
Intent
(
getApplicationContext
(),
MedBlur
.
class
);
progress
=
new
ProgressDialog
(
EditorActivity
.
this
);
progress
.
setTitle
(
"Loading"
);
progress
.
setMessage
(
"Please Wait..."
);
progress
.
show
();
progress
.
setCancelable
(
false
);
progress
.
setCanceledOnTouchOutside
(
false
);
Thread
t
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Call
<
ResponseBody
>
call
=
RetrofitClient
.
getInstance
()
.
getApi
()
.
medblur
();
call
.
enqueue
(
new
Callback
<
ResponseBody
>()
{
@Override
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
Response
<
ResponseBody
>
response
)
{
try
{
String
s
=
response
.
body
().
string
();
Toast
.
makeText
(
EditorActivity
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
progress
.
dismiss
();
openMedBlurActivity
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
Call
<
ResponseBody
>
call
,
Throwable
t
)
{
progress
.
dismiss
();
Toast
.
makeText
(
EditorActivity
.
this
,
t
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
});
}
});
t
.
start
();
// intent = new Intent(getApplicationContext(), MedBlur.class);
}
else
if
(
clickedPos
==
7
)
{
else
if
(
clickedPos
==
7
)
{
intent
=
new
Intent
(
getApplicationContext
(),
BackgroundCustomization
.
class
);
openCutActivity
();
//intent = new Intent(getApplicationContext(), Backgroundupload.class);
}
}
else
if
(
clickedPos
==
8
){
else
if
(
clickedPos
==
8
){
intent
=
new
Intent
(
getApplicationContext
(),
Blur
.
class
);
}
else
if
(
clickedPos
==
9
)
intent
=
new
Intent
(
getApplicationContext
(),
Bokeh
.
class
);
else
if
(
clickedPos
==
10
)
intent
=
new
Intent
(
getApplicationContext
(),
Splashedit
.
class
);
progress
=
new
ProgressDialog
(
EditorActivity
.
this
);
progress
.
setTitle
(
"Loading"
);
progress
.
setMessage
(
"Please wait..."
);
progress
.
show
();
progress
.
setCancelable
(
false
);
progress
.
setCanceledOnTouchOutside
(
false
);
Thread
t
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Call
<
ResponseBody
>
call
=
RetrofitClient
.
getInstance
()
.
getApi
()
.
blur
();
call
.
enqueue
(
new
Callback
<
ResponseBody
>()
{
@Override
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
Response
<
ResponseBody
>
response
)
{
try
{
String
s
=
response
.
body
().
string
();
Toast
.
makeText
(
EditorActivity
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
openBlurActivity
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
Call
<
ResponseBody
>
call
,
Throwable
t
)
{
progress
.
dismiss
();
Toast
.
makeText
(
EditorActivity
.
this
,
t
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
});
}
});
t
.
start
();
//intent = new Intent(getApplicationContext(), Blur.class);
}
else
if
(
clickedPos
==
9
)
{
progress
=
new
ProgressDialog
(
EditorActivity
.
this
);
progress
.
setTitle
(
"Loading"
);
progress
.
setMessage
(
"Please Wait..."
);
progress
.
show
();
progress
.
setCancelable
(
false
);
progress
.
setCanceledOnTouchOutside
(
false
);
Thread
t
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Call
<
ResponseBody
>
call
=
RetrofitClient
.
getInstance
()
.
getApi
()
.
bokeh
();
call
.
enqueue
(
new
Callback
<
ResponseBody
>()
{
@Override
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
Response
<
ResponseBody
>
response
)
{
try
{
String
s
=
response
.
body
().
string
();
Toast
.
makeText
(
EditorActivity
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
progress
.
dismiss
();
openBokehActivity
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
Call
<
ResponseBody
>
call
,
Throwable
t
)
{
progress
.
dismiss
();
Toast
.
makeText
(
EditorActivity
.
this
,
t
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
});
}
});
t
.
start
();
//intent = new Intent(getApplicationContext(), Bokeh.class);
}
else
if
(
clickedPos
==
10
)
{
// progress = new ProgressDialog(EditorActivity.this);
// progress.setTitle("Loading");
// progress.setMessage("Please Wait...");
// progress.show();
// progress.setCancelable(false);
// progress.setCanceledOnTouchOutside(false);
//
// Thread t = new Thread(new Runnable() {
// @Override
// public void run() {
//
// Call<ResponseBody> call = RetrofitClient
// .getInstance()
// .getApi()
// .vignette();
//
// call.enqueue(new Callback<ResponseBody>() {
// @Override
// public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
// try {
// String s = response.body().string();
// Toast.makeText(EditorActivity.this, s, Toast.LENGTH_LONG).show();
// progress.dismiss();
// openVignetteActivity();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public void onFailure(Call<ResponseBody> call, Throwable t) {
// progress.dismiss();
// Toast.makeText(EditorActivity.this, t.getMessage(), Toast.LENGTH_LONG).show();
// }
// });
// }
// });
// t.start();
progress
=
new
ProgressDialog
(
EditorActivity
.
this
);
progress
.
setTitle
(
"Loading"
);
progress
.
setMessage
(
"Please wait..."
);
progress
.
show
();
progress
.
setCancelable
(
false
);
progress
.
setCanceledOnTouchOutside
(
false
);
Thread
t
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Call
<
ResponseBody
>
call
=
RetrofitClient
.
getInstance
()
.
getApi
()
.
splash
();
call
.
enqueue
(
new
Callback
<
ResponseBody
>()
{
@Override
public
void
onResponse
(
Call
<
ResponseBody
>
call
,
Response
<
ResponseBody
>
response
)
{
try
{
String
s
=
response
.
body
().
string
();
Toast
.
makeText
(
EditorActivity
.
this
,
s
,
Toast
.
LENGTH_LONG
).
show
();
progress
.
dismiss
();
openSplashActivity
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
Call
<
ResponseBody
>
call
,
Throwable
t
)
{
progress
.
dismiss
();
Toast
.
makeText
(
EditorActivity
.
this
,
t
.
getMessage
(),
Toast
.
LENGTH_LONG
).
show
();
}
});
}
});
t
.
start
();
//intent = new Intent(getApplicationContext(), Splashedit.class);
}
if
(
intent
!=
null
)
if
(
intent
!=
null
)
{
{
...
@@ -406,4 +682,49 @@ public class EditorActivity extends AppCompatActivity
...
@@ -406,4 +682,49 @@ public class EditorActivity extends AppCompatActivity
});
});
}
}
public
static
Bitmap
convert
(
String
base64Str
)
throws
IllegalArgumentException
{
byte
[]
decodedBytes
=
Base64
.
decode
(
base64Str
.
substring
(
base64Str
.
indexOf
(
","
)
+
1
),
Base64
.
DEFAULT
);
return
BitmapFactory
.
decodeByteArray
(
decodedBytes
,
0
,
decodedBytes
.
length
);
}
public
static
String
convert
(
Bitmap
bitmap
)
{
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
100
,
outputStream
);
return
Base64
.
encodeToString
(
outputStream
.
toByteArray
(),
Base64
.
DEFAULT
);
}
public
void
openBlurActivity
()
{
Intent
intent
=
new
Intent
(
this
,
Blur
.
class
);
startActivity
(
intent
);
}
public
void
openSplashActivity
()
{
Intent
intent
=
new
Intent
(
this
,
Splashedit
.
class
);
startActivity
(
intent
);
}
public
void
openCutActivity
()
{
Intent
intent
=
new
Intent
(
this
,
Backgroundupload
.
class
);
startActivity
(
intent
);
}
public
void
openBokehActivity
()
{
Intent
intent
=
new
Intent
(
this
,
Bokeh
.
class
);
startActivity
(
intent
);
}
public
void
openVignetteActivity
()
{
Intent
intent
=
new
Intent
(
this
,
Vignette
.
class
);
startActivity
(
intent
);
}
public
void
openMedBlurActivity
()
{
Intent
intent
=
new
Intent
(
this
,
MedBlur
.
class
);
startActivity
(
intent
);
}
}
}
\ 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