/* * Nextcloud Talk application * * @author Mario Danic * Copyright (C) 2017-2018 Mario Danic * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package com.nextcloud.talk.activities; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import com.bluelinelabs.conductor.Conductor; import com.bluelinelabs.conductor.Router; import com.bluelinelabs.conductor.RouterTransaction; import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler; import com.nextcloud.talk.R; import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.controllers.CallController; import com.nextcloud.talk.controllers.CallNotificationController; import com.nextcloud.talk.utils.bundle.BundleKeys; import autodagger.AutoInjector; import butterknife.BindView; import butterknife.ButterKnife; @AutoInjector(NextcloudTalkApplication.class) public class MagicCallActivity extends AppCompatActivity { private static final String TAG = "MagicCallActivity"; @BindView(R.id.controller_container) ViewGroup container; private Router router; private static int getSystemUiVisibility() { int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN; flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; return flags; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject (this); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); getWindow().getDecorView().setSystemUiVisibility(getSystemUiVisibility()); setContentView(R.layout.activity_magic_call); ButterKnife.bind(this); router = Conductor.attachRouter(this, container, savedInstanceState); router.setPopsLastView(true); if (!router.hasRootController()) { if (getIntent().getBooleanExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL, false)) { router.setRoot(RouterTransaction.with(new CallNotificationController(getIntent().getExtras())) .pushChangeHandler(new HorizontalChangeHandler()) .popChangeHandler(new HorizontalChangeHandler())); } else { router.setRoot(RouterTransaction.with(new CallController(getIntent().getExtras())) .pushChangeHandler(new HorizontalChangeHandler()) .popChangeHandler(new HorizontalChangeHandler())); } } } @Override public void onBackPressed() { finish(); } }