Fragment transition with shared element supporting API 14+ example/tutorial

Now (27.0.0 support library) fragment can use support library versions of Transition for fragment transitions, including shared-element transitions.
https://developer.android.com/topic/libraries/support-library/revisions.html#27-0-0

Support android.transition classes provide transition API back to android API level 14.
https://developer.android.com/reference/android/support/transition/package-summary.html

Inspired by: Fragment Tricks (Google I/O ’17).

So let’s start with the build.gradle (support library 27.0.0+) :

implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

Keep Reading

Send event of scrolling from ScrollView to the WebView JavaScript code

GitHub: https://github.com/Pulimet/ScrollViewEventTest

First in onCreate() we will set our WebView:

private WebView mWebView;
private ScrollView mScrollView;
public static final long DELAY_TIME = 1000;
private long mTime;
...
mWebView = findViewById(R.id.webView);
mWebView.loadUrl("http:///alex.srv1043500.hstgr.cloud");

Enable JavaScript:

WebSettings webViewSettings = mWebView.getSettings();
webViewSettings.setJavaScriptEnabled(true);

Create a method that would invoke our JavaScript code:

private void invokeJavaScriptCode(String code) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    mWebView.evaluateJavascript(code, null);
  } else {
    mWebView.loadUrl(String.format("javascript:%s", code));
  }
}

Keep Reading

A collection of useful links for Android developers

I found a convenient way to organize websites that proved to be useful, during the process of developing Android apps.

I organized them in my Trello board (called “Android Developer Links“), combined with the gorgeous Google Chrome extension that is “Trello Card Links“.

I will keep updating this list on an almost daily basis, so feel free to check them out and offer other useful tools yourselves – just post then in the comments below!

Indicators library

Recently, I created a custom view, and after having used it for several of my projects, I decided to publish it as a library.

How to use it: https://github.com/Pulimet/Indicators-Library

<net.alexandroid.utils.indicators.IndicatorsView
    android:id="@+id/indicatorsView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    app:indicatorSize="20dp"
    app:paddingBetweenIndicators="16dp"

    app:selectedDrawable="@drawable/custom_selected"
    app:unSelectedDrawable="@drawable/custom_unselected"/>

Run signed apk on your device via Android Studio

  1. Open local.properties and add there keystore location, alias and password:This file must NOT be checked into Version Control Systems, as it contains information specific to your local configuration and password now.
    password=your_password
    keystore=C\:/keystore_location/keystore.jks 
    alias=your_alias
  2. Add signingConfigs at build.gardle of the module:
    android {
    ...
        signingConfigs {
            release {
            keyAlias alias
            keyPassword password
            storeFile file(keystore)
            storePassword password
            }
        }
    ...
    }
  3. Add build types:
    android {
    ...
        buildTypes {
            debug {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('p.txt'), 'proguard-rules.pro'
                shrinkResources true
            }
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('p.txt'), 'proguard-rules.pro'
                shrinkResources true
                signingConfig signingConfigs.release
            }
        }
    ...
    }
  4. Before running choose build variant:
    Capture