Skip to content

Commit

Permalink
fixed reusage GradualAnimation of another item in ListView
Browse files Browse the repository at this point in the history
  • Loading branch information
Nexen23 committed Aug 26, 2015
1 parent 9bef9bc commit fbf8b34
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
<orderEntry type="library" exported="" name="apktool-lib-1.4.4-3" level="project" />
<orderEntry type="library" exported="" name="aspectjrt-1.8.5" level="project" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="logback-android-core-1.1.1-4" level="project" />
<orderEntry type="library" exported="" name="joda-time-2.8.2" level="project" />
<orderEntry type="library" exported="" name="logback-android-core-1.1.1-4" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="slf4j-api-1.7.12" level="project" />
<orderEntry type="library" exported="" name="hugo-runtime-1.2.1" level="project" />
Expand Down
14 changes: 4 additions & 10 deletions app/src/main/java/alex/imhere/adapter/UsersAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,24 @@ public View getView(int position, View convertView, ViewGroup parent) {

/*String sessionLoggingString = "null";
String userViewLoggingString = "null";
String animationLoggingString = "null";
if (session != null) {
sessionLoggingString = session.getUdid();
}
if (userView != null) {
userViewLoggingString = String.format("%d", userView.hashCode());
Animation userViewAnimation = userView.getAnimation();
if (userViewAnimation != null) {
animationLoggingString = String.format("%d", userViewAnimation.hashCode());
}
}
String loggingString = String.format("[UsersAdapter] [%d - %s] {userView == %s} {animation == %s}",
position, sessionLoggingString, userViewLoggingString, animationLoggingString);
String loggingString = String.format("[UsersAdapter] [%d - %s] {userView == %s}",
position, sessionLoggingString, userViewLoggingString);
Log.d("TAG", loggingString);*/

if (userView == null)
if (userView == null || userView.getTag() == null || userView.getTag() != session)
{
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
userView = (UserLayout) inflater.inflate(resourceId, parent, false);

userView.setTag(session);

if (session != null) {
Long restLifetimeMs = session.getRestLifetime().getMillis();
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/alex/imhere/fragment/UsersFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ public void onDataUpdate(final int notification, final Object data) {
usersAdapter.clear();
break;

/*default :
default :
usersAdapter.notifyDataSetChanged();
break;*/
break;
}
usersAdapter.notifyDataSetChanged();

currentSessionWasAlive = currentSessionIsAlive;
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/alex/imhere/util/TemporaryElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public int compareTo(Object another) {
TemporaryElement a = this,
b = (TemporaryElement) another;

if (a.object.equals(b.object)) {
return 0;
}

int datesComparisionResult = a.deathTime.compareTo(b.deathTime);
int objectsComparisionResult = a.hashCode() - b.hashCode();
return (datesComparisionResult != 0) ? datesComparisionResult : objectsComparisionResult;
Expand Down

0 comments on commit fbf8b34

Please sign in to comment.