vocabularymanager navigation bar, hotfix system menu

parent e9e8e04b
...@@ -124,10 +124,9 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -124,10 +124,9 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// blockNotificationBar();
requestWindowFeature(Window.FEATURE_NO_TITLE); 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 // after a long inactivity, the pcbdb is discarded
if (!PCBcontext.is_user_logged()) { if (!PCBcontext.is_user_logged()) {
...@@ -310,6 +309,7 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -310,6 +309,7 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
onWindowFocusChanged(true);
Log.i(LOG_TAG, "Resuming Pictogram Activity"); Log.i(LOG_TAG, "Resuming Pictogram Activity");
PCBcontext.setActivityContext(this); PCBcontext.setActivityContext(this);
setConfig(); setConfig();
...@@ -321,23 +321,6 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -321,23 +321,6 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
, Toast.LENGTH_SHORT).show(); , 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() { public void setConfig() {
setFeedback(new View[]{deleteButton, ttsButton, this.showPictoCategoriesViewButton, this.pictoCategoryGridView, this.pictoMainGridView}); setFeedback(new View[]{deleteButton, ttsButton, this.showPictoCategoriesViewButton, this.pictoCategoryGridView, this.pictoMainGridView});
} }
......
...@@ -33,7 +33,9 @@ import android.widget.CheckBox; ...@@ -33,7 +33,9 @@ import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.GridView; import android.widget.GridView;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.yottacode.pictogram.action.TalkAction; import com.yottacode.pictogram.action.TalkAction;
...@@ -118,10 +120,9 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -118,10 +120,9 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// blockNotificationBar();
requestWindowFeature(Window.FEATURE_NO_TITLE); 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 // after a long inactivity, the pcbdb is discarded
if (!PCBcontext.is_user_logged()) { if (!PCBcontext.is_user_logged()) {
...@@ -143,7 +144,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -143,7 +144,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
this.vocabulary = PCBcontext.getVocabulary(); this.vocabulary = PCBcontext.getVocabulary();
this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() { this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() {
@Override @Override
public void action(action action, int picto_cat, int picto_id, JSONObject msg) { 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"); Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
...@@ -247,7 +247,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -247,7 +247,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
VocabularyManager.this.pictoMainGridView.setNumColumns(VocabularyManager.this.maxColumns); VocabularyManager.this.pictoMainGridView.setNumColumns(VocabularyManager.this.maxColumns);
VocabularyManager.this.pictoCategoryGridView.setNumColumns(VocabularyManager.this.maxColumns); VocabularyManager.this.pictoCategoryGridView.setNumColumns(VocabularyManager.this.maxColumns);
this.generateAnimations(); this.generateAnimations();
if (this.getCurrentCategory() != null) { if (this.getCurrentCategory() != null) {
...@@ -256,11 +255,24 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -256,11 +255,24 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
this.showPictoMainGridView(); 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 @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
onWindowFocusChanged(true);
Log.i(LOG_TAG, "Resuming Pictogram Activity"); Log.i(LOG_TAG, "Resuming Pictogram Activity");
PCBcontext.setActivityContext(this); PCBcontext.setActivityContext(this);
Toast.makeText(this.getBaseContext(), PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_stu()+ 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 ...@@ -270,23 +282,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
, Toast.LENGTH_SHORT).show(); , 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[]) { private void setFeedback(View views[]) {
boolean vibration = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.VIBRATION); 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); boolean click = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.BEEP);
......
...@@ -40,7 +40,10 @@ public class LoginActivity extends FragmentActivity { ...@@ -40,7 +40,10 @@ public class LoginActivity extends FragmentActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
setContentView(com.yottacode.pictogram.tabletlibrary.R.layout.activity_login); setContentView(com.yottacode.pictogram.tabletlibrary.R.layout.activity_login);
// Enable logout button // Enable logout button
...@@ -109,4 +112,24 @@ public class LoginActivity extends FragmentActivity { ...@@ -109,4 +112,24 @@ public class LoginActivity extends FragmentActivity {
super.onResume(); super.onResume();
PCBcontext.setActivityContext(this); 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 ...@@ -157,8 +157,12 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
SessionActivity.session=this; SessionActivity.session=this;
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
setContentView(R.layout.activity_session); setContentView(R.layout.activity_session);
User student=PCBcontext.getPcbdb().getCurrentUser(); User student=PCBcontext.getPcbdb().getCurrentUser();
final TextView StudentFullNameView = (TextView) findViewById(R.id.sessionTopbarStudentFullName); final TextView StudentFullNameView = (TextView) findViewById(R.id.sessionTopbarStudentFullName);
final ImageView StudentPhotoView = (ImageView) findViewById(R.id.sessionTopbarStudentPhoto); final ImageView StudentPhotoView = (ImageView) findViewById(R.id.sessionTopbarStudentPhoto);
...@@ -396,9 +400,30 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -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 @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
onWindowFocusChanged(true);
PCBcontext.setActivityContext(this); PCBcontext.setActivityContext(this);
} }
......
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) --> <!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<RelativeLayout <RelativeLayout
android:id="@+id/loginTopbarLayout" android:id="@+id/vmTopbarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/menu_top_height" android:layout_height="@dimen/menu_top_height"
android:background="@color/VerdeApp"> android:background="@color/VerdeApp">
<ImageView <ImageView
android:id="@+id/loginTopbarSupervisorPhoto" android:id="@+id/vmTopbarStudentPhoto"
android:layout_width="@dimen/menu_top_height" android:layout_width="@dimen/menu_top_height"
android:layout_height="@dimen/menu_top_height" android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
...@@ -31,18 +31,18 @@ ...@@ -31,18 +31,18 @@
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<LinearLayout <LinearLayout
android:id="@+id/loginTopbarSupervisorNameLayout" android:id="@+id/vmTopbarStudentNameLayout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_toEndOf="@+id/loginTopbarSupervisorPhoto" android:layout_toEndOf="@+id/vmTopbarStudentPhoto"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/loginTopbarSupervisorFullName" android:id="@+id/vmTopbarStudentFullName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="" android:text=""
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
android:layout_width="96dp" android:layout_width="96dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@+id/loginTopbarLayout" android:layout_below="@+id/vmTopbarLayout"
android:background="#EEEEEE" android:background="#EEEEEE"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" /> android:src="@drawable/show_categories_grid" />
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_below="@+id/loginTopbarLayout" android:layout_below="@+id/vmTopbarLayout"
android:layout_toEndOf="@+id/showPictoCategoriesViewButton" android:layout_toEndOf="@+id/showPictoCategoriesViewButton"
android:background="#DDDDDD" android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal" android:gravity="center_vertical|center|center_horizontal"
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@+id/loginTopbarLayout" android:layout_below="@+id/vmTopbarLayout"
android:background="#DDDDDD" android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal" android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing" android:horizontalSpacing="@dimen/picto_grid_spacing"
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) --> <!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<RelativeLayout <RelativeLayout
android:id="@+id/sessionTopbarLayout" android:id="@+id/vmTopbarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/menu_top_height" android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/VerdeApp"> android:background="@color/VerdeApp">
<ImageView <ImageView
android:id="@+id/sessionTopbarStudentPhoto" android:id="@+id/vmTopbarStudentPhoto"
android:layout_width="@dimen/menu_top_height" android:layout_width="@dimen/menu_top_height"
android:layout_height="@dimen/menu_top_height" android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
...@@ -32,18 +32,18 @@ ...@@ -32,18 +32,18 @@
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<LinearLayout <LinearLayout
android:id="@+id/sessionTopbarStudentNameLayout" android:id="@+id/vmTopbarStudentNameLayout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_toEndOf="@+id/sessionTopbarStudentPhoto" android:layout_toEndOf="@+id/vmTopbarStudentPhoto"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/sessionTopbarStudentFullName" android:id="@+id/vmTopbarStudentFullName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="" android:text=""
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
android:layout_width="96dp" android:layout_width="96dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@+id/sessionTopbarLayout" android:layout_below="@+id/vmTopbarLayout"
android:background="#EEEEEE" android:background="#EEEEEE"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" /> android:src="@drawable/show_categories_grid" />
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_below="@+id/sessionTopbarLayout" android:layout_below="@+id/vmTopbarLayout"
android:layout_toEndOf="@+id/showPictoCategoriesViewButton" android:layout_toEndOf="@+id/showPictoCategoriesViewButton"
android:background="#DDDDDD" android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal" android:gravity="center_vertical|center|center_horizontal"
...@@ -86,12 +86,12 @@ ...@@ -86,12 +86,12 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@+id/sessionTopbarLayout"
android:background="#DDDDDD" android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal" android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing" android:horizontalSpacing="@dimen/picto_grid_spacing"
android:paddingLeft="@dimen/small_padding" 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> </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