Android: Add exit to phone emu menu
Some phones that have capacitive nav bar buttons disable those buttons while in emulation. This gives those devices a way to exit
This commit is contained in:
parent
46fe6dc48c
commit
58aa6b9905
|
@ -45,6 +45,7 @@ import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
|
||||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||||
import org.dolphinemu.dolphinemu.utils.Java_GCAdapter;
|
import org.dolphinemu.dolphinemu.utils.Java_GCAdapter;
|
||||||
import org.dolphinemu.dolphinemu.utils.Java_WiimoteAdapter;
|
import org.dolphinemu.dolphinemu.utils.Java_WiimoteAdapter;
|
||||||
|
import org.dolphinemu.dolphinemu.utils.TvUtil;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -589,6 +590,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_ACTION_EXIT:
|
case MENU_ACTION_EXIT:
|
||||||
|
// 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)
|
toggleMenu(); // Hide the menu (it will be showing since we just clicked it)
|
||||||
mEmulationFragment.stopEmulation();
|
mEmulationFragment.stopEmulation();
|
||||||
exitWithAnimation();
|
exitWithAnimation();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.app.job.JobScheduler;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
@ -293,4 +294,8 @@ public class TvUtil
|
||||||
}
|
}
|
||||||
return subs;
|
return subs;
|
||||||
}
|
}
|
||||||
|
public static Boolean isLeanback(Context context)
|
||||||
|
{
|
||||||
|
return(context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,4 +106,8 @@
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/emulation_change_disc"/>
|
android:title="@string/emulation_change_disc"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_exit"
|
||||||
|
app:showAsAction="never"
|
||||||
|
android:title="@string/emulation_exit"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
Loading…
Reference in New Issue