Quantcast
Channel: Geek On Java
Viewing all 322 articles
Browse latest View live

Top 25 Android Libraries you can try in 2017 - Part 3

$
0
0
Hey geekers in my previous article i am list of top 20 android libraries which you can try in 2017 and the second part of this series is there.



Hope you like it too.

21. FlowLayout

This library:
“allows child views flow to next row when there is not enough space.
The spacing between child views can be calculated by the FlowLayout so that the views are evenly placed.”

Please note that this is still in its early stages of development.


FlowLayout - A flow layout for Android with auto-spacing.

22. Unofficial Google Actions Java SDK

This is a polish accent from Mirek Stanek. Because of the fact that the official Google Actions SDK is written in Node.js, he introduced his unofficial version written natively in Java. According to the README:
“Google Actions Java SDK is built based on official Node.js library, but it’s not a mirror copy of it. The goal is to make it fully compatible with Conversational Protocol of Assistant Platform.”

Google-Actions-Java-SDK - Unofficial Google Actions Java SDK - for Android engineers and all Java lovers

23. Wearable Reply

On 9th of February 2017 Google released a new Android Wear 2.0.
Luke Klinker found a missing API and released the library for this OS. It:
“allows for quick and easy text input, whether that is from your voice, a keyboard, or canned responses. The missing API is now available!”



wearable-reply - Simplify text input for Android Wear 2.0, by voice, keyboard, or canned response.

24. Shortbread

This is a library:
“generates app shortcuts for Activities and methods annotated with @Shortcut. No need to touch the manifest, create XML files or use the shortcut manager. Just annotate the code that you want the shortcut to call.”
Currently, it’s at version 1.0.0.

shortbread - Android library that generates app shortcuts from Shortcut annotations

25. Material About

This library helps you to prepare an About Me screen to introduce you to your users.



MaterialAbout - It's a material-design about screen to use on your Android apps. A developer profile and application…

That’s it. I hope you enjoyed my list. If you know any great library, which was released in January or February this year and I didn’t mention about it, please let me know in the comments.

Top 25 Android Libraries you can try in 2017 - Part 2

$
0
0
Hey friends in my previous article i am list of top 10 android libraries which you can try in 2017 and the second part of this series is there.


Hope you like it too.

11. CameraFragment

CameraFragment is an implementation of a Fragment which allows you to easily integrate a camera functionality to your app. According to its README:
“CameraFragment previews directly the camera view, and provides an easy API to capture or manage the device. You can setup your own layout and control the camera using CameraFragment.”


CameraFragment - A simple easy-to-integrate Camera Fragment for Android

12. AwesomeBar

This is another great implementation from Florent Champigny. It is new approach to a design of a top bar (which we know from ActionBar/Toolbar implementation), in conjunction with DrawerLayout, inspired by Gmail Mobile from Weekz. You can check, how it works below:


AwesomeBar - Just beautiful

13. ArcNavigationView

This is an implementation of NavigationView from Android Design Support Library which introduces curved edges.



ArcNavigationView - Another approach to create NavigationDrawer with Material concepts

14. ShimmerRecyclerView

It is a custom RecyclerView implementation with shimmer views to indicate that views are loading. The RecyclerView has also a built-in adapter, to control the shimmer appearance.


Contribute to ShimmerRecyclerView development by creating an account on GitHub.

15. Android-SwitchIcon

“A Google launcher-style implementation of switch (enable/disable) icon.”
This library extends AppCompatImageView and allows you to set any icon (vector or image), to SwitchIconView using app:srcCompat attribute.


Android-SwitchIcon - Google launcher-style implementation of switch (enable/disable) icon

16. CounterFab

This library is a FloatingActionButton subclass that shows a counter badge in the top right corner. You can download a demo app from Google Play.


CounterFab - A FloatingActionButton subclass that shows a counter badge on right top corner

17. FadingTextView

This library allows you to make a TextView change its content automatically every few seconds.

FadingTextView - A textview that changes its content automatically every few seconds

18. Bridge

“Bridge is a simple but powerful HTTP networking library for Android. It features a Fluent chainable API, powered by Java/Android’s URLConnection classes for maximum compatibility and speed.”
This library has a really comprehensive documentation and is definitely worth checking out.
bridge - A simple but powerful HTTP networking library for Android. It features a Fluent chainable API, powered by Java…

19. Ason

It is the second library from Aidan Follestad. Its main idea is to simplify an interaction with JSON. The library:
“also makes (de)serialization painless.”
The documentation is also pretty good. You can check it out here:
ason - JSON in Java made easy!

20. ObjectBox

I assume that majority of you knows greenrobot. If not, they developed GreenDAO and EventBus. Now, this is time for a new database for objects focused on performance. As greenrobot claims,
“Performance is the number one reason why we created ObjectBox. Previously, we created greenDAO, the fastest Object/Relational Mapper (ORM) for Android and SQLite. Since its first release in 2011, we gained a lot of insight into object persistence — and the performance limitations imposed by SQLite. We realized that in order to improve performance on mobile significantly, we needed to go to the core and build a database designed for objects.”

You can read more about it here. Please take into consideration that ObjectBox is currently in beta (version 0.9.7 ).


ObjectBox is a superfast mobile database for objects

<<Prev                                   Next>>

Top 25 Android Libraries you can try in 2017 - Part 1

$
0
0
This is a list of 25 best Android libraries released in January and February 2017. All of these are worth trying out — they are not in ranked order.


Let’s get started!

1. Lottie

This is a library that parses Adobe After Effects animations exported as JSON with Bodymovin (After Effects plugin for exporting animations to SVG/Canvas/HTML + JavaScript) and renders them natively on mobile.
There is also an example app available in the Google Play Store.
The more than 7,500 Github users who starred this library can not be wrong!



lottie-android - Render After Effects animations natively on Android and iOS

2. Toasty

This is a library for creating customized Toasts. As the author described the lib, it is:
“The usual Toast, but with steroids.”
You can find screenshots and the link to the library below.



Toasty - The usual Toast, but with steroids 💪

3. StyleableToast

This is another library for Toasts customization. It adds:
“variety of styling options that gives your app and user experience that little extra unique feeling! Style your toast either by code or in styles.xml!”



StyleableToast - A library that takes the standard Android toast to the next level with a variety of styling options…

4. Store

Store is a library for Async Data Loading and Caching. According to the documentation:
“Store is a class that simplifies fetching, parsing, storage, and retrieval of data in your application. A Store is similar to the Repository pattern while exposing a Reactive API built with RxJava that adheres to a unidirectional data flow.”
The documentation is really comprehensive and the lib is for sure worth trying. You can check many flows such as data requests, caching and parsing.
Store - Android Library for Async Data Loading and Caching

5. PreviewSeekBar

If you use Google Play Movies, you have probably noticed this great animated SeekBar with a preview of the movie. It turned out that Rúben Sousa implemented that as an open-source library. The gif below gives a good flavor of its functionalities. If your app is for instance a movie player, you should definitely try it!



PreviewSeekBar - A SeekBar suited for showing a preview of something. As seen in Google Play Movies.

6. Chuck

If you use OkHttp, this is the library that helps intercept and persist all HTTP requests and responses inside your application. It also provides a UI for inspecting their content.


chuck - An in-app HTTP inspector for Android OkHttp clients

7. CoordinatorTabLayout

CoordinatorTabLayout is a custom composite control that quickly implements the combination of TabLayout and CoordinatorLayout.
You can check how it works on the gif below:


