How to implement Android material chips for contacts selection without a third party library? - android-chips

How can I implement Android Material Design chips without an external library. Google Apps have it inside their apps, so I guess that it should be available in the native SDK. If yes, how to implement it for a contacts selection functionality. Similar to the given screenshot.

Google has officially released a library for it you can use that:
dependencies {
implementation 'com.google.android.material:material:1.0.0'
}
Then you just need to add it in XML, like this :
<chip
style="#style/Widget.MaterialComponents.Chip.Entry"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:checkable="false"
app:chipIcon="#drawable/ic_android_24dp"
app:iconStartPadding="5dp"/>
Or you can add it dynamically as stated here:
Stack Overflow Answer
Taken from Chips Example here. More info about chips is also stated here.

Related

UWP Listview with expandable items

I have searched a lot on internet about how to build a ListView with grouped items in it(header and subitems) but i did not manage to find a good documentation.
Found something here or here but something goes wrong...So the question is: is there a best practice for building that kind of ListView? Any official guidelines? I see, Windows 10 makes use of that control. Any thoughts of providing it with the SDK?
You can also choose to use some third-party libraries. E.g, How to Use Expandable List Items in Windows Store Apps
You will see its source code on GitHub as described in that blog.

Microsoft Active Accessibility, VB6 and Ranorex

Ranorex is a user interface test tool for Windows. If UI elements support Microsoft Active Accessiblity (MSAA) then it can retrieve rich information about the elements, which is very useful for writing test scripts.
We have a lot of legacy code in VB6, which does not support MSAA.
I am trying to add this support to some of our VB6 UserControls as follows.
I have created an ActiveX component in C++ using ATL. This contains a helper class which implements the interface IAccessible. It also contains an initialization function which can be called from VB6.
The VB6 UserControl creates the helper object and passes its Window Handle and name to the initialization function. The helper object subclasses the window and handles the WM_GETOBJECT message, to provide the IAccessible interface for the window.
I have debugged through the code and as far as I can tell, it is working. The Ranorex Spy tool gets the IAccessible interface and calls methods on the interface.
However, Ranorex does not actually show any of the information which it appears to have fetched via this interface.
I know this is a very specific problem, but does anybody have experience of implementing IAccessible for use in Ranorex, or in other similar test tools?
I would be happy to provide my code, but I think it is too much for a normal posting.
This doesn't ever seem to have been widely used. I have found a few breadcrumbs I can share, so perhaps these will be of some value?
First:
Microsoft Active Accessibility 2.0 ships as a standard system component in Microsoft Windows XP...
This is from the MSAA20RDK\redist.txt and it goes on to talk about how it can be installed into Win2K and earlier. As far as I can determine the pieces and parts are included in XP and later so you probably don't need the RDK download, which has basically no info at all and mostly just the DLLs.
Here's a link though:
Microsoft Active Accessibility 2.0 Redist
Something perhaps more useful, note that this is a "live" link to download the Word DOC:
Microsoft Active Accessibility 2.0
I haven't found a "page" link at MS Downloads that discusses it. This is a larger document giving many details, almost entirely for C++ programmers. There is however a little bit on VB6.
That said it tells you little except:
Visual Basic Sample Programs
The book Advanced Microsoft Visual Basic 6.0, 2nd Edition (Mandelbrot Set
International, Ltd.) includes a chapter that discusses Active
Accessibility. The chapter provides sample code that demonstrates how to
use key Active Accessibility APIs. (Microsoft Press, ISBN 1-57231-893-7)
There is a little more there but not much. The book cited could be pretty hard to find anymore, I only saw one in Italian on Amazon but dig around and a 3rd party might sell there or on eBay, etc.
At this link: Microsoft Active Accessibility the info from that Word DOC appears to be duplicated, though perhaps it is more current.

Portable C++ Component Design

I've been using COM and .NET assemblies in the past to develop component-based-systems. Now I'm going to work on a cross-plattform-C++-project and want to structure the code in components aswell…
Obviously COM and .NET are not an option, as COM is not available anywhere but Windows and Assemblies would add dependencies to the .NET framwork which may be not available at the target system.
I'm aware that due to ABI-differences I won't be able to move components between different operating systems without recompilation, but I would like to write the code in a manner, that it's compatible at source-code-level.
Is there any system/framework that enables such a architecture in C++?
I have worked with such a system in the past - we basically re-invented COM. If you are interested in that approach, check out this great article: http://msdn.microsoft.com/en-us/library/ms809983.aspx
The Mozilla suite uses a framework called XPCOM. Never used it myself, but the implication it's supposed to be like Microsoft's COM but portable. That's the only in-process component system I know of that's native code based; if you're working in Java, there's OSGi.
These days most Unix software appears to use distributed component models, where components live in different processes. The current fashionable system appears to be DBus; KDE3 used an alternative called DCOP; and of course if you want to go this route there's good old CORBA.
If you can live with a Qt dependency (only core libraries, no GUI libs), you could have a look at the CTK Plugin Framework
It is licensed under Apache 2.0 and is a dynamic C++ component system with an API which is nearly identical to OSGi.
Maybe this: http://blog.redshoelace.com/2007/09/what-is-boostextension.html

