Android TV: Visual tweaks & glitch fixes

This commit is contained in:
sigmabeta 2015-07-03 16:38:23 -04:00
parent 9dd4cee1b7
commit d191d8851a
4 changed files with 30 additions and 42 deletions

View File

@ -13,6 +13,9 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -41,6 +44,9 @@ public final class EmulationActivity extends AppCompatActivity
// So that MainActivity knows which view to invalidate before the return animation.
private int mPosition;
private static Interpolator sDecelerator = new DecelerateInterpolator();
private static Interpolator sAccelerator = new AccelerateInterpolator();
/**
* Handlers are a way to pass a message to an Activity telling it to do something
* on the UI thread. This Handler responds to any message, even blank ones, by
@ -241,44 +247,40 @@ public final class EmulationActivity extends AppCompatActivity
{
if (mMenuVisible)
{
mMenuVisible = false;
mMenuLayout.animate()
.withLayer()
.setDuration(200)
.setInterpolator(sAccelerator)
.alpha(0.0f)
.scaleX(1.1f)
.scaleY(1.1f)
.translationX(-400.0f)
.withEndAction(new Runnable()
{
@Override
public void run()
{
mMenuLayout.setVisibility(View.GONE);
mMenuVisible = false;
if (mMenuVisible)
{
mMenuLayout.setVisibility(View.GONE);
}
}
});
}
else
{
mMenuVisible = true;
mMenuLayout.setVisibility(View.VISIBLE);
mMenuLayout.setScaleX(1.1f);
mMenuLayout.setScaleY(1.1f);
// mMenuLayout.setTranslationX(-400.0f);
mMenuLayout.setAlpha(0.0f);
mMenuLayout.animate()
.withLayer()
.setDuration(300)
.setInterpolator(sDecelerator)
.alpha(1.0f)
.scaleX(1.0f)
.scaleY(1.0f)
.withEndAction(new Runnable()
{
@Override
public void run()
{
mMenuVisible = true;
}
});
.translationX(0.0f);
}
}

View File

@ -20,7 +20,6 @@
android:id="@+id/layout_ingame_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#af000000"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible"
@ -38,7 +37,7 @@
android:id="@+id/frame_submenu"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"/>
android:layout_weight="3"/>
</LinearLayout>

View File

@ -3,62 +3,44 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="32dp">
android:background="@color/dolphin_blue_dark"
android:paddingTop="32dp"
android:paddingBottom="32dp"
>
<Button
android:id="@+id/menu_take_screenshot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overlay_screenshot"
android:layout_margin="8dp"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_quicksave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/emulation_quicksave"
android:layout_margin="8dp"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_quickload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/emulation_quickload"
android:layout_margin="8dp"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_emulation_save_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overlay_savestate"
android:layout_margin="8dp"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_emulation_load_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overlay_loadstate"
android:layout_margin="8dp"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_ingame_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings"
android:layout_margin="8dp"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_exit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overlay_exit_emulation"
android:layout_margin="8dp"
style="@style/InGameMenuOption"/>
</LinearLayout>

View File

@ -127,11 +127,16 @@
</style>
<style name="InGameMenuOption" parent="Widget.AppCompat.Button.Borderless">
<item name="android:textSize">24dp</item>
<item name="android:textSize">20sp</item>
<item name="android:fontFamily">sans-serif-condensed</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:textAllCaps">false</item>
<item name="android:gravity">left</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="android:gravity">center_vertical|left</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
<item name="android:layout_margin">0dp</item>
</style>
</resources>