From 23e12c19109724169f210fd3b9f764abc0fc9142 Mon Sep 17 00:00:00 2001 From: vinsentli Date: Sun, 22 Dec 2024 21:07:05 +0800 Subject: [PATCH] Revert SampleActivity --- .../facebook/igl/sample/SampleActivity.java | 62 ------------------- 1 file changed, 62 deletions(-) diff --git a/build/android/app/src/main/java/com/facebook/igl/sample/SampleActivity.java b/build/android/app/src/main/java/com/facebook/igl/sample/SampleActivity.java index 2ff8ff5279..822ed8fede 100644 --- a/build/android/app/src/main/java/com/facebook/igl/sample/SampleActivity.java +++ b/build/android/app/src/main/java/com/facebook/igl/sample/SampleActivity.java @@ -10,11 +10,8 @@ package com.facebook.igl.shell; import android.app.Activity; -import android.content.Context; -import android.content.SharedPreferences; import android.graphics.Color; import android.os.Bundle; -import android.util.Log; import android.view.Gravity; import android.view.SurfaceView; import android.view.View; @@ -22,18 +19,12 @@ import android.widget.LinearLayout; import android.widget.TextView; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; - public class SampleActivity extends Activity implements View.OnClickListener { // UI LinearLayout mMainView; LinearLayout mTabBar; FrameLayout mBackendViewFrame; - private static String TAG = "SampleActivity"; - // initialize runtime backend configuration / context private int curConfig = 0; private SampleLib.RenderSessionConfig[] mConfigs; @@ -98,16 +89,6 @@ protected void onCreate(Bundle icicle) { mMainView.addView(mTabBar); mMainView.addView(mBackendViewFrame); setContentView(mMainView); - - boolean hasCopy = getSharedPreferences("data", Context.MODE_PRIVATE).getBoolean("HasCopyAssets", false); - - if (!hasCopy) { - copyAssetsDirToSDCard(this, "", getFilesDir().getAbsolutePath()); - - SharedPreferences.Editor editor = getSharedPreferences("data", Context.MODE_PRIVATE).edit(); - editor.putBoolean("HasCopyAssets",true); - editor.commit(); - } } @Override @@ -155,47 +136,4 @@ protected void onResume() { ((SampleView) mTabViews[curConfig]).onResume(); } } - - public static void copyAssetsDirToSDCard(Context context, String assetsDirName, String sdCardPath) { - Log.d(TAG, "copyAssetsDirToSDCard() called with: context = [" + context + "], assetsDirName = [" + assetsDirName + "], sdCardPath = [" + sdCardPath + "]"); - try { - String list[] = context.getAssets().list(assetsDirName); - if (list.length == 0) { - InputStream inputStream = context.getAssets().open(assetsDirName); - byte[] mByte = new byte[1024]; - int bt = 0; - File file = new File(sdCardPath + File.separator - + assetsDirName); - if (!file.exists()) { - file.createNewFile(); - } else { - return; - } - FileOutputStream fos = new FileOutputStream(file); - while ((bt = inputStream.read(mByte)) != -1) { - fos.write(mByte, 0, bt); - } - fos.flush(); - inputStream.close(); - fos.close(); - } else { - String subDirName = assetsDirName; - if (assetsDirName.contains("/")) { - subDirName = assetsDirName.substring(assetsDirName.lastIndexOf('/') + 1); - } - sdCardPath = sdCardPath + File.separator + subDirName; - File file = new File(sdCardPath); - if (!file.exists()) - file.mkdirs(); - for (String s : list) { - String fileName = assetsDirName.length() > 0 ? assetsDirName + File.separator + s : s; - copyAssetsDirToSDCard(context, fileName , sdCardPath); - } - } - } catch ( - Exception e) { - e.printStackTrace(); - } - } - }