Fix issue when fullscreen
authorPeng Li <seudut@gmail.com>
Tue, 29 May 2018 04:02:25 +0000 (12:02 +0800)
committerPeng Li <seudut@gmail.com>
Tue, 29 May 2018 04:02:25 +0000 (12:02 +0800)
app/src/main/java/ai/suanzi/rtmpclient/CameraView.java
app/src/main/java/ai/suanzi/rtmpclient/LogUtil.java
app/src/main/java/ai/suanzi/rtmpclient/MainActivity.java
app/src/main/res/menu/main.xml [new file with mode: 0644]

index de88ca1..e4bc71c 100644 (file)
@@ -30,7 +30,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback {
     public void setLayout(int width, int heitht){
         this.height = heitht;
         this.width = width;
-        gLogger.error("SurfacedCreated, screen size w: " + SCREEN_WIDTH + ", h:" + SCREEN_HEIGHT + ". preview size, w: " + width + ", h: " + height);
+        gLogger.error("setLayout, screen size w: " + SCREEN_WIDTH + ", h:" + SCREEN_HEIGHT + ". preview size, w: " + width + ", h: " + height);
 
         float ratio = (float) height / width; // 3/4,,,  640x480  1008x1344
         FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)getLayoutParams();
@@ -46,6 +46,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback {
             lp.leftMargin = 0;
             lp.topMargin = (SCREEN_HEIGHT - lp.height) / 2;
         }
+        gLogger.error("width=" + lp.width + ", height=" + lp.height + ". leftMargin=" + lp.leftMargin + ", topMargin=" + lp.topMargin);
         this.setLayoutParams(lp);
     }
 
index e91b735..b15d435 100644 (file)
@@ -72,11 +72,8 @@ public class LogUtil {
 
         AsyncTask<Void, Integer, Boolean> mailTask = new AsyncTask<Void, Integer, Boolean>() {
 
-            //private String zfile = DIR + File.separator + "log.zip";
             private String zfile = mContext.getExternalCacheDir() + File.separator + "log.zip";
 
-
-
             @Override
             protected Boolean doInBackground(Void... voids) {
 
index fbe69c3..34132f1 100644 (file)
@@ -181,13 +181,16 @@ public class MainActivity extends AppCompatActivity implements MyService.MyServi
         } else {
             display.getSize(outPoint); // exclude navigation bar
         }
-        if(outPoint.y > outPoint.x) {
+        size.width = outPoint.x;
+        size.height = outPoint.y;
+
+        /*if(outPoint.y > outPoint.x) {
             size.height = outPoint.y;
             size.width = outPoint.x;
         } else {
             size.height = outPoint.x;
             size.width = outPoint.y;
-        }
+        }*/
         return size;
     }
 
@@ -214,12 +217,12 @@ public class MainActivity extends AppCompatActivity implements MyService.MyServi
 
 
 
-        //DisplayMetrics outMetrics = new DisplayMetrics();
-        //this.getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
-
-        //CameraView.SCREEN_WIDTH = outMetrics.widthPixels;
-        //CameraView.SCREEN_HEIGHT = outMetrics.heightPixels;
-        //gLogger.debug("Screen size is w: " + CameraView.SCREEN_WIDTH  + ", h: " + CameraView.SCREEN_HEIGHT);
+//        DisplayMetrics outMetrics = new DisplayMetrics();
+//        this.getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
+//
+//        CameraView.SCREEN_WIDTH = outMetrics.widthPixels;
+//        CameraView.SCREEN_HEIGHT = outMetrics.heightPixels;
+//        gLogger.debug("Screen size is w: " + CameraView.SCREEN_WIDTH  + ", h: " + CameraView.SCREEN_HEIGHT);
 
         ScreenSize size = getScreenSize();
 
diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml
new file mode 100644 (file)
index 0000000..347a188
--- /dev/null
@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/action_settings"
+        android:orderInCategory="100"
+        android:showAsAction="never"
+        android:title="setting"/>
+
+</menu>
\ No newline at end of file