vocabularymanager navigation bar, hotfix system menu

parent e9e8e04b
......@@ -124,10 +124,9 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// blockNotificationBar();
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
onWindowFocusChanged(true);
// after a long inactivity, the pcbdb is discarded
if (!PCBcontext.is_user_logged()) {
......@@ -310,6 +309,7 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
@Override
protected void onResume() {
super.onResume();
onWindowFocusChanged(true);
Log.i(LOG_TAG, "Resuming Pictogram Activity");
PCBcontext.setActivityContext(this);
setConfig();
......@@ -321,23 +321,6 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
, Toast.LENGTH_SHORT).show();
}
private void blockNotificationBar() {
WindowManager manager = ((WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE));
WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
// this is to enable the notification to recieve touch events
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
// Draws over status bar
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
localLayoutParams.height = (int) (50 * getResources().getDisplayMetrics().scaledDensity);
localLayoutParams.format = PixelFormat.TRANSPARENT;
customViewGroup view = new customViewGroup(this);
manager.addView(view, localLayoutParams);
}
public void setConfig() {
setFeedback(new View[]{deleteButton, ttsButton, this.showPictoCategoriesViewButton, this.pictoCategoryGridView, this.pictoMainGridView});
}
......
......@@ -33,7 +33,9 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.yottacode.pictogram.action.TalkAction;
......@@ -118,10 +120,9 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// blockNotificationBar();
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
onWindowFocusChanged(true);
// after a long inactivity, the pcbdb is discarded
if (!PCBcontext.is_user_logged()) {
......@@ -143,7 +144,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
this.vocabulary = PCBcontext.getVocabulary();
this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() {
@Override
public void action(action action, int picto_cat, int picto_id, JSONObject msg) {
Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
......@@ -247,7 +247,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
VocabularyManager.this.pictoMainGridView.setNumColumns(VocabularyManager.this.maxColumns);
VocabularyManager.this.pictoCategoryGridView.setNumColumns(VocabularyManager.this.maxColumns);
this.generateAnimations();
if (this.getCurrentCategory() != null) {
......@@ -256,11 +255,24 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
this.showPictoMainGridView();
}
// vmTopbar and vmBigTopbar data
User student = PCBcontext.getPcbdb().getCurrentUser();
final TextView StudentFullNameView = (TextView) findViewById(R.id.vmTopbarStudentFullName);
final ImageView StudentPhotoView = (ImageView) findViewById(R.id.vmTopbarStudentPhoto);
StudentFullNameView.setText(student.get_name_stu() + " " + student.get_surname_stu());
try {
StudentPhotoView.setImageBitmap(student.get_bitmap_stu(this.getBaseContext()));
} catch (IOException e) {
Log.e(LOG_TAG,e.getMessage());
}
}
@Override
protected void onResume() {
super.onResume();
onWindowFocusChanged(true);
Log.i(LOG_TAG, "Resuming Pictogram Activity");
PCBcontext.setActivityContext(this);
Toast.makeText(this.getBaseContext(), PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_stu()+
......@@ -270,23 +282,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
, Toast.LENGTH_SHORT).show();
}
private void blockNotificationBar() {
WindowManager manager = ((WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE));
WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
// this is to enable the notification to recieve touch events
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
// Draws over status bar
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
localLayoutParams.height = (int) (50 * getResources().getDisplayMetrics().scaledDensity);
localLayoutParams.format = PixelFormat.TRANSPARENT;
customViewGroup view = new customViewGroup(this);
manager.addView(view, localLayoutParams);
}
private void setFeedback(View views[]) {
boolean vibration = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.VIBRATION);
boolean click = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.BEEP);
......
......@@ -40,7 +40,10 @@ public class LoginActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
setContentView(com.yottacode.pictogram.tabletlibrary.R.layout.activity_login);
// Enable logout button
......@@ -109,4 +112,24 @@ public class LoginActivity extends FragmentActivity {
super.onResume();
PCBcontext.setActivityContext(this);
}
/**
* Disable long power button press (system menu)
*
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
}
}
......@@ -157,8 +157,12 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SessionActivity.session=this;
requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
setContentView(R.layout.activity_session);
User student=PCBcontext.getPcbdb().getCurrentUser();
final TextView StudentFullNameView = (TextView) findViewById(R.id.sessionTopbarStudentFullName);
final ImageView StudentPhotoView = (ImageView) findViewById(R.id.sessionTopbarStudentPhoto);
......@@ -396,9 +400,30 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
}
}
/**
* Disable long power button press (system menu)
*
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
}
@Override
public void onResume() {
super.onResume();
onWindowFocusChanged(true);
PCBcontext.setActivityContext(this);
}
......
......@@ -15,13 +15,13 @@
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<RelativeLayout
android:id="@+id/loginTopbarLayout"
android:id="@+id/vmTopbarLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/menu_top_height"
android:background="@color/VerdeApp">
<ImageView
android:id="@+id/loginTopbarSupervisorPhoto"
android:id="@+id/vmTopbarStudentPhoto"
android:layout_width="@dimen/menu_top_height"
android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true"
......@@ -31,18 +31,18 @@
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/loginTopbarSupervisorNameLayout"
android:id="@+id/vmTopbarStudentNameLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toEndOf="@+id/loginTopbarSupervisorPhoto"
android:layout_toEndOf="@+id/vmTopbarStudentPhoto"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/loginTopbarSupervisorFullName"
android:id="@+id/vmTopbarStudentFullName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
......@@ -58,7 +58,7 @@
android:layout_width="96dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="@+id/loginTopbarLayout"
android:layout_below="@+id/vmTopbarLayout"
android:background="#EEEEEE"
android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" />
......@@ -69,7 +69,7 @@
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/loginTopbarLayout"
android:layout_below="@+id/vmTopbarLayout"
android:layout_toEndOf="@+id/showPictoCategoriesViewButton"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
......@@ -86,7 +86,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/loginTopbarLayout"
android:layout_below="@+id/vmTopbarLayout"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
......
......@@ -15,14 +15,14 @@
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<RelativeLayout
android:id="@+id/sessionTopbarLayout"
android:id="@+id/vmTopbarLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true"
android:background="@color/VerdeApp">
<ImageView
android:id="@+id/sessionTopbarStudentPhoto"
android:id="@+id/vmTopbarStudentPhoto"
android:layout_width="@dimen/menu_top_height"
android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true"
......@@ -32,18 +32,18 @@
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/sessionTopbarStudentNameLayout"
android:id="@+id/vmTopbarStudentNameLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toEndOf="@+id/sessionTopbarStudentPhoto"
android:layout_toEndOf="@+id/vmTopbarStudentPhoto"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/sessionTopbarStudentFullName"
android:id="@+id/vmTopbarStudentFullName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
......@@ -58,7 +58,7 @@
android:layout_width="96dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="@+id/sessionTopbarLayout"
android:layout_below="@+id/vmTopbarLayout"
android:background="#EEEEEE"
android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" />
......@@ -69,7 +69,7 @@
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/sessionTopbarLayout"
android:layout_below="@+id/vmTopbarLayout"
android:layout_toEndOf="@+id/showPictoCategoriesViewButton"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
......@@ -86,12 +86,12 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/sessionTopbarLayout"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
android:paddingLeft="@dimen/small_padding"
android:verticalSpacing="@dimen/picto_grid_spacing"></GridView>
android:verticalSpacing="@dimen/picto_grid_spacing"
android:layout_below="@+id/vmTopbarLayout"></GridView>
</RelativeLayout>
......
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 sign in to comment