add animation for new event

This commit is contained in:
akaessens 2020-09-26 19:58:37 +02:00
parent a30756a873
commit af504084fe
2 changed files with 10 additions and 7 deletions

View File

@ -45,8 +45,10 @@ dependencies {
// Image loading and transforming
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
// animations and transformations
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
implementation 'jp.wasabeef:recyclerview-animators:3.0.0'
// tests
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'

View File

@ -33,14 +33,14 @@ import java.lang.reflect.Type;
import java.util.List;
import java.util.Objects;
import jp.wasabeef.recyclerview.animators.FadeInAnimator;
import static com.akdev.nofbeventscraper.FbEvent.createEventList;
public class MainActivity extends AppCompatActivity {
protected ExtendedFloatingActionButton paste_button;
protected TextInputEditText edit_text_uri_input;
protected TextInputLayout layout_uri_input;
@ -115,7 +115,9 @@ public class MainActivity extends AppCompatActivity {
recycler_view.setAdapter(adapter);
linear_layout_manager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recycler_view.setLayoutManager(linear_layout_manager);
recycler_view.setHasFixedSize(true);
recycler_view.setItemAnimator(new FadeInAnimator());
/*
@ -229,8 +231,7 @@ public class MainActivity extends AppCompatActivity {
if (error) {
layout_uri_input.setError(str);
}
else {
} else {
layout_uri_input.setError(null);
layout_uri_input.setHelperText(str);
}
@ -245,7 +246,7 @@ public class MainActivity extends AppCompatActivity {
if (new_event != null) {
this.events.add(0, new_event);
this.adapter.notifyDataSetChanged();
this.adapter.notifyItemInserted(0);
}
}