Coder Social home page Coder Social logo

varelaandroidtools's Introduction

VarelaAndroidTools

VarelaAndroidTools is an android library developed to speed up the process of android apps creation. The library include a lot of features to keep your code clean and avoid loose time searching for some features. The aim of VarelaAndroidTools are:

  • Simplify the code;
  • Avoid write a class in each project you always use;
  • Guarantee the organization of code using a specific structure;

Installation

Add the JitPack repository to your build file:

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

Add dependency:

dependencies {
    implementation 'com.github.mrkali:VarelaAndroidTools:0.6'
}

Documentation

Appeareance

This class contatins a lot of functions to change the appearance of your app. You should start by create an instance of it:

private Appearance appearance;

@Override
protected void onCreate(){
  appearance = new Appearance(this);
}

Change color of status bar

If you want to use your own color in status bar, you should use the follow code

appearance.changeColorOfStatusBar(R.color.myCustomColor);

Network

This class is used to handle events related to network

private Network network;

@Override
protected void onCreate(){
  network = new Network(this);
}

Check network connection

To check the network connection in that exactly moment, you can use the follow functions, which return a boolean:

if (network.isConnectedToNetwork()){
  // returned true, is connected
  Toast.makeText(context, "Is connected to network", Toast.LENGTH_SHORT).show();
}else{
  // returned false, isn't connected
  Toast.makeText(context, "Isn't connected to network", Toast.LENGTH_SHORT).show();
}

Code sctructure

In order to keep the organization of the code, there is some methods to do it

Basic functions

Always when is created a new activity or fragment, there are some methods that are always required. So i can easily override and create this methods implementing the BasicFunctions:

public class LoginActivity extends AppCompatActivity implements BasicFunctions {
    
    private Button loginButton
    private ArrayList<String> arrayListNames;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

	// call the methods
        findVisualElements();
        startPublicVariables();
        onClickListener();
    }

    @Override
    public void findVisualElements() {
	// find the elements of layout by id
	loginButton = findViewById(R.id.login_button);
	
    }

    @Override
    public void startPublicVariables() {
    	// start all public variables
        arrayListNames = new ArrayList();
    }

    @Override
    public void onClickListener() {
	// handle the click of buttons
        buttonLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                login();
            }
        });
    }
}

Todos

  • Add listener to network changes
  • Add implementation to Room Database
  • Camera utils
  • Volley request utils

License

MIT

Free Software, Hell Yeah!

varelaandroidtools's People

Contributors

mrkali avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.