Permalink
Browse files

Merge pull request #485 from fzurita/cheat_improvements

Adding, editing, and deleting no longer resets scroll position
  • Loading branch information...
xperia64 committed Oct 12, 2015
2 parents b0bc5bf + 980d51c commit 0281802a703c813f6b278961eccaa30eba47cc93
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/paulscode/android/mupen64plusae/cheat/CheatEditorActivity.java
@@ -220,8 +220,8 @@ public void onClick( View v )
cheat.code = "";
cheat.option = "";
userCheats.add( cheat );
- cheatListAdapter = new CheatListAdapter( CheatEditorActivity.this, userCheats );
- setListAdapter( cheatListAdapter );
+ Collections.sort(userCheats);
+ cheatListAdapter.notifyDataSetChanged();
Toast t = Toast.makeText( CheatEditorActivity.this, getString( R.string.cheatEditor_added ), Toast.LENGTH_SHORT );
t.show();
break;
@@ -283,6 +283,8 @@ public void onClick( View v )
{
case R.id.btnEditTitle:
promptTitle( cheat );
+ Collections.sort(userCheats);
+ cheatListAdapter.notifyDataSetChanged();
break;
case R.id.btnEditNotes:
promptNotes( cheat );
@@ -358,8 +360,6 @@ public void onDialogClosed( CharSequence text, int which )
{
String str = text.toString().replace( '\n', ' ' );
cheat.name = str;
- cheatListAdapter = new CheatListAdapter( CheatEditorActivity.this, userCheats );
- setListAdapter( cheatListAdapter );
}
}
} );
@@ -517,8 +517,7 @@ public void onClick( DialogInterface dialog, int which )
if( which == DialogInterface.BUTTON_POSITIVE )
{
userCheats.remove( pos );
- cheatListAdapter = new CheatListAdapter( CheatEditorActivity.this, userCheats );
- setListAdapter( cheatListAdapter );
+ cheatListAdapter.notifyDataSetChanged();
}
}
};

0 comments on commit 0281802

Please sign in to comment.