This file contains hidden or 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 void showEnterDialog() { | |
final Dialog dialog = new Dialog(requireContext()); | |
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); | |
dialog.setCancelable(false); | |
dialog.setContentView(R.layout.dialog); | |
EditText mMacEdit = dialog.findViewById(R.id.campo); |
This file contains hidden or 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 Reversed<T> implements Iterable<T> { | |
private final List<T> original; | |
public Reversed(List<T> original) { | |
this.original = original; | |
} | |
@NonNull | |
public Iterator<T> iterator() { | |
final ListIterator<T> i = original.listIterator(original.size()); |
This file contains hidden or 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
private static void hideKeyBoardMethod(final Context context, final View view) { | |
try { | |
view.post( () -> { | |
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); | |
assert imm != null; | |
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); | |
} ); | |
} catch (Exception e) { | |
e.printStackTrace(); |
This file contains hidden or 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
private float[] scale() { | |
float[] scaledValues = new float[this.datapoints.length]; | |
float total = getTotal(); // Total all values supplied to the chart | |
for (int i = 0; i < this.datapoints.length; i++) { | |
scaledValues[i] = (this.datapoints[i] / total) * 360; // Scale each value | |
} | |
return scaledValues; | |
} |
This file contains hidden or 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
private String getDate(long time) { | |
Calendar cal = Calendar.getInstance(Locale.ENGLISH); | |
TimeZone tz = TimeZone.getTimeZone("GMT"); | |
cal.setTimeZone(tz); | |
cal.setTimeInMillis(time * 1000); | |
String cosa = DateFormat.format("yyyy-MM-dd'T'HH:mm", cal).toString(); | |
return String.format("%s:00Z",cosa); | |
} |
This file contains hidden or 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 String convertiimmagineinstringabase64(Bitmap finalBitmap) { | |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | |
finalBitmap.compress(JPEG, 50, byteArrayOutputStream); | |
byte[] byteArray = byteArrayOutputStream .toByteArray(); | |
String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT); | |
return encoded.replaceAll("(\\r|\\n)", ""); | |
} |
This file contains hidden or 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 Bitmap convertibianconero(Bitmap bmp) { | |
int width = bmp.getWidth(); | |
int height = bmp.getHeight(); | |
int[] pixels = new int[width * height]; | |
bmp.getPixels(pixels, 0, width, 0, 0, width, height); | |
int alpha = 0xFF << 24; // ?bitmap?24? | |
for (int i = 0; i < height; i++) { | |
for (int j = 0; j < width; j++) { | |
int grey = pixels[width * i + j]; |
This file contains hidden or 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
private boolean localizzazioneattiva(Context context) { | |
LocationManager lm; | |
boolean gpsEnabled; | |
boolean networkEnabled; | |
lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); | |
try { | |
gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); | |
} catch (Exception ex) { |
This file contains hidden or 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
private boolean isValidEmailId(String email) { | |
return Pattern.compile("^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@" | |
+ "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?" | |
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\." | |
+ "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?" | |
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|" | |
+ "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$").matcher(email).matches(); | |
} |
This file contains hidden or 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:id="@+id/dialog" | |
android:layout_width="match_parent" | |
android:layout_height="200dp" | |
android:background="@drawable/boxverde" | |
android:orientation="vertical" | |
tools:ignore="MissingDefaultResource"> |