CoordinatorTabLayout - Combination of TabLayout and CoordinatorLayout./TabLayout/CoordinatorLayout

8. boxing

Boxing is a multimedia selector and by using it you can:
do a selection of your images (single or multiple images)
preview and crop images.
It also supports gifs, video selection, image compression and custom UI as shown in the screenshot below:



boxing - Android multi-media selector based on MVP mode.

9. excelPanel

This is a two-dimensional RecyclerView. It can not only load historical data, but also load future data.


excelPanel - An Android's two-dimensional RecyclerView. Not only can load historical data, but also can load future…

10. Horizontal Calendar

Another implementation for RecyclerView is dedicated to show Material horizontal Calendar View.


HorizontalCalendar - A material horizontal calendar view for Android based on RecyclerView
Next >>

Liquid Pour Loading Animation Android Example

$
0
0
Today i am giving you a great animation tutorial for loading progress with liquid pour effect and in previous article you can learn to create your custom loading progress bar by using Road runner library. But here you'll teach another cool animation effect for your loading animation.
You can also check : Circular Fillable Loaders Android Library
Just look at the example below :

Cool animation for all project : Kick Out the Wrong Password Android Animation

In xml layout file

<com.gospelware.liquidbutton.LiquidButton
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:clickable="true"/>

Uses startPour() to start the animation.

LiquidButton liquidButton = (LiquidButton) findViewById(R.id.button);
liquidButton.setOnClickListener(new View.OnClickListener() {
@Override
publicvoidonClick(View v) {
LiquidButton btn = (LiquidButton) v;
btn.startPour();
}
});

Set fillAfter using setFillAfter(), befault as not fill after

liquidButton.setFillAfter(true);

Set autoPlay using setAutoPlay(), default as not palying automatically

liquidButton.setAutoPlay(true);

Register PourFinishListener to the widget

It will send a callback onPourFinish() when the animation completed, and onProgressUpdate() when new progress is updated;
liquidButton.setPourFinishListener(new LiquidButton.PourFinishListener() {

@Override
publicvoidonPourFinish() {
Toast.makeText(MainActivity.this, "Finish", Toast.LENGTH_SHORT).show();
}

@Override
publicvoidonProgressUpdate(float progress) {
textView.setText(String.format("%.2f", progress * 100) + "%");
}
});

How to update and finish the animation?

You'll able to uses changeProgress() to alternate the progress of the liquid level. (You need AutoPlay turn Off to be able to do that.) Progress are measure in float, where 1f = 100%;
liquidButton.changeProgress(progress);
Note :
By default the widget starts a finish animation when the progress is 1f, but you can also uses finishPour to start the finish Animation.
liquidButton.finishPour();

How to?

Gradle
dependencies {    
compile 'com.gospelware.liquidbutton:liquidButtonLib:1.1.4'
}

Hope you like this tutorial. If it is then please give some time to share with your friends.

Search Filter Animation in Android

$
0
0
Today i am telling you how to implementing Search Filter Animation in Kotlin for Quora Meets LinkedIn.

How we implemented Search Filter animation

We had to make it scalable so it can be independent from the filter items count. We chose the combination of ScrollView and HorizontalScrollView as a solution to this problem.
The ScrollViewcontains an expanded filter view that places items in such a way that they take all the possible width of the parent view. The HorizontalScrollViewhas a collapsed filter view where filter items are placed one after another.

Dowload this library

Add to your root build.gradle:

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}

Add the dependency:

dependencies {
compile 'com.github.yalantis:searchfilter:v1.0.1'
}

How to use this library

search filter animation in android

Firstly you need to place Filter above your RecyclerViewin the layout file
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:paddingRight="16dp">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.AppCompatImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_alarm"
android:tint="@android:color/white"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Questions"
android:textColor="@android:color/white"
android:textSize="20sp"/>

<android.support.v7.widget.AppCompatImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_search"
android:tint="@android:color/white"/>

</RelativeLayout>

</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E4E6E3"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/container_height"
tools:listitem="@layout/item_list"/>

<com.yalantis.filter.widget.Filter
android:id="@+id/filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
After that you need to create a class that extends FilterAdapter and to pass your model class as a generic. Here you can easily customize the appearance of filter items.
For the sample app I created Tag model to represent the category of a question in the conversation.
classAdapterextends FilterAdapter<Tag> {

Adapter(@NotNull List<? extends Tag> items) {
super(items);
}

@NotNull
@Override
public FilterItem createView(int position, Tag item) {
FilterItem filterItem = new FilterItem(ExampleActivity.this);

filterItem.setStrokeColor(mColors[0]);
filterItem.setTextColor(mColors[0]);
filterItem.setCheckedTextColor(ContextCompat.getColor(ExampleActivity.this, android.R.color.white));
filterItem.setColor(ContextCompat.getColor(ExampleActivity.this, android.R.color.white));
filterItem.setCheckedColor(mColors[position]);
filterItem.setText(item.getText());
filterItem.deselect();

return filterItem;
}
}
To receive all the events from the Filter such as selection or deselection of a filter item it's necessary to add a FilterListener with the same model class passed as a generic
private FilterListener<Tag> mListener = new FilterListener<Tag>() {

@Override
publicvoidonFiltersSelected(@NotNull ArrayList<Tag> filters) {

}

@Override
publicvoidonNothingSelected() {

}

@Override
publicvoidonFilterSelected(Tag item) {

}

@Override
publicvoidonFilterDeselected(Tag item) {

}

};
Basically Filter setup looks like that
mFilter = (Filter<Tag>) findViewById(R.id.filter);
mFilter.setAdapter(new Adapter(getTags()));
mFilter.setListener(this);

//the text to show when there's no selected items
mFilter.setNoSelectedItemText(getString(R.string.str_all_selected));
mFilter.build();
For more usage examples please review sample app

Let us know!

We’d be really happy if you sent us links to your projects where you use our component.

Multi-Selection Animation in Android

$
0
0
Multi selection can be tricky on mobile. Default solutions, where you have a list with check boxes at the right behave bad when the list is getting real big and gets more functionality like filtering.

Suppose when creating your own playlists it can be confusing to understand which songs have already been added without switching between several screens or endlessly scrolling through a list of selected songs.
And the situation may get even worse if we decide to apply filters. In this case, the list of compositions may change once we’ve applied a filter, but the compositions you’ve already selected may not be displayed at all. Vitally decided to solve this problem with yalantis.com concept for multiselection.


In this little experiment, the screen is divided into two parts, so user can always see and manage what he selected without leaving current view. As for filtering or else, it applies only for main left list.

Implementing the component

The animation’s logic seems straightforward, yet it has a few catches.
The component has a ViewPager with two RecyclerViews. We can make a ViewPager page narrower than the screen by overriding the getPageWidth method in the ViewPager adapter and returning a floating number between 0 and 1.
A ViewPager has two pages, each with the RecyclerView. Unselected items are on the left list. Selected items are on the right one.
For instance, if you click an unselected item, a few things will happen:
  1. The clicked item is deleted from the unselected items list and added to the container that holds both lists.
  2. Item position in the selected items list is determined. (The unselected list always has its items sorted alphabetically. The selected list has its items in the order they were selected)
  3. A hidden item is added to the selected items list.
  4. The translation animation is run for the clicked item.
  5. The clicked item is deleted and the hidden item in the selected list is shown.

How to use MultiSelect

Here are 5 simple steps to follow if you want to use this multiselect component in your project.

