diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 3400bfa..9be2b9c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.application' id 'com.google.gms.google-services' + id 'com.google.firebase.crashlytics' } android { @@ -43,19 +44,21 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'com.google.android.material:material:1.8.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.10.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.navigation:navigation-fragment:2.5.3' - implementation 'androidx.navigation:navigation-ui:2.5.3' + implementation 'androidx.navigation:navigation-fragment:2.7.5' + implementation 'androidx.navigation:navigation-ui:2.7.5' implementation 'com.github.bumptech.glide:glide:4.16.0' implementation platform('com.google.firebase:firebase-bom:32.3.1') implementation 'com.google.firebase:firebase-analytics' implementation("com.google.firebase:firebase-auth") + implementation("com.google.firebase:firebase-crashlytics") implementation("com.google.android.gms:play-services-auth:20.7.0") - implementation 'com.google.android.gms:play-services-ads:22.4.0' + implementation 'com.google.android.gms:play-services-ads:22.5.0' + implementation 'com.airbnb.android:lottie:6.1.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 375c1a1..e56d2ce 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,9 +2,7 @@ + android:installLocation="auto"> data=new ArrayList<>(); + JSONArray jArray = new JSONArray(FileUtils.readFromFile(MainActivity.activity, jsonFile)); - } catch (Exception e) { - UIUtils.toastLong(activity, e.toString()); + try { + // Extract data from json and store into ArrayList as class objects + for(int i=0;i { + class DownloadsImage extends AsyncTask{ @Override - protected void onPreExecute() { - super.onPreExecute(); - showDialog(DIALOG_DOWNLOAD_PROGRESS); - } - - @Override - protected String doInBackground(String... aurl) { - int count; - + protected Void doInBackground(String... strings) { + URL url = null; try { - URL url = new URL(aurl[0]); - URLConnection conexion = url.openConnection(); - conexion.connect(); + url = new URL(strings[0]); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + Bitmap bm = null; + try { + bm = BitmapFactory.decodeStream(url.openConnection().getInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } - int lenghtOfFile = conexion.getContentLength(); - String fileName = URLUtil.guessFileName(selectedIcon,null,null); - InputStream input = new BufferedInputStream(url.openStream()); - OutputStream output = new FileOutputStream(Config.maindirpath+"icons/"+selectedPath.replace(".IMG", ".png")); + //Create Path to save Image + File path = new File(Config.maindirpath + "icons"); //Creates app specific folder - byte data[] = new byte[1024]; + if(!path.exists()) { + path.mkdirs(); + } - long total = 0; - - while ((count = input.read(data)) != -1) { - total += count; - publishProgress("" + (int) ((total * 100) / lenghtOfFile)); - output.write(data, 0, count); - } - - output.flush(); - output.close(); - input.close(); - } catch (Exception e) { + File imageFile = new File(path, selectedPath.replace(".IMG", ".jpg")); // Imagename.png + FileOutputStream out = null; + try { + out = new FileOutputStream(imageFile); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + try{ + bm.compress(Bitmap.CompressFormat.PNG, 100, out); // Compress Image + out.flush(); + out.close(); + // Tell the media scanner about the new file so that it is + // immediately available to the user. + MediaScannerConnection.scanFile(activity,new String[] { imageFile.getAbsolutePath() }, null,new MediaScannerConnection.OnScanCompletedListener() { + public void onScanCompleted(String path, Uri uri) { + // Log.i("ExternalStorage", "Scanned " + path + ":"); + // Log.i("ExternalStorage", "-> uri=" + uri); + } + }); + } catch(Exception e) { } return null; - - } - - protected void onProgressUpdate(String... progress) { - } @Override - protected void onPostExecute(String unused) { - + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); } } diff --git a/app/src/main/java/com/epicstudios/vectras/Fragment/ControlsFragment.java b/app/src/main/java/com/epicstudios/vectras/Fragment/ControlsFragment.java index e6088b9..3dafc99 100644 --- a/app/src/main/java/com/epicstudios/vectras/Fragment/ControlsFragment.java +++ b/app/src/main/java/com/epicstudios/vectras/Fragment/ControlsFragment.java @@ -188,35 +188,6 @@ public class ControlsFragment extends Fragment { SDLActivity.onNativeKeyDown(KeyEvent.KEYCODE_SPACE); } }); - final Toolbar optionsTb = view.findViewById(R.id.toolbar); - optionsTb.setTitle(null); - optionsTb.inflateMenu(R.menu.sdl_menu); - - // and finally set click listener - optionsTb.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - int id = item.getItemId(); - if(id == R.id.shutdownItem) { - //VectrasSDLActivity.stopVM(VectrasSDLActivity.activity, false); - return true; - } else if (item.getItemId() == R.id.itemFitToScreen) { - //VectrasSDLActivity.setFitToScreen(); - } else if (item.getItemId() == R.id.itemStretchToScreen) { - //VectrasSDLActivity.setStretchToScreen(); - } else if (item.getItemId() == R.id.itemZoomIn) { - //VectrasSDLActivity.setZoomIn(); - } else if (item.getItemId() == R.id.itemZoomOut) { - //VectrasSDLActivity.setZoomOut(); - } else if (item.getItemId() == R.id.itemOneToOne) { - //VectrasSDLActivity.setOneToOne(); - } else if (item.getItemId() == R.id.itemZoomable) { - //VectrasSDLActivity.setZoomable(); - } - return false; - } - }); - setHasOptionsMenu(true); int loop =25; JoystickView joystick = (JoystickView) view.findViewById(R.id.joyStick); joystick.setOnMoveListener(new JoystickView.OnMoveListener() { @@ -456,20 +427,4 @@ public class ControlsFragment extends Fragment { }); return view; } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - // Do something that differs the Activity's menu here - inflater.inflate(R.menu.sdl_menu, menu); - super.onCreateOptionsMenu(menu, inflater); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - int id = item.getItemId(); - if (id == R.id.shutdownItem) { - VectrasSDLActivity.stop(); - } - return super.onOptionsItemSelected(item); - } } diff --git a/app/src/main/java/com/epicstudios/vectras/Fragment/HomeFragment.java b/app/src/main/java/com/epicstudios/vectras/Fragment/HomeFragment.java index 36d1ac3..8259103 100644 --- a/app/src/main/java/com/epicstudios/vectras/Fragment/HomeFragment.java +++ b/app/src/main/java/com/epicstudios/vectras/Fragment/HomeFragment.java @@ -2,6 +2,7 @@ package com.epicstudios.vectras.Fragment; import android.app.ProgressDialog; import android.content.Context; +import android.content.Intent; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkInfo; @@ -13,19 +14,26 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + +import com.epicstudios.vectras.FirstActivity; +import com.epicstudios.vectras.MainRoms.AdapterMainRoms; +import com.epicstudios.vectras.MainRoms.DataMainRoms; import com.epicstudios.vectras.R; import com.epicstudios.vectras.Blog.AdapterBlog; import com.epicstudios.vectras.Blog.DataBlog; import com.epicstudios.vectras.Config; import com.epicstudios.vectras.MainActivity; +import com.epicstudios.vectras.utils.FileUtils; import com.epicstudios.vectras.utils.UIUtils; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.net.HttpURLConnection; import java.net.InetAddress; @@ -44,12 +52,18 @@ public class HomeFragment extends Fragment { View view; - private RecyclerView mRVBlog; + public static RecyclerView mRVBlog; + public static RecyclerView mRVMainRoms; + public static LinearLayout romsLayout; private AdapterBlog mAdapter; + public static AdapterMainRoms mMainAdapter; public MainActivity activity; public String Data; public static LinearLayout noConnectionLayout; public SwipeRefreshLayout pullToRefresh; + public ImageView ivRomsManager; + public static JSONArray jArray; + public static List data; /*private ImageButton mStop; private ImageButton mRestart;*/ @@ -61,9 +75,12 @@ public class HomeFragment extends Fragment { view = inflater.inflate(R.layout.home_fragment, container, false); + romsLayout = view.findViewById(R.id.romsLayout); + + ivRomsManager = view.findViewById(R.id.ivRomsManager); + noConnectionLayout = view.findViewById(R.id.noConnectionLayout); mRVBlog = view.findViewById(R.id.blogRv); - if (checkConnection(activity)) { new AsyncLogin().execute(); noConnectionLayout.setVisibility(View.GONE); @@ -85,23 +102,40 @@ public class HomeFragment extends Fragment { } } }); + data=new ArrayList<>(); - /*mStop = (ImageButton) view.findViewById(R.id.stopvm); - mStop.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - MainActivity.onStopButton(false); - - } - }); - - mRestart = (ImageButton) view.findViewById(R.id.restartvm); - mRestart.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - - MainActivity.onRestartButton(); - - } - });*/ + try { + + jArray = new JSONArray(FileUtils.readFromFile(MainActivity.activity, new File(Config.maindirpath + + "roms-data.json"))); + + // Extract data from json and store into ArrayList as class objects + for(int i=0;i { myHolder.textAvail.setText("availability: unavailable"); myHolder.textAvail.setTextColor(Color.RED); myHolder.checkBox.setEnabled(false); - myHolder.cdItem.setEnabled(false); } if (current.itemAvail) myHolder.checkBox.setOnClickListener(new View.OnClickListener() { @@ -86,34 +87,6 @@ public class AdapterRoms extends RecyclerView.Adapter { FirstActivity.selectedIcon = current.itemIcon; } }); - //Glide.with(MainActivity.activity).load(current.itemIcon).into(myHolder.ivIcon); - if (current.itemAvail) - myHolder.cdItem.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (FileUtils.fileValid(FirstActivity.activity, Config.maindirpath + current.itemPath)) { - mSelectedItem = position; - notifyItemRangeChanged(0, data.size()); - FirstActivity.selected = true; - FirstActivity.selectedPath = current.itemPath; - FirstActivity.selectedExtra = current.itemExtra; - } else { - AlertDialog ad; - ad = new AlertDialog.Builder(FirstActivity.activity, R.style.MainDialogTheme).create(); - ad.setTitle(current.itemName + " Not found"); - ad.setMessage(current.itemName + " Rom not found please download from our official website"); - ad.setButton(Dialog.BUTTON_POSITIVE, "DOWNLAOD WEBSITE", new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - String gt = current.itemUrl; - Intent g = new Intent(Intent.ACTION_VIEW); - g.setData(Uri.parse(gt)); - FirstActivity.activity.startActivity(g); - FirstActivity.activity.finish(); - } - }); - } - } - }); } @@ -125,7 +98,6 @@ public class AdapterRoms extends RecyclerView.Adapter { class MyHolder extends RecyclerView.ViewHolder { - CardView cdItem; TextView textName, textAvail, textSize; ImageView ivIcon; @@ -134,7 +106,6 @@ public class AdapterRoms extends RecyclerView.Adapter { // create constructor to get widget reference public MyHolder(View itemView) { super(itemView); - cdItem = (CardView) itemView.findViewById(R.id.cdItem); textName = (TextView) itemView.findViewById(R.id.textName); ivIcon = (ImageView) itemView.findViewById(R.id.ivIcon); textSize = (TextView) itemView.findViewById(R.id.textSize); diff --git a/app/src/main/java/com/epicstudios/vectras/SplashActivity.java b/app/src/main/java/com/epicstudios/vectras/SplashActivity.java index caae6a6..3df6a9b 100644 --- a/app/src/main/java/com/epicstudios/vectras/SplashActivity.java +++ b/app/src/main/java/com/epicstudios/vectras/SplashActivity.java @@ -3,6 +3,7 @@ package com.epicstudios.vectras; import static android.os.Build.VERSION.SDK_INT; import android.Manifest; +import android.animation.ValueAnimator; import android.app.Dialog; import android.content.*; import android.content.pm.*; @@ -16,6 +17,8 @@ import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; + +import com.airbnb.lottie.LottieAnimationView; import com.epicstudios.vectras.R; import com.epicstudios.vectras.MainActivity; import com.epicstudios.vectras.utils.UIUtils; @@ -113,8 +116,11 @@ public class SplashActivity extends AppCompatActivity implements Runnable { intent.setData(uri); startActivity(intent); ad.cancel(); + finish(); + } else { new Handler().postDelayed(this, 2000); - } + + } } else if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_DENIED) { ActivityCompat.requestPermissions(SplashActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); diff --git a/app/src/main/java/com/epicstudios/vectras/VectrasApp.java b/app/src/main/java/com/epicstudios/vectras/VectrasApp.java index 8b4ecd3..43dad65 100644 --- a/app/src/main/java/com/epicstudios/vectras/VectrasApp.java +++ b/app/src/main/java/com/epicstudios/vectras/VectrasApp.java @@ -162,7 +162,7 @@ public class VectrasApp extends Application { @Override public void run() { - VectrasStatus.logError("[E] "+e.getMessage()+""); + VectrasStatus.logError("[E] >"+ mContext.getApplicationContext().toString() +e.getMessage()+""); } }); } else { diff --git a/app/src/main/java/com/epicstudios/vectras/jni/VMExecutor.java b/app/src/main/java/com/epicstudios/vectras/jni/VMExecutor.java index b737a22..34ec0fd 100644 --- a/app/src/main/java/com/epicstudios/vectras/jni/VMExecutor.java +++ b/app/src/main/java/com/epicstudios/vectras/jni/VMExecutor.java @@ -12,6 +12,8 @@ import com.epicstudios.vectras.utils.FileUtils; import com.epicstudios.vectras.utils.RamInfo; import com.epicstudios.vectras.utils.UIUtils; import java.io.File; +import java.util.Arrays; + import android.os.Environment; public class VMExecutor { @@ -30,7 +32,7 @@ public class VMExecutor { private int height; public static final File fileExtra = new File(Config.basefiledir + "config_extra.txt"); - public static final String extraParams = FileUtils.readFromFile(MainActivity.activity, fileExtra); + public static String extraParams; /** * @throws Exception @@ -81,7 +83,7 @@ public class VMExecutor { VectrasStatus.logInfo(String.format(" QEMU Params Error: "+extraParams)); return "error"; } - VectrasStatus.logInfo(String.format("QEMU PARAMS: "+extraParams+" -m "+ RamInfo.vectrasMemory())); + VectrasStatus.logInfo(String.format("QEMU PARAMS: "+ Arrays.toString(MainActivity.params) +extraParams+" -m "+ RamInfo.vectrasMemory())); res = start(this.libqemu, MainActivity.params, extraParams+" -m "+ RamInfo.vectrasMemory(), paused, "VECTRAS"); } catch (Exception ex) { ex.printStackTrace(); diff --git a/app/src/main/res/anim/slide_from_left.xml b/app/src/main/res/anim/slide_from_left.xml index dd3f6c6..bcbafd1 100644 --- a/app/src/main/res/anim/slide_from_left.xml +++ b/app/src/main/res/anim/slide_from_left.xml @@ -1,5 +1,8 @@ + android:duration="300"/> + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_to_left.xml b/app/src/main/res/anim/slide_to_left.xml index 30b2b39..2c159e4 100644 --- a/app/src/main/res/anim/slide_to_left.xml +++ b/app/src/main/res/anim/slide_to_left.xml @@ -2,4 +2,7 @@ + \ No newline at end of file diff --git a/app/src/main/res/drawable-anydpi-v26/controls_button.xml b/app/src/main/res/drawable-anydpi-v26/controls_button.xml index f737dea..6ed972c 100644 --- a/app/src/main/res/drawable-anydpi-v26/controls_button.xml +++ b/app/src/main/res/drawable-anydpi-v26/controls_button.xml @@ -8,6 +8,11 @@ android:width="2dp" android:color="#90000000" /> + @@ -19,6 +24,11 @@ android:width="2dp" android:color="#90000000" /> + @@ -29,6 +39,11 @@ android:width="2dp" android:color="#90000000" /> + diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml index 948c4ba..ac3fb15 100644 --- a/app/src/main/res/layout/activity_splash.xml +++ b/app/src/main/res/layout/activity_splash.xml @@ -1,25 +1,16 @@ + android:orientation="vertical"> - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/container_post.xml b/app/src/main/res/layout/container_post.xml index b087844..7563d85 100644 --- a/app/src/main/res/layout/container_post.xml +++ b/app/src/main/res/layout/container_post.xml @@ -8,7 +8,8 @@ android:foreground="?android:attr/selectableItemBackground" app:cardBackgroundColor="@color/main_dark" app:cardCornerRadius="10dp" - app:cardUseCompatPadding="true" > + app:cardUseCompatPadding="true" + android:focusable="true"> - - + - - - + android:layout_margin="10dp" + android:clipToPadding="false" + app:cardBackgroundColor="@color/colorPrimaryDark" + app:cardCornerRadius="10dp" + app:cardPreventCornerOverlap="true"> + android:orientation="horizontal"> - + + android:layout_weight="1.0" + android:orientation="vertical" + android:padding="10dp"> + android:maxLines="1" + android:text="@string/name" + android:textSize="20sp" + android:textStyle="bold" /> - + android:orientation="horizontal"> + + + + + + + - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/controls_fragment.xml b/app/src/main/res/layout/controls_fragment.xml index d688a5e..14c8da0 100644 --- a/app/src/main/res/layout/controls_fragment.xml +++ b/app/src/main/res/layout/controls_fragment.xml @@ -1,45 +1,20 @@ - - - - - - - - - - - - - + android:orientation="vertical"> + android:padding="10dp"> + android:orientation="horizontal"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + android:padding="15dp"> + android:orientation="horizontal"> + android:orientation="horizontal"> + android:text="@string/mode" /> + android:orientation="horizontal"> + android:text="@string/keyboard" /> + android:orientation="horizontal" + android:visibility="gone"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/gamepad_mode_layout.xml b/app/src/main/res/layout/gamepad_mode_layout.xml deleted file mode 100644 index ff81d23..0000000 --- a/app/src/main/res/layout/gamepad_mode_layout.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/home_fragment.xml b/app/src/main/res/layout/home_fragment.xml index e24989a..e4df965 100644 --- a/app/src/main/res/layout/home_fragment.xml +++ b/app/src/main/res/layout/home_fragment.xml @@ -1,20 +1,61 @@ - + android:layout_height="match_parent" + android:padding="8dp" + android:orientation="vertical"> - + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="horizontal" + android:visibility="gone"> + android:layout_height="wrap_content" + android:layout_weight="1.0" + android:orientation="horizontal" + tools:listitem="@layout/container_main_roms" + android:clipToPadding="false" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> - - + - \ No newline at end of file + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/raw/data.json b/app/src/main/res/raw/data.json deleted file mode 100644 index c3d6e03..0000000 --- a/app/src/main/res/raw/data.json +++ /dev/null @@ -1,8 +0,0 @@ -[ -{ -"post_thumb":"https://raw.githubusercontent.com/epicstudios856/Vectras-windows-emulator/main/res/images/app_icon.png", -"post_title":"Post Title", -"post_content":"post content", -"post_date":"lol" -} -] \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ea49648..5882372 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -113,4 +113,9 @@ Hide Toolbar View Log + Mode + Keyboard + name + size: + availablity: diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 4e2a344..666bb20 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -40,7 +40,6 @@ - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 99e7d29..d5e0ce3 100644 --- a/build.gradle +++ b/build.gradle @@ -2,4 +2,5 @@ plugins { id 'com.android.application' version '8.1.2' apply false id 'com.google.gms.google-services' version '4.4.0' apply false + id 'com.google.firebase.crashlytics' version '2.9.9' apply false } \ No newline at end of file