Monday, October 8, 2018

Java static Method import

this was interesting to see the method is directly imported. This is possible for variables and functions those are static.

import static com.github.florent37.materialviewpager.Utils.canScroll;
import static com.github.florent37.materialviewpager.Utils.colorWithAlpha;
import static com.github.florent37.materialviewpager.Utils.dpToPx;
import static com.github.florent37.materialviewpager.Utils.getTheVisibileView;
import static com.github.florent37.materialviewpager.Utils.minMax;

However, there seems to be no performance impact or advantage due to this

references:
https://stackoverflow.com/questions/18825640/are-there-any-advantages-of-using-static-import-over-import

Sunday, October 7, 2018

Android How to give slide up/down animation with Activity

 Define an animation in res/anim/slide_in_up.xml:


    android:fromYDelta="100%p" android:toYDelta="0%p"
    android:duration="@android:integer/config_longAnimTime"/>
and another at res/anim/slide_out_up.xml:


    android:fromYDelta="0%p" android:toYDelta="-100%p"
    android:duration="@android:integer/config_longAnimTime"/>
Then apply these after to call startActivity:

Intent i2 = new Intent(main.this, test.class);
startActivity(i2);
overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );

references:
https://blog.stylingandroid.com/simple-animation-part-1/

What is CPanel?

cPanel is an online Linux-based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a three-tier structure that provides capabilities for administrators, resellers, and end-user website owners to control the various aspects of website and server administration through a standard web browser.

In addition to the GUI, cPanel also has command line and API-based access that allows third-party software vendors, web hosting organizations, and developers to automate standard system administration processes.[4]

cPanel is designed to function either as a dedicated server or virtual private server. The latest cPanel version supports installation on CentOS, Red Hat Enterprise Linux (RHEL), and CloudLinux OS.[5] cPanel 11.30 is the last major version to support FreeBSD.[6][7]

references:
https://en.wikipedia.org/wiki/CPanel

Thursday, October 4, 2018

How to get preview image from Youtube link?

This below one should be good enough

https://img.youtube.com/vi/f1qz8vn3XbY/0.jpg

However, there are also links upto 4
https://img.youtube.com/vi/f1qz8vn3XbY/1.jpg
https://img.youtube.com/vi/f1qz8vn3XbY/2.jpg
https://img.youtube.com/vi/f1qz8vn3XbY/3.jpg


references:
https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api

How to edit cloud functions online?

the quickest way is to login to the account and use the below link. This gives a way to list all the cloud functions on the account and let us edit quickly.

https://console.cloud.google.com/functions/list


references:
https://firebase.google.com/docs/functions/

Picasso Android Some tips

To invalidate a particular image cache
Picasso.with(getApplicationContext()).invalidate(getProfileImageURL());

To clear all cache contents
Picasso.with(context).cache.clear()

To explicitly set the cache policy
Picasso.with(context).load(uri).networkPolicy(NetworkPolicy.NO_CACHE)
        .memoryPolicy(MemoryPolicy.NO_CACHE)
        .placeholder(R.drawable.bv_logo_default).stableKey(id)
        .into(viewImage_imageView);

Monday, October 1, 2018

Whats the easiest way to detect links on Android text view and launch web browser?

Just have the below !

    android:text="www.google..com"
    android:id="@+id/tv_linkable"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:autoLink="web"
    android:linksClickable="true">



references:
https://stackoverflow.com/questions/6910703/android-active-link-of-url-in-textview