1. First, add this to your root build.gradle:

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
And then add this to your module build.gradle:
dependencies {
   compile 'com.github.yalantis:multi-selection:v0.1' }

2. Then create a ViewHolder:

classViewHolderextends RecyclerView.ViewHolder {
TextView name;
TextView comment;
ImageView avatar;

publicViewHolder(View view) {
super(view);
name = (TextView) view.findViewById(R.id.name);
comment = (TextView) view.findViewById(R.id.comment);
avatar = (ImageView) view.findViewById(R.id.yal_ms_avatar);
}

publicstaticvoidbind(ViewHolder viewHolder, Contact contact) {
viewHolder.name.setText(contact.getName());
viewHolder.avatar.setImageURI(contact.getPhotoUri());
viewHolder.comment.setText(String.valueOf(contact.getTimesContacted()));
}
}

Take note of the static bind method. It’s useful to have it in here because that way you can use the same viewholder in both adapters.

Download Source Code


3. Next, create two adapters for unselected and selected items. 

The first one should extend BaseLeftAdapter; the second, BaseRightAdapter:
publicclassLeftAdapterextends BaseLeftAdapter<Contact, ViewHolder>{
privatefinal Callback callback;

publicLeftAdapter(Callback callback) {
super(Contact.class);
this.callback = callback;
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view, parent, false);
returnnewViewHolder(view);
}

@Override
publicvoidonBindViewHolder(@NonNullfinal ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);

ViewHolder.bind(holder, getItemAt(position));

holder.itemView.setOnClickListener(view -> {
// ...
callback.onClick(holder.getAdapterPosition());
// ...
});

}

}
Notice that you should call super constructor with the model class you use in the adapters.
The adapter for selected items is very similar:
publicclassRightAdapterextends BaseRightAdapter<Contact, ViewHolder> {

privatefinal Callback callback;

publicRightAdapter(Callback callback) {
this.callback = callback;
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view, parent, false);
returnnewViewHolder(view);
}

@Override
publicvoidonBindViewHolder(@NotNullfinal ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);

ViewHolder.bind(holder, getItemAt(position));

holder.itemView.setOnClickListener(view -> {
// ...
callback.onClick(holder.getAdapterPosition());
// ...
});
}
}
Adapters need to extend different base classes because unselected items are sorted, but selected items stay in the order they were previously selected.

4. Finally, call the builder:

