How to create WearableRecyclerView - android-recyclerview

How to create WearableRecyclerView in android wearable? I aware that in android devloper got information about it but it still small and i need full tutorial about it.

You should add this in your main xml layout:
<android.support.wear.widget.WearableRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/recycler_launcher_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
And use it like a regular RecyclerView i.e add an Adapter etc.

Related

Android Studio Preview not able to render constraintLayout Barrier item

(on Android Studio version 3.5.3)
The barrier works fine at run time, but AS preview is not able to find it/render it
<androidx.constraintlayout.widget.Barrier
android:id="#+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="view1, view2"
/>
result:
barrier shows up as a gray box as if preview doesn't recognize it
If you're using older dependency, then please use one of them:
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' // For MotionLayout

What setting provides me with a warning / error for the following xaml

I lost quite a few hours finding out why my view didn't show images anymore
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BB.App.ViewModels.LibraryBookView">
<ContentView.Content>
<StackLayout>
<Label Text="{Binding BookTitle}"></Label>
<Image Source="{Binding BookCoverImage}" x:Name="BookCoverImage"/>
</StackLayout>
</ContentView.Content>
8
</ContentView>
Because I didn't check in often enough I could not move back to an earlier version (my mistake) and didn't know where to look.
It turned out that the 8 on alsmost the last line is causing some kind of xaml interpretation error resulting in not showing an image in the running app.
I was surprised I didn't get a parse error or at least a warning for my mistake.
Would any of you know of a setting that would trigger an error for this kind of bug?
This is a bug. I filed a bug report about it: github.com/xamarin/Xamarin.Forms/issues/5095
enable XAML Compilation
You can enable it for an entire assembly
using Xamarin.Forms.Xaml;
...
[assembly: XamlCompilation (XamlCompilationOptions.Compile)]
namespace PhotoApp
{
...
}

Xamarin Forms not displaying images in MVVMCross MvxContentPage

I'm not able to view any local image in my pages. Using android as a reference, the images are correctly placed in the Resources/Drawable subfolders, but even using the default "icon.png" nothing shows up.
Here is my page:
<?xml version="1.0" encoding="utf-8" ?>
<mvx:MvxContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyApp"
xmlns:mvx="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
x:Class="MyApp.MainPage"
BackgroundImage="icon.png">
<StackLayout Orientation="Vertical">
<Image Source="icon.png"></Image>
</StackLayout>
</mvx:MvxContentPage>
Here are the files:
In the build output I get the following messages:
[0:] Could not load image named: {0}: icon.png
[0:] FileImageSourceHandler: Could not find image or image file was invalid: File: icon.png
I suspect the problem is related to the use of mvxContentPage, because changing to a simple ContentPage and using Gorilla player for previewing the page the image shows up as intended.
Thanks in advance!
Just delete everything under your (...).Android\bin folder. VS will recreate everything and this time will include new images.

LED & Camera always ON

I'm trying to open the device camera an activate immediately the LED light of that device (android/iOS).
I've tried the appcelerator ti.media events but didn't work, neither this module: Ti.Light.
Found this on this link activate-iphone-4-led-light
Hey guys!
For the flash stuff you have to check the property:
Ti.Media.cameraFlashMode (case sensitive)
To change it you can use Ti.Media.setCameraFlashMode(PARAM) .
PARAM could be: Ti.Media.CAMERA_FLASH_OFF , Ti.Media.CAMERA_FLASH_ON,
Ti.Media.CAMERA_FLASH_AUTO
Unfortunately you can’t start the led and use it as a torch, you can
only control the camera flash handling (on, off, auto) while taking a
photo.
There is any module that allow to use the led light all the time? I just need this while the camera is opened.
UPDATE 1#:
I’m trying to use your ts.camera widget, that have the embed camera and flash methods:
github - ts.camera
gittio - ts.camera
But there is no method switchFlashlight() in “pw.custom.androidcamera” module, this widget works?
github - Ti-Android-CameraView
gittio - pw.custom.androidcamera
UPDATE 2#:
In order to find a workaroud, I've added this flashlight module, and I'm trying to call it before or after showing the camera, but I think that it's not possible to have 2 camera activities at the same time.
This is my index.js file:
if(OS_ANDROID) {
flash = require('dk.napp.flashlight');
if(!flash.isFlashLightOn()) flash.turnFlashLightOn();
camera = require('pw.custom.androidcamera');
view = camera.createCameraView();
}
I'm getting this error:
[DEBUG] : CameraViewProxy: Camera not available
[ERROR] : CameraViewProxy: Camera is null. Make sure
[ERROR] : CameraViewProxy: <uses-permission android:name="android.permission.CAMERA" />
[ERROR] : CameraViewProxy: is in you tiapp.xml file.
This is my tiapp.xml file:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-feature android:name="android.hardware"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera2"/>
<uses-feature android:name="android.hardware.camera2.params"/>
<uses-feature android:name="android.hardware.camera.flash"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
These two modules might do the job:
http://gitt.io/search?q=flash
Although it could well be that activating the device camera will override the control over the flash light.

How to show ActionBar in a CordovaActivity

Using Worklight 6.2 and the new ActionSender API, I'd like to show the actionbar in the main CordovaActivity of my hybrid app.
That's in order to manage it by Javascript code, through the new API.
The problem is that getActionBar() returns null, even adding the holo theme and a layout to this activity.
Does somebody have a snippet of code to show me the how to do that?
Regards
Giuseppe
The blog post has been revised to include the missing pieces. Follow the instructions again, it will now work.
The missing pieces were related to the below:
Make sure that in your AndroidManifest, the activity doesn't have a theme without a title bar:
<activity
android:name=".HybridActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="sensor"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
^ last line should be removed.
>
Add a preference to Cordova configuration (res/xml/config.xml) to make the title bar be shown:
<preference name="ShowTitle" value="true" />