Posts

Compress Image Android Studio

1. Create folder called Utils 2. Add class to that folder called CompressBitmap 3. Write inside that file the following: import android.graphics.Bitmap ; import android.graphics.Matrix ; import java.io.ByteArrayOutputStream ; public class CompressBitmap { public static Bitmap compress (Bitmap bitmap , double maxSize) { // bitmapbitmap ByteArrayOutputStream baos = new ByteArrayOutputStream() ; // bitmap.compress(Bitmap.CompressFormat. PNG , 70 , baos) ; byte [] b = baos.toByteArray() ; // KB double mid = b. length / 1024 ; // bitmap double i = mid / maxSize ; // bitmap if (i > 1 ) { // // bitmap = scale (bitmap , bitmap.getWidth() / Math. sqrt (i) , bitmap.getHeight() / Math. sqrt (i)) ; } return bitmap ; } public static Bitmap scale (Bitmap src , double newWidth , double newHeight) { // src float w

Android Studio Dialog with Style

 Java class package com.elesteam.pefis.Dialogs ; /** * * * BASIC INPUT DIALOG * * Description_______________ * * Date______________________ * * */ import android.app.AlertDialog ; import android.app.DatePickerDialog ; import android.app.Dialog ; import android.content.Context ; import android.content.DialogInterface ; import android.os.Bundle ; import android.text.Editable ; import android.text.TextWatcher ; import android.util.Log ; import android.view.LayoutInflater ; import android.view.View ; import android.widget.Button ; import android.widget.DatePicker ; import android.widget.EditText ; import androidx.annotation. NonNull ; import androidx.annotation. Nullable ; import androidx.appcompat.app.AppCompatDialogFragment ; import androidx.fragment.app.DialogFragment ; import com.elesteam.pefis.R ; import java.text.ParseException ; import java.util.Calendar ; import java.util.Objects ; public class BasicInputDialog extends AppCompatDialogFragment { private

Android Studio Development/Design Tricks

Button with border <Button                 android:id="@+id/email_sign_in_button"                 style="?android:textAppearanceSmall"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginTop="17dp"                 android:background="@drawable/btn_accented_cornered"                 android:paddingLeft="50dp"                 android:paddingRight="50dp"                 android:text="@string/login"                 android:textColor="@android:color/white"                 android:textStyle="bold"                 app:layout_constraintEnd_toEndOf="@+id/textInputLayout4"                 app:layout_constraintStart_toStartOf="@+id/textInputLayout4"                 app:layout_constraintTop_toBottomOf="@+id/textInputLayout4" /> //btn_accented_cornered.xml <?xml v

Configure .htaccess URL to subdomain

  Example 1: https://webmasters.stackexchange.c-om/questions/100872/htaccess-change-subdomain-add-a-custom-file-extension-and-url-parameters/100890 www.example.com/path/index.php?user=username&option=optname to username.example.com/path/optname.html <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.example.com [NC] RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC] </IfModule> Example 2: https://stackoverflow.com/questions/17907596/htaccess-redirect-to-subdomain-based-on-query-string-parameter Example: http://example.com/message.php?id=subdomain to http://subdomain.example.com/message.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC] RewriteCond %{QUERY_STRING} ^id=(.*)$ RewriteRule message.php http://%1.example.com/message.php? [R=301,L] </IfModule>

GRUB Kody

  set root=(hd0,3) linux /KERNEL boot=/dev/sda3 disk=/dev/sda4

Retrocompatibilidad XCode12 Swift a iOS10/XCode 12 Swift backward compatibility to iOS 10

Image
Retrocompatibilidad XCode12 Swift a iOS10/XCode 12 Swift backward compatibility to iOS 10 Para agregar retrocompatilidad se debe agregar las siguientes lineas en SceneDelegate.swift @available ( iOS 13.0 , *) ejemplo: copiar el  var window : UIWindow ?  de SceneDelegate.swift a AppDelegate.swift Agregar a func application del AppDelegate.swift lo siguiente: @available ( iOS 13.0 , *) Errores a resolver con este tutorial: 'UISceneConfiguration' is only available in iOS 13.0 or newer 'UISceneSession' is only available in iOS 13.0 or newer 'UIScene' is only available in iOS 13.0 or newer 'ConnectionOptions' is only available in iOS 13.0 or newer 'UISceneSession' is only available in iOS 13.0 or newer 'UISceneConfiguration' is only available in iOS 13.0 or newer 'UIScene' is only available in iOS 13.0 or newer

Android/Kotlin: Como hacer un VideoSplash para nuestra aplicación

Image
  Código del Main: class MainActivity : AppCompatActivity() {     protected lateinit var vv_fondo: VideoView     protected lateinit var mMediaPlayer: MediaPlayer     protected var mCurrentVideoPosition: Int = 0     override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContentView(R.layout.activity_main)         vv_fondo = findViewById<VideoView>(R.id.vv_fondo)         val uri = Uri.parse("android.resource://"                                 +packageName                                 +"/"                                 +R.raw.paisaje_fondo)         vv_fondo.setVideoURI(uri)         vv_fondo.start()         vv_fondo.setOnPreparedListener { mp ->             mMediaPlayer = mp             mMediaPlayer.isLooping = true             if(mCurrentVideoPosition != 0){                 mMediaPlayer.seekTo(mCurrentVideoPosition)                 mMediaPlayer.start()             }         }     }     override fun onPa