/*
* Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://mindorks.com/license/apache-v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.mindorks.framework.mvp.ui.splash;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.mindorks.framework.mvp.R;
import com.mindorks.framework.mvp.ui.base.BaseActivity;
import com.mindorks.framework.mvp.ui.login.LoginActivity;
import com.mindorks.framework.mvp.ui.main.MainActivity;
import javax.inject.Inject;
import butterknife.ButterKnife;
/**
* Created by janisharali on 27/01/17.
*/
public class SplashActivity extends BaseActivity implements SplashMvpView {
@Inject
SplashMvpPresenter<SplashMvpView> mPresenter;
public static Intent getStartIntent(Context context) {
Intent intent = new Intent(context, SplashActivity.class);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
getActivityComponent().inject(this);
setUnBinder(ButterKnife.bind(this));
mPresenter.onAttach(SplashActivity.this);
}
/**
* Making the screen wait so that the branding can be shown
*/
@Override
public void openLoginActivity() {
Intent intent = LoginActivity.getStartIntent(SplashActivity.this);
startActivity(intent);
finish();
}
@Override
public void openMainActivity() {
Intent intent = MainActivity.getStartIntent(SplashActivity.this);
startActivity(intent);
finish();
}
@Override
public void startSyncService() {
// SyncService.start(this);
}
@Override
protected void onDestroy() {
mPresenter.onDetach();
super.onDestroy();
}
@Override
protected void setUp() {
}
}