package com.iyong.mahal; import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.*; import android.app.*; import android.os.*; import android.view.*; import android.view.View.*; import android.widget.*; import android.content.*; import android.content.res.*; import android.graphics.*; import android.graphics.drawable.*; import android.media.*; import android.net.*; import android.text.*; import android.text.style.*; import android.util.*; import android.webkit.*; import android.animation.*; import android.view.animation.*; import java.io.*; import java.util.*; import java.util.regex.*; import java.text.*; import org.json.*; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.ImageView; import android.content.Intent; import android.net.Uri; import java.util.Timer; import java.util.TimerTask; import com.bumptech.glide.Glide; import android.graphics.Typeface; import com.unity3d.ads.*; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.DialogFragment; public class MainActivity extends AppCompatActivity { private Timer _timer = new Timer(); private String fontName = ""; private String typeace = ""; private LinearLayout linear1; private TextView textview1; private LinearLayout linear3; private LinearLayout linear5; private LinearLayout linear6; private LinearLayout start; private LinearLayout loading; private LinearLayout end; private ImageView imageview1; private TextView textview2; private TextView textview3; private Intent v = new Intent(); private TimerTask t; @Override protected void onCreate(Bundle _savedInstanceState) { super.onCreate(_savedInstanceState); setContentView(R.layout.main); initialize(_savedInstanceState); initializeLogic(); } private void initialize(Bundle _savedInstanceState) { linear1 = findViewById(R.id.linear1); textview1 = findViewById(R.id.textview1); linear3 = findViewById(R.id.linear3); linear5 = findViewById(R.id.linear5); linear6 = findViewById(R.id.linear6); start = findViewById(R.id.start); loading = findViewById(R.id.loading); end = findViewById(R.id.end); imageview1 = findViewById(R.id.imageview1); textview2 = findViewById(R.id.textview2); textview3 = findViewById(R.id.textview3); } private void initializeLogic() { Glide.with(getApplicationContext()).load(Uri.parse("https://i.imgur.com/lGarq57.png")).into(imageview1); _changeActivityFont("bagos"); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { Window w =MainActivity.this.getWindow(); w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); w.setStatusBarColor(0xFFC0B5AB); } t = new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { v.setAction(Intent.ACTION_VIEW); v.setClass(getApplicationContext(), HomeActivity.class); startActivity(v); } }); } }; _timer.schedule(t, (int)(6000)); t = new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { textview1.setText("Loading..."); textview1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/bagos.ttf"), 0); } }); } }; _timer.schedule(t, (int)(5000)); t = new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { start.setBackgroundColor(0xFFFDCC61); loading.setBackgroundColor(0xFFFDCC61); end.setBackgroundColor(0xFFFDCC61); } }); } }; _timer.schedule(t, (int)(4000)); t = new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { start.setBackgroundColor(0xFFFDCC61); loading.setBackgroundColor(0xFFFDCC61); end.setBackgroundColor(Color.TRANSPARENT); } }); } }; _timer.schedule(t, (int)(3000)); t = new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { start.setBackgroundColor(0xFFFDCC61); loading.setBackgroundColor(Color.TRANSPARENT); end.setBackgroundColor(Color.TRANSPARENT); } }); } }; _timer.schedule(t, (int)(1000)); } public void _changeActivityFont(final String _fontname) { fontName = "fonts/".concat(_fontname.concat(".ttf")); overrideFonts(this,getWindow().getDecorView()); } private void overrideFonts(final android.content.Context context, final View v) { try { Typeface typeace = Typeface.createFromAsset(getAssets(), fontName);; if ((v instanceof ViewGroup)) { ViewGroup vg = (ViewGroup) v; for (int i = 0; i < vg.getChildCount(); i++) { View child = vg.getChildAt(i); overrideFonts(context, child); } } else { if ((v instanceof TextView)) { ((TextView) v).setTypeface(typeace); } else { if ((v instanceof EditText )) { ((EditText) v).setTypeface(typeace); } else { if ((v instanceof Button)) { ((Button) v).setTypeface(typeace); } } } } } catch(Exception e) { SketchwareUtil.showMessage(getApplicationContext(), "Error Loading Font"); }; } @Deprecated public void showMessage(String _s) { Toast.makeText(getApplicationContext(), _s, Toast.LENGTH_SHORT).show(); } @Deprecated public int getLocationX(View _v) { int _location[] = new int[2]; _v.getLocationInWindow(_location); return _location[0]; } @Deprecated public int getLocationY(View _v) { int _location[] = new int[2]; _v.getLocationInWindow(_location); return _location[1]; } @Deprecated public int getRandom(int _min, int _max) { Random random = new Random(); return random.nextInt(_max - _min + 1) + _min; } @Deprecated public ArrayList getCheckedItemPositionsToArray(ListView _list) { ArrayList _result = new ArrayList(); SparseBooleanArray _arr = _list.getCheckedItemPositions(); for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) { if (_arr.valueAt(_iIdx)) _result.add((double)_arr.keyAt(_iIdx)); } return _result; } @Deprecated public float getDip(int _input) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, getResources().getDisplayMetrics()); } @Deprecated public int getDisplayWidthPixels() { return getResources().getDisplayMetrics().widthPixels; } @Deprecated public int getDisplayHeightPixels() { return getResources().getDisplayMetrics().heightPixels; } }