Added scroll animation on dashboard
This commit is contained in:
parent
e3072af5d1
commit
71bd4fbf8a
2 changed files with 23 additions and 1 deletions
|
@ -20,10 +20,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
<LinearLayout android:id="@+id/fragments"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="-40dp"
|
||||
android:padding="@dimen/dashPadding" >
|
||||
|
||||
<LinearLayout android:id="@+id/content"
|
||||
|
|
|
@ -6,10 +6,12 @@ import java.lang.ref.WeakReference;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.*;
|
||||
import android.widget.LinearLayout;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
|
@ -70,6 +72,8 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
|
|||
|
||||
private static final int START_ALPHA = 60;
|
||||
|
||||
int defaultMargin;
|
||||
|
||||
private Drawable actionBarBackground;
|
||||
FloatingActionButton fabButton;
|
||||
|
||||
|
@ -87,6 +91,18 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
|
|||
} else {
|
||||
//getSupportActionBar().show();
|
||||
fabButton.hideFloatingActionButton();
|
||||
|
||||
//makes other cards to move on top of the map card to make it look like android animations
|
||||
View fragments = findViewById(R.id.fragments);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
int margintop = -(int)(ratio * 60);
|
||||
Resources r = getResources();
|
||||
int px = (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
margintop,
|
||||
r.getDisplayMetrics());
|
||||
params.setMargins(0, px + defaultMargin, 0, 0);
|
||||
fragments.setLayoutParams(params);
|
||||
}
|
||||
if (newAlpha > START_ALPHA) {
|
||||
actionBarBackground.setAlpha(newAlpha);
|
||||
|
@ -175,6 +191,11 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
|
|||
fabButton.hideFloatingActionButton();
|
||||
getLocationProvider().addCompassListener(this);
|
||||
getLocationProvider().registerOrUnregisterCompassListener(true);
|
||||
|
||||
defaultMargin = (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
-40,
|
||||
getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue