add debug bottom sheet
This commit is contained in:
		| @@ -15,22 +15,26 @@ | |||||||
|  */ |  */ | ||||||
| package pub.doric.demo; | package pub.doric.demo; | ||||||
|  |  | ||||||
| import androidx.appcompat.app.AppCompatActivity; |  | ||||||
|  |  | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
|  | import android.view.KeyEvent; | ||||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||||
| import android.widget.FrameLayout; | import android.widget.FrameLayout; | ||||||
|  |  | ||||||
|  | import androidx.appcompat.app.AppCompatActivity; | ||||||
|  |  | ||||||
|  | import java.io.IOException; | ||||||
|  |  | ||||||
|  | import pub.doric.DevPanel; | ||||||
| import pub.doric.Doric; | import pub.doric.Doric; | ||||||
| import pub.doric.DoricContext; | import pub.doric.DoricContext; | ||||||
| import pub.doric.dev.LocalServer; | import pub.doric.dev.LocalServer; | ||||||
| import pub.doric.utils.DoricUtils; | import pub.doric.utils.DoricUtils; | ||||||
|  |  | ||||||
| import java.io.IOException; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| public class MainActivity extends AppCompatActivity { | public class MainActivity extends AppCompatActivity { | ||||||
|  |  | ||||||
|  |     private DevPanel mDevPanel = new DevPanel(); | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected void onCreate(Bundle savedInstanceState) { |     protected void onCreate(Bundle savedInstanceState) { | ||||||
|         super.onCreate(savedInstanceState); |         super.onCreate(savedInstanceState); | ||||||
| @@ -47,4 +51,12 @@ public class MainActivity extends AppCompatActivity { | |||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public boolean onKeyDown(int keyCode, KeyEvent event) { | ||||||
|  |         if (KeyEvent.KEYCODE_MENU == event.getKeyCode()) { | ||||||
|  |             mDevPanel.show(getSupportFragmentManager(), "DevPanel"); | ||||||
|  |         } | ||||||
|  |         return super.onKeyDown(keyCode, event); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|     xmlns:tools="http://schemas.android.com/tools" |     xmlns:tools="http://schemas.android.com/tools" | ||||||
|     android:layout_width="match_parent" |     android:layout_width="match_parent" | ||||||
|     android:layout_height="match_parent" |     android:layout_height="match_parent" | ||||||
|     tools:context="com.github.penfeizhou.doricdemo.pub.doric.demo.MainActivity"> |     tools:context=".MainActivity"> | ||||||
|  |  | ||||||
|     <FrameLayout |     <FrameLayout | ||||||
|         android:id="@+id/root" |         android:id="@+id/root" | ||||||
|   | |||||||
| @@ -49,9 +49,11 @@ dependencies { | |||||||
|     implementation 'androidx.appcompat:appcompat:1.1.0' |     implementation 'androidx.appcompat:appcompat:1.1.0' | ||||||
|     api 'com.github.pengfeizhou:jsc4a:0.1.0' |     api 'com.github.pengfeizhou:jsc4a:0.1.0' | ||||||
|     implementation 'com.squareup.okhttp3:okhttp:4.2.1' |     implementation 'com.squareup.okhttp3:okhttp:4.2.1' | ||||||
|     implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.0.1' |     implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.1.0' | ||||||
|     api 'org.nanohttpd:nanohttpd:2.3.1' |     api 'org.nanohttpd:nanohttpd:2.3.1' | ||||||
|     implementation 'com.google.code.gson:gson:2.8.6' |     implementation 'com.google.code.gson:gson:2.8.6' | ||||||
|  |     api "com.google.android.material:material:1.0.0" | ||||||
|  |     implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | ||||||
|  |  | ||||||
|     testImplementation 'junit:junit:4.12' |     testImplementation 'junit:junit:4.12' | ||||||
|     androidTestImplementation 'androidx.test.ext:junit:1.1.1' |     androidTestImplementation 'androidx.test.ext:junit:1.1.1' | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								Android/doric/src/main/java/pub/doric/DevPanel.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Android/doric/src/main/java/pub/doric/DevPanel.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | package pub.doric; | ||||||
|  |  | ||||||
|  | import android.os.Bundle; | ||||||
|  | import android.view.LayoutInflater; | ||||||
|  | import android.view.View; | ||||||
|  | import android.view.ViewGroup; | ||||||
|  |  | ||||||
|  | import androidx.annotation.NonNull; | ||||||
|  | import androidx.annotation.Nullable; | ||||||
|  |  | ||||||
|  | import com.google.android.material.bottomsheet.BottomSheetDialogFragment; | ||||||
|  |  | ||||||
|  | public class DevPanel extends BottomSheetDialogFragment { | ||||||
|  |  | ||||||
|  |     public DevPanel() { | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Nullable | ||||||
|  |     @Override | ||||||
|  |     public View onCreateView( | ||||||
|  |             @NonNull LayoutInflater inflater, | ||||||
|  |             @Nullable ViewGroup container, | ||||||
|  |             @Nullable Bundle savedInstanceState | ||||||
|  |     ) { | ||||||
|  |         return inflater.inflate(R.layout.layout_dev, container, false); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -67,8 +67,8 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time | |||||||
|  |  | ||||||
|  |  | ||||||
|     private void initJSExecutor() { |     private void initJSExecutor() { | ||||||
| //        mDoricJSE = new DoricNativeJSExecutor(); |         mDoricJSE = new DoricNativeJSExecutor(); | ||||||
|         mDoricJSE = new DoricRemoteJSExecutor(); | //        mDoricJSE = new DoricRemoteJSExecutor(); | ||||||
|         mDoricJSE.injectGlobalJSFunction(DoricConstant.INJECT_LOG, new JavaFunction() { |         mDoricJSE.injectGlobalJSFunction(DoricConstant.INJECT_LOG, new JavaFunction() { | ||||||
|             @Override |             @Override | ||||||
|             public JavaValue exec(JSDecoder[] args) { |             public JavaValue exec(JSDecoder[] args) { | ||||||
|   | |||||||
							
								
								
									
										34
									
								
								Android/doric/src/main/res/layout/layout_dev.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Android/doric/src/main/res/layout/layout_dev.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||||
|  |     android:layout_width="match_parent" | ||||||
|  |     android:layout_height="match_parent" | ||||||
|  |     android:orientation="vertical"> | ||||||
|  |  | ||||||
|  |     <TextView | ||||||
|  |         android:id="@+id/menu1_text_view" | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="60dp" | ||||||
|  |         android:gravity="center" | ||||||
|  |         android:text="Debug via Visual Studio Code" | ||||||
|  |         android:textSize="20sp" | ||||||
|  |         app:layout_constraintEnd_toEndOf="parent" | ||||||
|  |         app:layout_constraintStart_toStartOf="parent" | ||||||
|  |         app:layout_constraintTop_toTopOf="parent" /> | ||||||
|  |  | ||||||
|  |     <View | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="1dp" | ||||||
|  |         android:background="#cccccc" /> | ||||||
|  |  | ||||||
|  |     <TextView | ||||||
|  |         android:id="@+id/menu2_text_view" | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="60dp" | ||||||
|  |         android:gravity="center" | ||||||
|  |         android:text="Enable Hot Reload" | ||||||
|  |         android:textSize="20sp" | ||||||
|  |         app:layout_constraintEnd_toEndOf="parent" | ||||||
|  |         app:layout_constraintStart_toStartOf="parent" | ||||||
|  |         app:layout_constraintTop_toBottomOf="@+id/menu1_text_view" /> | ||||||
|  | </LinearLayout> | ||||||
		Reference in New Issue
	
	Block a user