use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.
the class WebTokenRequest method getToken.
/**
* Request a new token if the application has not been authenticated,
* other wise request a new refresh token and replace the current token
* retaining the refresh token key
*/
public static void getToken(Context context) {
synchronized (lock) {
if (new ApplicationPref(context).isAuthenticated()) {
BasePresenter presenter = new BasePresenter(context);
if (token == null || token.getExpires() < (System.currentTimeMillis() / 1000L)) {
token = presenter.getDatabase().getWebToken();
checkTokenState(context, presenter);
}
}
}
}
use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.
the class NotificationSyncTask method onHandleInit.
private void onHandleInit(Context context) {
presenter = new BasePresenter(context);
if (presenter.getApplicationPref().isAuthenticated()) {
UserModel requestModel = WebFactory.createService(UserModel.class, context);
checkNotificationCount(requestModel);
} else {
JobSchedulerUtil.cancelJob(context);
Log.e(TAG, "JobDispatcher has been unscheduled to avoid posting of notification while the user is not authenticated.");
}
}
use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.
the class BottomSheetBase method onCreate.
/**
* Set up your custom bottom sheet and check for arguments if any
*/
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
TAG = this.toString();
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mTitle = getArguments().getInt(KeyUtil.arg_title);
mText = getArguments().getInt(KeyUtil.arg_text);
mPositive = getArguments().getInt(KeyUtil.arg_positive_text);
mNegative = getArguments().getInt(KeyUtil.arg_negative_text);
}
presenter = new BasePresenter(getContext());
}
use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.
the class MainActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
setPresenter(new BasePresenter(getApplicationContext()));
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
if (savedInstanceState == null)
redirectShortcut = getIntent().getIntExtra(KeyUtil.arg_redirect, 0);
}
use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.
the class SplashActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
ButterKnife.bind(this);
setPresenter(new BasePresenter(this));
setViewModel(true);
}
Aggregations