Error on small screen - android-screen-support

I have the following code in my manifest.
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
/>
But it is not showing the complete screen in galaxy y.

Related

PrintPreviewDialog issue on 4K monitor

I have added a print preview feature to my program. The problem is, it does not display the preview document well on screen resolutions above 1920 x 1080.
Example:
Code:
QFont docFont;
docFont.setPointSize(14);
QTextDocument *textDoc = new QTextDocument(this);
textDoc->setDefaultFont(docFont);
textDoc->setPlainText(getHardwareData());
During a debugging process I have found the following issues:
QWindowsMultiFontEngine::loadEngine: CreateFontFromLOGFONT failed for "Courier": error 0x88985002 : Indicates the specified font does not exist.
QWindowsMultiFontEngine::loadEngine: CreateFontFromLOGFONT failed for "Courier": error 0x88985002 : Indicates the specified font does not exist.
Is there any hint/font to make it look well on all screens resolutions?
Edited:
I have fixed the QWindowsMultiFontEngine::loadEngine: CreateFontFromLOGFONT failed for "Courier" issue. The problem was caused by a Unicode character in Peripheral data. Now, the only thing left is to make it look better on 4K.
I have found some hack to get the toolbar actions from a print preview dialog. By adding some additional logic it fixed the issue.
QList<QToolBar*> toolbarList = printPreviewDlg->findChildren<QToolBar*>();
if (!toolbarList.isEmpty()) {
if (screenSize.width() > 1920 && screenSize.height() > 1080) {
toolbarList.first()->actions().at(0)->activate(QAction::Trigger);
} else {
toolbarList.first()->actions().at(1)->activate(QAction::Trigger);
}
}
To detect the screen size I use the native Win API methods. Now, it automatically triggers the Fit to width toolbar option and sets a better preview on 4K monitor. It works depending on the screen size. The issue is resolved.

How to eliminate TabLayout scroll jumping (skipping) in Android TV when there are more than 64 tabs?

I’m trying to implement tab navigation in my Android TV app using TabLayout. There are many tabs so I have enabled “scrollable” mode.
When I'm trying to navigate through the tabs (from left to right) using remote control the tab indicator does not move to the very next tab but jumps far to the right, and again and again until it reaches some position. After this position is reached, tab indicator start moving normally.
I have experimented a little and found that this abnormal scrolling behavior appears only when number of tabs in TabLayout is more than 64
First I met this problem with TabHost and changed my code to use TabLayout, but problem persists.
I have played with all relevant options with different combinations but nothing worked.
Below is the fragment of my layout file
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="false"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="#+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="#color/black_opaque"
android:fillViewport="true"
android:measureAllChildren="true"
android:nestedScrollingEnabled="false"
android:padding="2dp"
app:tabGravity="center"
app:tabMode="scrollable"
app:tabTextAppearance="#style/TextAppearance.AppCompat.Medium" />
<GridView
android:id="#+id/gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="4" />
</LinearLayout>
I have recorded the video to show how it looks like:
scroll_skipping.mp4
What do I missing? How to configure TabLayout to avoid such behavior?
Finally I couldn’t find any solution, it looks like bug or TabLayout limitation.
So I have changed the layout and did what I need with ListView.
Conclusion - TabLayout is for limited number of tabs, no more than 64, less is better.

Opencv C++ Opens Two Window for Each imshow

I am using OpenCV 3.3.0 for c++ in visual studio. The problem is that when I use this code, it opens two windows with the same name that one of them contains the image and the another one is extra and empty. (Screenshot from the two windows )
cv::Mat im0 = cv::imread("C:\\Users\\MY_PC\\Desktop\\Image.bmp"); //read the image
cv::resize(im0, I, cv::Size(640, 480), 0, 0, CV_INTER_LINEAR); //Resize the image to 640x480
cv::namedWindow("HI");
cv::imshow("HI", I);
cv::waitKey(0);
The more important problem following this problem, is that the waitkey() function just works with the extra window and I should press the keys on that window to see the changes in the another window.
Furthermore the setMouseCallback has the same problem and mouse commands doesn't work on the window containing the image. Thanks a lot.
I have the same problem with the project type "Win32 Console Application".
If you use a "Empty Project" the problem disappears.
Try commenting out the line cv::namedWindow("HI");, does it work?
Unfortunately I can't help with other two.
I don't see any mistakes in the code you shared.
However, I'm usually writing like that:
const char* display_name = "Display";//Display name
namedWindow(display_name, WINDOW_AUTOSIZE);//Create Display
imshow(display_name, frame);//Display Image
waitKey(0);//Wait a key to be pressed
For x64: Removed opencv_world410.lib and just add opencv_world410d.lib from Additional Dependencies
(Common properties->Linker->Inputs->Additional Dependencies)
This link helps you to create config files for all of your projects:
https://docs.opencv.org/4.1.0/dd/d6e/tutorial_windows_visual_studio_opencv.html

Create window without title bar

