Commit 351dc041 authored by Samesh Buddhika Alahakoon's avatar Samesh Buddhika Alahakoon

Merge branch 'IT18109672' into 'master'

It18109672

See merge request !36
parents 23463232 6414e808
......@@ -17,7 +17,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
......
......@@ -21,11 +21,13 @@ import com.app.smartphotoeditor.adapters.FilterAdapter;
import com.app.smartphotoeditor.config.ImageList;
import com.app.smartphotoeditor.listeners.OnBitmapChanged;
import com.app.smartphotoeditor.listeners.OnCameraPreviewChanged;
import com.app.smartphotoeditor.listeners.OnVoiceCommandResultChanged;
import com.app.smartphotoeditor.listeners.ml.OnEyeStatusChanged;
import com.app.smartphotoeditor.listeners.ml.OnGestureDetected;
import com.app.smartphotoeditor.sdk.Methods;
import com.app.smartphotoeditor.sdk.RealTimeCamera;
import com.app.smartphotoeditor.services.ComputerVision;
import com.app.smartphotoeditor.services.SpeechService;
import com.bumptech.glide.Glide;
import com.warkiz.tickseekbar.OnSeekChangeListener;
import com.warkiz.tickseekbar.SeekParams;
......@@ -47,7 +49,7 @@ import java.util.List;
public class AddEffects extends AppCompatActivity
implements OnBitmapChanged,
OnGestureDetected,OnEyeStatusChanged{
OnGestureDetected,OnEyeStatusChanged, OnVoiceCommandResultChanged {
static
{
......@@ -66,7 +68,6 @@ public class AddEffects extends AppCompatActivity
private TickSeekBar listener,listener2,listener3;
private Bitmap subFilterBitmap = null;
private boolean isAnEffectAdded = false;
private boolean isAllowedToChangeFilters = true;
......@@ -77,38 +78,35 @@ public class AddEffects extends AppCompatActivity
private ComputerVision computerVision;
int count = 0;
int count2 = 0;
boolean isPossible = true;
private SpeechService speechService;
@Override
protected void onDestroy()
{
super.onDestroy();
protected void onResume() {
super.onResume();
speechService.onResume();
}
@Override
public void onBackPressed()
{
if(subFiltersLayout.getVisibility() == View.VISIBLE)
{
subFiltersLayout.setVisibility(View.GONE);
}
else
{
super.onBackPressed();
}
protected void onPause() {
super.onPause();
speechService.onPause();
}
@Override
protected void onStop() {
super.onStop();
speechService.onStop();
}
@Override
protected void onDestroy()
{
super.onDestroy();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -137,6 +135,8 @@ public class AddEffects extends AppCompatActivity
init();
setData();
speechService = new SpeechService(getApplicationContext(),findViewById(R.id.progress),this);
}
private void setPreviewFrame(Mat previewMat)
{
......@@ -281,7 +281,6 @@ public class AddEffects extends AppCompatActivity
Glide.with(getApplicationContext()).load(subFilterBitmap).into(userSelectedImage);
isAnEffectAdded = true;
}
......@@ -293,7 +292,6 @@ public class AddEffects extends AppCompatActivity
listener2.setProgress(0);
listener3.setProgress(0);
subFilterBitmap = null;
isAnEffectAdded = true;
currentEditingBitmap = bitmap;
......@@ -322,7 +320,13 @@ public class AddEffects extends AppCompatActivity
void findViewPoint(int x,int y)
{
ImageView cursor = findViewById(R.id.cursor);
int viewMaxX = 0;
int viewMaxY = 0;
for(View view : viewsInDisplay)
{
int[] location = new int[2];
......@@ -331,6 +335,10 @@ public class AddEffects extends AppCompatActivity
int viewX = location[0] + (view.getWidth() / 2);
int viewY = location[1] / 2;
if(viewX >= viewMaxX)
{
viewMaxX = viewX;
}
if(viewY >= viewMaxY)
{
viewMaxY = viewY;
......@@ -338,130 +346,50 @@ public class AddEffects extends AppCompatActivity
}
ImageView b = findViewById(R.id.cursor);
if(x == 620 || x == 720 || x == 360)
if(x > viewMaxX)
{
viewsInDisplay.get(1).setBackgroundColor(Color.RED);
viewsInDisplay.get(0).setBackgroundColor(Color.BLACK);
x = viewMaxX;
}
else
if(y > viewMaxY)
{
viewsInDisplay.get(0).setBackgroundColor(Color.RED);
viewsInDisplay.get(1).setBackgroundColor(Color.BLACK);
y = viewMaxY;
}
b.animate().x(x);
b.animate().y(viewMaxY);
Log.d("XXXXXX","x-" + x);
// ImageView b = findViewById(R.id.cursor);
//
//
// int viewMaxX = 0;
// int viewMaxY = 0;
//
//
//
// for(View view : viewsInDisplay)
// {
// int[] location = new int[2];
// view.getLocationOnScreen(location);
//
// int viewX = location[0] + (view.getWidth() / 2);
// int viewY = location[1] / 2;
//
// if(viewX >= viewMaxX)
// {
// viewMaxX = viewX;
// }
// if(viewY >= viewMaxY)
// {
// viewMaxY = viewY;
// }
//
// }
//
// if(x > viewMaxX)
// {
// x = viewMaxX;
// }
// if(y > viewMaxY)
// {
// y = viewMaxY;
// }
//
//
//
//
//
//
//
//
// for(View view : viewsInDisplay)
// {
// int[] location = new int[2];
// view.getLocationOnScreen(location);
//
// int viewX = location[0];
// int viewY = location[1];
//
//
// int viewMaxWidth = viewX + view.getWidth();
// int viewMinWidth = viewX - view.getWidth();
//
// int viewMaxHeight = viewY + view.getHeight();
// int viewMinHeight = viewY - view.getHeight();
//
//
// if ((x >= viewMinWidth && x <= viewMaxWidth))
// {
//
// if(lastLookedView != null && lastLookedView.getId() == view.getId())
// {
// count++;
// if(count >= 3)
// {
// //lock for some seconds
// isPossible = false;
// }
// if(count >= 10)
// {
// count = 0;
// isPossible = true;
// lastLookedView = null;
// }
// }
// else
// {
// count = 0;
// }
//
// if(isPossible)
// {
// view.setBackgroundColor(Color.RED);
// b.animate().x((viewMinWidth + viewMaxWidth) / 2);
// b.animate().y((viewMinHeight + viewMaxHeight) / 2);
// lastLookedView = view;
// }
// else
// {
// lastLookedView.setBackgroundColor(Color.RED);
// }
//
//
// }
// else
// {
// view.setBackgroundColor(Color.BLACK);
// }
//
// }
// b.animate().x(x);
// b.animate().y(y);
for(View view : viewsInDisplay)
{
int[] location = new int[2];
view.getLocationOnScreen(location);
int viewX = location[0];
int viewY = location[1];
int viewMaxWidth = viewX + view.getWidth();
int viewMinWidth = viewX - view.getWidth();
int viewMaxHeight = viewY + view.getHeight();
int viewMinHeight = viewY - view.getHeight();
if ((x >= viewMinWidth && x <= viewMaxWidth))
{
view.setBackgroundColor(Color.RED);
cursor.animate().x((viewMinWidth + viewMaxWidth) / 2);
cursor.animate().y((viewMinHeight + viewMaxHeight) / 2);
}
else
{
view.setBackgroundColor(Color.BLACK);
}
}
cursor.animate().x(x);
cursor.animate().y(y);
}
@Override
......@@ -482,26 +410,6 @@ public class AddEffects extends AppCompatActivity
@Override
public void onPupilChanged(Mat binary,int x, int y,int range,int pupilX)
{
// try
// {
// Methods.saveImage(getApplicationContext(),Methods.matToBit(binary),"Right");
// }
// catch (IOException e)
// {
// e.printStackTrace();
// }
runOnUiThread(new Runnable()
{
@Override
public void run()
{
//setPreviewFrame(binary);
ProgressBar bar = findViewById(R.id.progress);
bar.setMax(range);
bar.setProgress(pupilX);
}
});
findViewPoint(x,y);
}
......@@ -559,9 +467,11 @@ public class AddEffects extends AppCompatActivity
public void Save(View view)
{
ImageList.getInstance().addBitmap(currentEditingBitmap,true);
if(currentEditingBitmap != null)
{
ImageList.getInstance().addBitmap(currentEditingBitmap,true);
}
Back(null);
}
public void Back(View view)
......@@ -569,4 +479,36 @@ public class AddEffects extends AppCompatActivity
setResult(100);
finish();
}
@Override
public void back() {
Back(null);
}
@Override
public void exit() {
}
@Override
public void undo() {
}
@Override
public void redo() {
}
@Override
public void save() {
Save(null);
}
@Override
public void select() {
}
}
......@@ -49,6 +49,7 @@ public class AdjustBrightness extends AppCompatActivity
private SpeechService speechService;
@Override
protected void onResume() {
super.onResume();
......@@ -74,7 +75,7 @@ public class AdjustBrightness extends AppCompatActivity
setContentView(R.layout.activity_adjust_brightness);
viewsInDisplay.add(findViewById(R.id.back));
viewsInDisplay.add(findViewById(R.id.save));
viewsInDisplay.add(findViewById(R.id.select_btn));
computerVision = new ComputerVision(this,this,this);
......@@ -163,17 +164,10 @@ public class AdjustBrightness extends AppCompatActivity
}
void findViewPoint(int x,int y)
{
//if(!isPossible) return;
ImageView b = findViewById(R.id.cursor);
ImageView cursor = findViewById(R.id.cursor);
int viewMaxX = 0;
int viewMinX = 0;
int viewMaxY = 0;
int viewMinY = 0;
......@@ -206,23 +200,6 @@ public class AdjustBrightness extends AppCompatActivity
}
//
// b.animate().x(x);
// b.animate().y(y);
for(View view : viewsInDisplay)
{
int[] location = new int[2];
......@@ -231,16 +208,6 @@ public class AdjustBrightness extends AppCompatActivity
int viewX = location[0];
int viewY = location[1];
// if(viewX >= viewMaxX)
// {
// viewMaxX = viewX;
// }
// if(viewY >= viewMaxY)
// {
// viewMaxY = viewY;
// }
Log.d("aaaaaaaaaaaa", "View=" + view.getId() + "X=" + viewX + ", Y=" + viewY);
int viewMaxWidth = viewX + view.getWidth();
int viewMinWidth = viewX - view.getWidth();
......@@ -248,40 +215,14 @@ public class AdjustBrightness extends AppCompatActivity
int viewMaxHeight = viewY + view.getHeight();
int viewMinHeight = viewY - view.getHeight();
//b.animate().y((viewMinHeight + viewMaxHeight) / 2);
if ((x >= viewMinWidth && x <= viewMaxWidth))
{
if(lastLookedView != null && lastLookedView.getId() == view.getId())
{
count++;
}
else
{
count = 0;
}
if(count >= 3)
{
isPossible = false;
checkCount();
}
view.setBackgroundColor(Color.RED);
b.animate().x((viewMinWidth + viewMaxWidth) / 2);
b.animate().y((viewMinHeight + viewMaxHeight) / 2);
Log.d("bbbbb", "Came here");
lastLookedView = view;
cursor.animate().x((viewMinWidth + viewMaxWidth) / 2);
cursor.animate().y((viewMinHeight + viewMaxHeight) / 2);
}
else
......@@ -290,8 +231,8 @@ public class AdjustBrightness extends AppCompatActivity
}
}
b.animate().x(x);
b.animate().y(y);
cursor.animate().x(x);
cursor.animate().y(y);
}
private void checkCount()
......
......@@ -76,7 +76,7 @@ public class AdjustSaturation extends AppCompatActivity
viewsInDisplay.add(findViewById(R.id.back));
viewsInDisplay.add(findViewById(R.id.save));
viewsInDisplay.add(findViewById(R.id.select_btn));
computerVision = new ComputerVision(this,this,this);
......@@ -101,7 +101,7 @@ public class AdjustSaturation extends AppCompatActivity
@Override
public void onSeeking(SeekParams seekParams)
{
saturationLevel = seekBar.getProgress() / 10;
saturationLevel = seekBar.getProgress() / 40;
createImage();
}
@Override
......@@ -161,17 +161,10 @@ public class AdjustSaturation extends AppCompatActivity
}
void findViewPoint(int x,int y)
{
//if(!isPossible) return;
ImageView b = findViewById(R.id.cursor);
ImageView cursor = findViewById(R.id.cursor);
int viewMaxX = 0;
int viewMinX = 0;
int viewMaxY = 0;
int viewMinY = 0;
......@@ -204,23 +197,6 @@ public class AdjustSaturation extends AppCompatActivity
}
//
// b.animate().x(x);
// b.animate().y(y);
for(View view : viewsInDisplay)
{
int[] location = new int[2];
......@@ -229,16 +205,6 @@ public class AdjustSaturation extends AppCompatActivity
int viewX = location[0];
int viewY = location[1];
// if(viewX >= viewMaxX)
// {
// viewMaxX = viewX;
// }
// if(viewY >= viewMaxY)
// {
// viewMaxY = viewY;
// }
Log.d("aaaaaaaaaaaa", "View=" + view.getId() + "X=" + viewX + ", Y=" + viewY);
int viewMaxWidth = viewX + view.getWidth();
int viewMinWidth = viewX - view.getWidth();
......@@ -246,40 +212,14 @@ public class AdjustSaturation extends AppCompatActivity
int viewMaxHeight = viewY + view.getHeight();
int viewMinHeight = viewY - view.getHeight();
//b.animate().y((viewMinHeight + viewMaxHeight) / 2);
if ((x >= viewMinWidth && x <= viewMaxWidth))
{
if(lastLookedView != null && lastLookedView.getId() == view.getId())
{
count++;
}
else
{
count = 0;
}
if(count >= 3)
{
isPossible = false;
checkCount();
}
view.setBackgroundColor(Color.RED);
b.animate().x((viewMinWidth + viewMaxWidth) / 2);
b.animate().y((viewMinHeight + viewMaxHeight) / 2);
Log.d("bbbbb", "Came here");
lastLookedView = view;
cursor.animate().x((viewMinWidth + viewMaxWidth) / 2);
cursor.animate().y((viewMinHeight + viewMaxHeight) / 2);
}
else
......@@ -288,8 +228,8 @@ public class AdjustSaturation extends AppCompatActivity
}
}
b.animate().x(x);
b.animate().y(y);
cursor.animate().x(x);
cursor.animate().y(y);
}
private void checkCount()
{
......
......@@ -102,7 +102,7 @@ public class DenoisingActivity extends AppCompatActivity
viewsInDisplay.add(findViewById(R.id.back));
viewsInDisplay.add(findViewById(R.id.save));
viewsInDisplay.add(findViewById(R.id.select_btn));
computerVision = new ComputerVision(this,this,this);
......@@ -220,17 +220,10 @@ public class DenoisingActivity extends AppCompatActivity
}
void findViewPoint(int x,int y)
{
//if(!isPossible) return;
ImageView b = findViewById(R.id.cursor);
ImageView cursor = findViewById(R.id.cursor);
int viewMaxX = 0;
int viewMinX = 0;
int viewMaxY = 0;
int viewMinY = 0;
......@@ -263,23 +256,6 @@ public class DenoisingActivity extends AppCompatActivity
}
//
// b.animate().x(x);
// b.animate().y(y);
for(View view : viewsInDisplay)
{
int[] location = new int[2];
......@@ -288,16 +264,6 @@ public class DenoisingActivity extends AppCompatActivity
int viewX = location[0];
int viewY = location[1];
// if(viewX >= viewMaxX)
// {
// viewMaxX = viewX;
// }
// if(viewY >= viewMaxY)
// {
// viewMaxY = viewY;
// }
Log.d("aaaaaaaaaaaa", "View=" + view.getId() + "X=" + viewX + ", Y=" + viewY);
int viewMaxWidth = viewX + view.getWidth();
int viewMinWidth = viewX - view.getWidth();
......@@ -305,40 +271,14 @@ public class DenoisingActivity extends AppCompatActivity
int viewMaxHeight = viewY + view.getHeight();
int viewMinHeight = viewY - view.getHeight();
//b.animate().y((viewMinHeight + viewMaxHeight) / 2);
if ((x >= viewMinWidth && x <= viewMaxWidth))
{
if(lastLookedView != null && lastLookedView.getId() == view.getId())
{
count++;
}
else
{
count = 0;
}
if(count >= 3)
{
isPossible = false;
checkCount();
}
view.setBackgroundColor(Color.RED);
b.animate().x((viewMinWidth + viewMaxWidth) / 2);
b.animate().y((viewMinHeight + viewMaxHeight) / 2);
Log.d("bbbbb", "Came here");
lastLookedView = view;
cursor.animate().x((viewMinWidth + viewMaxWidth) / 2);
cursor.animate().y((viewMinHeight + viewMaxHeight) / 2);
}
else
......@@ -347,23 +287,8 @@ public class DenoisingActivity extends AppCompatActivity
}
}
b.animate().x(x);
b.animate().y(y);
}
private void checkCount()
{
count++;
if(count >= 5)
{
isPossible = true;
count = 0;
}
else
{
isPossible = false;
}
cursor.animate().x(x);
cursor.animate().y(y);
}
@Override
......
......@@ -2,6 +2,7 @@ package com.app.smartphotoeditor.activities;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
......@@ -30,6 +31,7 @@ import com.bumptech.glide.Glide;
import org.opencv.core.Mat;
import java.io.IOException;
import java.util.ArrayList;
public class EditorActivity extends AppCompatActivity
......@@ -45,6 +47,8 @@ public class EditorActivity extends AppCompatActivity
private SpeechService speechService;
private ArrayList<View> viewsInDisplay = new ArrayList<>();
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
......@@ -78,6 +82,9 @@ public class EditorActivity extends AppCompatActivity
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editor);
tools_rv = findViewById(R.id.tools_rv);
toolsAdapter = new ToolsAdapter(getApplicationContext(), new OnToolClicked() {
@Override
......@@ -112,6 +119,8 @@ public class EditorActivity extends AppCompatActivity
tools_rv.setLayoutManager(layoutManager);
tools_rv.setAdapter(toolsAdapter);
computerVision = new ComputerVision(this,this,this);
ConstraintLayout constraintLayout = findViewById(R.id.constraint_main);
......@@ -124,6 +133,9 @@ public class EditorActivity extends AppCompatActivity
}
}).initialize();
viewsInDisplay.add(findViewById(R.id.back));
viewsInDisplay.add(findViewById(R.id.select_btn));
methods = new Methods(getApplicationContext());
......@@ -138,6 +150,7 @@ public class EditorActivity extends AppCompatActivity
speechService = new SpeechService(getApplicationContext(),findViewById(R.id.speech_progress),this);
}
private void setPreviewFrame(Mat previewMat)
{
......@@ -218,6 +231,7 @@ public class EditorActivity extends AppCompatActivity
@Override
public void onPupilChanged(Mat binary,int x, int y,int range, int pupilX) {
findViewPoint(x,y);
}
@Override
......@@ -354,4 +368,78 @@ public class EditorActivity extends AppCompatActivity
}
});
}
void findViewPoint(int x,int y)
{
ImageView cursor = findViewById(R.id.cursor);
int viewMaxX = 0;
int viewMaxY = 0;
for(View view : viewsInDisplay)
{
int[] location = new int[2];
view.getLocationOnScreen(location);
int viewX = location[0] + (view.getWidth() / 2);
int viewY = location[1] / 2;
if(viewX >= viewMaxX)
{
viewMaxX = viewX;
}
if(viewY >= viewMaxY)
{
viewMaxY = viewY;
}
}
if(x > viewMaxX)
{
x = viewMaxX;
}
if(y > viewMaxY)
{
y = viewMaxY;
}
for(View view : viewsInDisplay)
{
int[] location = new int[2];
view.getLocationOnScreen(location);
int viewX = location[0];
int viewY = location[1];
int viewMaxWidth = viewX + view.getWidth();
int viewMinWidth = viewX - view.getWidth();
int viewMaxHeight = viewY + view.getHeight();
int viewMinHeight = viewY - view.getHeight();
if ((x >= viewMinWidth && x <= viewMaxWidth))
{
view.setBackgroundColor(Color.RED);
cursor.animate().x((viewMinWidth + viewMaxWidth) / 2);
cursor.animate().y((viewMinHeight + viewMaxHeight) / 2);
}
else
{
view.setBackgroundColor(Color.BLACK);
}
}
cursor.animate().x(x);
cursor.animate().y(y);
}
}
\ No newline at end of file
......@@ -134,7 +134,7 @@ public class LowLightEnhanceActivity extends AppCompatActivity
viewsInDisplay.add(findViewById(R.id.back));
viewsInDisplay.add(findViewById(R.id.save));
viewsInDisplay.add(findViewById(R.id.select_btn));
computerVision = new ComputerVision(this,this,this);
......@@ -252,17 +252,10 @@ public class LowLightEnhanceActivity extends AppCompatActivity
}
void findViewPoint(int x,int y)
{
//if(!isPossible) return;
ImageView b = findViewById(R.id.cursor);
ImageView cursor = findViewById(R.id.cursor);
int viewMaxX = 0;
int viewMinX = 0;
int viewMaxY = 0;
int viewMinY = 0;
......@@ -295,23 +288,6 @@ public class LowLightEnhanceActivity extends AppCompatActivity
}
//
// b.animate().x(x);
// b.animate().y(y);
for(View view : viewsInDisplay)
{
int[] location = new int[2];
......@@ -320,16 +296,6 @@ public class LowLightEnhanceActivity extends AppCompatActivity
int viewX = location[0];
int viewY = location[1];
// if(viewX >= viewMaxX)
// {
// viewMaxX = viewX;
// }
// if(viewY >= viewMaxY)
// {
// viewMaxY = viewY;
// }
Log.d("aaaaaaaaaaaa", "View=" + view.getId() + "X=" + viewX + ", Y=" + viewY);
int viewMaxWidth = viewX + view.getWidth();
int viewMinWidth = viewX - view.getWidth();
......@@ -337,40 +303,14 @@ public class LowLightEnhanceActivity extends AppCompatActivity
int viewMaxHeight = viewY + view.getHeight();
int viewMinHeight = viewY - view.getHeight();
//b.animate().y((viewMinHeight + viewMaxHeight) / 2);
if ((x >= viewMinWidth && x <= viewMaxWidth))
{
if(lastLookedView != null && lastLookedView.getId() == view.getId())
{
count++;
}
else
{
count = 0;
}
if(count >= 3)
{
isPossible = false;
checkCount();
}
view.setBackgroundColor(Color.RED);
b.animate().x((viewMinWidth + viewMaxWidth) / 2);
b.animate().y((viewMinHeight + viewMaxHeight) / 2);
Log.d("bbbbb", "Came here");
lastLookedView = view;
cursor.animate().x((viewMinWidth + viewMaxWidth) / 2);
cursor.animate().y((viewMinHeight + viewMaxHeight) / 2);
}
else
......@@ -379,8 +319,8 @@ public class LowLightEnhanceActivity extends AppCompatActivity
}
}
b.animate().x(x);
b.animate().y(y);
cursor.animate().x(x);
cursor.animate().y(y);
}
private void checkCount()
......
......@@ -103,7 +103,7 @@ public class RestorationActivity extends AppCompatActivity
viewsInDisplay.add(findViewById(R.id.back));
viewsInDisplay.add(findViewById(R.id.save));
viewsInDisplay.add(findViewById(R.id.select_btn));
computerVision = new ComputerVision(this,this,this);
......@@ -219,17 +219,10 @@ public class RestorationActivity extends AppCompatActivity
}
void findViewPoint(int x,int y)
{
//if(!isPossible) return;
ImageView b = findViewById(R.id.cursor);
ImageView cursor = findViewById(R.id.cursor);
int viewMaxX = 0;
int viewMinX = 0;
int viewMaxY = 0;
int viewMinY = 0;
......@@ -262,23 +255,6 @@ public class RestorationActivity extends AppCompatActivity
}
//
// b.animate().x(x);
// b.animate().y(y);
for(View view : viewsInDisplay)
{
int[] location = new int[2];
......@@ -287,16 +263,6 @@ public class RestorationActivity extends AppCompatActivity
int viewX = location[0];
int viewY = location[1];
// if(viewX >= viewMaxX)
// {
// viewMaxX = viewX;
// }
// if(viewY >= viewMaxY)
// {
// viewMaxY = viewY;
// }
Log.d("aaaaaaaaaaaa", "View=" + view.getId() + "X=" + viewX + ", Y=" + viewY);
int viewMaxWidth = viewX + view.getWidth();
int viewMinWidth = viewX - view.getWidth();
......@@ -304,40 +270,14 @@ public class RestorationActivity extends AppCompatActivity
int viewMaxHeight = viewY + view.getHeight();
int viewMinHeight = viewY - view.getHeight();
//b.animate().y((viewMinHeight + viewMaxHeight) / 2);
if ((x >= viewMinWidth && x <= viewMaxWidth))
{
if(lastLookedView != null && lastLookedView.getId() == view.getId())
{
count++;
}
else
{
count = 0;
}
if(count >= 3)
{
isPossible = false;
checkCount();
}
view.setBackgroundColor(Color.RED);
b.animate().x((viewMinWidth + viewMaxWidth) / 2);
b.animate().y((viewMinHeight + viewMaxHeight) / 2);
Log.d("bbbbb", "Came here");
lastLookedView = view;
cursor.animate().x((viewMinWidth + viewMaxWidth) / 2);
cursor.animate().y((viewMinHeight + viewMaxHeight) / 2);
}
else
......@@ -346,8 +286,8 @@ public class RestorationActivity extends AppCompatActivity
}
}
b.animate().x(x);
b.animate().y(y);
cursor.animate().x(x);
cursor.animate().y(y);
}
private void checkCount()
......
......@@ -24,8 +24,8 @@ public class EyeBlinkDetection
private final int imageSize;
private static final int MIN_EYE_CLOSE_COUNT = 0;
private static final int LONG_EYE_CLOSE_COUNT = 6;
private static final int MAX_EYE_CLOSE_TIME = 10;
private static final int LONG_EYE_CLOSE_COUNT = 4;
private static final int MAX_EYE_CLOSE_TIME = 8;
private int eyeCloseCount = MIN_EYE_CLOSE_COUNT;
private final OnEyeStatusChanged listener;
......
......@@ -109,5 +109,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/userSelectedImage" />
<ImageView
android:id="@+id/cursor"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/cursor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/preview" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -5,21 +5,23 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:id="@+id/main_container"
tools:context=".activities.CameraView">
<org.opencv.android.JavaCameraView
<ImageView
android:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frame_Surface"/>
android:id="@+id/preview"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.4"
android:background="@color/black"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:alpha="0.4"-->
<!-- android:background="@color/black"-->
<!-- tools:layout_editor_absoluteX="0dp"-->
<!-- tools:layout_editor_absoluteY="0dp" />-->
<TextView
android:id="@+id/textView"
......@@ -40,64 +42,52 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/frame"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_marginTop="32dp"
android:scaleType="centerCrop"
app:civ_border_color="@color/white"
app:civ_border_width="2dp"
android:src="@drawable/eye"
app:layout_constraintEnd_toEndOf="parent"
<ImageView
android:id="@+id/left"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginStart="60dp"
android:rotation="180"
android:src="@drawable/arrow"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/preview"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="32dp"
android:gravity="center"
android:letterSpacing="0.1"
android:lineSpacingMultiplier="1.2"
android:text="Place your eye"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="16sp"
<ImageView
android:id="@+id/right"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginEnd="60dp"
android:src="@drawable/arrow"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/frame" />
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="60dp"
android:progress="0"
<ImageView
android:id="@+id/top"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="70dp"
android:rotation="270"
android:src="@drawable/arrow"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView1" />
app:layout_constraintTop_toBottomOf="@+id/textView" />
<TextView
android:id="@+id/view_point"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="View Point"
android:textColor="@android:color/white"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="@+id/frame_Surface"
app:layout_constraintTop_toBottomOf="@+id/frame" />
<ImageView
android:id="@+id/bottom"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginBottom="150dp"
android:rotation="90"
android:src="@drawable/arrow"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -4,17 +4,18 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".activities.SplashScreen">
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/logo"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:src="@drawable/icon"
app:layout_constraintBottom_toTopOf="@+id/textView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintStart_toStartOf="parent" />
<TextView
......@@ -27,7 +28,8 @@
android:text="@string/app_name"
android:textAllCaps="true"
android:textColor="@color/tools_icon_ash"
android:textSize="21sp"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline7" />
......@@ -37,6 +39,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
app:layout_constraintGuide_percent="0.51" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment