Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pyone Thant Win
calorieEstimation
Commits
bc5c1fa5
Commit
bc5c1fa5
authored
Apr 10, 2020
by
Pyone Thant Win
Browse files
Added android app v1
parent
27b1c82d
Changes
50
Hide whitespace changes
Inline
Side-by-side
CalorieEstimator/.gitignore
0 → 100644
View file @
bc5c1fa5
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
CalorieEstimator/.idea/.name
0 → 100644
View file @
bc5c1fa5
Calorie Estimator
\ No newline at end of file
CalorieEstimator/.idea/codeStyles/Project.xml
0 → 100644
View file @
bc5c1fa5
<component
name=
"ProjectCodeStyleConfiguration"
>
<code_scheme
name=
"Project"
version=
"173"
>
<codeStyleSettings
language=
"XML"
>
<indentOptions>
<option
name=
"CONTINUATION_INDENT_SIZE"
value=
"4"
/>
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>
xmlns:android
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
xmlns:.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*:id
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*:name
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
name
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
style
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
^$
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
http://schemas.android.com/apk/res/android
</XML_NAMESPACE>
</AND>
</match>
<order>
ANDROID_ATTRIBUTE_ORDER
</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>
.*
</NAME>
<XML_ATTRIBUTE
/>
<XML_NAMESPACE>
.*
</XML_NAMESPACE>
</AND>
</match>
<order>
BY_NAME
</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
CalorieEstimator/.idea/gradle.xml
0 → 100644
View file @
bc5c1fa5
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild
compositeDefinitionSource=
"SCRIPT"
/>
</compositeConfiguration>
<option
name=
"distributionType"
value=
"DEFAULT_WRAPPED"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"resolveModulePerSourceSet"
value=
"false"
/>
<option
name=
"testRunner"
value=
"PLATFORM"
/>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
CalorieEstimator/.idea/misc.xml
0 → 100644
View file @
bc5c1fa5
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
project-jdk-name=
"JDK"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
<option
name=
"id"
value=
"Android"
/>
</component>
</project>
\ No newline at end of file
CalorieEstimator/.idea/runConfigurations.xml
0 → 100644
View file @
bc5c1fa5
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer"
/>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer"
/>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
CalorieEstimator/app/.gitignore
0 → 100644
View file @
bc5c1fa5
/build
CalorieEstimator/app/build.gradle
0 → 100644
View file @
bc5c1fa5
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
29
buildToolsVersion
"29.0.0"
defaultConfig
{
applicationId
"com.example.calorieestimator"
minSdkVersion
28
targetSdkVersion
29
versionCode
1
versionName
"1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes
{
release
{
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
}
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
'androidx.appcompat:appcompat:1.0.2'
implementation
'androidx.constraintlayout:constraintlayout:1.1.3'
implementation
'com.google.android.material:material:1.0.0'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'androidx.test.ext:junit:1.1.0'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.1.1'
implementation
'com.android.volley:volley:1.1.1'
implementation
'com.google.code.gson:gson:2.4'
}
CalorieEstimator/app/proguard-rules.pro
0 → 100644
View file @
bc5c1fa5
# Add project specific ProGuard rules here.
#
You
can
control
the
set
of
applied
configuration
files
using
the
#
proguardFiles
setting
in
build
.
gradle
.
#
#
For
more
details
,
see
#
http
://
developer
.
android
.
com
/
guide
/
developing
/
tools
/
proguard
.
html
#
If
your
project
uses
WebView
with
JS
,
uncomment
the
following
#
and
specify
the
fully
qualified
class
name
to
the
JavaScript
interface
#
class
:
#-
keepclassmembers
class
fqcn
.
of
.
javascript
.
interface
.
for
.
webview
{
#
public
*
;
#
}
#
Uncomment
this
to
preserve
the
line
number
information
for
#
debugging
stack
traces
.
#-
keepattributes
SourceFile
,
LineNumberTable
#
If
you
keep
the
line
number
information
,
uncomment
this
to
#
hide
the
original
source
file
name
.
#-
renamesourcefileattribute
SourceFile
CalorieEstimator/app/src/androidTest/java/com/example/calorieestimator/ExampleInstrumentedTest.java
0 → 100644
View file @
bc5c1fa5
package
com.example.calorieestimator
;
import
android.content.Context
;
import
androidx.test.platform.app.InstrumentationRegistry
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
static
org
.
junit
.
Assert
.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith
(
AndroidJUnit4
.
class
)
public
class
ExampleInstrumentedTest
{
@Test
public
void
useAppContext
()
{
// Context of the app under test.
Context
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
getTargetContext
();
assertEquals
(
"com.example.calorieestimator"
,
appContext
.
getPackageName
());
}
}
CalorieEstimator/app/src/main/AndroidManifest.xml
0 → 100644
View file @
bc5c1fa5
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.example.calorieestimator"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-feature
android:name=
"android.hardware.camera"
android:required=
"true"
/>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".take_picture"
android:label=
"@string/title_activity_take_picture"
android:theme=
"@style/AppTheme.NoActionBar"
></activity>
<activity
android:name=
".login"
/>
<activity
android:name=
".MainActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
CalorieEstimator/app/src/main/java/com/example/calorieestimator/MainActivity.java
0 → 100644
View file @
bc5c1fa5
package
com.example.calorieestimator
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.ContentValues
;
import
android.content.Intent
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteOpenHelper
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.Toast
;
public
class
MainActivity
extends
AppCompatActivity
{
SQLiteOpenHelper
openHelper
;
SQLiteDatabase
db
;
Button
_btnregister
,
_btn_to_login
,
_btn_skip
;
EditText
_fname
,
_lname
,
_user_email
,
_user_pswd
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
openHelper
=
new
database_helper
(
this
);
_btnregister
=
(
Button
)
findViewById
(
R
.
id
.
btnregister
);
_fname
=
(
EditText
)
findViewById
(
R
.
id
.
fname
);
_lname
=
(
EditText
)
findViewById
(
R
.
id
.
lname
);
_user_email
=
(
EditText
)
findViewById
(
R
.
id
.
user_email
);
_user_pswd
=
(
EditText
)
findViewById
(
R
.
id
.
user_pswd
);
_btn_to_login
=
(
Button
)
findViewById
(
R
.
id
.
btn_to_login
);
_btn_skip
=
(
Button
)
findViewById
((
R
.
id
.
btn_skip
));
_btnregister
.
setOnClickListener
(
new
View
.
OnClickListener
(){
@Override
public
void
onClick
(
View
v
){
db
=
openHelper
.
getWritableDatabase
();
String
fname
=
_fname
.
getText
().
toString
();
String
lname
=
_lname
.
getText
().
toString
();
String
email
=
_user_email
.
getText
().
toString
();
String
pswd
=
_user_pswd
.
getText
().
toString
();
insertdata
(
fname
,
lname
,
email
,
pswd
);
Toast
.
makeText
(
getApplicationContext
(),
"register successfully"
,
Toast
.
LENGTH_LONG
).
show
();
}
});
_btn_to_login
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
login
.
class
);
startActivity
(
intent
);
}
});
_btn_skip
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
take_picture
.
class
);
startActivity
(
intent
);
}
});
}
public
void
insertdata
(
String
fname
,
String
lname
,
String
email
,
String
pswd
){
ContentValues
contentValues
=
new
ContentValues
();
contentValues
.
put
(
database_helper
.
COL_2
,
fname
);
contentValues
.
put
(
database_helper
.
COL_3
,
lname
);
contentValues
.
put
(
database_helper
.
COL_4
,
email
);
contentValues
.
put
(
database_helper
.
COL_5
,
pswd
);
long
id
=
db
.
insert
(
database_helper
.
TABLE_NAME
,
null
,
contentValues
);
}
}
CalorieEstimator/app/src/main/java/com/example/calorieestimator/database_helper.java
0 → 100644
View file @
bc5c1fa5
package
com.example.calorieestimator
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteOpenHelper
;
public
class
database_helper
extends
SQLiteOpenHelper
{
public
static
final
String
DATABASE_NAME
=
"calories.db"
;
public
static
final
String
TABLE_NAME
=
"credentials"
;
public
static
final
String
COL_1
=
"ID"
;
public
static
final
String
COL_2
=
"FirstName"
;
public
static
final
String
COL_3
=
"LastName"
;
public
static
final
String
COL_4
=
"email"
;
public
static
final
String
COL_5
=
"password"
;
public
database_helper
(
Context
context
){
super
(
context
,
DATABASE_NAME
,
null
,
1
);
}
@Override
public
void
onCreate
(
SQLiteDatabase
db
)
{
db
.
execSQL
(
"CREATE TABLE "
+
TABLE_NAME
+
"(ID INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT, email TEXT, first_name TEXT,last_name TEXT)"
);
}
@Override
public
void
onUpgrade
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
){
db
.
execSQL
(
"DROP TABLE IF EXISTS "
+
TABLE_NAME
);
onCreate
(
db
);
}
}
CalorieEstimator/app/src/main/java/com/example/calorieestimator/login.java
0 → 100644
View file @
bc5c1fa5
package
com.example.calorieestimator
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteOpenHelper
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.Toast
;
public
class
login
extends
AppCompatActivity
{
SQLiteDatabase
db
;
SQLiteOpenHelper
openHelper
;
Button
_btn_login
;
EditText
_user_email
,
_user_pswd
;
Cursor
cursor
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_login
);
openHelper
=
new
database_helper
(
this
);
db
=
openHelper
.
getReadableDatabase
();
_btn_login
=
(
Button
)
findViewById
(
R
.
id
.
btn_login
);
_user_email
=
(
EditText
)
findViewById
(
R
.
id
.
user_email
);
_user_pswd
=
(
EditText
)
findViewById
(
R
.
id
.
user_pswd
);
_btn_login
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
String
email
=
_user_email
.
getText
().
toString
();
String
pass
=
_user_pswd
.
getText
().
toString
();
cursor
=
db
.
rawQuery
(
"SELECT * FROM "
+
database_helper
.
TABLE_NAME
+
"WHERE "
+
database_helper
.
COL_4
+
"=? AND"
+
database_helper
.
COL_5
+
"=?"
,
new
String
[]
{
email
,
pass
});
if
(
cursor
!=
null
){
if
(
cursor
.
getCount
()
>
0
){
Toast
.
makeText
(
getApplicationContext
(),
"login successfully"
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"error"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
}
});
}
/*private void validate(String username, String password){
if ((username == "Admin") && (password=="123abc")){
Intent
}
}*/
}
CalorieEstimator/app/src/main/java/com/example/calorieestimator/take_picture.java
0 → 100644
View file @
bc5c1fa5
package
com.example.calorieestimator
;
import
android.os.Bundle
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.google.android.material.snackbar.Snackbar
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.Toolbar
;
import
android.view.View
;
public
class
take_picture
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_take_picture
);
Toolbar
toolbar
=
findViewById
(
R
.
id
.
toolbar
);
setSupportActionBar
(
toolbar
);
FloatingActionButton
fab
=
findViewById
(
R
.
id
.
fab
);
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Snackbar
.
make
(
view
,
"Replace with your own action"
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
"Action"
,
null
).
show
();
}
});
}
}
CalorieEstimator/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
0 → 100644
View file @
bc5c1fa5
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:aapt=
"http://schemas.android.com/aapt"
android:width=
"108dp"
android:height=
"108dp"
android:viewportWidth=
"108"
android:viewportHeight=
"108"
>
<path
android:fillType=
"evenOdd"
android:pathData=
"M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth=
"1"
android:strokeColor=
"#00000000"
>
<aapt:attr
name=
"android:fillColor"
>
<gradient
android:endX=
"78.5885"
android:endY=
"90.9159"
android:startX=
"48.7653"
android:startY=
"61.0927"
android:type=
"linear"
>
<item
android:color=
"#44000000"
android:offset=
"0.0"
/>
<item
android:color=
"#00000000"
android:offset=
"1.0"
/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor=
"#FFFFFF"
android:fillType=
"nonZero"
android:pathData=
"M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth=
"1"
android:strokeColor=
"#00000000"
/>
</vector>
CalorieEstimator/app/src/main/res/drawable/ic_launcher_background.xml
0 → 100644
View file @
bc5c1fa5
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"108dp"
android:height=
"108dp"
android:viewportWidth=
"108"
android:viewportHeight=
"108"
>
<path
android:fillColor=
"#008577"
android:pathData=
"M0,0h108v108h-108z"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M9,0L9,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M19,0L19,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M29,0L29,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M39,0L39,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M49,0L49,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M59,0L59,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M69,0L69,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M79,0L79,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M89,0L89,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path
android:fillColor=
"#00000000"
android:pathData=
"M99,0L99,108"
android:strokeWidth=
"0.8"
android:strokeColor=
"#33FFFFFF"
/>
<path