kopia lustrzana https://github.com/xdsopl/robot36
take width and height from config
rodzic
a505e5f937
commit
bd40d8ec2b
|
@ -26,7 +26,6 @@ import android.os.ParcelFileDescriptor;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -389,12 +388,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
thinColor = getColor(R.color.thin);
|
thinColor = getColor(R.color.thin);
|
||||||
tintColor = getColor(R.color.tint);
|
tintColor = getColor(R.color.tint);
|
||||||
scopeBuffer = new PixelBuffer(640, 2 * 1280);
|
scopeBuffer = new PixelBuffer(640, 2 * 1280);
|
||||||
createScope(config);
|
|
||||||
freqPlotBuffer = new PixelBuffer(256, 2 * 256);
|
freqPlotBuffer = new PixelBuffer(256, 2 * 256);
|
||||||
createFreqPlot(config);
|
|
||||||
peakMeterBuffer = new PixelBuffer(1, 16);
|
peakMeterBuffer = new PixelBuffer(1, 16);
|
||||||
createPeakMeter();
|
|
||||||
imageBuffer = new PixelBuffer(640, 496);
|
imageBuffer = new PixelBuffer(640, 496);
|
||||||
|
createScope(config);
|
||||||
|
createFreqPlot(config);
|
||||||
|
createPeakMeter();
|
||||||
List<String> permissions = new ArrayList<>();
|
List<String> permissions = new ArrayList<>();
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
|
||||||
permissions.add(Manifest.permission.RECORD_AUDIO);
|
permissions.add(Manifest.permission.RECORD_AUDIO);
|
||||||
|
@ -587,11 +586,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
private void createScope(Configuration config) {
|
private void createScope(Configuration config) {
|
||||||
int width = scopeBuffer.width;
|
int width = scopeBuffer.width;
|
||||||
int height = scopeBuffer.height / 2;
|
int height = scopeBuffer.height / 2;
|
||||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
|
||||||
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||||
height /= 2;
|
height /= 2;
|
||||||
else
|
else
|
||||||
height = Math.min(Math.max((width * (metrics.heightPixels - 257)) / metrics.widthPixels, height / 2), height);
|
height = Math.min(Math.max((width * (config.screenHeightDp - 101)) / config.screenWidthDp, height / 2), height);
|
||||||
scopeBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
scopeBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||||
int stride = scopeBuffer.width;
|
int stride = scopeBuffer.width;
|
||||||
int offset = stride * (scopeBuffer.line + scopeBuffer.height / 2 - height);
|
int offset = stride * (scopeBuffer.line + scopeBuffer.height / 2 - height);
|
||||||
|
|
Ładowanie…
Reference in New Issue