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);
}
Picasso.get()
.load(event.image_url)
.placeholder(R.drawable.ic_banner_foreground)
.into(holder.image_view_event_image);
if (event.image_url == null) {
holder.image_view_event_image.setVisibility(View.GONE);
}
else {
Picasso.get()
.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>-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -3,52 +3,54 @@
<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"
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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="64dp"
android:orientation="vertical">
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layout_uri_input"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
app:endIconCheckable="false"
app:endIconDrawable="@drawable/ic_backspace_black"
app:endIconMode="custom"
app:errorIconDrawable="@drawable/ic_backspace_black"
app:helperText="@string/helper_add_link"
app:helperTextEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_uri_input"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layout_uri_input"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:cursorVisible="true"
android:hint="@string/hint_add_link"
android:inputType="textNoSuggestions"
android:singleLine="true"
android:textColorLink="@color/material_on_background_emphasis_high_type" />
</com.google.android.material.textfield.TextInputLayout>
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
<androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
app:endIconCheckable="false"
app:endIconDrawable="@drawable/ic_backspace_black"
app:endIconMode="custom"
app:errorIconDrawable="@drawable/ic_backspace_black"
app:helperText="@string/helper_add_link"
app:helperTextEnabled="true">
</LinearLayout>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_uri_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:cursorVisible="true"
android:hint="@string/hint_add_link"
android:inputType="textNoSuggestions"
android:singleLine="true"
android:textColorLink="@color/material_on_background_emphasis_high_type" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -1,97 +1,111 @@
<?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="wrap_content"
android:layout_margin="8dp"
app:strokeWidth="1dp"
app:strokeColor="#000000"
app:cardElevation="0dp">
android:layout_height="match_parent"
android:layout_margin="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
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">
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- Title, secondary and supporting text -->
<TextView
android:id="@+id/edit_text_event_name"
android:layout_width="wrap_content"
<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:text="Title"
android:textAppearance="?attr/textAppearanceHeadline6"
/>
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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<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>