|
|
@ -5,7 +5,9 @@ import android.content.Context; |
|
|
|
import android.content.DialogInterface; |
|
|
|
import android.graphics.Bitmap; |
|
|
|
import android.net.Uri; |
|
|
|
|
|
|
|
import androidx.appcompat.app.AlertDialog; |
|
|
|
|
|
|
|
import android.view.LayoutInflater; |
|
|
|
import android.view.View; |
|
|
|
import android.view.ViewGroup; |
|
|
@ -49,6 +51,7 @@ public class Utility { |
|
|
|
alertDialog.show(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void showImageDialog(Context context, String title, int image) { |
|
|
|
View view = LayoutInflater.from(context).inflate(R.layout.alert_example_layout, null); |
|
|
|
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context, R.style.CustomAlertDialog); |
|
|
@ -57,15 +60,53 @@ public class Utility { |
|
|
|
titletext = view.findViewById(R.id.title); |
|
|
|
btnok = view.findViewById(R.id.btn_ok); |
|
|
|
ImageView imageView = view.findViewById(R.id.image); |
|
|
|
if(title==null) { |
|
|
|
if (title == null) { |
|
|
|
titletext.setVisibility(View.GONE); |
|
|
|
android.view.ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); |
|
|
|
layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT; |
|
|
|
layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; |
|
|
|
layoutParams.height = 500; |
|
|
|
imageView.setLayoutParams(layoutParams); |
|
|
|
} |
|
|
|
else |
|
|
|
titletext.setText(title); |
|
|
|
} else |
|
|
|
titletext.setText(title); |
|
|
|
android.view.ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); |
|
|
|
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; |
|
|
|
layoutParams.height = 800; |
|
|
|
imageView.setLayoutParams(layoutParams); |
|
|
|
imageView.setImageResource(image); |
|
|
|
|
|
|
|
final AlertDialog dialog = alertDialog.create(); |
|
|
|
|
|
|
|
btnok.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
dialog.dismiss(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
|
|
|
dialog.show(); |
|
|
|
} |
|
|
|
|
|
|
|
public static void showImageDialog(Context context, String title, int image, int imageHeight) { |
|
|
|
View view = LayoutInflater.from(context).inflate(R.layout.alert_example_layout, null); |
|
|
|
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context, R.style.CustomAlertDialog); |
|
|
|
alertDialog.setView(view); |
|
|
|
TextView titletext, btnok; |
|
|
|
titletext = view.findViewById(R.id.title); |
|
|
|
btnok = view.findViewById(R.id.btn_ok); |
|
|
|
ImageView imageView = view.findViewById(R.id.image); |
|
|
|
if (title == null) { |
|
|
|
titletext.setVisibility(View.GONE); |
|
|
|
android.view.ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); |
|
|
|
layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT; |
|
|
|
layoutParams.height = 500; |
|
|
|
imageView.setLayoutParams(layoutParams); |
|
|
|
} else |
|
|
|
titletext.setText(title); |
|
|
|
android.view.ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); |
|
|
|
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT; |
|
|
|
layoutParams.height = imageHeight; |
|
|
|
imageView.setLayoutParams(layoutParams); |
|
|
|
imageView.setImageResource(image); |
|
|
|
|
|
|
|
final AlertDialog dialog = alertDialog.create(); |
|
|
@ -107,6 +148,7 @@ public class Utility { |
|
|
|
public static void showImageFromServer(Context context, ImageView imageView, String image) { |
|
|
|
Glide.with(context).load(image).diskCacheStrategy(DiskCacheStrategy.NONE).into(imageView); |
|
|
|
} |
|
|
|
|
|
|
|
public static void showImageFromServerCache(Context context, ImageView imageView, String image) { |
|
|
|
Glide.with(context).load(image).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView); |
|
|
|
} |
|
|
@ -122,7 +164,7 @@ public class Utility { |
|
|
|
.into(imageView);*/ |
|
|
|
} |
|
|
|
|
|
|
|
public static void intetToHome(Context c){ |
|
|
|
public static void intetToHome(Context c) { |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean checkString(String val) { |
|
|
@ -154,20 +196,19 @@ public class Utility { |
|
|
|
|
|
|
|
public static String checkEllipsizeSmall(String val) { |
|
|
|
if (val != null && val.length() > 10) { |
|
|
|
return val.substring(0,7) + "..."; |
|
|
|
return val.substring(0, 7) + "..."; |
|
|
|
} |
|
|
|
return val; |
|
|
|
} |
|
|
|
|
|
|
|
public static String checkEllipsizeMedium(String val) { |
|
|
|
if (val != null && val.length() > 14) { |
|
|
|
return val.substring(0,13) + "..."; |
|
|
|
return val.substring(0, 13) + "..."; |
|
|
|
} |
|
|
|
return val; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getMimeType(Context context, Uri uri) { |
|
|
|
String extension; |
|
|
|
|
|
|
|