dependencies {
// other existing code
implementation 'com.github.isaiahnoelsalazar:SimpleFunctions:[latest release version]'
}Note: Remove the brackets for version
dependencyResolutionManagement {
// other existing code
repositories {
// other existing code
maven { url 'https://jitpack.io' }
}
}- will check a String for a number
- returns a boolean value
Check.hasNumbers("Sample text"); // returns false
Check.hasNumbers("Sample text 1"); // returns true- will check a String for a symbol
- returns a boolean value
Check.hasSymbols("Sample text"); // returns false
Check.hasSymbols("Sample text!"); // returns true- will check a String for a space
- returns a boolean value
Check.hasSpaces("Sample_text"); // returns false
Check.hasSpaces("Sample text"); // returns true- will compare two Date objects to see how many seconds are left
- returns a double value representing the number of seconds
Date now = new Date("2025/01/01");
Date until = new Date("2025/01/02");
Check.howManySecondsLeft(now, until); // returns 86400.0- will compare two Date objects to see how many minutes are left
- returns a double value representing the number of minutes
Date now = new Date("2025/01/01");
Date until = new Date("2025/01/02");
Check.howManyMinutesLeft(now, until); // returns 1440.0- will compare two Date objects to see how many hours are left
- returns a double value representing the number of hours
Date now = new Date("2025/01/01");
Date until = new Date("2025/01/02");
Check.howManyHoursLeft(now, until); // returns 24.0- will compare two Date objects to see how many days are left
- returns a double value representing the number of days
Date now = new Date("2025/01/01");
Date until = new Date("2025/01/02");
Check.howManyDaysLeft(now, until); // returns 1.0- adds a valid domain name to the list of valid domain names
Check.Email.addValidDomainName("gmail");- adds a valid domain extension to the list of valid domain extensions
Check.Email.addValidDomainExtension("com");- adds a valid domain to the list of valid domains
Check.Email.addValidDomain("gmail.com");- sets the checker to use full domains or not
Check.Email.shouldUseFullDomain();
// Or
Check.Email.shouldUseFullDomain(true);
// Or
Check.Email.shouldUseFullDomain(false);- checks a String if it is a valid email or not
- will return false if the email domain is not listed in the valid domains
Check.Email.isValid("test@gmail.com"); // returns true
Check.Email.isValid("test@outlook.com"); // returns false
Check.Email.isValid("test@asd.com"); // returns false- will capitalize the first character of a given String
- returns a String
Convert.toRealName("sample text"); // returns "Sample text"- will convert a String to its Base64 version
- returns a String
Convert.toBase64("Sample text"); // returns "U2FtcGxlIHRleHQ="- will convert a Base64 String to its normal version
- returns a String
Convert.fromBase64("U2FtcGxlIHRleHQ="); // returns "Sample text"- will convert a Date object to a String in the format of "DD/MM/YY"
- returns a String
Date now = new Date("2025/01/02");
Convert.dateToDDMMYY(now); // returns "2/1/2025"- will convert a Date object to a String in the format of "MM/DD/YY"
- returns a String
Date now = new Date("2025/01/02");
Convert.dateToMMDDYY(now); // returns "1/2/2025"- will convert a Date object to a String in the format of "YY/MM/DD"
- returns a String
Date now = new Date("2025/01/02");
Convert.dateToYYMMDD(now); // returns "2025/1/2"EasySQL easySQL = new EasySQL(this);- creates a table inside a given database
easySQL.createTable("sampleDB", "sampleTABLE", new String[]{"name:text", "age:int"});- clears a table inside a given database
easySQL.clearTable("sampleDB", "sampleTABLE");- checks if a table inside a given database exists
- returns a boolean value
easySQL.doesTableExist("sampleDB", "sampleTABLE");- inserts a value into a table inside a given database
easySQL.insertToTable("sampleDB", "sampleTABLE", new String[]{"name:Sample", "age:20"});- returns a List of all values of each column in a table inside a given database
for (String value : easySQL.getTableValues("sampleDB", "sampleTABLE")){
System.out.println(value);
}
/*
returns:
- name:'Sample'
- age:20
*/- returns a List<String[]> of all rows in a table inside a given database
for (String[] value : easySQL.getTableValuesAsArray("sampleDB", "sampleTABLE")){
System.out.println(java.util.Arrays.toString(value));
}
/*
returns:
- [name:'Sample', age:20]
*/- deletes a value from a table inside a given database using a "column:value" pair String
easySQL.deleteFromTable("sampleDB", "sampleTABLE", "name:Sample");- deletes a table inside a given database
easySQL.deleteTable("sampleDB", "sampleTABLE");<com.github.isaiahnoelsalazar.SimpleFunctions.FlippableImageView
android:id="@+id/sample_flippable_image_view"
android:layout_width="100dp"
android:layout_height="100dp" />or
<com.github.isaiahnoelsalazar.SimpleFunctions.FlippableImageView
android:id="@+id/sample_flippable_image_view"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/sample_image" />or
<com.github.isaiahnoelsalazar.SimpleFunctions.FlippableImageView
android:id="@+id/sample_flippable_image_view"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/sample_image" />FlippableImageView flippableImageView = findViewById(R.id.sample_flippable_image_view);- set the front image of the flippable image view
flippableImageView.setFrontImage(R.drawable.piece);- set the back image of the flippable image view
flippableImageView.setBackImage(R.drawable.piece);- reverses back image of the flippable image view
flippableImageView.setReverseBackImage(true);- flips the flippable image view
flippableImageView.flip();- instantly flips the flippable image view
flippableImageView.instantFlip();- will enable fullscreen viewing on an activity
Fullscreen.enable(this);- will disable fullscreen viewing on an activity
Fullscreen.disable(this);RoundedAlertDialog roundedAlertDialog = new RoundedAlertDialog(this);- set a title for the dialog
roundedAlertDialog.setTitle("Sample title");- setup the left button for the dialog with a specified text and color
roundedAlertDialog.setupLeftButton("Left button");
// Or
roundedAlertDialog.setupLeftButton("Left button", Color.RED);- setup the right button for the dialog with a specified text and color
roundedAlertDialog.setupRightButton("Right button");
// Or
roundedAlertDialog.setupRightButton("Right button", Color.RED);- setup the OnClick function for the dialog's left button
roundedAlertDialog.setupLeftButtonOnClick(new View.OnClickListener() {
@Override
public void onClick(View v) {
// do something
}
});- setup the OnClick function for the dialog's right button
roundedAlertDialog.setupRightButtonOnClick(new View.OnClickListener() {
@Override
public void onClick(View v) {
// do something
}
});<com.github.isaiahnoelsalazar.SimpleFunctions.SimpleList
android:id="@+id/simple_list_id"
android:layout_width="match_parent"
android:layout_height="wrap_content" />SimpleList simpleList = findViewById(R.id.simple_list_id);- add a String to the list
simpleList.addItem("Sample text 1");- remove a String from the list using its position
simpleList.removeItem(0);- set the OnItemClickListener for the list
simpleList.setOnItemClickListener(new SimpleList.OnItemClickListener() {
@Override
public void onItemClick(int position) {
// do something
}
});- set the OnItemLongClickListener for the list
simpleList.setOnItemLongClickListener(new SimpleList.OnItemLongClickListener() {
@Override
public void onItemLongClick(int position) {
// do something
}
});- set the padding for each item in the list
simpleList.setPadding(16);- set individual padding for each item in the list
simpleList.setPadding(24, 16, 8, 12); // left, top, right, bottom