how to toggle password visibility in android studio 3.6 - android-studio-3.6

I have tried to use the functionality to toggle password visibility in the android studio 3.6.3 but due to some new upgrades features I'm not able to toggle password visibility.
So I need a help to attain this toggle option.

I am not sure if what you are asking is how to toggle password visibility on a TextInputLayout, but this works for me.
Using TextInputLayout and TextInputLayout you can do it this way
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/lightGrey"
android:freezesText="true"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
The important attribute is app:passwordToggleEnabled="true" at TextInputLayout.
I hope this may help.

Related

Switches Have Disappeared with a Xamarin Update

I have a little app up which was fine until a few months ago when I updated Xamarin and also all the Nuget packages in my project. Now, the Switch components are playing up.
The text which accompanies the Switch is fine and has not changed.
The graphic of the switch itself has disappeared and the "on/off" text is tiny (as big as a dot).
Can anyone explain that?
If you look at the following image, each of white text labels is meant to be next to a Switch (they are the text properties of those switches):
Where have the switches gone? How do I get them back. Well, actually, if you put some thick goggles on and look really carefully, they are actually there, just so small as to be barely perceivable.
I'd be interested to know how professional Xamarin devs deal with this kind of thing if they can't resolve it. Do they start a fresh project and copy over the code? Sounds like a maintenance nightmare.
It is Native Xamarin and the Xaml for that view is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:height="30dp"
android:text="Questions Repeatable"
android:textOff="No"
android:textOn="Yes"
android:id="#+id/repeatOperationConfig" />
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:height="30dp"
android:text="Show Answer After Each Question"
android:textOff="No"
android:textOn="Yes"
android:id="#+id/showAnswerConfig" />
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:height="60dp"
android:text="Change Colour of Progress Text by Correctness"
android:textOff="No"
android:textOn="Yes"
android:id="#+id/highlightCorrectConfig" />
<Button
android:id="#+id/goToTestButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="150dp"
android:height="50dp"
android:text="Continue to Test"
/>
</LinearLayout>
The theme (from style.xml) is:
<style name="app_theme" parent="android:Theme">
<item name="android:windowBackground">#drawable/app_background</item>
<item name="android:listViewStyle">#style/TransparentListView</item>
<item name="android:expandableListViewStyle">#style/TransparentExpandableListView</item>
</style>
Thanks
OK. I worked out why my switches went all screwy. My code did not change. My app_theme is in my Styles.xml file. The first line was:
<style name="app_theme" parent="android:Theme">
As I said, this never changed. But my switches did. They disappeared!
I changed the parent to:
parent="android:style/Theme.Material.Light"
My switches became visible again.
I have no idea why the original code used to work and then didn't!

Error switching layout to API19 (Android 4.4.2)

I have googled for a while and any of the solutions worked for me. My problem is when i try to change a layout to API version 19, throws me this error:
mono.android.DesignerException: java.lang.NullPointerException
at mono.android.DesignerException.fromThrowable(DesignerException.java:46)
at mono.android.DesignerSession.checkRenderResultForError(DesignerSession.java:187)
at mono.android.DesignerSession.load(DesignerSession.java:239)
at mono.android.DesignerSession.processMessage(DesignerSession.java:702)
at mono.android.MessageListener.executeMessage(MessageListener.java:88)
at mono.android.MessageListener$Runner.run(MessageListener.java:44)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at android.content.res.Resources_Delegate.disposeSystem(Resources_Delegate.java:85)
at com.android.layoutlib.bridge.android.BridgeContext.disposeResources(BridgeContext.java:264)
at com.android.layoutlib.bridge.impl.RenderAction.tearDown(RenderAction.java:257)
at com.android.layoutlib.bridge.impl.RenderAction.release(RenderAction.java:220)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:438)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
at mono.android.DesignerSession.load(DesignerSession.java:233)
... 4 more
This is the Main.axml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:gridSpec="1|8|#0093eeff|K:#ee8700ff:16,l:72,l:16,r|S:#83ee00ff:16,0,l:16,56,l:16,0,r"
android:minWidth="25px"
android:minHeight="25px">
<Button
android:text="Hello world"
android:layout_width="match_parent"
android:layout_height="259.5dp"
android:id="#+id/button1"
android:onClick="btnOneClick" />
</LinearLayout>
I tried to install extras, tools and API 19 from the SDK manager, but nothing is working. Know someone why is this happening?
I was getting the same error, and I found this thread here which helped me.
OlafB posted a response about halfway down that helped me:
I changed the application to another API level and it now displays
correctly in the Designer. Not sure what the problem was / is.
I had the 'Compile using Android version' set to API 19. When I
changed it to Android 6.0, the designer works, even though the Minimum
Android Version and Targeted Android Version are still API 19 (Android
4.4.2).
The option that he's talking about changing is the Compile using Android version: (Target Framework) setting on the Application tab in the project properties.
The other settings he's talking about are in the "Android Manifest" section of the properties.
In my case, I changed the "Compile using..." setting to Android 4.1 since that's the version I'm currently testing.