MultiSelectBuilder<Contact> builder = new MultiSelectBuilder<>(Contac
.withContext(this)
.mountOn((ViewGroup) findViewById(R.id.mount_point))
.withSidebarWidth(46 + 8 * 2); // ImageView width with paddings
You’ll then need to:
  • Pass the context.
  • Pass the view (usually FrameLayout) that you want the component to be mounted on.
  • Specify the sidebar width in dp (shown in the image below).

how-we-build-a-multiselection-component-for-android-application

5. Last but not least, set the adapters:

LeftAdapter leftAdapter = new LeftAdapter(position -> mMultiSelect.select(position));
RightAdapter rightAdapter = new RightAdapter(position -> mMultiSelect.deselect(position));

leftAdapter.addAll(contacts);

builder.withLeftAdapter(leftAdapter)
.withRightAdapter(rightAdapter);
Now all you need to do is call builder.build(), which returns the MultiSelect<T> instance.

Thats it.

Control an Android Phone using PHP

$
0
0
Today i am telling you trick for Android in which you can control an Android phone using PHP by using Termux which is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required.

What is PHP Termux API?

Termux App is a useful Android app which enables us to use a sort of Linux console inside our Android devices, like phones, tablets, and so on.



It needs the Termux:API add-on app to be installed, so it can use a command line programs that expose Android functions to Termux system. Inside Termux we can access networking (wi-fi and mobile internet).

Recommended hacking article:



Termux supports package management using .deb files and the apt tool. In his own package repository there are many tools like imagemagick, a c language compiler, PHP 7.1 interpreter, lighttpd, etcetera. The actual build supports only ARM and x86 platforms, so can't install on MIPS.

So now we have PHP 7.1 on the smartphone too... ready to begin the development of new applications? We need to access some of the Android features to power up our projects. the Termux:API add some command line tools to deal; a wrapper class is the only we need to take advantage of it.

Features of Termux API

  • Secure. Access remote servers using the ssh client from OpenSSH. Termux combines standard packages with accurate terminal emulation in a beautiful open source solution.
  • Feature packed. Take your pick between Bash, fish or Zsh and nano, Emacs or Vim. Grep through your SMS inbox. Access API endpoints with curl and use rsync to store backups of your contact list on a remote server.
  • Customizable. Install what you want through the APT package management system known from Debian and Ubuntu GNU/Linux. Why not start with installing Git and syncing your dotfiles?
  • Explorable. Have you ever sat on a bus and wondered exactly which arguments tar accepts? Packages available in Termux are the same as those on Mac and Linux - install man pages on your phone and read them in one session while experimenting with them in another.
  • With batteries included. Can you imagine a more powerful yet elegant pocket calculator than a readline-powered Python console? Up-to-date versions of Perl, Python, Ruby and Node.js are all available.
  • Ready to scale up. Connect a Bluetooth keyboard and hook up your device to an external display if you need to - Termux supports keyboard shortcuts and has full mouse support.
  • Tinkerable. Develop by compiling C files with Clang and build your own projects with CMake and pkg-config. Both GDB and strace are available if you get stuck and need to debug.

Accessing Android Device Features using the Termux API

The PHP Termux API package provides methods to access the following functionality exposed bt the Termux API app.

  1. Battery Status
  2. Camera Info
  3. Camera Photo
  4. Clipboard Get
  5. Clipboard Set
  6. Contact List
  7. Download file with Android Download Manager
  8. Location via GPS, Mobile Network or Wi-Fi
  9. Notification
  10. Open Url with default web browser
  11. Share file with Android actions
  12. SMS Inbox read
  13. SMS Send
  14. Telephony Device Info
  15. Toast show over the screen
  16. TTS Engines in Android
  17. TTS Speak
  18. Vibrate the Phone
  19. Wi-Fi Connection Info
  20. Wi-Fi Scan info

Steps to have the full setup



  • Install and configure a more generic keyboard you know and use (like Hacker's Keyboard)
  • Install and configure FTP Server you now and use 
  • Install Termux and Termux:API add-on from some repo (F-Droid or Play Store)
  • Inside Termux console, type:
apt update
apt upgrade
apt install termux-api php
mkdir /sdcard/php

Accessing the device using a keyboard

We need to type in a terminal emulator capable and requiring of ctrl-c, so I recommend to install a keyboard with it (as Hacker's keyboard does).

Transfer files via FTP

To transfer PHP scripts and other files easily between our workstation and the Android devices, a FTP server is a must.

It is easy to set up your desktop environment to use LAN FTP servers. You can install a FTP client in the system, or even use inside Mozilla Firefox (FireFTP extension). In Windows, type in the Explorer Address Bar, the URL of the server, like:
ftp://user@ipaddress:port/
The same can be done for other operating systems desktop environments, like Nautilus for Linux, etc..

Running PHP from Termux in an endless loop

For polling endlessly some conditions. Inside the script, the loop must have a sleep(seconds) call, to avoid monopolize the processor.
in Termux, type:
php endlessloop.php

Running PHP as a Web Server from Termux

You can run PHP and make it work as a Web server that executes your PHP scripts in side your project root directory stored in your device memory file system.
In Termux, type In order to start the development Web server embedded in PHP.
php -S address:port -t /sdcard/php/rootdirectory/
If you use an address that is 0.0.0.0, the server listens to any of the device network IP addresses. if address is 127.0.0.1, the server only listens to local connections (inside the device or phone).

The port must be any number over 1024. the rootdirectory is the base path which serve as root web directory, with all the resources including JavaScript, images, CSS stylesheets, HTML files, and PHP scripts.


Using the PHP Termux API class

The PHP Termux API class provides wrappers to many services of the Termux:API app. It is very simple to use as you may see here.
  $termux =new termuxapi();
echo $termux->location();

Termux:API issues

Some Termux:API functions are long-lasting and resource-intensive like for instance the SMS inbox check, contact list, and location.

Since Termux programs are called is with shell_exec(), its synchronous behavior may delay seriously the Web Server approach. Consider to make an AJAX call to the methods to hide this issue.

Conclusion

Termux is a nice Android app that makes it easy to run PHP or other programs typically available in Linux distributions.

The possibility to run PHP either as a command line script or as a Web server opens a myriad of possibilities to run nice applications using PHP code like other native Android applications.

If you liked this article, share it with your developer friends. If you have questions or suggestions, post a comment here. 

Elastic Progress JQuery Tutorial

$
0
0
Today we’d like to share an interesting progress button effect with you. The effect is based on a very nice Dribbble shot called “Download” by xjw. The button starts as an icon with an arrow and once it’s clicked, it animates into a fun little wire and a label that indicates the download percentage.
Here you can learn to creates a button that turns into a progress bar with a elastic effect.

Take a look:

http://geekonjava.blogspot.com/2017/03/elastic-progress-jquery-tutorial.html

This project requires GSAP. You can use either TweenMax...
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js"></script>
...or TweenLite, with EasePack and the CSS and attr plugins:
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenLite.min.js"></script>
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/easing/EasePack.min.js"></script>
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/plugins/CSSPlugin.min.js"></script>
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/plugins/AttrPlugin.min.js"></script>
Then, include the elastic-progress.min.js file, located in the dist folder:
<scriptsrc="path/to/js/elastic-progress.min.js"></script>

How to implements

Create the element you want to turn into a button:
<divclass="Upload"role="button"aria-label="Upload file"></div>
Note: We are using a div element with role="button" instead of a button element because, according to W3C recommendation, button elements should have no interactive elements as descendants.

Demo and Download full source code 

Then, via JS:

var element=document.querySelector('.Upload');
var progress=new ElasticProgress(element, { /*options*/ });

// or...

var progress=new ElasticProgress('.Upload', { /*options*/});

Or, in case you are using jQuery:

$('.Upload').ElasticProgress({/*options*/});

Setting Options

Options are set on the constructor, like this:
var progress=new ElasticProgress('.Upload', {
colorFg:"#FF0000",
buttonSize:80,
//...
})
A complete list of options can be found below.

Calling Methods

The button doesn't do much by itself - controlling the opening, bar progress, etc. is in your charge.
var progress=new ElasticProgress('.Upload', {
// ...
onClick:function(){
progress.open();
}
});
function theFunctionYouAreUsingToCheckProgress(){
// ...
progress.setValue(value);
}


// with jQuery
$(".Upload").ElasticProgress({
// ...
onClick:function(){
$(this).ElasticProgress('open');
}
});

function theFunctionYouAreUsingToCheckProgress(){
// ...
$(".Upload").ElasticProgress('setValue',value);
}
A complete list of methods can be found below.

Options


  • arrowDirection string

Either 'up' or 'down'. Defaults to 'down'.

Colors


  • colorFg, colorBg string

Colors of the foreground (the arrow, the filled part of the progress bar) and the background (the circle, the empty part of the progress bar), respectively. Defaults are white and black.

  • highlightColor string

Color of the highlight outline. Defaults to #08F.

  • background string

Color of the overlay during the "pop" animation. Defaults to the background color of the body.

Size


  • buttonSize number

Circumference of the button. Defaults to the height of the element.

  • width number

Width of the expanded progress bar. Defaults to the width of the element.

  • labelHeight number

Height of the label, in pixels. Defaults to 53.

  • barHeight number

Thickness of the progress bar. Defaults to 4.

  • barInset number

Inset of the filled part of the progress bar. Defaults to -0.5 Helps covering jagged edges.

  • bleedTop, bleedRight, bleedLeft and bleedBottom number

Margin to draw the graphics. If there's clipping during the animation, increase these values. Performance might take a hit for values too large. Defaults to 100, 50, 50 and 60 respectively.

Text


  • fontFamily string

Font used for the label. Defaults to 'Helvetica Neue','Helvetica','Arial',sans-serif. This default is added to the value set, so there's no need to manually set these as fallback.

  • fontWeight string

Defaults to 'bold'.

  • textComplete, textFail and textCancel string

Texts that will be shown on these events. Defaults are 'Done', 'Failed' and 'Canceled'.

Animation


  • barStretch number

The maximum distance the bar will stretch. Defaults to 20.

  • jumpHeight number

How hight the arrow/label will jump. Defaults to 50.

  • barElasticOvershoot and barElasticPeriod number

Settings for the elastic animation. Defaults are 1.8 and 0.15, respectively.

  • labelWobbliness number

Setting for the animation of the label during progress. Defaults to 40.

  • arrowHangOnFail and arrowHangOnCancel boolean

Whether the arrow should 'fall' on these events or not. Default is true for both.

Events


  • onClick function

Called when the user clicks the button only.

  • onOpen function

Called when the progress bar finishes the opening animation.

  • onChange function

Called when the bar value is changed.

  • onComplete function

Called when the bar is full.

  • onClose function

Called when the close animation is finished.

  • onFail function

Called when the fail animation starts.

  • onCancel function

Called when the cancel animation starts.

Methods


  • open()

Starts the opening animation (turns the button into a progress bar).

  • close()

Turns the progress bar back into a button.

  • setValue(valuenumber)

Sets the percentage loaded of the progress bar. From 0 to 1.

  • getValue() number

Returns the current value of the progress bar.

  • fail() and cancel()

Runs the fail and the cancel animations, respectively.

  • complete()

Runs the complete animation, regardless of the progress. You should probably call setValue(1) instead.

  • onClick(callbackfunction), onOpen(callbackfunction), onChange(callbackfunction), onComplete(callbackfunction), onClose(callbackfunction), onFail(callbackfunction) and onCancel(callbackfunction)

Aliases to the options of the same name.


We hope you enjoyed this progress button and find it useful!



How to Install AngularJS plugin in Eclipse

$
0
0
If you're performing on AngularJS and using eclipse for development then its smart to own AngularJS plugin install in your eclipse that supports its expression and directives to create development easy.

Please follow below steps to install this plugin:


  • Open your eclipse (Note: We are using Eclipse Kepler)
  • Click Window –> Eclipse Marketplace
  • In the Eclipse Marketplace window type AngularJS then click search. You will see below click install button:
For Java EE developers : WebJars - Life saviour for Java Dev

Install AngularJS plugin Eclipse

See the compare : Difference : AngularJS vs. Backbone.js vs. Ember.js
  • You will see below confirm feature window, here select all then click confirm:



Want some animations : Mobile Animation Using AngularJs
  • Accept terms and click Finish:



  • You will see eclipse stared installing this plugin:



Want some help : Struts2 AngularJS CRUD Example
  • If you get warning window click OK to proceed:



  • Once installation is complete you will see popup to restart your eclipse click Yes to restart it:


Now to validate please create sample HTML page as below:

<!DOCTYPE html>
<html>
<head>
<metacharset="ISO-8859-1">
<title>AngularJS Plugin Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<script type="text/javascript">

</script>
</head>
<body>
<divng-controller="HelloWorldController">


</div>

</body>
</html>

  • To check if you get its expression and directive assistant write ng then press ctrl+space you will see below:

Important: After getting comment from Angelo below are findings:


  • To see blue icon with detail explanation including hyperlink of AngularJS API you will have to convert your project to AngularJS project. To convert right click project –> Configure –> Convert to AngularJS Project as below:



  • Once your project converted to AngularJS project validate it using any html file. Type first few words of AngularJS directive then press Ctrl+Space you will see below:


That’s it we successfully installed AngularJS plugin in eclipse.

Use Facebook emoji like button in Android

$
0
0
Facebook has expanded its Like button. The six emoji-alternatives, called “Reactions,” give Facebook users an extended palette of emotions and you also want to implement this feature in your android app. Then just dive with us in code.

Game on Emoji : HungerMoji - Android Notification Game [Source Code]

Just like Facebook's app:


  • long press on like button
  • keep your finger down, swipe left or right
  • release your finger

Demo



Step 1. Get it with

allprojects {
repositories {
maven { url"https://jitpack.io"}
...
dependencies {
compile'com.github.andob:emojilike-android:beta2'
...

Step 2. Setup your "emoji-like" activity

This library uses the activity to detect touch events, to prevent sending touch events to RecyclerView/ListView/ScrollView when the EmojiLikeView is visible on screen (when you select an emoji, you can move your finger up/down and the activity will prevent the scrolling view to scroll).
Thus, you will need to extend a class called ActivityWithEmoji
publicclassFragmentActivitySampleextends ActivityWithEmoji
{
@Override
protectedvoidonCreate(Bundle savedInstanceState)
{
.....
OR without extending,

publicclassMainActivityextends AppCompatActivity implements IActivityWithEmoji
{
EmojiLikeTouchDetector emojiLikeTouchDetector;

@Override
protectedvoidonCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
.....
emojiLikeTouchDetector=new EmojiLikeTouchDetector();
.....
}

//override theese 2 methods if your activity doesn't extend ActivityWithEmoji
@Override
publicbooleandispatchTouchEvent(MotionEvent event)
{
boolean shouldCallSuper=emojiLikeTouchDetector.dispatchTouchEvent(event);
if (shouldCallSuper)
returnsuper.dispatchTouchEvent(event);
returnfalse;
}

@Override
publicvoidconfigureEmojiLike(EmojiConfig config)
{
emojiLikeTouchDetector.configure(config);
}
}

Step 3. Define EmojiLikeView in XML

You can put an EmojiLikeView whereever you want, in an activity, fragment, an item from an adapter (for RecyclerViews or ListViews), etc.

You just need to define the "trigger" view (=the like button, the button that, once long pressed, the view with emojis will be visible on screen)
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Like"
android:id="@+id/likeButton"....../>
And the view with emojis:
<ro.andreidobrescu.emojilike.EmojiLikeView
android:layout_width="match_parent"
android:layout_height="110dp"
android:id="@+id/emojiView"
android:layout_alignBottom="@+id/likeButton"
android:layout_marginBottom="10dp"/>
Then get them in your activity/fragment/list cell/etc.

Step 4. Configure the emojis

When the activity/fragment/list cell is created, use EmojiConfig class to configure how emojis will behave. Pass a reference to the context to "with" metod (the context will need to implement IActivityWithEmoji or extend ActivityWithEmoji as described above), the "trigger" view to "on" method, and the EmojiLikeView to "open" method. Then, use addEmoji to add emoji objects (with picture and description).

With this class you can personalize the EmojiLikeView, the in and out animation, background image, margins, delays. There is no default background image (the image behind emojis) or in/out animations, so you will probably need to set them as below.
//in onCreate/onCreateView/onBindViewHolder/etc
EmojiConfig.with(this)
.on(likeButton)
.open(emojiView)
.addEmoji(new Emoji(R.drawable.like, "Like"))
.addEmoji(new Emoji(R.drawable.haha, "Haha"))
.addEmoji(new Emoji(R.drawable.kiss, "Kiss"))
.addEmoji(new Emoji(R.drawable.sad, "Sad"))
.addEmoji(new Emoji(R.drawable.t, ":P"))
.setEmojiViewInAnimation((AnimationSet)AnimationUtils.loadAnimation(this, R.anim.in_animation))
.setEmojiViewOutAnimation((AnimationSet) AnimationUtils.loadAnimation(this, R.anim.out_animation))
.setBackgroundImage(R.drawable.background_drawable)
.setOnEmojiSelectedListener(new OnEmojiSelectedListener() {
@Override
publicvoidonEmojiSelected(Emoji emoji) {
Toast.makeText(getContext(), "Selected " + emoji.getDescription(), Toast.LENGTH_SHORT).show();
}
})
.setup();
For more info look at the source code of sample project.

Google Hangout new Avatar after ovetake Slack

$
0
0
If you know something regarding Google’s messaging strategy within the previous few years, you recognize that it’s been a little of a mess. Allo, the consumer app, launched without the cross-platform options users expect. Text messaging on mobile is involved in inter-carrier warfare. And Hangouts has become a punchline.

Google Hangout new Avatar after ovetake Slack

But currently there are a few of recent wrinkles within the Hangouts story. Google is splitting Hangouts into two: Hangouts Chat, that is clearly gunning for Slack, and Hangouts Meet, that is all concerning video and audio communications. Those two are primarily the enterprise counterparts to Allo and duo.

PhotoScan - A new Google Photo feature

Meet is currently typically available. Hangout Chat goes into Google’s early access program.

 Hangout Chat

A amazingly rich FEATURE SET AT LAUNCH

Hangouts Chat can still provide direct one-on-one chats, and it'll additionally still work natively on the web, Android, and iOS. However the new group chat rooms — that also provide threaded messages — are maybe the biggest move the app has made since its launch in 2013.

Why Google Pixel replace Nexus and iPhone 7

A amazingly rich FEATURE SET AT LAUNCH

GOOGLE DOCS INTEGRATION IS HANGOUTS’ MAIN DIFFERENTIATOR

The core features of Hangouts Chat play on Google’s strengths. It’s deeply integrated into Google Docs and Sheets — and may assign document permissions automatically supported the team that created them. As you would possibly expect, Google is also touting the search options inside the app. It'll allow you to filter by rooms, people, file types, or maybe links that were dropped within the room.

GOOGLE DOCS INTEGRATION IS HANGOUTS’ MAIN DIFFERENTIATOR

BETTER VIDEO CHAT

Speaking of conferences, Hangouts Chat can integrate with a big upgrade to the Hangouts video chat service, currently dubbed “Hangouts Meet.” (Yes, the naming is confusing and dumb.) Google says that the new video chat are going to be a lot of less likely to spike your processor or grind your pc to a halt.

BETTER VIDEO CHAT


The lighter-weight version of the app apparently means up to thirty participants will be a part of. There's no need to install a plugin on Chrome or Firefox, although each Microsoft Edge and Apple’s safari can still require one until they recreate and support the web RTC standard.

Add FoldingTab Bar and Menu in Android

$
0
0
In current market, Mobile app is on hike and the major success of app is their UI design, no matter it is Android or iOS application. In my previous article i share some cool UI design with their code implementation and today also i share a cool code of UI for Tab bar and menu is called FoldingTab bar and Folding menu in Android. But before going ahead you should know about Common 10 Mistakes by Android Developer which we cover in previous article.
You should also friendly with Bad features of Java. Now we dive with this cool library but firstly know about what is it ?
A sort of UI revolution in android development is going on recently. ready for it?
Google finally added a bottom tab bar as a suggested style pattern for android development!

Add FoldingTab Bar and Menu in Android

Obviously, there aren't any tab bar components by Google within the support libraries yet. Therefore we decided that it’s time to bring our legendary FoldingTabBar to android – before 2017 arrives.

FoldingTabBar to android

How to use this FoldingTabBar library

Requirements

Android SDK 19+

Usage

Add to your root build.gradle:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}

Add the dependency:

dependencies {
compile 'com.github.Yalantis:OfficialFoldingTabBar.Android:v0.9'
}
It’s very simple. On Android we have the @menu resource type. We can think of FoldingTabBar as a menu. Let’s create our menu file:
<?xml version="1.0" encoding="utf-8"?>
<menuxmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/ftb_menu_nearby"
android:icon="@drawable/ic_nearby_icon"
android:title="Nearby"/>

<item
android:id="@+id/ftb_menu_new_chat"
android:icon="@drawable/ic_new_chat_icon"
android:title="Chat"/>

<item
android:id="@+id/ftb_menu_profile"
android:icon="@drawable/ic_profile_icon"
android:title="Profile"/>

<item
android:id="@+id/ftb_menu_settings"
android:icon="@drawable/ic_settings_icon"
android:title="Settings"/>

</menu>
Looks good. This is the menu that you’re using for dialogs, toolbar menus, or the navigation drawer.

You can add this also : PanoramaImageView in Android

The coolest thing is that you can easily switch from the navigation drawer to our FoldingTabBar. Or you can use both menus simultaneously on the same screen.

 Here’s an example of how you can implement this FoldingTabBar into your layout file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/activity_main"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
tools:context="client.yalantis.com.foldingtabbarandroid.MainActivity">

<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>

<client.yalantis.com.foldingtabbar.FoldingTabBar
android:id="@+id/folding_tab_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_centerInParent="true"
android:layout_alignParentBottom="true"
app:menu="@menu/menu_tab_bar"/>
</RelativeLayout>
As you can see, we have some custom attributes. The main and required attribute is app:menu – here you can link your menu file to our component.
There are also some additional attributes:

  • app:itemPadding - sets padding for your menu items. Default item padding is 17dp.
  • app:mainImage - here you can link your image resource for the main image.
  • app:selectionColor - our menu supports color selection. You can change the menu’s color here.

This menu is flexible, so you can use wrap_content or hard-coded sizes. When you’re using wrap_content, the size will equal 70dp.

How to use our FoldingTabBar in Java code

Here we have two interfaces. The first works when your menu item is pressed:
tabBar.setOnFoldingItemClickListener(new FoldingTabBar.OnFoldingItemSelectedListener() {
@Override
publicbooleanonFoldingItemSelected(@NotNull MenuItem item) {
switch (item.getItemId()) {
case R.id.ftb_menu_nearby:
mViewPager.setCurrentItem(0);
break;
case R.id.ftb_menu_new_chat:
mViewPager.setCurrentItem(1);
break;
case R.id.ftb_menu_profile:
mViewPager.setCurrentItem(2);
break;
case R.id.ftb_menu_settings:
mViewPager.setCurrentItem(3);
break;
}
returnfalse;
}
});
The second works when a user presses the home button:
tabBar.setOnMainButtonClickListener(new FoldingTabBar.OnMainButtonClickedListener() {
@Override
publicvoidonMainButtonClicked() {

}
});
We created two interfaces instead of one because this corresponds with the Interface Segregation principle (from SOLID).

Technology stack

We chose Kotlin as the language for our library. We already have a few components in Kotlin; we love Kotlin because it’s a powerful language that makes it much more fun to develop apps than Java does.

Collections

Here we’re using some functional “magic” of Kotlin collections:
mData = mMenu.visibleItems.map {
initAndAddMenuItem(it)
}
Also, note that we’ve used forEach instead of for loops.

Null Safety

This fantastic feature of Kotlin is used everywhere across our library (where needed, of course). Now our code is much cleaner and more understandable.
Lambda functions
We’ve only had this feature in Java since version 8. But Java 8 is not yet ready for Android. In Kotlin we have this feature by default.
rotationAnimator.addUpdateListener {
valueAnimator ->
val value = valueAnimator.animatedValue as Float
mainImageView.rotation = value
}
Really beautiful, isn’t it?

Apply function

The apply function defines an extension function for all types. When you invoke the apply function, it calls the closure passed as a parameter and then returns the receiver object that the closure ran on. This is an amazing feature!
val scalingAnimator = ValueAnimator.ofInt(mSize, destWidth).apply {
addUpdateListener(scaleAnimator)
addListener(rollUpListener)
}

Animations

We’re using different ValueAnimators and, of course, AnimationSets for playing our animators together. Obviously, we made our own interpolator:
internal classCustomBounceInterpolator(val amplitude: Double = 0.1,
val frequency: Double = 0.8) : Interpolator {

override fun getInterpolation(time: Float): Float {
return (-1.0 * Math.exp(-time / amplitude) *
Math.cos(frequency * time) + 1).toFloat()
}
}
That’s all about the technologies. If you've have any problem then you can download this library with demo.

Candle Powered USB Charger Lamp

$
0
0
Here’s a tutorial that would teach you how to harvest the heat of candles to charge USB devices and at the same time use it as a candle lamp!

Add Material Intro Screen in Android

$
0
0
Whenever we start to creating a Android app we need to focus on their layout and try to make user friendly apps. In my previous article i gave you some cool animation effect which you can use in your any applications. I listed some hand picked animation libraries below :


But whenever user firstly come to your app then first thing is intro screen which is also important for app success point of view and in today tutorial you can get how to add material intro screen in your android applications.



For Material Icon library you can check this tutorial. And if you want full Material UI XML template then check this.
Now we dive in tutorial of Intro Screen with material for Android.

Features

  • Easily add new slides
  • Custom slides
  • Parallax slides
  • Easy extensible api
  • Android TV support!
  • Material design at it's best!!!
We cover four different type of intro slide

Step 1:

Add gradle dependecy
dependencies {
compile 'agency.tango.android:material-intro-screen:{latest_release}'
}

Step 2:

First, your intro activity class needs to extend MaterialIntroActivity:
publicclassIntroActivityextends MaterialIntroActivity

Step 3:

Add activity to manifest with defined theme:
<activity
android:name=".IntroActivity"
android:theme="@style/Theme.Intro"/>

Step 4:

Add slides:
@Override
protectedvoidonCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

addSlide(new SlideFragmentBuilder()
.backgroundColor(R.color.colorPrimary)
.buttonsColor(R.color.colorAccent)
.possiblePermissions(new String[]{Manifest.permission.CALL_PHONE, Manifest.permission.READ_SMS})
.neededPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION})
.image(agency.tango.materialintroscreen.R.drawable.ic_next)
.title("title 3")
.description("Description 3")
.build(),
newMessageButtonBehaviour(new View.OnClickListener() {
@Override
publicvoidonClick(View v) {
showMessage("We provide solutions to make you love your work");
}
}, "Work with love"));
}

Explanation of SlideFragment usage:


  • possiblePermissions ⇾ permissions which are not necessary to be granted
  • neededPersmissions ⇾ permission which are needed to be granted to move further from that slide
  • MessageButtonBehaviour ⇾ create a new instance only if you want to have a custom action or text on a message button

Step 5:

Customize Intro Activity:

  • setSkipButtonVisible() ⇾ show skip button instead of back button on the left bottom of screen
  • hideBackButton() ⇾ hides any button on the left bottom of screen
  • enableLastSlideAlphaExitTransition() ⇾ set if the last slide should disapear with alpha hiding effect

Customizing view animations:
You can set enter, default and exit translation for every view in intro activity. To achive this you need to get translation wrapper for chosen view (for example: getNextButtonTranslationWrapper()) and set there new class which will implement IViewTranslation
getBackButtonTranslationWrapper()
.setEnterTranslation(new IViewTranslation() {
@Override
publicvoidtranslate(View view, @FloatRange(from = 0, to = 1.0) float percentage) {
view.setAlpha(percentage);
}
});
Available translation wrappers:

  • getNextButtonTranslationWrapper()
  • getBackButtonTranslationWrapper()
  • getPageIndicatorTranslationWrapper()
  • getViewPagerTranslationWrapper()
  • getSkipButtonTranslationWrapper()

Custom slides

Of course you are able to implement completely custom slides. You only need to extend SlideFragment and override following functions:

  • backgroundColor()
  • buttonsColor()
  • canMoveFurther() (only if you want to stop user from being able to move further before he will do some action)
  • cantMoveFurtherErrorMessage() (as above)

If you want to use parallax in a fragment please use one of the below views:
ParallaxFrameLayout
ParallaxLinearLayout
ParallaxRelativeLayout
And set there the app:layout_parallaxFactor attribute:
<agency.tango.materialintroscreen.parallax.ParallaxLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android">

<ImageView
android:id="@+id/image_slide"
app:layout_parallaxFactor="0.6"/>
That's it. Hope you like this tutorial and download this demo with full source code here.

LoopBar Infinite Scrolling for Android

$
0
0
Navigation part is also a important role for user point of view and now a days navigation panel is pretty boring and trivial. Thats why i introduce you our new component named LoopBar in which idea was to make the navigation menu right at fingerprints, in a tab bar. What's more the view has a few specific features that make it stand out from the crowd of similar ones. So, try out the LoopBar library in your app and you’ll see the difference.


Previous article : Add Material Intro Screen in Android
Customers comfort should be priority that is why they provided the ability to place the bar either horizontally or vertically. Thus, it is possible to not only customize the application look but also choose the most efficient user experience.
Cool library : Use Facebook emoji like button in Android


Installation

by gradle :
dependencies {
compile "com.cleveroad:loopbar:1.1.3"
}
or just download source code given below and import module "LoopBar-widget" to be able to modify the sources

Features

View consist from two parts:
  • A list of your selectable groups
  • Selected view
View can work in three scroll modes: infinite, finite and auto mode. Names of first two speak for itself. In auto mode the list of groups will be infinite if all adapter items didn't fit on screen in other case it will be a static list. Selected view by request could overlay layout on screen on which it placed. Widget has horizontal and vertical layouts and also start or end gravity of selected view.
Compile Android app fast : JRebel for Android



You are allowed to use any RecyclerView adapter, which you want. Concrete infinite scroll logic is fully encapsulated.
Android Studio layouts preview is supported.

Usage


   <com.cleveroad.loopbar.widget.LoopBarView

android:id="@+id/endlessView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:enls_placeholderId="@id/placeHolder"
app:enls_orientation="horizontal"
app:enls_selectionGravity="start"
app:enls_selectionMargin="10dp"
app:enls_overlaySize="5dp"
app:enls_selectionInAnimation="@animator/enls_scale_restore"
app:enls_selectionOutAnimation="@animator/enls_scale_small"
app:enls_selectionBackground="@android:color/holo_blue_dark"
app:enls_menu="@menu/loopbar"
app:enls_scrollMode="auto"
/>
enls_overlaySize& enls_placeholderId are used for overlay feature. Placeholder must be the view lying under the LoopBar. And it's used for setting bounds In layout when selected view has overlay. LoopBar will set width or height for this view by itself (depending of LoopBar orientation), it will be the same as LoopBar has.
Without this placeholder the bounds of LoopBar will be limited by selected view (with overlay). And thanks to placeholder the bounds will be limited only by list of groups. You can see an example of overlay usage in sample.
attribute namedescription
enls_overlaySizea size of selected view overlaying
enls_placeholderIdan id of view on which you should use layout:above or other attributes of RelativeLayouts, because LoopBarView will have increased height in this case. See more in sample
enls_selectionGravitya gravity of selection view. Can be vertical or horizontal. Default horizontal
enls_selectionMargina margin of selectionView from bounds of view. Default 5dp
enls_selectionInAnimationan animation of appearing an icon inside selection view
enls_selectionOutAnimationan animation of hiding an icon inside selection view
enls_selectionBackgroundselection background. Default #ff0099cc
enls_menuan id of menu which will be used for getting title and icon items
enls_scrollModeScrolling mode. Can be infinitefiniteauto. Default infinite
android:backgroundView have yellow background by default. Use standart android:background attribute to change it. Default #ffc829
To initialize items in widget and work with it you should setup adapter to it and add item click mListener:
LoopBarView loopBarView = findViewById(...);
categoriesAdapter = new SimpleCategoriesAdapter(MockedItemsFactory.getCategoryItems(getContext()));
loopBarView.setCategoriesAdapter(categoriesAdapter);
loopBarView.addOnItemClickListener(this);
Here SimpleCategoriesAdapter is used which required collection of ICategoryItem objects (to draw default view with icon and text).
Also you can setup adapter through:

Menu 

Java code (see example MenuLoopBarFragment):


       loopBarView.setCategoriesAdapterFromMenu(R.menu.loopbar);

//or
Menu menu = ...;
loopBarView.setCategoriesAdapterFromMenu(menu);

or via XML:


        <com.cleveroad.loopbar.widget.LoopBarView

...
app:enls_menu="@menu/loopbar"
/>

ViewPager

Just set a viewPager into your LoopBar. If you want to show category icons, your ViewPager adapter must implement ILoopBarPagerAdapter interface (see example ViewPagerLoopBarFragment), otherwise the icons will not be shown:

    loopBarView.setupWithViewPager(viewPager);

To customize wrapped RecyclerView (control animations, decorators or add RecyclerView.OnScrollListener) you are able to use following methods:
method namedescription
setItemAnimator(RecyclerView.ItemAnimator animator)Sets the ItemAnimator to wrapped RecyclerView
isAnimating()Returns true if wrapped RecyclerView is currently running some animations
addItemDecoration(RecyclerView.ItemDecoration decor)Add an ItemDecoration to wrapped RecyclerView
addItemDecoration(RecyclerView.ItemDecoration decor, int index)Add an ItemDecoration to wrapped RecyclerView
removeItemDecoration(RecyclerView.ItemDecoration decor)Remove an ItemDecoration from wrapped RecyclerView
invalidateItemDecorations()Invalidates all ItemDecorations in wrapped RecyclerView
addOnScrollListener(RecyclerView.OnScrollListener listener)Add a OnScrollListener to wrapped RecyclerView
removeOnScrollListener(RecyclerView.OnScrollListener listener)Remove a OnScrollListener from wrapped RecyclerView
clearOnScrollListeners()Remove all secondary OnScrollListener from wrapped RecyclerView

Hope you like this post and library and want to download this click here.

Android O features and API you should know - Tell Me How

$
0
0
Android O features and API you should know - Tell Me How:



After launching of Android O many developers and geekier want to know about their features. So do I introduces a variety of latest features and capabilities for users and developers.



Android O features and APIs you should need to know







This document highlights what is new for developers. you can check first developer preview here   Lets discuss with features and API of Android O …

Super Mario Run available on Google Play Store - Tell Me How

ViewPager cards animation like Duolingo - Tell Me How - A Place for Technology Geekier

Top 5 IoT Hacks

$
0
0

In this article you can get top 5 IoT hack which can ease and safe your life. The Internet of Things (IoT) automates your lives by connecting everything around you from your cars to your homes to even your bodies.

On the other side of the spectrum is the concern for the safety and security of your data. All data is interconnected, which reduces the efforts needed by hackers to hack the entire system. A large number of Internet-connected devices lack even the most basic cyber security protocols, making these hackable in minutes. And even though most secure and trusted machines give hackers a tough time, one tiny loophole is sufficient for them to steal your data.

You are on the driving seat, but it is not you who is driving

Hack iot car

Charlie Miller and Chris Valasek, automotive cyber security researchers, have proved that hacking Jeeps is child’s play for them, especially because all carmakers are doing their best to turn an automobile into a smartphone. Uconnect, an Internet-connected computer feature in hundreds of thousands of Fiat Chrysler cars, sport utility vehicles (SUVs) and trucks, controls the vehicles’ entertainment and navigation, enables phone calls and offers Wi-Fi hot spots. Uconnect’s mobile connection lets anyone who knows the car’s Internet Protocol (IP) address gain access from anywhere in the world. In 2015, the duo attacked a Jeep over the Internet, from a distance of around 15 kilometres. They toyed with the air-conditioning, radio and windshield wipers, disabled brakes at low speeds and managed to paralyse the vehicle. This made Chrysler announce for a recall of 1.4 million vehicles and fix the vulnerabilities. But now these researchers have come out with better hacking tricks.

Adventures of Barnaby Jack

Barnaby Jack, a hacker programmer and computer security expert, has managed to hack multiple devices including automatic teller machines (ATMs), pacemakers, ear implants and insulin pumps. At Black Hat conference in 2010, he gave a presentation on jackpotting, or exploiting ATMs to make these dispense cash without using a bank’s debit or credit card. Jack gave demonstrations about different kinds of attacks involving physical access to the machines and completely automated remote attacks. In both cases, malware was injected into the operating system of the machines, causing these to fraudulently dispense currency on the attacker’s command. During the remote attack, malware was installed on the target system via exploited vulnerabilities in the remote management system, most notably the use of default passwords and remote management transmission control protocol (TCP) ports. The attacker then executed the malware, causing the target ATM to dispense a given amount of currency. Jack has also developed software that allows him to remotely send an electric shock to anyone wearing a pacemaker within a 15 metres radius.

World’s first digital weapon

Stuxnet, a highly sophisticated computer worm was discovered in 2010 and was essentially termed the world’s first digital weapon. It was developed by American and Israeli governments, and was used to wreak havoc on an Iranian nuclear facility called Natanz. It targets industrial control systems that are used to monitor and control large-scale industrial facilities like power plants, dams, waste-processing systems and similar operations. It allows attackers to take control of these systems without the operators knowing. Attack using Stuxnet was the first one that allowed hackers to manipulate real-world equipment, thereby making it very dangerous. It was the first computer virus to be able to wreak havoc in the physical world.

A kindle of devices attacked at once

A massive Distributed Denial of Service (DDoS) attack against Dyn, a major domain name system (DNS) provider, broke large portions of the Internet in October 2016, causing significant outage to a ton of websites and services, including Twitter, GitHub, PayPal, Amazon, Reddit, Netflix and Spotify. According to security intelligence firm Flashpoint, Mirai bots were detected driving much, but not necessarily all, of the traffic in the DDoS attacks against DynDNS. Mirai is a piece of malware that targets IoT devices such as routers, security cameras and DVRs, and enslaves vast numbers of these compromised devices into a botnet, which is then used to conduct DDoS attacks. Since the source code of Mirai botnet has already been made available to the public, anyone can wield these attacks against targets.

Not-so-smart refrigerator

White-hat hackers, or ethical computer hackers, at Pen-Test Partners were able to use fake security credentials to intercept communications between the fridge and Google Calendar. Besides the fridge, the hackers also found 25 vulnerabilities in 14 allegedly smartdevices including scales, coffee makers, wireless cameras, locks, home automation hubs and fingerprint readers. The hack was pulled off against RF28HMELBSR smartfridge, part of Samsung’s line-up of Smart Home appliances that can be controlled via their Smart Home app. While the fridge implements SSL, it fails to validate SSL certificates; thereby, enabling man-in-the-middle attacks against most connections.

[td_smart_list_end]

To sum it, the threats are real and our data is prone to attacks. Therefore while using IoT devices make sure that security is built on the foundation of the system and validity checks, authentication, data verification and encryption is carried out frequently.

Hope you enjoy this information please speak with us via comments.

The post Top 5 IoT Hacks appeared first on Tell Me How - A Place for Technology Geekier.

Cool Cards Menu Android Library

$
0
0

Cool cards menu Android library is a really cool as name define itself. It concept about multi tasks switching such like that, it’s thought-provoking and entertaining too.

You can see the demo here :

Working demo of Cool Cards Menu Android Library:

You can fun with code : BlurImageView For Android

I published the library with Jitpack, so add it to your build.gradle with:


repositories {
...
maven { url "https://jitpack.io" }
}

 Add the dependency:


dependencies {
compile 'com.github.DxTT:coolMenu:v1.1'
}

Note:

If you got the problem in adding external library in Android Studio.

The usage is really like ViewPager, just add CoolMenuFrameLayout to your layout.

An example of basic usage in layout.xml:


<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://ift.tt/nIICcg"
xmlns:app="http://ift.tt/GEGVYd"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.foocoder.coolmenu.MainActivity"
tools:ignore="all"
tools:showIn="@layout/activity_main">

<com.dxtt.coolmenu.CoolMenuFrameLayout
android:id="@+id/rl_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
app:num="four"/>
</merge>

This statement declares the number of cards, The upper limit is five.


app:num="four"

You can set your title icon or title style in xml like this:


app:titleSize="@dimen/cl_title_size"
app:titleColor="@color/colorPrimary"
app:titleIcon="@drawable/menu"

Like ViewPager,set an Adapter for the CoolMenuFrameLayout view.


coolMenuFrameLayout = $(R.id.rl_main);
String[] titles = {"CONTACT", "ABOUT", "TEAM", "PROJECTS"};
titleList = Arrays.asList(titles);
//set your titles,which is optional
coolMenuFrameLayout.setTitles(titleList);
//set your menu icon
coolMenuFrameLayout.setMenuIcon(R.drawable.menu2);

fragments.add(new Fragment1());
fragments.add(new Fragment2());
fragments.add(new Fragment3());
fragments.add(new Fragment4());

FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}

@Override
public int getCount() {
return fragments.size();
}
};
coolMenuFrameLayout.setAdapter(adapter);

Download this library from here. Hope you like this library tutorial isn’t it. Please comment below for appreciation.

The post Cool Cards Menu Android Library appeared first on Tell Me How - A Place for Technology Geekier.

Viewing all 322 articles
Browse latest View live