Can I make a rather native C++ app with Android?

I'm interested in the following features:
Writing an app for Android Market that is written completely in C++ (a port of existing product actually).
Use fast screen-buffer pixel pushing (or rather using OpenGL ES for this).
Grab user input and direct it to C++ code.
Is it legal to write such an app for Market? Is Market policy somehow strict to such things?
As of NDK r5 with Android 2.3 (Gingerbread) this is possible, although I assume only devices to support natives apps must have Gingerbread on them.
From the native-activity sample:
The Android SDK provides a helper class, NativeActivity, that allows you to write a completely
native activity. With a native activity, it is possible to write a completely native application.
NativeActivity handles the communication between the Android framework and your
native code, so you do not have to subclass it or call its methods. All you need to do is declare
your application to be native in your AndroidManifest.xml file and begin creating your native
application.
It is really not my cup of tea but there is something called Android NDK (Native Development Kit) to use if you want to write your program in C. Not sure how the C++ compiler support is though.
As far as I know your app can be almost 100% native code but keep in mind that by walking that way you will probably have a hard time supporting the different CPUs out there in Android hardware. If you need to bootstrap the native code so that it is started from java it is probably not a very big problem for you.
I found a few different tutorials when googling for "Android NDK". This one is a very minimalistic Hello World. Obviously you want something much more than a library that returns a string to java but it is a good first start and you will probably have to do all of the things described. Do a search using NDK and Android as keywords and you get a good selection. I see no reason to list them here as such lists tends to be outdated and broken within a year or so.
I guess the official Android Developer site from Google will stay put and be updated on new releases of the platform, it has a link to the current NDK.
With Gingerbread (Android 2.3) it looks like you can build your entire app in C++.
cf:
http://phandroid.com/2011/01/11/android-developers-blog-awesome-ndk-leads-to-awesome-apps/
"
With the latest version of the NDK, r5, many big improvements have been made to coincide with the release of Gingerbread. The most major is the ability to code a native application for Android 2.3 entirely in C++. This means even programmers and developers with no Java knowledge won’t have to implement a single line of that code..."
Can't vouch for the veracity of this blogger, however, from what I have read, it appears you can do this
There is no 100% native solution but what I think you are looking for is the Android NDK (Native Development Kit)
From their site "Please note that the NDK does not enable you to develop native-only applications. Android's primary runtime remains the Dalvik virtual machine."
I believe it lets you make calls to your own native code from an Android application
I have personally never used it for my games, but I am sure it would help on a lot of things (like being able to manage my own memory and not have "lag" do to the garbage collector)
conversations in this thread can help you.
http://groups.google.com/group/android-ndk/browse_thread/thread/50362904ae0574cf
essence is,
It is possible to make Native only apps and Android Market doesn't restrict you either.
But with limited support for native development, there is high chance of using some of the non standard functionality which might break in future releases.
http://developer.android.com/guide/basics/what-is-android.html
"The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language."
http://arstechnica.com/open-source/news/2009/06/android-goes-beyond-java-gains-native-cc-dev-kit.ars
In general, you don't. There is some limited C++ support through JNI, but it is mostly intended to supplement Java code, not replace it. There's no framework/API support (AFAIK) for C++, so doing this isn't really an option.

What is an SDK? (C++)

Just in general terms, for a noobie. I apparently need an 'SDK' to install something; what is this?
An SDK is a set of libraries which hold reusable code that you in turn use to develop applications. Whether those applications will run in Windows, on an XBOX, and iPhone, in a Flash application, etc. determine what SDK you should be using.
Take the iPhone for example. To write an iPhone application, you write code in a language called Objective-C (which looks and feels just like C, but with Smalltalk's object-model). Anyway, every time you write an app, you don't need to rewrite the code that draws text on the actual screen or registers the actual screen-touches. Instead, Apple provides the code that all application developers will need to do simple things.
Likewise, if you're writing for Windows, there are libraries to do things like draw an actual window, or connect to the network stack.
All of these common libraries, along with some other tools, make up an SDK.
For C++, you will probably see a lot of mention of Boost. This is not an SDK, but rather a set of libraries that contain code that a lot of other developers find useful.
What platform are you trying to write for? Are you just getting into C++ in Windows and looking to get started? Are you trying to write a game for some console?
"Software Development Kit" - a set of tools and libraries that let you develop software.
An example would be the iPhone SDK, which lets you develop software for the iPhone.
An SDK for a given product in general includes what you need to create an interface or an application based on that product. That's why "software development kit", a set of things needed to build software. It is strange though that an SDK is necessary for an install, could you provide more details?
An SDK is a tool kit that helps you develop software for a certain platform.
Help us out with some context! We might just be able to get you the correct SDK.
The OP indicates that the SDK is needed to install software. If this is the case, then maybe the OP is really asking is "Why is an SDK needed to install software, given that I am not developing (compiling) software?"
The OP tagged the question with SDK, which provides a definition and if the OP took the time write the question, the OP would in all likeliness Google SDK.
I suspect this is a case where moderators could have helped the OP to refine the question.