How to create google play menu in xamarin

I'm new to Xamarin. How can i design a pop up menu that looks like google play menu in Xamarin ? I.e see the image below :
There are several ways to go about making a fly-out menu, which is what I believe you are after. The very basic approach, is to add something similar to the following to your AXML:
<?xml version="1.0" encoding="utf-8"?>
<flyoutmenu.FlyOutContainer xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
layout="#layout/MenuLayout" />
<include
layout="#layout/ContentLayout" />
</flyoutmenu.FlyOutContainer>
Source: http://blog.neteril.org/blog/2013/04/19/fly-out-menu-xamarin-android/
Another Source: http://www.appliedcodelog.com/2016/01/navigation-drawer-using-material-design.html
I hope this helps!

Android testing in Android Studio using Robolectric issue

First of all I would like to declare my frustration for the lack of proper testing infrastructure in Android... or maybe I am retarded, I don't know...
I eventually managed to setup android-test-plugin and I wrote a couple of tests for an activity that includes in its layout a CustomMapFragment which is a class I wrote that extends SupportMapFragment. All my tests that try to get an instance of this activity using:
activity = Robolectric.buildActivity(MyActivity.class).create().get();
fail with:
java.lang.NoClassDefFoundError:
com/google/android/gms/maps/GoogleMap$OnInfoWindowClickListener
at activity's setContentView.
The activity's xml is the following:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MyActivity">
<fragment
android:id="#+id/customMapFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.myproject.CustomMapFragment"/>
</RelativeLayout>
Is there a workaround/solution for this?
Any help would be appreciated.
I have temporary solution. The problem seems to be that the android-test-plugin in unable to read an aar file. My solution is to add a dependency to the jar file instead only to testCompile, like this
testCompile files('YOUR_ANDROID_SDK_FOLDER/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar')
Like this I'm able to run a simple test, for example creating a LatLng and checking if it's not null, without errors. Hope it helps.
Edit
A better solution thanks to SuperJugy on github is to apply the fix in this commit https://github.com/SuperJugy/gradle-android-test-plugin/commit/d5b7836cf7278dc9d0fe765b635de60c33911d72

Detecting and Implementing Scrollbar Style in Window 8/RT Application

I am developing a Custom Control to be placed inside a ScrollViewer, I have Custom coded a generic.xaml for applying visual style for the Scrollviewer.
<ScrollBar x:Name="VerticalScrollBar"
Grid.Row="0"
Grid.Column="1"
Width="18"
Margin="0,-1,-1,-1"
IndicatorMode="TouchIndicator"
IsTabStop="False"
Maximum="{TemplateBinding ScrollableHeight}"
The Problem I am facing is, I need to set the IndicatorMode to TouchIndicator/MouseIndicator based on whether the user is using Touch Devices or not.
Is there a way to do it?
Thanks
Arun Selva Kumar. B
Used Visual State Manager to achieve the requirement.

Resources