diff --git a/src/frontends/android/res/layout/imc_state_fragment.xml b/src/frontends/android/res/layout/imc_state_fragment.xml
new file mode 100644
index 000000000..bdb3cd37d
--- /dev/null
+++ b/src/frontends/android/res/layout/imc_state_fragment.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/frontends/android/res/layout/main.xml b/src/frontends/android/res/layout/main.xml
index 1c7973e20..ab03e72bc 100644
--- a/src/frontends/android/res/layout/main.xml
+++ b/src/frontends/android/res/layout/main.xml
@@ -1,6 +1,6 @@
+ Assessment:
+ Eingeschränkt
+ Fehlgeschlagen
+
Passwort eingeben um zu verbinden
Verbinden
diff --git a/src/frontends/android/res/values-pl/strings.xml b/src/frontends/android/res/values-pl/strings.xml
index 9a5471530..e3576d5de 100644
--- a/src/frontends/android/res/values-pl/strings.xml
+++ b/src/frontends/android/res/values-pl/strings.xml
@@ -1,7 +1,5 @@
+ Assessment:
+ Restricted
+ Failed
+
Wprowadż hasło
Połącz
diff --git a/src/frontends/android/res/values-ru/strings.xml b/src/frontends/android/res/values-ru/strings.xml
index 9ff1eff5e..f5f696ab4 100644
--- a/src/frontends/android/res/values-ru/strings.xml
+++ b/src/frontends/android/res/values-ru/strings.xml
@@ -83,6 +83,11 @@
Нет активных VPN
Ошибка
+
+ Assessment:
+ Restricted
+ Failed
+
Введите пароль для соединения
Соединить
diff --git a/src/frontends/android/res/values-ua/strings.xml b/src/frontends/android/res/values-ua/strings.xml
index e420a35f4..39d67eaba 100644
--- a/src/frontends/android/res/values-ua/strings.xml
+++ b/src/frontends/android/res/values-ua/strings.xml
@@ -1,7 +1,7 @@
+ Assessment:
+ Restricted
+ Failed
+
Введіть пароль для з\'єднання
Підключити
diff --git a/src/frontends/android/res/values/colors.xml b/src/frontends/android/res/values/colors.xml
index be64d5d5a..ee8d72461 100644
--- a/src/frontends/android/res/values/colors.xml
+++ b/src/frontends/android/res/values/colors.xml
@@ -1,6 +1,6 @@
+ Assessment:
+ Restricted
+ Failed
+
Enter password to connect
Connect
diff --git a/src/frontends/android/src/org/strongswan/android/ui/ImcStateFragment.java b/src/frontends/android/src/org/strongswan/android/ui/ImcStateFragment.java
new file mode 100644
index 000000000..473611394
--- /dev/null
+++ b/src/frontends/android/src/org/strongswan/android/ui/ImcStateFragment.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2013 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See .
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+package org.strongswan.android.ui;
+
+import org.strongswan.android.R;
+import org.strongswan.android.logic.VpnStateService;
+import org.strongswan.android.logic.VpnStateService.VpnStateListener;
+
+import android.app.Fragment;
+import android.app.FragmentTransaction;
+import android.app.Service;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class ImcStateFragment extends Fragment implements VpnStateListener
+{
+ private TextView mStateView;
+ private VpnStateService mService;
+ private final ServiceConnection mServiceConnection = new ServiceConnection() {
+ @Override
+ public void onServiceDisconnected(ComponentName name)
+ {
+ mService = null;
+ }
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service)
+ {
+ mService = ((VpnStateService.LocalBinder)service).getService();
+ mService.registerListener(ImcStateFragment.this);
+ updateView();
+ }
+ };
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ /* bind to the service only seems to work from the ApplicationContext */
+ Context context = getActivity().getApplicationContext();
+ context.bindService(new Intent(context, VpnStateService.class),
+ mServiceConnection, Service.BIND_AUTO_CREATE);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState)
+ {
+ View view = inflater.inflate(R.layout.imc_state_fragment, null);
+
+ mStateView = (TextView)view.findViewById(R.id.imc_state);
+
+ return view;
+ }
+
+ @Override
+ public void onDestroy()
+ {
+ super.onDestroy();
+ if (mService != null)
+ {
+ mService.unregisterListener(this);
+ getActivity().getApplicationContext().unbindService(mServiceConnection);
+ }
+ }
+
+ @Override
+ public void stateChanged()
+ {
+ updateView();
+ }
+
+ public void updateView()
+ {
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
+ ft.show(this);
+
+ switch (mService.getImcState())
+ {
+ case UNKNOWN:
+ case ALLOW:
+ ft.hide(this);
+ break;
+ case ISOLATE:
+ mStateView.setText(R.string.imc_state_isolate);
+ mStateView.setTextColor(getResources().getColor(R.color.warning_text));
+ break;
+ case BLOCK:
+ mStateView.setText(R.string.imc_state_block);
+ mStateView.setTextColor(getResources().getColor(R.color.error_text));
+ break;
+ }
+ ft.commit();
+ }
+}