Glance widget does not pop up when holding on the app launcher - android-jetpack-compose

The glance widget does not pop up when holding on the app icon, though the receiver is registered.
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:description="#string/widget_description"
android:minWidth="400dp"
android:minHeight="400dp"
android:initialLayout="#layout/widget_initial_layout"
android:previewImage="#string/app_name"
android:resizeMode="vertical"
/>

The minWidth/Height defines the minimum available size the widget needs in order to be displayed. That means that if the device width or height is less than 400dp your widget cannot be displayed. Thus the launcher does not even show it in the list.
Unless, you specify the android:minResizableWidth/Height and android:resizeMode="horizontal|vertical". If that value is less than the device size, the launcher will automatically resize it to fit.

Related

Detecting and dealing with increased screen size via accessibility

my app user base is of an older age group and I'm having some issues when they have increased the screen size via accessibility options.
I'm going to guess Apple doesn't allow you to override this in your app? I'd rather them squint than think the app is useless because a 1/4 of the UI is off screen!
Failing that is there a way to detect it and at least pop a dialog to warn them?
Using Flutter.
You can override default system scaling if you absolutely have to via:
return MaterialApp(
builder: (context, child) => MediaQuery(
// or whatever `textScaleFactor` you want
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0)
child: child ?? SizedBox.shrink(),
),
// ... the rest of your MaterialApp setup
);
... but you shouldn't, ESPECIALLY given your target audience are visually impaired and you should instead be fixing your app and accommodating responsive UI to handle such use cases.
This is an "Accessibility" (a11y) topic.
Indeed, you can't override screen zoom settings in Apple devices. You can override some settings for Android though (through MediaQuery you should be able to set textScaleFactor).
But this makes sense: we can't just ignore the needs of visually impaired users. We should build apps and UIs that react to such settings without overflowing, even though the Layout worsen a bit.
When it comes to a11y, you don't necessarily need to re-think the whole layout as responsive (Layout Builders, etc.), but you should make your text containers flexible. For example, say you have:
Row(
children: [
Text("Hello a11y!"),
],
),
then, you should consider wrapping your Text in a Flexible container to avoid Overflow (so that your text can go down to a new line).

Number EditText with keyboard displayed only

I'm trying to create an application on which I have to input numbers directly with a virtual keyboard. The problem is that the EditText Number, which is perfect for this purpose (only inputting numbers) is hiding the whole screen.
What I want is only the keyboard on the bottom half of the screen with the EditText showing the inputted number, but, even after a few times of searching, I can't find an answer. Can you please help me? this is really important.
First you can configure an inputType for your EditText:
<EditText android:inputType="number" ... >
also write <requestFocus /> in between <EditText> and </EditText>
What worked best for me is in Android Manifest for activity adding:
android:windowSoftInputMode="stateVisible"
I hope that helps you as well.
So you full tag will be:
<EditText android:inputType="number">
<requestFocus />
</EditText>
It will open keypad automatically when you start your activity.

How do i change react-native theme to transaperent on ios

how can i change the theme or default background color for ios.. it's conflicting with my background image. I'd like to set it to transparent.. Thanks
First let's understand how scenes in react-native-router-flux works. When you define them in your navigator, like below,
<Scene sceneStyle={{marginTop: 64}} title="Home" key="home" component={Home} />
You simply say that, my content should render below the pre defined navbar. Which can be 54 or 64 depending on your OS. So when you use Router,
<Router navigationBarStyle={{backgroundColor: 'transparent'}}>
and add navigationBarStyle to every Scene you have by introducing that line, you almost forgot what you've done above, setting your Scene to align itself some margin below the navigationBar. Therefore you see nothing (white space) in your simulator.
In order to have what you need, do this where you want your image to appear full screen with navigation controls:
Actions.refresh({
key: 'home',
navigationBarStyle: {backgroundColor: 'transparent'},
sceneStyle: {marginTop: 0},
});
Or you can introduce this settings in your Scene component where you define it.
I tested this solution and it works on iOS, can't tell the same for Android, so please back up your code before making changes. You can further customize it to remove borderBottom line.

Appium: How to wait for new element with same name as visible one to appear on screen?

We're using Appium with iOS Simulator and test functions written in Java.
We have an iOS App with screen 1 containing a UICollection view, and tell Appium to click on one of its elements.
This opens screen 2 (and the scrolling animation takes about 500 ms), which also contains an UICollection view. I want to find out the size of the UICollection view of the second screen with Appium.
The problem is that Appium is too fast and executes the findElements() method directly after the click, which causes it to find the UICollection view of the first screen.
clickOnElementOnFirstScreen();
webDriver.findElements( By.className( "UIACollectionCell" ) ).size();
// is supposed to find the UICollection view on the second screen,
// but actually finds the UICollection view on the first screen
Appium provides several waiting functions. However as far as I can see all of them are intended to be used in this fashion:
"wait until element at location X / with name X becomes visible"
If I try to use these waiting functions, they don't wait at all because they immediately find the UICollection view of the first screen, which has the same location and name as the one on the second screen.
The only solution I have found is to use Thread.sleep:
Thread.sleep(1000);
webDriver.findElements( By.className( "UIACollectionCell" ) ).size();
But we don't want to use Thread.sleep in code that will run on the client's server on hundreds of tests.
We might be able to modify the App and enter metadata into the views so that Appium is able to distinguish them, but this situation occurs in several places and the App is being programmed by the client, so we want to avoid this too.
What is a simple and safe way to wait for the new screen to appear, without modifying the code of the iOS App?
I have found only dirty workaround for this issue.
static waitFor(Duration duration) {
try {
def WebDriverWait wait = new WebDriverWait(mobileDriver, duration.standardSeconds)
wait.until(visibilityOfElementLocated(By.xpath("//Fail")))
//Wait until false case is visible to ensure proper timeout
} catch (Exception e) {
}
}
Another workaround/solution that has been posted on the Appium forums is:
First search for some other element that distinguishes the 2. screen from the 1. screen; once that is visible, it's safe to search for the originally desired element.

Xcode Image Catalogs: Image not showing in Interface Builder

So, the artist sent me a Resources.xcassets folder that I simply dragged into the project. I then jumped to interface builder, added a new UIImageView, assigned an image name from the xcassets, and to my surprise, I couldn't see the images. It shows as a blue question mark.
Notice, that the IB autocomplete is working, and when I run the application, the assets actually show up! But not in interface builder, which makes laying the assets around virtually impossible, especially with the size to fit not working...
Bug reported: 15733387
It seems I am at fault... I created a fresh new XIB, and made sure to select device family 'iPad', and the image is now showing up properly. I didn't think that was the problem because you cannot change the device family after creating the XIB! I looked everywhere for that options, but never found it... Seeing the raw XIB files, you can do this change manually, I guess (Notice where it says ".iPad"):
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
Yeah, I actually solved it, and the problem is super crazy. The artist had set all the assets as "iPad" assets, so the Contents.json file inside the *.imageset folder was assigning the "ipad" to the images I have. I opened the json file in sublime text, and changed the "ipad" to "universal", and BOOM. I had Xcode open on the side, and the image showed up almost instantly in IB!! Like, wth...

Resources