Skip to content

Commit

Permalink
- margin in recipe
Browse files Browse the repository at this point in the history
- now you can reach the settings-menu everytime
- landscape-mode-layout
- portrait-mode-layout
- added margin in recipe
- background color in recipe
  • Loading branch information
amarradi committed Jul 19, 2022
1 parent 9e60b47 commit 412269e
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.git.amarradi.palatschinkencounter;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TextView;

import androidx.annotation.Nullable;
Expand Down Expand Up @@ -38,4 +42,21 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
appVersion.setText(version);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.item_setting) {
Intent intentSetting = new Intent(this, SettingActivity.class);
startActivity(intentSetting);
return true;
}
return super.onOptionsItemSelected(item);
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.git.amarradi.palatschinkencounter;

import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -14,6 +18,7 @@

public class ChangelogActivity extends AppCompatActivity {
TextView tv_changelog, et_changelog;
ImageView birthday;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -23,10 +28,29 @@ protected void onCreate(Bundle savedInstanceState) {
tv_changelog = findViewById(R.id.tvChangeloghead);
et_changelog = findViewById(R.id.etChangelog);

birthday = findViewById(R.id.birthday);

readChangelog();

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.item_setting) {
Intent intentSetting = new Intent(this, SettingActivity.class);
startActivity(intentSetting);
return true;
}
return super.onOptionsItemSelected(item);
}

private void readChangelog() {
try {
InputStream inputStream = getResources().openRawResource(R.raw.changelog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,7 @@ protected void onCreate(Bundle savedInstanceState) {

Button counterTextButton = findViewById(R.id.counter_text_button);
counterTextButton.setTypeface(getResources().getFont(R.font.opensans_bold));
/*
imageViewShare = findViewById(R.id.share);
imageViewShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "share now", Toast.LENGTH_SHORT).show();
}
});

*/
textView = findViewById(R.id.textview);
TextView textView_start = findViewById(R.id.tv_startpage);
textView.setTypeface(typeface);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.git.amarradi.palatschinkencounter;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -17,6 +22,7 @@ public class RecipeActivity extends AppCompatActivity {
ArrayList<RecipeModel> ingredientsModels = new ArrayList<>();
ArrayList<RecipeModel> preparationModels = new ArrayList<>();

@SuppressLint("ResourceAsColor")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -42,6 +48,23 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
recyclerView_Preparation.setLayoutManager(new LinearLayoutManager(this));
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.item_setting) {
Intent intentSetting = new Intent(this, SettingActivity.class);
startActivity(intentSetting);
return true;
}
return super.onOptionsItemSelected(item);
}

private void setupPreparationModels() {
String[] strings_preparation = getResources().getStringArray(R.array.preparation_array);
for (String s : strings_preparation) {
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:layout_marginTop="4dp"
android:text="@string/textviewComplain"
android:textAppearance="?android:attr/textAppearanceMedium" />

Expand All @@ -35,7 +35,6 @@
android:layout_gravity="center"



android:text="@string/txViewCounterState"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
Expand All @@ -56,7 +55,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="4dp"
android:layout_marginBottom="2dp"
android:layout_alignParentBottom="true">


Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/layout-land/activity_recipe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="always"
android:layout_margin="5dp">
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp">

<LinearLayout
android:layout_width="match_parent"
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/res/layout-land/recycler_view_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="2dp"
style="@style/CustomCardview"
app:layout_constraintBottom_toBottomOf="parent"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<TextView

android:id="@+id/CVtextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:paddingBottom="16dp"
android:layout_marginLeft="5dp"
android:textAppearance="?android:attr/textAppearanceMedium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/layout/activity_changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/birthday"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_baseline_cake_24" />

<TextView
android:id="@+id/etChangelog"
android:layout_width="match_parent"
Expand All @@ -30,4 +36,6 @@
android:layout_marginTop="16dp"
android:gravity="start|top" />



</androidx.appcompat.widget.LinearLayoutCompat>
24 changes: 12 additions & 12 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="16dp"
android:layout_marginBottom="2dp"
android:layout_alignParentBottom="true">


<Button
android:id="@+id/counter_text_button"

<Button
android:id="@+id/counter_text_button"
android:layout_width="75dp"
android:layout_height="75dp"

android:layout_width="75dp"
android:layout_height="75dp"
android:background="@drawable/counter_plus_btn_bg_shape"

android:gravity="center"

android:background="@drawable/counter_plus_btn_bg_shape"
android:fontFamily="@font/opensans_extrabold"
android:text="@string/btnCounter"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/md_theme_light_onPrimary" />
android:fontFamily="@font/opensans_extrabold"
android:gravity="center"
android:text="@string/btnCounter"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/md_theme_light_onPrimary" />

</RelativeLayout>

</RelativeLayout>
5 changes: 4 additions & 1 deletion app/src/main/res/layout/activity_recipe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="always"
android:layout_margin="5dp">
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp">

<LinearLayout

Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout/recycler_view_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,28 @@
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="2dp"
style="@style/CustomCardview"


app:layout_constraintBottom_toBottomOf="parent"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<TextView

android:id="@+id/CVtextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:paddingBottom="16dp"
android:layout_marginLeft="5dp"
android:textAppearance="?android:attr/textAppearanceMedium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/raw/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## [1.0.12] - 2022-07-25
happy birthday Palatschinkencounter
### Added
-margin in recipe
- margin in recipe
### Changed
- now you can reach the settings-menu everytime
- landscape-mode-layout
- portrait-mode-layout
- added margin in recipe
- background color in recipe
4 changes: 4 additions & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
</style>

<style name="CustomCardview" parent="CardView">
<item name="cardBackgroundColor">@color/md_theme_dark_background</item>
</style>

<style name="MyAlertDialogTheme" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<item name="android:fontFamily">@font/opensans_regular</item>
<item name="colorPrimary">@color/md_theme_light_primary</item>
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
<item name="colorOnSecondary">@color/md_theme_light_onSecondary</item>
<item name="colorError">@color/md_theme_light_error</item>
<item name="colorOnError">@color/md_theme_light_onError</item>
<item name="android:colorBackground">@color/md_theme_light_background</item>
<item name="android:colorBackground">@color/md_theme_light_onSecondary</item>
<item name="colorOnBackground">@color/md_theme_light_onBackground</item>
<item name="colorSurface">@color/md_theme_light_surface</item>
<item name="colorOnSurface">@color/md_theme_light_onSurface</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>


</style>
<style name="CustomCardview" parent="CardView">
<item name="cardBackgroundColor">@color/md_theme_light_surface</item>
</style>


<style name="MyAlertDialogTheme" parent="Theme.MaterialComponents.Dialog.Alert">
<item name="android:fontFamily">@font/opensans_regular</item>
Expand All @@ -41,6 +43,7 @@

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:fontFamily">@font/opensans_bold</item>
<item name="android:colorBackground">@color/md_theme_light_onSecondary</item>
<item name="android:textColor">@color/md_theme_light_onPrimary</item>
<item name="android:buttonStyle">@style/ButtonColor</item>
<item name="colorButtonNormal">@color/md_theme_dark_primaryContainer</item>
Expand Down

0 comments on commit 412269e

Please sign in to comment.