1
0
Fork 0
mirror of https://github.com/MatomoCamp/matomocamp-companion-android.git synced 2024-09-19 16:13:46 +02:00

Added custom animation when opening settings menu.

Added settings icon and show it if there's room.
This commit is contained in:
Christophe Beyls 2014-01-08 00:26:10 +01:00
parent 2a2da59839
commit aa88aad78e
11 changed files with 54 additions and 2 deletions

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="100%p"
android:toXDelta="0" />

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="0"
android:toXDelta="100%p" />

17
res/anim/zoom_in.xml Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime" >
<scale
android:fromXScale="0.75"
android:fromYScale="0.75"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" />
<alpha
android:fromAlpha="0.5"
android:toAlpha="1.0" />
</set>

17
res/anim/zoom_out.xml Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime" >
<scale
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.75"
android:toYScale="0.75" />
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.5" />
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View file

@ -16,8 +16,9 @@
app:showAsAction="ifRoom"/>
<item
android:id="@+id/settings"
android:icon="@drawable/ic_action_settings"
android:menuCategory="secondary"
android:title="@string/settings"
app:showAsAction="never"/>
app:showAsAction="ifRoom"/>
</menu>

View file

@ -314,6 +314,7 @@ public class MainActivity extends ActionBarActivity implements ListView.OnItemCl
return true;
case R.id.settings:
startActivity(new Intent(this, SettingsActivity.class));
overridePendingTransition(R.anim.slide_in_right, R.anim.zoom_out);
return true;
}
return false;

View file

@ -25,9 +25,15 @@ public class SettingsActivity extends ActionBarActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
onBackPressed();
return true;
}
return false;
}
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(R.anim.zoom_in, R.anim.slide_out_right);
}
}