I am trying to create a simple panel for Openbox in Arch Linux using c++, but I cannot figure out how to remove the title bar from a window.
I am creating the window with XCreateWindow(...), and that gives a window with the correct size, but it contains a title bar, and the window also opens in the top-left corner of the screen, no matter what offset coordinates I specify.
I read here that both of these problems are probably caused by the window manager (Openbox), which overrides the window attributes I specified in XCreateWindow(..., &window_attributes). This could be solved by adding window_attributes.override_redirect = True;, although this does not seem to do anything for me. When I try this I get the exact same window as before. (I did compile the file after this change.)
Also I read into the code of Tint2 (link), which is another panel for Openbox. They create a window using the following code:
XSetWindowAttributes att = { .colormap=server.colormap, .background_pixel=0, .border_pixel=0 };
p->main_win = XCreateWindow(server.dsp, server.root_win, p->posx, p->posy, p->area.width, p->area.height, 0, server.depth, InputOutput, server.visual, mask, &att);
I don't see an override_redirect anywhere in their code, so I'm not sure how they are removing the title bar.
As additional information, I thought it would be worth mentioning how I'm executing the script:
/* The c++ file is saved as 'panel.cpp' */
$ gcc panel.cpp -lX11 -o panel
$ ./panel
Also, I am running Arch Linux through VirtualBox with Windows 8 as host. I'm not sure if this changes anything, but it won't hurt to mention.
Since I found the solution, I figured I'd post the solution here if anyone else needs it.
As #JoachimPileborg mentioned, I needed to alter the Openbox settings in ~/.config/openbox/rc.xml. Inside the <applications> tag, I added the following code:
<application class="*">
<decor>no</decor>
<position force="no"></position>
</application>
The class="*" means that all applications will follow these rules, you could fill in the class name of the application instead. The <decor>no</decor> removes the title bar, and <position force="no"></position> ensures that my own script is able to handle the positioning. You could also add another <application> tag after this one to make exceptions to this rule.
Also, the window_attributes.override_redirect = True; is not needed anymore.
A more correct way is to use the Extended Window Manager Hints.
The idea is that you don't tell the window manager how to decorate or not your window, you just indicate the window type with _NET_WM_WINDOW_TYPE :
Atom window_type = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
long value = XInternAtom(display, "_NET_WM_WINDOW_TYPE_DOCK", False);
XChangeProperty(display, your_window, window_type,
XA_ATOM, 32, PropModeReplace, (unsigned char *) &value,1 );
"Dock" is the type for panels and taskbar. Usually they are undecorated and appear on all desktops. As written on the documentation, previously the _MOTIF_WM_HINTS property was used to define the appearance and decorations of the window. Window managers still support it, but _NET_WM_WINDOW_TYPE is prefered as it describe the function and let the window manager (and user) decide on the appearance and behavior of that type of window.
Another interesting property for a panel is _NET_WM_STRUT_PARTIAL, to "reserve" space.

Google Glass GDK: Progress Indicator?

Using the GDK (or in some other way), is there a way to display a progress indicator similar to the one displayed when connecting to a WiFi network on Glass? (the "spinning" lines on the bottom of the display, kind of like at the end of this video: https://www.youtube.com/watch?v=g3ncmeGaKN0)
Thanks!
UPD 04.11.2014: Google released Slider -- UX component suitable for this. You should better use it instead of the extracted project.
I've extracted Google Glass Progress Bar from GlassHome.apk and created a library project based on that: https://github.com/pif/glass-progress-bar
supports indeterminate
supports default progress
Usage is described in README in the repository.
And yes, everyone is still waiting for a full-featured set of Glass Views.
Update: I extracted MessageDialog as well. You can find it in the same library.
This issue is resolved by google with Slider (global UX Components) https://developers.google.com/glass/develop/gdk/slider
This comes pretty close, but the color is off (blue/teal/whatever instead of white).
style="?android:attr/progressBarStyleHorizontal"
Sample (via OkGlassFindACat):
<ProgressBar
android:id="#+id/someProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
I definitely haven't figured out how to override that color, though.
I know I'm late but here's my version :)
https://github.com/prt2121/glass-gdk-progressbar
adding to your project in the gradle file
compile 'com.github.prt2121:ProgressBar:1.0#aar'
screenshot:
changing color
app:progress_color="#android:color/holo_blue_bright"
The GDK overrides themes for some widgets automatically to provide a proper Glass-like appearance, such as TextView. For widgets that don't yet have that theming, please file an issue here so that we can track it.
I put together the answer above to create a general layout for my card-list loader activities. Here's the layout file card_scroll_with_progress_layout.xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/black">
<com.google.android.glass.widget.CardScrollView
android:id="#+id/card_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="#+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</FrameLayout>
Then in the onCreate I get the progress bar and set it rolling:
View rootLayout = getLayoutInflater()
.inflate(R.layout.card_scroll_with_progress_layout, null);
mProgressBar = (ProgressBar)rootLayout.findViewById(R.id.progress_bar);
mProgressBar.setVisibility(View.VISIBLE);
mCardScrollView = (CardScrollView)rootLayout
.findViewById(R.id.card_scroll_view);
mCardScrollView.setAdapter(mAdapter);
setContentView(rootLayout);
Later on in my loader callback I hide the progress bar and activate the card scroll view:
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (loader.getId() == mLoaderId) {
mAdapter.swapCursor(data);
mProgressBar.setVisibility(View.GONE);
mCardScrollView.activate();
}
}
This seems to be working well as a paradigm for handling various json loading into a list of cards in the GDK.
We have been having a similar issue and found a hybrid approach that works for us. We use the standard progress bar #patridge mentioned in a previous post and applied generated Holo styles provided by Android Holo Colors.
We were able to generate a white progress bar images, animation, layer and style that looks very similar to the built in GDK version. You can increase the height of the bar to match the GDK by editing the size of Holo Color's generated png images.
You will need the generated files included in your project, but here is what our theme looks like afterwards:
<style name="OurGlassTheme" parent="#android:style/Theme.DeviceDefault.NoActionBar.Fullscreen">
<item name="android:progressBarStyleHorizontal">#style/ProgressBarGlass</item>
</style>
<style name="ProgressBarGlass" parent="android:Widget.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/glass_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">#drawable/glass_progress_indeterminate_horizontal_holo_light</item>
<item name="android:minHeight">16dip</item>
<item name="android:maxHeight">16dip</item>
</style>
I know it's super tedious, but it gets us there while #giladgo 's accepted submission to the Glass developers to provide a GDK Progress Bar is finished.
Try to use ProgressBar from zoom-in project.