android – Camera preview in framelayout with distorted picture

Need help again!

I am developing an app that only uses the smartphone camera to show the camera, ie it does not record any photos or videos, just a preview.

Already managed to open the smartphone camera in activity and all. The problem was that I noticed my app's camera view compared to other apps and the default app on my smartphone and noticed that my app was distorting the image displayed on my camera.

Below the pictures, to illustrate what happens.

Note: Both pictures were taken from the same distance and position.

Figure 1 – Standard Smartphone Camera and Normal Mode (ORIENTATION_LANDSCAPE)

Enter image description here

Picture 2 – Camera of my app and normal mode (ORIENTATION_LANDSCAPE)

Enter image description here

Note that Image 1, is sharper and "thinner", ie original image size without zoom included. Nice picture 2, is "chubby" flattened, ie distorted.

Below the code of the classes, layout XML and manifest file of the application:





public class MainActivity extends AppCompatActivity {

Camera camera;
FrameLayout frameLayout;
CameraPreview cameraPreview;

protected void onCreate(Bundle savedInstanceState) {

    frameLayout = findViewById(;
    camera =;
    cameraPreview = new CameraPreview(this, camera);


public void onWindowFocusChanged(boolean hasFocus) {
    View decorView = getWindow().getDecorView();
    if (hasFocus){
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

protected void onPause() {
    if (camera != null){
        camera = null;



public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback{

Camera camera;
SurfaceHolder holder;

public CameraPreview(Context context, Camera camera) {
    super(context); = camera;
    this.holder = getHolder();


public void surfaceCreated(SurfaceHolder holder) {
    Camera.Parameters parameters = camera.getParameters();
    List sizes = parameters.getSupportedPictureSizes();
    Camera.Size mSize = null;

    for (Camera.Size size: sizes){
        mSize = size;

    if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE){
        parameters.set("orientation", "portrait");
    }else {
        parameters.set("orientation", "portrait");

    parameters.setPictureSize(mSize.width, mSize.height);

    try {
    } catch (IOException e){

public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {


public void surfaceDestroyed(SurfaceHolder holder) {






If someone can give me a light where I make a mistake, thank you?

Theme Development – Custom post pages use the correct template in preview mode, but display a different template after posting

I developed a WordPress theme. I've created a custom post type called functions.php called blog.

// Blog Post Type Creation
function te_blog_type() {
            "rewrite" => array("slug" => "blogs"),
            "labels" => array(
                "name" => "Blogs",
                "singular_name" => "Blog",
                "add_new_item" => "Add New Blog",
                "edit_item" => "Edit Blog"
            "menu-icon" => "dashicons-format-status",
            "public" => true,
            "has_archive" => true, 
            "supports" => array(
                "title", "thumbnail", "editor", "excerpt", "comments"
            "taxonomies" => array("category", "post_tag", "blog_tag")

add_action("init", "te_blog_type");

It worked well.

I've also created a single-blog.php file as a template for each blog post.
When I preview the blog post. It uses the right template from single-blog.php. However, when I post a blog, index.php appears as a template. What caused that?

8 – Change the page title in the preview preprocessing function

I want to be able to change the main line page Title based on a value that I get in a preview preprocessing function.

The view is displayed as a page.

function MYTHEME_preprocess_views_view(&$variables) {

  // Can I set the page title from here?

The title I am trying to overwrite is the title given by the /templates/content/page-title.html.twig below:

 * @file
 * Theme override for page titles.
 * Available variables:
 * - title_attributes: HTML attributes for the page title element.
 * - title_prefix: Additional output populated by modules, intended to be
 *   displayed in front of the main title tag that appears in the template.
 * - title: The page title, for use in the actual content.
 * - title_suffix: Additional output populated by modules, intended to be
 *   displayed after the main title tag that appears in the template.
{{ title_prefix }}
{% if title %}
  {{ title }}
{% endif %}
{{ title_suffix }}

Run C # code in the ASP.NET Core Razor page model or in Print Preview

Today I'm doing something where I get some data, select, sort, and pass it to the view (which loads a partial view) as a list of custom objects

Note that the code below the code is removed and is ASP.NET Core 2.2 with Razor pages.

page model

public PagesSettings PageSettings { get; set; }
public List itemListReportages { get; set; }

public void OnGet()
    var fileContent = _fileService.GetFileContentCached(PageSettings.DataFile);

    if (fileContent?.Result.Length > 0)
        itemListReportages = new List(JsonConvert.DeserializeObject>(fileContent.Result))
            .Where(l => l.Published)
            .OrderBy(l => l.Name)


@model ListReportagesModel

partial view

@for (var i = 0; i < Model.itemListReportages.Count; i++)

It's starting to get busy now PageModelSo I started wondering where the right place to run C # code is. At the top, loading / selecting / sorting of the data is done in PageModel and the rest in the view.

I intended to divide it as follows and to move the selection / sorting of Pagemodel on the partial view, and thus reduce the amount of Pagemodeland simplify adding data by simply creating a new class + data file + partial view.

My question is which way (if any) is recommended and if there are some * performance issues with the following ones (especially at higher workloads).

* In terms of performance, I have done some simpler tests, though they do not differ much. The question is, is there anything under the hood that gives one or the other preference.

page model

public PagesSettings PageSettings { get; set; }
public Task fileContent { get; set; }

public void OnGet()
    fileContent = _fileService.GetFileContentCached("path-to-data");

partial view

if (fileContent?.Result.Length > 0)
    var itemListReportages = new List(JsonConvert.DeserializeObject>(fileContent.Result))
        .Where(l => l.Published)
        .OrderBy(l => l.Name)

    @for (var i = 0; i < Model.itemListReportages.Count; i++)
} }

Change the live preview feature of iFrame SRC for WordPress Theme Customizers

I have a WordPress application installed in a subdomain (eg and use a subdirectory (eg behind a reverse proxy as a permalink.

WP uses the WP_HOME URL, but I need it to use WP_SITEURL. I can replace the URL for previewing posts with the preview_post_link hook. However, I can not find a solution for the Theme Customizer.

I know that the URL for the Theme Customizer iFrame is set in wp-admin / customize-control.js. However, the file is large (7K + lines) and there seem to be several conditions that determine how the URL is set.

mac os x – What is the name of this preview template for vertical tabs?

In Mac OS X System Preferences, the following preview pattern appears: A list of options on the left side, displayed as vertical tabs, and a preview window for each option you select. In this particular case, a video will be played to clarify this option.


I saw the same pattern on another website (Atlassian, I think) to display multiple, grouped features in a way that allows you to see information in very close proximity.

Now that I want to use a similar pattern, I'm curious if it's normal vertical tabs or something else.

Prevent the SharePoint Migration Tool Public Preview from executing workflows during migration from SP 2010 to SP Online

We would like to migrate a local sharepoint 2010 to an online Sharepoint. We are planning a test migration with the "SharePoint Migration Tool Public Preview", which was downloaded from

Now our SP 2010 contains many subpages, document libraries and lists + some libraries and lists are linked to workflows. These workflows are executed when adding / editing the elements. So I need to make sure these workflows do not run during the migration, as this can cause hundreds of emails to be sent and external systems to be updated that should not be run during the migration. The workflows must be migrated, but they did not run during the migration. I reviewed the available options in the SharePoint Migration Tool Public Preview tool. However, no option was found to display the workflows that were running during the migration, or will that happen immediately?

Many Thanks

navigation – What is a user-friendly way to exit a preview screen?

I have a mobile Android application that allows users to set the layout of the on-screen items through a form. The user can also preview the custom layout in full screen mode. However, the use of the back key (soft key) is not available, and a navigation header provides more clutter. Is there a clean, intuitive approach to responding to user input to finish the preview?

I thought about adding a button Tap to exit Approach. A button is not very desirable because it adds clutter. In addition, it can be assumed that the button is part of the preview. Allows the user Tap to exit is fine, but I find the approach vulnerable to accidental touch and not immediately intuitive for a user. Responding to multiple touches in a given time frame is not a terrible approach. double-tap.

Uploaded video on Google Drive constantly shows a preview with "Whoops! There was a problem playing this video."

It does not really have anything to do with formats. Google Drive seems to have an error when attempting to use multiple Google Accounts on the same computer from the drop-down list; Upload to the drive of your personal Gmail account if you have another business account that you use in 90% of the time. You may find that this is the case because clicking on the video itself displays a 403 error even if you have the required credentials.

  1. The easiest way is to use the incognito mode, sign in and see the preview of the video properly. There is actually no problem with the video format.
  2. Alternatively, you can log out of any accounts that you do not need for the drive.