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;
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.mrkali:VarelaAndroidTools:0.6'
}
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);
}
If you want to use your own color in status bar, you should use the follow code
appearance.changeColorOfStatusBar(R.color.myCustomColor);
This class is used to handle events related to network
private Network network;
@Override
protected void onCreate(){
network = new Network(this);
}
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();
}
In order to keep the organization of the code, there is some methods to do it
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();
}
});
}
}
- Add listener to network changes
- Add implementation to Room Database
- Camera utils
- Volley request utils
MIT
Free Software, Hell Yeah!