package de.beyondsoft.ownchat.filepicker;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import de.beyondsoft.ownchat.filepicker.utils.Orientation;

/**
 * Created by Lyndon on 26-Oct-2017.
 */

public abstract class BaseFilePickerActivity extends AppCompatActivity {
    protected void onCreate(@Nullable Bundle savedInstanceState, @LayoutRes int layout) {
        super.onCreate(savedInstanceState);

        setContentView(layout);

        Orientation orientation = PickerManager.getInstance().getOrientation();

        if(orientation==Orientation.PORTRAIT_ONLY) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        } else if(orientation== Orientation.LANDSCAPE_ONLY) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        }

        initView();
    }

    protected abstract void initView();
}
