Merge branch 'prototype/basic-interface' of s407312/photoeat into master
This commit is contained in:
commit
1dd72ac633
@ -1,9 +1,35 @@
|
|||||||
<?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_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="NullableNotNullManager">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="7">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="6">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||||
<option name="id" value="Android" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/PhotoEat.iml" filepath="$PROJECT_DIR$/PhotoEat.iml" />
|
<module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
|
6
android/.idea/vcs.xml
Normal file
6
android/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -16,6 +16,10 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = '1.8'
|
||||||
|
targetCompatibility = '1.8'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -25,4 +29,6 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
|
implementation 'com.android.support:cardview-v7:26.1.0'
|
||||||
|
implementation 'com.android.support:recyclerview-v7:26.1.0'
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.krokogator.photoeat">
|
package="com.krokogator.photoeat">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
@ -12,10 +14,22 @@
|
|||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".PhotoPreviewActivity"></activity>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="android.support.v4.content.FileProvider"
|
||||||
|
android:authorities="com.krokogator.photoeat.android.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/provider_paths" />
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
<activity android:name=".ArchiveActivity" android:label="@string/archive"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.krokogator.photoeat;
|
||||||
|
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class ArchiveActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_archive);
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,103 @@
|
|||||||
package com.krokogator.photoeat;
|
package com.krokogator.photoeat;
|
||||||
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.support.v4.content.FileProvider;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
static final int REQUEST_TAKE_PHOTO = 1;
|
||||||
|
|
||||||
|
ImageView photo_preview;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
Button btnCamera = (Button) findViewById(R.id.button_take_photo);
|
||||||
|
Button btnArchive = (Button) findViewById(R.id.button_archive);
|
||||||
|
|
||||||
|
btnCamera.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dispatchTakePictureIntent();
|
||||||
|
// System.out.println(getPic().getHeight());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnArchive.setOnClickListener((view) -> {
|
||||||
|
Intent intent = new Intent(this, ArchiveActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static final int REQUEST_IMAGE_CAPTURE = 1;
|
||||||
|
|
||||||
|
String mCurrentPhotoPath;
|
||||||
|
|
||||||
|
private File createImageFile() throws IOException {
|
||||||
|
// Create an image file name
|
||||||
|
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
||||||
|
String imageFileName = "JPEG_" + timeStamp + "_";
|
||||||
|
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||||
|
File image = File.createTempFile(
|
||||||
|
imageFileName, /* prefix */
|
||||||
|
".jpg", /* suffix */
|
||||||
|
storageDir /* directory */
|
||||||
|
);
|
||||||
|
|
||||||
|
// Save a file: path for use with ACTION_VIEW intents
|
||||||
|
mCurrentPhotoPath = image.getAbsolutePath();
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dispatchTakePictureIntent() {
|
||||||
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
// Ensure that there's a camera activity to handle the intent
|
||||||
|
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
|
||||||
|
// Create the File where the photo should go
|
||||||
|
File photoFile = null;
|
||||||
|
try {
|
||||||
|
photoFile = createImageFile();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
// Error occurred while creating the File
|
||||||
|
}
|
||||||
|
// Continue only if the File was successfully created
|
||||||
|
if (photoFile != null) {
|
||||||
|
Uri photoURI = FileProvider.getUriForFile(this,
|
||||||
|
"com.krokogator.photoeat.android.fileprovider",
|
||||||
|
photoFile);
|
||||||
|
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
||||||
|
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
|
||||||
|
Intent previewPhotoIntent = new Intent(this, PhotoPreviewActivity.class);
|
||||||
|
previewPhotoIntent.putExtra("imagePath", mCurrentPhotoPath);
|
||||||
|
startActivity(previewPhotoIntent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.krokogator.photoeat;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Matrix;
|
||||||
|
import android.media.ExifInterface;
|
||||||
|
import android.media.Image;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class PhotoPreviewActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.photo_previev);
|
||||||
|
|
||||||
|
String imagePath = (String) getIntent().getExtras().get("imagePath");
|
||||||
|
ImageView preview = findViewById(R.id.photo_preview);
|
||||||
|
preview.setImageBitmap(getPic(imagePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bitmap getPic(String picPath) {
|
||||||
|
// Get the dimensions of the View
|
||||||
|
int targetW = 800;
|
||||||
|
int targetH = 1200;
|
||||||
|
|
||||||
|
// Get the dimensions of the bitmap
|
||||||
|
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
|
||||||
|
bmOptions.inJustDecodeBounds = true;
|
||||||
|
BitmapFactory.decodeFile(picPath, bmOptions);
|
||||||
|
int photoW = bmOptions.outWidth;
|
||||||
|
int photoH = bmOptions.outHeight;
|
||||||
|
|
||||||
|
// Determine how much to scale down the image
|
||||||
|
int scaleFactor = Math.min(photoW/targetW, photoH/targetH);
|
||||||
|
|
||||||
|
// Decode the image file into a Bitmap sized to fill the View
|
||||||
|
bmOptions.inJustDecodeBounds = false;
|
||||||
|
bmOptions.inSampleSize = scaleFactor;
|
||||||
|
bmOptions.inPurgeable = true;
|
||||||
|
|
||||||
|
Bitmap bitmap = BitmapFactory.decodeFile(picPath, bmOptions);
|
||||||
|
bitmap = getCorrectlyRotated(picPath, bitmap);
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bitmap getCorrectlyRotated(String imagePath, Bitmap bitmap){
|
||||||
|
// Rotate Image if Needed
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Determine Orientation
|
||||||
|
ExifInterface exif = new ExifInterface(imagePath);
|
||||||
|
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
|
||||||
|
|
||||||
|
// Determine Rotation
|
||||||
|
int rotation = 0;
|
||||||
|
if (orientation == 6) rotation = 90;
|
||||||
|
else if (orientation == 3) rotation = 180;
|
||||||
|
else if (orientation == 8) rotation = 270;
|
||||||
|
|
||||||
|
// Rotate Image if Necessary
|
||||||
|
if (rotation != 0)
|
||||||
|
{
|
||||||
|
// Create Matrix
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postRotate(rotation);
|
||||||
|
|
||||||
|
// Rotate Bitmap
|
||||||
|
Bitmap rotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
|
||||||
|
|
||||||
|
// Pretend none of this ever happened!
|
||||||
|
bitmap.recycle();
|
||||||
|
bitmap = rotated;
|
||||||
|
rotated = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// TODO: Log Error Messages Here
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
}
|
334
android/app/src/main/res/layout/activity_archive.xml
Normal file
334
android/app/src/main/res/layout/activity_archive.xml
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.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="match_parent"
|
||||||
|
tools:context=".ArchiveActivity">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="1dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/element1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Cukinia"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Data: Dzisiaj"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/element1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/calories1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Kaloryczność: 749kcal"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/date1" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image1"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:adjustViewBounds="false"
|
||||||
|
android:background="@color/cardview_dark_background"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:maxWidth="10dp"
|
||||||
|
android:maxHeight="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="1dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/element2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Zapiekanka"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Data: Dzisiaj"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/element2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/calories2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Kaloryczność: 823kcal"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/date2" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image2"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:adjustViewBounds="false"
|
||||||
|
android:background="@color/cardview_light_background"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:maxWidth="10dp"
|
||||||
|
android:maxHeight="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="1dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/element3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Pizza"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Data: Dzisiaj"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/element3" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/calories3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Kaloryczność: 1352kcal"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/date3" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image3"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:adjustViewBounds="false"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:maxWidth="10dp"
|
||||||
|
android:maxHeight="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="1dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/element4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Kanapki"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Data: Dzisiaj"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/element4" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/calories4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Kaloryczność: 342kcal"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/date4" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image4"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:adjustViewBounds="false"
|
||||||
|
android:background="@color/cardview_dark_background"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:maxWidth="10dp"
|
||||||
|
android:maxHeight="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="1dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/element5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Lasagna"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Data: Dzisiaj"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/element5" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/calories5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Kaloryczność: 1120kcal"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/date5" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image5"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:adjustViewBounds="false"
|
||||||
|
android:background="@color/colorAccent"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:maxWidth="10dp"
|
||||||
|
android:maxHeight="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="1dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/element6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Nutella"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Data: Dzisiaj"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/element6" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/calories6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Kaloryczność: 600kcal"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/date6" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image6"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:adjustViewBounds="false"
|
||||||
|
android:background="@color/cardview_dark_background"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:maxWidth="10dp"
|
||||||
|
android:maxHeight="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
@ -6,13 +6,57 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="com.krokogator.photoeat.MainActivity">
|
tools:context="com.krokogator.photoeat.MainActivity">
|
||||||
|
|
||||||
<TextView
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/button_take_photo"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:text="Hello World!"
|
android:layout_height="94dp"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:layout_marginEnd="36dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:backgroundTint="@color/colorAccent"
|
||||||
|
android:text="@string/take_photo"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Button"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/button2"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="94dp"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:layout_marginEnd="36dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:backgroundTint="@color/colorAccent"
|
||||||
|
android:text="@string/daily_survey"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/button_archive"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_archive"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="94dp"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:layout_marginEnd="36dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:backgroundTint="@color/colorAccent"
|
||||||
|
android:text="@string/archive"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/button4"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button4"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="94dp"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:layout_marginEnd="36dp"
|
||||||
|
android:layout_marginBottom="64dp"
|
||||||
|
android:backgroundTint="@color/colorAccent"
|
||||||
|
android:text="@string/settings"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
22
android/app/src/main/res/layout/photo_previev.xml
Normal file
22
android/app/src/main/res/layout/photo_previev.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.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="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/photo_preview"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#3F51B5</color>
|
<color name="colorPrimary">#146919</color>
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
<color name="colorPrimaryDark">#1b7634</color>
|
||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#4e814f</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">PhotoEat</string>
|
<string name="app_name">PhotoEat</string>
|
||||||
|
<string name="take_photo">Zrób zdjęcie</string>
|
||||||
|
<string name="daily_survey">Ankieta codzienna</string>
|
||||||
|
<string name="archive">Historia</string>
|
||||||
|
<string name="settings">Ustawienia</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
4
android/app/src/main/res/xml/provider_paths.xml
Normal file
4
android/app/src/main/res/xml/provider_paths.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-path name="my_images" path="Android/data/com.krokogator.photoeat/files/Pictures" />
|
||||||
|
</paths>
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#Tue Dec 04 15:17:08 CET 2018
|
#Tue Dec 04 16:28:48 CET 2018
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||||
|
Loading…
Reference in New Issue
Block a user