Skip to content

Commit

Permalink
switching between activities now has a pretty transition
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Owen committed Feb 20, 2014
1 parent 4cb0ea2 commit 61eaebc
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions res/anim/slide_in_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="100%p" android:toXDelta="0%p"
android:duration="@android:integer/config_longAnimTime"/>
4 changes: 4 additions & 0 deletions res/anim/slide_in_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="-100%p" android:toXDelta="0%p"
android:duration="@android:integer/config_longAnimTime"/>
4 changes: 4 additions & 0 deletions res/anim/slide_out_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0%p" android:toXDelta="-100%p"
android:duration="@android:integer/config_longAnimTime"/>
4 changes: 4 additions & 0 deletions res/anim/slide_out_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0%p" android:toXDelta="100%p"
android:duration="@android:integer/config_longAnimTime"/>
1 change: 1 addition & 0 deletions res/layout/note_hub.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
android:layout_gravity="center"
android:textColor="@color/white"
android:layout_weight=".65" />

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand Down
6 changes: 4 additions & 2 deletions src/com/spinninggangstaz/stickyspeech/EditNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ public void onClick(View view) {
NoteDB.saveNotes();

Intent returnToNoteHubActivity = new Intent(EditNote.this, NoteHubActivity.class);
setResult(1, returnToNoteHubActivity);
setResult(1, returnToNoteHubActivity);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_right);
finish();
}
});
}

protected void returnWithoutSaving() {
Intent returnToNoteHubActivity = new Intent(EditNote.this, NoteHubActivity.class);
setResult(55, returnToNoteHubActivity);
setResult(55, returnToNoteHubActivity);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_right);
finish();
}
}
2 changes: 2 additions & 0 deletions src/com/spinninggangstaz/stickyspeech/NoteHubActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ protected void onListItemClick(ListView l, View v, int position, long id) {
editNoteActivity.putExtra("noteIndex", position);

startActivityForResult(editNoteActivity, 1);
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);

}

Expand All @@ -167,6 +168,7 @@ else if(requestCode == 1 && resultCode == 55) {
protected void goToNewNote() {
Intent startNewNoteActivity = new Intent(NoteHubActivity.this, TakeNote.class);
startActivity(startNewNoteActivity);
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_right);
}

private class NoteAdapter extends ArrayAdapter<Note> {
Expand Down
2 changes: 2 additions & 0 deletions src/com/spinninggangstaz/stickyspeech/TakeNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void onClick(View view) {

Intent startNoteHubActivity = new Intent(TakeNote.this, NoteHubActivity.class);
startActivity(startNoteHubActivity);
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);
}
});
}
Expand Down Expand Up @@ -164,6 +165,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data)
protected void gotoNoteHub() {
Intent startNoteHubActivity = new Intent(TakeNote.this, NoteHubActivity.class);
startActivity(startNoteHubActivity);
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);
}

}

0 comments on commit 61eaebc

Please sign in to comment.