Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #7303 from zackhow/exitemumenu
Android:  Add exit to phone emu menu
  • Loading branch information
degasus committed Aug 9, 2018
2 parents bfbf9ed + 58aa6b9 commit 74057ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Expand Up @@ -45,6 +45,7 @@
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
import org.dolphinemu.dolphinemu.utils.Java_GCAdapter;
import org.dolphinemu.dolphinemu.utils.Java_WiimoteAdapter;
import org.dolphinemu.dolphinemu.utils.TvUtil;

import java.lang.annotation.Retention;
import java.util.List;
Expand Down Expand Up @@ -589,7 +590,9 @@ public void handleMenuAction(@MenuAction int menuAction)
return;

case MENU_ACTION_EXIT:
toggleMenu(); // Hide the menu (it will be showing since we just clicked it)
// ATV menu is built using a fragment, this will pop that fragment before emulation ends.
if(TvUtil.isLeanback(getApplicationContext()))
toggleMenu(); // Hide the menu (it will be showing since we just clicked it)
mEmulationFragment.stopEmulation();
exitWithAnimation();
return;
Expand Down
Expand Up @@ -6,6 +6,7 @@
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -293,4 +294,8 @@ private static List<HomeScreenChannel> createPlatformSubscriptions()
}
return subs;
}
public static Boolean isLeanback(Context context)
{
return(context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK));
}
}
4 changes: 4 additions & 0 deletions Source/Android/app/src/main/res/menu/menu_emulation.xml
Expand Up @@ -106,4 +106,8 @@
app:showAsAction="never"
android:title="@string/emulation_change_disc"/>

<item
android:id="@+id/menu_exit"
app:showAsAction="never"
android:title="@string/emulation_exit"/>
</menu>

0 comments on commit 74057ec

Please sign in to comment.