Kotlin How to create a template application - android

I have to create 2 application with almost the same design. But the backend i mean the way i receive data and i make request to my api is not the same. And there are also minor design such as color or bouton placement...
So i wanted to know if it's possible to create and app template i was thinking of creating a library module such as aar that would hold all the design then i would import it in both my application ?
But if i do that, is there a way to to update the design of the library within the app for exemple i assume that i want to change some color i could do it programmatically, but what happen if i want to change some button position or add rounder corner ? Do i have to provide methodes in my library to handle all those cases ? or is there a way to handle those within the app, meaning that the app could change some design of the library it self ?
In the end would like to have the logic in my app then give all information to the template library to render the design. So i would like to know if there is a way to implement such thing and what are the best practices to do it.

I have in my projects two ways.
Library, as you mention. I use it when there are routines that are common to several projects. It is possible to change color patterns and some style details. But it is often plastered.
Flavors - Build Variants https://developer.android.com/studio/build/build-variants
With build variants you can create one project/app with two versions, chandind only wat you need. This option is very good when you want to change color, endpoint, style, show or hide some system functionality. I use it and it's very good.

Related

Building a preference screen with Android Jetpack Compose

i have to build a new Android app. Since Jetpack Compose is now stable i want to build the entire UI with that. Further i need also a Preference/Settings screen where the user can specify his preferences. According the doc it is still recommended doing this via Fragments.
https://developer.android.com/guide/topics/ui/settings
I found also an external library witch would provide this functionality in the compose way.
https://github.com/alorma/Compose-Settings
Has anybody done this before? Whats the "cleanest" way for doing that?
Thank you
I have implemented an app in compose and I created the settings screen using the tools available in Jetpack Compose, without fragments.
The way I did this is create a composable for each settings option, that contains a title, and optional subtitle, and a checkbox, which indicates if the option is enabled or not.
These options are then added to a column (or a grid, if you have a tablet, it's easy to support both in compose); you just have to hook the clicks on the checkbox to your viewmodel to change the setting and then refresh the UI.
If you have other kinds of settings entries you can define your own composables for those as well. In my case I have other settings options that open a dialog where the user can configure some parameters, I have another composable function for this kind of settings row as well.
This is personal opinion, but I prefer to stay away from 3rd party libraries unless a) they provide significant value and b) they're from a source that offers some kind of maintenance and bug fixes guarantees. I don't know about that library you mentioned, but if you include 3rd party libraries, you need to be aware you are relinquishing control over parts of your app so you need to balance the cost/benefit ratio.

React Native - Share code for different applications

I have a react native application called A, now I want create another application very similar to A, I only need change some colours the rest of the code is exactly the same. One option could be create a new application B and copy all the code from A and change the hard coded colours, obviously it doesn't look very clever because now I have to maintain two different applications.
There are any way to load the colours information from a theme file and then when I start the application determinate what file the application should use?
You can do it using product flavors.
Take a look at the docs:
http://developer.android.com/tools/building/configuring-gradle.html

Android - App with layouts only - without controllers

I'm programming an app in Android.
My client needs a 'dummy' like application, I mean, an app with all layouts but just navigable, without the actual controllers or activities, just navigate through layouts. By clicking buttons, but just pass to the other layouts without executing java or whatever code.
My question is, is this possible in AndroidStudio?
Or should I generate another kind of graphical app in order to accomplish this?
Any ideas?
Thanks in advance!
The short answer to your question (as I understood it) is no. You have to have activities to have an android app that will function. You could create a very rudimentary set of activities to do what you want.
However, if you are simply trying to create a mockup of what the app will look like for your client, I suggest using a tool like FluidUI. This will allow you to layout the general look and feel of your app without any actual code required.
Let me know if this helps!

Creating a high quality Android user interface

I have created an Android app using the standard controls available. It seems that most apps on the market have their own set of controls. It generally looks much better that the standard controls. How do I create better looking control? Can I just apply a theme or should I overwrite the onDraw method? For instance, there is a problem with the default android spinner control details here .
adding custom images is the best way to have more eye-catching GUI, use colorful & meaningful images to your application to appeal users. Custom theme's and styles are helpful too.....
You can apply different themes and styles on the one hand or work with 9patch-drawables - have a look here for details and examples

Android Application looks like iphone

I came across this app and I wonder how was it developed on android (Cause it looks so much like an iphone app), see this screenshot.
Anyone have any idea how to accomplish that type of look on Android?
That's just a matter of styling after all. In general, I would consider it to be discouraged to make your Android app look like an iPhone app. Every platform has its own UX standards, and Android's standards are different from iPhone's. That quite obviously also reflects in the user interface.
Anyhow, you may want to read this article about Android themes and styles. It should get you going with defining own widget styles and stateful drawables to implement custom buttons.
This app obviously uses customized ListViews, ButtonView on the bottom of the screen.
Theses are pretty much standard and common in android apps.
Here is how to create custom components:
https://developer.android.com/guide/topics/ui/custom-components.html

Categories

Resources