Posts

Android Color Hex Value Opacity Chart

  How to set transparency with hex value? For example, you want to set  40%  alpha transparence to  #000000  (black color), you need to add  66  like this  #66000000 . 100% — FF 99% — FC 98% — FA 97% — F7 96% — F5 95% — F2 94% — F0 93% — ED 92% — EB 91% — E8 90% — E6 89% — E3 88% — E0 87% — DE 86% — DB 85% — D9 84% — D6 83% — D4 82% — D1 81% — CF 80% — CC 79% — C9 78% — C7 77% — C4 76% — C2 75% — BF 74% — BD 73% — BA 72% — B8 71% — B5 70% — B3 69% — B0 68% — AD 67% — AB 66% — A8 65% — A6 64% — A3 63% — A1 62% — 9E 61% — 9C 60% — 99 59% — 96 58% — 94 57% — 91 56% — 8F 55% — 8C 54% — 8A 53% — 87 52% — 85 51% — 82 50% — 80 49% — 7D 48% — 7A 47% — 78 46% — 75 45% — 73 44% — 70 43% — 6E 42% — 6B 41% — 69 40% — 66 39% — 63 38% — 61 37% — 5E 36% — 5C 35% — 59 34% — 57 33% — 54 32% — 52 31% — 4F 30% — 4D 29% — 4A 28% — 47 27% — 45 26% — 42 25% — 40 24% — 3D 23% — 3B 22% — 38 21% — 36 20% — 33 19% — 30 18% — 2E 17% — 2B 16% — 29 15% — 26 14% — 24 13% — 21 ...

Hide the keyboard from emulator

Image
 

Implementing Navigation Component in Single Activity Application

 Create a new project with one Activity. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super .onCreate(savedInstanceState) setContentView(R.layout. activity_main ) } } Create two Fragments(Fragment1 and Fragment2) class Fragment1 : Fragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout. fragment_1 , container, false ) } } class Fragment2 : Fragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout. fragment_2 , container, false ) } } Now add dependencies for navigation component and data binding: In app level  build.gra...

Difference between dependencies and dev-dependencies?

In your node project in the file package.json , you may have seen two similar JSON element: “dependencies”: {             … }  and “ devDependencies” : {             … } devDependencies contains modules which are only required during development. To save a module as devDependencies on installation, we do: npm install <module-name> --save-dev or shortcut: npm i <module-name> -D Some examples of dev dependencies are Jest, Chai, Nodemon, Babel, etc. dependencies contains modules that are required at runtime. To save a module as run time dependencies , we do: npm install <module-name> --save or shortcut: npm i  <module-name>  -S Some examples of runtime dependencies are Express, React, Apollo-client etc.

Allow Installation of Application from Unknown Source in Mac

If Mac is not allowing you to install/run application from unknown source, go to command line and run the following command: sudo spctl --master-disable Now install or run the application that was previously blocked. It should work fine. If you don't care about security then you can close the terminal and continue to work. But if you do, go to step Step 2. Optional Step 1: Now if you go to System Preference -> Security and Privacy you will see that Install From Anywhere is enabled. Optional Step 2: Go to command line and run the following command: sudo spctl --master-enable

Download or Generate GraphQL Schema

Image
If you are using Apollo server on localhost and want to generate or retrieve the schema ( I did this because I needed the schema.json file in my Android project), do the following: Install Apollo CLI using: npm install -g apollo After this is installed, run the following command: apollo client:download-schema --endpoint=http://localhost:8080 This will download the schema.json file in the present working directory.  If the endpoint of your server is not localhost, change it to the respective URL. You may need sudo permission while installing apollo.

Decreasing the size of Vector Drawables in Android

Follow the steps written in this github page: https://github.com/alexjlockwood/avocado Run the following command: sudo npm install -g avocado If vector_old.xml is the old vector drawable file, runt he following command: avocado vector.xml The vector.xml file will be modified into small size file by replacing it.