Aktualizacja JDK do v1.7, dodany prototyp graficzny archiwum

This commit is contained in:
Krokogator 2018-12-05 12:53:14 +01:00
parent 5635f41cce
commit 43a26ebee9
7 changed files with 369 additions and 15 deletions

View File

@ -29,7 +29,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="JDK" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View File

@ -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'
} }

View File

@ -14,12 +14,11 @@
<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 android:name=".PhotoPreviewActivity"></activity>
</activity>
<provider <provider
android:name="android.support.v4.content.FileProvider" android:name="android.support.v4.content.FileProvider"
android:authorities="com.krokogator.photoeat.android.fileprovider" android:authorities="com.krokogator.photoeat.android.fileprovider"
@ -27,9 +26,10 @@
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"></meta-data> android:resource="@xml/provider_paths" />
</provider> </provider>
<activity android:name=".ArchiveActivity" android:label="@string/archive"></activity>
</application> </application>
</manifest> </manifest>

View File

@ -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);
}
}

View File

@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Button btnCamera = (Button) findViewById(R.id.button_take_photo); Button btnCamera = (Button) findViewById(R.id.button_take_photo);
photo_preview = (ImageView) findViewById(R.id.mainImgView); Button btnArchive = (Button) findViewById(R.id.button_archive);
btnCamera.setOnClickListener(new View.OnClickListener() { btnCamera.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -41,6 +41,13 @@ public class MainActivity extends AppCompatActivity {
} }
}); });
btnArchive.setOnClickListener((view) -> {
Intent intent = new Intent(this, ArchiveActivity.class);
startActivity(intent);
});
} }
static final int REQUEST_IMAGE_CAPTURE = 1; static final int REQUEST_IMAGE_CAPTURE = 1;

View 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>

View File

@ -6,12 +6,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="com.krokogator.photoeat.MainActivity"> tools:context="com.krokogator.photoeat.MainActivity">
<ImageView
android:id="@+id/mainImgView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
<Button <Button
android:id="@+id/button_take_photo" android:id="@+id/button_take_photo"
android:layout_width="0dp" android:layout_width="0dp"
@ -35,12 +29,12 @@
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:backgroundTint="@color/colorAccent" android:backgroundTint="@color/colorAccent"
android:text="@string/daily_survey" android:text="@string/daily_survey"
app:layout_constraintBottom_toTopOf="@+id/button3" app:layout_constraintBottom_toTopOf="@+id/button_archive"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
<Button <Button
android:id="@+id/button3" android:id="@+id/button_archive"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="94dp" android:layout_height="94dp"
android:layout_marginStart="36dp" android:layout_marginStart="36dp"