update card design

This commit is contained in:
akaessens 2020-09-20 23:03:43 +02:00
parent 3c73ea2d77
commit 3c5876f6bc
5 changed files with 126 additions and 225 deletions

View File

@ -100,10 +100,15 @@ public class EventAdapter extends
holder.edit_text_event_description.setText(event.description);
}
if (event.image_url == null) {
holder.image_view_event_image.setVisibility(View.GONE);
}
else {
Picasso.get()
.load(event.image_url)
.placeholder(R.drawable.ic_banner_foreground)
.into(holder.image_view_event_image);
.load(event.image_url).into(holder.image_view_event_image);
}
//.placeholder(R.drawable.ic_banner_foreground)*/
}
// Returns the total count of items in the list

View File

@ -6,40 +6,30 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SnapHelper;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.squareup.picasso.Picasso;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Objects;
import static com.akdev.nofbeventscraper.FbEvent.createEventList;
import static com.akdev.nofbeventscraper.FbEvent.dateTimeToEpoch;
public class MainActivity extends AppCompatActivity {
protected Button ok_button;
protected ExtendedFloatingActionButton paste_button;
protected TextInputEditText edit_text_uri_input;
@ -81,9 +71,9 @@ public class MainActivity extends AppCompatActivity {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ok_button = (Button) findViewById(R.id.ok_button);
//ok_button = (Button) findViewById(R.id.ok_button);
paste_button = (ExtendedFloatingActionButton) findViewById(R.id.paste_button);
ok_button.setEnabled(false);
//ok_button.setEnabled(false);
/*
* initialize recycler view with empty list of events
@ -109,8 +99,7 @@ public class MainActivity extends AppCompatActivity {
try {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
String str = Objects.requireNonNull(clipboard.getPrimaryClip())
.getItemAt(0).getText().toString();
String str = clipboard.getPrimaryClip().getItemAt(0).getText().toString();
clear(true);
edit_text_uri_input.setText(str);
@ -139,7 +128,7 @@ public class MainActivity extends AppCompatActivity {
/*
* Add to calendar button: launch calendar application with current event
*/
ok_button.setOnClickListener(new View.OnClickListener() {
/*ok_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -241,7 +230,7 @@ public class MainActivity extends AppCompatActivity {
this.events.clear();
adapter.notifyDataSetChanged();
ok_button.setEnabled(false);
//ok_button.setEnabled(false);
}
/**
@ -262,7 +251,7 @@ public class MainActivity extends AppCompatActivity {
.placeholder(R.drawable.ic_banner_foreground)
.into(image_view_toolbar);*/
ok_button.setEnabled(true);
//ok_button.setEnabled(true);
}
@SuppressLint("RestrictedApi")

View File

@ -8,21 +8,6 @@
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<!-- <com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="NoFb Event Scraper" />
</com.google.android.material.appbar.AppBarLayout>-->
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
@ -60,7 +45,6 @@
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
@ -76,98 +60,5 @@
tools:ignore="UnusedAttribute" />
<include layout="@layout/content_main" />
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottom_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<Button
android:id="@+id/ok_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:padding="12dp"
android:text="@string/button_add"
android:textColor="#FFFFFF"
app:cornerRadius="24dp"
app:icon="@drawable/ic_event_available"
app:iconGravity="textStart"
app:iconPadding="16dp"
app:iconTint="#FFFFFF" />
</com.google.android.material.bottomappbar.BottomAppBar>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<!--<androidx.coordinatorlayout.widget.CoordinatorLayout 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:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="150dp"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/layout_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="center"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="NoFb Event Scraper" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/paste_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="64dp"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end"
app:icon="@drawable/ic_content_paste"
android:text="@android:string/paste"
android:tooltipText="@string/tooltip_paste"
tools:ignore="UnusedAttribute" />
<include layout="@layout/content_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>-->

View File

@ -3,16 +3,15 @@
<androidx.core.widget.NestedScrollView 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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
tools:showIn="@layout/activity_main">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="64dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
@ -24,6 +23,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:endIconCheckable="false"
@ -46,9 +46,11 @@
</com.google.android.material.textfield.TextInputLayout>
<androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:nestedScrollingEnabled="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -1,14 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView android:id="@+id/card"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:strokeWidth="1dp"
app:strokeColor="#000000"
app:cardElevation="0dp">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_view_event_image"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginRight="8dp"
android:contentDescription="thumbnail"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/edit_text_event_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hint_event_name"
android:textAppearance="?attr/textAppearanceHeadline6" />
<TextView
android:id="@+id/edit_text_event_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/hint_event_location"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
</LinearLayout>
<LinearLayout
@ -16,82 +56,56 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Media -->
<ImageView
android:id="@+id/image_view_event_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:contentDescription="image" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<!-- Title, secondary and supporting text -->
<TextView
android:id="@+id/edit_text_event_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textAppearance="?attr/textAppearanceHeadline6"
/>
<TextView
android:id="@+id/edit_text_event_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="start"
android:textAppearance="?attr/textAppearanceBody2"
/>
android:text="@string/hint_event_start"
android:textAppearance="?attr/textAppearanceBody2" />
<TextView
android:id="@+id/edit_text_event_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="end"
android:textAppearance="?attr/textAppearanceBody2"
/>
<TextView
android:id="@+id/edit_text_event_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="location"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="?android:attr/textColorSecondary"
/>
android:text="@string/hint_event_end"
android:textAppearance="?attr/textAppearanceBody2" />
<TextView
android:id="@+id/edit_text_event_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="description"
android:text="@string/hint_event_description"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="?android:attr/textColorSecondary"
/>
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
<!-- Buttons -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/button_add"
android:textColor="@android:color/white"
app:icon="@drawable/ic_event_available"
app:iconGravity="textStart"
app:iconTint="@android:color/white" />
<ImageButton
style="?android:attr/borderlessButtonStyle"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="add"
style="?attr/borderlessButtonStyle"
/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dismiss"
style="?attr/borderlessButtonStyle"
/>
android:gravity="end"
android:maxWidth="10dp"
android:src="@drawable/ic_add_location"
android:tint="@color/material_on_surface_emphasis_high_type" />
</LinearLayout>
</LinearLayout>