This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun emptyTextBox(context: Context, txt: EditText, toggleFlag: Boolean = true): Boolean | |
fun emptyTextView(context: Context, txt: TextView, toggleFlag: Boolean = true): Boolean | |
fun emptyCustomTextBox(context: Context, txt: TextView, msg: String, toggleFlag: Boolean = true): Boolean | |
fun emptyEditTextPicker(context: Context, txt: EditText, toggleFlag: Boolean = true): Boolean | |
fun rangeTextBox(context: Context, txt: EditText, min: Int, max: Int, type: String, toggleFlag: Boolean = true): Boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun clearCheckBoxes(container: ViewGroup, flag: Boolean? = null) | |
fun clearRadioGroup(view: RadioGroup, flag: Boolean? = null) | |
fun clearAllFields(view: View, flag: Boolean? = null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Empty edittext checking | |
if (txtbox1.getText().toString().isEmpty()) { | |
txtbox1.setError("This data is Required!"); | |
return false; | |
} else { | |
txtbox1.setError(null); | |
} | |
//Equal/Pattern edittext checking | |
if (!txtBoxDefault.isTextEqualToPattern()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Clearing edittext | |
txtbox1.setText(null); | |
txtbox1.clearFocus(); | |
txtbox1.setError(null); | |
//Clearing Radiogroup | |
mnc2.clearCheck() | |
mnc2.clearFocus(); | |
mnc2.setError(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//fldGrpSecA01: is the view group in which whole layout is defined in xml | |
Clear.clearAllFields(fldGrpSecA01); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//fldGrpSecA01: is the view group in which whole layout is defined in xml | |
Validator.emptyCheckingContainer(this, fldGrpSecA01); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
╔══════════╦═════════════════╦═══════════════╦═══════════════╗ | |
║ Function ║ Receiver (this) ║ Argument (it) ║ Result ║ | |
╠══════════╬═════════════════╬═══════════════╬═══════════════╣ | |
║ let ║ this@MyClass ║ String("...") ║ Int(42) ║ | |
║ run ║ String("...") ║ N\A ║ Int(42) ║ | |
║ run* ║ this@MyClass ║ N\A ║ Int(42) ║ | |
║ with* ║ String("...") ║ N\A ║ Int(42) ║ | |
║ apply ║ String("...") ║ N\A ║ String("...") ║ | |
║ also ║ this@MyClass ║ String("...") ║ String("...") ║ | |
╚══════════╩═════════════════╩═══════════════╩═══════════════╝ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocationService extends Service { | |
public static final String BROADCAST_ACTION = "GettingLoc"; | |
private static final int TWO_MINUTES = 1000 * 60 * 2; | |
private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in Meters | |
private static final long MINIMUM_TIME_BETWEEN_UPDATES = 2000; // in Milliseconds | |
public LocationManager locationManager; | |
public GPSLocationListener listener; | |
public Location previousBestLocation = null; | |
Intent intent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocalBroadcastReceiver extends BroadcastReceiver { | |
@Override public void onReceive(Context context, Intent intent) { | |
Log.d("LocalBroadcastReceiver", "onReceive()"); | |
// Tell the result receiver to CANCEL some specific action. | |
// eg. do not display System Notification | |
setResultCode(Activity.RESULT_CANCELED); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
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" | |
tools:context=".MainActivity"> | |
<fragment |