Posts

Showing posts from August, 2020

Animator in Sketchware

 Code:- ObjectAnimator anim = new ObjectAnimator(); anim.setTarget(_view); anim.setPropertyName(_propertyName); anim.setFloatValues((float)_value); anim.setDuration((long)_duration); anim.setInterpolator(new android.view.animation.AccelerateDecelerateInterpolator()); anim.start();

Background video in Sketchware

Image
 code:  final VideoView vd = new VideoView(MainActivity.this); vd.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT)); vd.setVideoURI(Uri.parse(your video path)); vd.requestFocus(); vd.start(); RelativeLayout rl = new RelativeLayout(this); RelativeLayout rl2 = new RelativeLayout(this); rl2.addView(vd, -1,-1); linear1.removeAllViews(); rl.addView(rl2, -1,-1); rl.addView(linear2, -1,-1); linear1.addView(rl,-1,-1); //this property will all the video to be played in full screen DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); android.widget.RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) vd.getLayoutParams();  params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_TOP, android.widget.RelativeLayout.TRUE); params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_START, android...

Phone verification in Sketchware

Image
 Code in to send code: com.google.firebase.auth.PhoneAuthProvider.getInstance().verifyPhoneNumber(phone, 60, java.util.concurrent.TimeUnit.SECONDS, this, mCallbacks); } com.google.firebase.auth.PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks = new com.google.firebase.auth.PhoneAuthProvider.OnVerificationStateChangedCallbacks() { @Override public void onVerificationCompleted(com.google.firebase.auth.PhoneAuthCredential phoneAuthCredential) { showMessage("Verification completed"); } @Override public void onVerificationFailed(com.google.firebase.FirebaseException e) { showMessage(e.toString()); } @Override public void onCodeSent(String s, com.google.firebase.auth.PhoneAuthProvider.ForceResendingToken forceResendingToken) { super.onCodeSent(s, forceResendingToken); codeSent = s; } }; { Code to verify: com.google.firebase.auth.PhoneAuthCredential credential = com.google.firebase.auth.PhoneAuthProvider.getCredential(codeSent, code); signInWithPhoneAuthCredential(cr...

Download in webview

Image
 code: _webview.setDownloadListener(new DownloadListener() {      @Override         public void onDownloadStart(String url, String userAgent,                                     String contentDisposition, String mimetype,                                     long contentLength) {             DownloadManager.Request request = new DownloadManager.Request(                     Uri.parse(url));             request.allowScanningByMediaScanner();             final String filename= URLUtil.guessFileName(url, contentDisposition, mimetype);             request.setDestinationInExternalPublicDir(Environment.DIRECTORY...

Push notification in Sketchware

Image
 Code: final Context context = getApplicationContext(); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Intent intent = new Intent(this, MainActivity.class);  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);  PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);  androidx.core.app.NotificationCompat.Builder builder;      int notificationId = 1;     String channelId = "channel-01";     String channelName = "Channel Name";     int importance = NotificationManager.IMPORTANCE_HIGH;     if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {         NotificationChannel mChannel = new NotificationChannel(                 channelId, channelName, importance);         notificationManager.create...

Sending image in Sketchware Chatting (Photo)

Image
 code1: final AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create(); LayoutInflater inflater = getLayoutInflater(); View convertView = (View) inflater.inflate(R.layout.photo, null); dialog.setView(convertView); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(Color.TRANSPARENT)); ImageView img1 =(ImageView) convertView.findViewById(R.id.imageview1); img1.setImageBitmap(FileUtil.decodeSampleBitmapFromPath(new_path, 1024, 1024)); Button btn1 =(Button) convertView.findViewById(R.id.button1); Button btn2 =(Button) convertView.findViewById(R.id.button2); img1.setOnClickListener(new OnClickListener() { public void onClick(View view) { showMessage(name); } }); btn1.setOnClickListener(new OnClickListener() { public void onClick(View view) { dialog.dismiss(); } }); btn2.setOnClickListener(new OnClickListener() { public void onClick(View view) { code2: dialog.dismiss(); } }); dialog.s...

Sending image in Sketchware Chatting (Trans_Custom)

Image
  Code1: final AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create(); LayoutInflater inflater = getLayoutInflater(); View convertView = (View) inflater.inflate(R.layout.trans_custom, null); dialog.setView(convertView); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(Color.TRANSPARENT)); ImageView img1 =(ImageView) convertView.findViewById(R.id.imageview1); ImageView img2 =(ImageView) convertView.findViewById(R.id.imageview2); ImageView img3 =(ImageView) convertView.findViewById(R.id.imageview3); img1.setOnClickListener(new OnClickListener() { public void onClick(View view) { showMessage("Camera"); Code2:  dialog.dismiss();} }); img2.setOnClickListener(new OnClickListener() { public void onClick(View view) { showMessage("Gallery");  Code3: dialog.dismiss();} }); img3.setOnClickListener(new OnClickListener() { public void onClick(View view) { dialog.dismiss();...

Horizontal Sliding layout in Sketchware

Image
  Code:- final LinearLayout _layout = (LinearLayout)_forelayout;         final LinearLayout _backview = (LinearLayout) _backlayout; _layout.setTranslationZ(1);         _backview.post(new Runnable() {             @Override             public void run() {                 final boolean[] closed = {true};                 final int[] current = {0};                 final int value = 0-_backview.getWidth();                 _backview.setTranslationX(value);                 LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,_layout.getHeight());                 _layout.setLayoutParams(params);   ...

Collapsing CardView in Sketchware

Image
 Code(Transition): LinearLayout viewgroup =(LinearLayout) _view; android.transition.AutoTransition autoTransition = new android.transition.AutoTransition(); autoTransition.setDuration((long)_duration); android.transition.TransitionManager.beginDelayedTransition(viewgroup, autoTransition);

CardView in Sketchware

Image
  Code: androidx.cardview.widget.CardView cv = new androidx.cardview.widget.CardView(MainActivity.this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(30,30,30,30); cv.setLayoutParams(lp); cv.setCardBackgroundColor(Color.WHITE); cv.setRadius(15); cv.setCardElevation(8); cv.setMaxCardElevation(12); cv.setPreventCornerOverlap(true); ((ViewGroup)_view.getParent()).removeView(_view); linear1.removeAllViews(); linear1.addView(cv); cv.addView(_view);

Transparent dialog in Sketchware

Image
  Code : final AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create(); LayoutInflater inflater = getLayoutInflater(); View convertView = (View) inflater.inflate(R.layout.trans_custom, null); dialog.setView(convertView); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(Color.TRANSPARENT)); ImageView img1 =(ImageView) convertView.findViewById(R.id.imageview1); ImageView img2 =(ImageView) convertView.findViewById(R.id.imageview2); ImageView img3 =(ImageView) convertView.findViewById(R.id.imageview3); img1.setOnClickListener(new OnClickListener() { public void onClick(View view) { showMessage("Camera"); } }); img2.setOnClickListener(new OnClickListener() { public void onClick(View view) { showMessage("Gallery"); } }); img3.setOnClickListener(new OnClickListener() { public void onClick(View view) { dialog.dismiss(); } }); dialog.show();