Commit 6f302781 authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Launcher perfectly handled

parent 954b2086
......@@ -14,8 +14,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:launchMode="singleInstance"
android:launchMode="singleTask"
android:stateNotNeeded="true"
android:theme="@style/AppTheme">
<activity android:name="fr.utc.simde.jessy.MainActivity"
......
......@@ -3,11 +3,13 @@ package fr.utc.simde.jessy;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
......@@ -120,6 +122,25 @@ public class MainActivity extends BaseActivity {
badgeDialog(badgeId);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (Integer.parseInt(android.os.Build.VERSION.SDK) > 5 && keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
onBackPressed();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public void onBackPressed() {
Intent setIntent = new Intent(Intent.ACTION_MAIN);
setIntent.addCategory(Intent.CATEGORY_HOME);
setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(setIntent);
}
@Override
protected void unregister(final Activity activity) {
super.unregister(activity);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment