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:
parent
2a2da59839
commit
aa88aad78e
11 changed files with 54 additions and 2 deletions
5
res/anim/slide_in_right.xml
Normal file
5
res/anim/slide_in_right.xml
Normal 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" />
|
5
res/anim/slide_out_right.xml
Normal file
5
res/anim/slide_out_right.xml
Normal 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
17
res/anim/zoom_in.xml
Normal 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
17
res/anim/zoom_out.xml
Normal 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>
|
BIN
res/drawable-hdpi/ic_action_settings.png
Normal file
BIN
res/drawable-hdpi/ic_action_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 468 B |
BIN
res/drawable-mdpi/ic_action_settings.png
Normal file
BIN
res/drawable-mdpi/ic_action_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 340 B |
BIN
res/drawable-xhdpi/ic_action_settings.png
Normal file
BIN
res/drawable-xhdpi/ic_action_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 591 B |
BIN
res/drawable-xxhdpi/ic_action_settings.png
Normal file
BIN
res/drawable-xxhdpi/ic_action_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 849 B |
|
@ -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>
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue