Search in sources :

Example 11 with AppComponent

use of com.alexstyl.specialdates.AppComponent in project Memento-Calendar by alexstyl.

the class AddEventActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.slide_in_from_below, R.anim.stay);
    setContentView(R.layout.activity_add_event);
    AppComponent applicationModule = ((MementoApplication) getApplication()).getApplicationModule();
    applicationModule.inject(this);
    analytics.trackScreen(Screen.ADD_EVENT);
    filePathProvider = new FilePathProvider(this);
    MementoToolbar toolbar = Views.findById(this, R.id.memento_toolbar);
    setSupportActionBar(toolbar);
    toolbar.displayNavigationIconAsClose();
    AvatarPickerView avatarView = Views.findById(this, R.id.add_event_avatar);
    RecyclerView eventsView = Views.findById(this, R.id.add_event_events);
    eventsView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    eventsView.setHasFixedSize(true);
    ContactDetailsAdapter adapter = new ContactDetailsAdapter(contactDetailsListener);
    eventsView.setAdapter(adapter);
    AddEventContactEventViewModelFactory factory = new AddEventContactEventViewModelFactory(new AndroidDateLabelCreator(this));
    AddEventViewModelFactory addEventFactory = new AddEventViewModelFactory(strings);
    ContactEventsFetcher contactEventsFetcher = new ContactEventsFetcher(getSupportLoaderManager(), this, peopleEventsProvider, factory, addEventFactory);
    WriteableAccountsProvider accountsProvider = WriteableAccountsProvider.from(this);
    ContactOperations contactOperations = new ContactOperations(getContentResolver(), accountsProvider, peopleEventsProvider, ShortDateLabelCreator.INSTANCE);
    MessageDisplayer messageDisplayer = new ToastDisplayer(getApplicationContext());
    ContactOperationsExecutor operationsExecutor = new ContactOperationsExecutor(getContentResolver(), tracker);
    ImageDecoder imageDecoder = new ImageDecoder();
    AvatarPresenter avatarPresenter = new AvatarPresenter(imageLoader, avatarView, createToolbarAnimator(toolbar), imageDecoder);
    EventsPresenter eventsPresenter = new EventsPresenter(contactEventsFetcher, adapter, factory, addEventFactory);
    presenter = new AddContactEventsPresenter(analytics, avatarPresenter, eventsPresenter, contactOperations, messageDisplayer, operationsExecutor);
    permissionChecker = new AndroidPermissions(tracker, this);
    presenter.startPresenting(new OnCameraClickedListener() {

        @RequiresApi(api = Build.VERSION_CODES.M)
        @Override
        public void onPictureRetakenRequested() {
            if (permissionChecker.canReadExternalStorage()) {
                BottomSheetPicturesDialog.includeClearImageOption().show(getSupportFragmentManager(), "picture_pick");
            } else {
                requestExternalStoragePermission();
            }
        }

        @RequiresApi(api = Build.VERSION_CODES.M)
        @Override
        public void onNewPictureTakenRequested() {
            if (permissionChecker.canReadExternalStorage()) {
                BottomSheetPicturesDialog.newInstance().show(getSupportFragmentManager(), "picture_pick");
            } else {
                requestExternalStoragePermission();
            }
        }

        @RequiresApi(api = Build.VERSION_CODES.M)
        private void requestExternalStoragePermission() {
            requestPermissions(new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, CODE_PERMISSION_EXTERNAL_STORAGE);
        }
    });
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MementoToolbar(com.alexstyl.specialdates.ui.widget.MementoToolbar) AndroidDateLabelCreator(com.alexstyl.specialdates.date.AndroidDateLabelCreator) MementoApplication(com.alexstyl.specialdates.MementoApplication) ImageDecoder(com.alexstyl.specialdates.images.ImageDecoder) AvatarPickerView(com.alexstyl.specialdates.addevent.ui.AvatarPickerView) AndroidPermissions(com.alexstyl.specialdates.permissions.AndroidPermissions) AppComponent(com.alexstyl.specialdates.AppComponent) RequiresApi(android.support.annotation.RequiresApi) RecyclerView(android.support.v7.widget.RecyclerView)

Example 12 with AppComponent

use of com.alexstyl.specialdates.AppComponent in project Memento-Calendar by alexstyl.

the class UpcomingWidgetConfigureActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppComponent applicationModule = ((MementoApplication) getApplication()).getApplicationModule();
    applicationModule.inject(this);
    setContentView(R.layout.activity_upcoming_events_widget_configure);
    MementoToolbar mementoToolbar = Views.findById(this, R.id.memento_toolbar);
    setSupportActionBar(mementoToolbar);
    backgroundView = Views.findById(this, R.id.upcoming_widget_wallpaper);
    previewLayout = Views.findById(this, R.id.upcoming_widget_preview);
    configurationPanel = Views.findById(this, R.id.upcoming_widget_configure_panel);
    configurationPanel.setListener(configurationListener);
    preferences = new UpcomingWidgetPreferences(this);
    initialisePreview(preferences);
    considerAsNotComplete();
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }
}
Also used : MementoApplication(com.alexstyl.specialdates.MementoApplication) Bundle(android.os.Bundle) AppComponent(com.alexstyl.specialdates.AppComponent) Intent(android.content.Intent) MementoToolbar(com.alexstyl.specialdates.ui.widget.MementoToolbar)

Example 13 with AppComponent

use of com.alexstyl.specialdates.AppComponent in project Memento-Calendar by alexstyl.

the class DailyReminderIntentService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    AppComponent applicationModule = ((MementoApplication) getApplication()).getApplicationModule();
    applicationModule.inject(this);
    bankHolidaysPreferences = AndroidBankHolidaysPreferences.newInstance(this);
    checker = new AndroidPermissions(tracker, this);
}
Also used : AndroidPermissions(com.alexstyl.specialdates.permissions.AndroidPermissions) MementoApplication(com.alexstyl.specialdates.MementoApplication) AppComponent(com.alexstyl.specialdates.AppComponent)

Example 14 with AppComponent

use of com.alexstyl.specialdates.AppComponent in project Memento-Calendar by alexstyl.

the class UpcomingEventsFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppComponent applicationModule = ((MementoApplication) getActivity().getApplication()).getApplicationModule();
    applicationModule.inject(this);
    askForSupport = new AskForSupport(getActivity());
    refresher.addEventsView(this);
}
Also used : AskForSupport(com.alexstyl.specialdates.support.AskForSupport) MementoApplication(com.alexstyl.specialdates.MementoApplication) AppComponent(com.alexstyl.specialdates.AppComponent)

Example 15 with AppComponent

use of com.alexstyl.specialdates.AppComponent in project Memento-Calendar by alexstyl.

the class FacebookProfileActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppComponent applicationModule = ((MementoApplication) getApplication()).getApplicationModule();
    applicationModule.inject(this);
    analytics.trackScreen(Screen.FACEBOOK_PROFILE);
    setContentView(R.layout.activity_facebook_profile);
    setupToolbar();
    profilePicture = findById(this, R.id.facebook_profile_avatar);
    userName = findById(this, R.id.facebook_profile_name);
    findById(this, R.id.facebook_profile_fb_page).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            navigator.toFacebookPage();
        }
    });
    FacebookFriendsPersister persister = new FacebookFriendsPersister(new AndroidPeopleEventsPersister(new EventSQLiteOpenHelper(this), marshaller, tracker));
    navigator = new ExternalNavigator(this, analytics, tracker);
    FacebookLogoutService service = new FacebookLogoutService(AndroidSchedulers.mainThread(), facebookSettings, persister, uiRefresher, onLogOut());
    presenter = new FacebookProfilePresenter(service, this, facebookSettings);
    presenter.startPresenting();
}
Also used : FacebookFriendsPersister(com.alexstyl.specialdates.facebook.friendimport.FacebookFriendsPersister) ExternalNavigator(com.alexstyl.specialdates.ExternalNavigator) AndroidPeopleEventsPersister(com.alexstyl.specialdates.events.peopleevents.AndroidPeopleEventsPersister) MementoApplication(com.alexstyl.specialdates.MementoApplication) AppComponent(com.alexstyl.specialdates.AppComponent) EventSQLiteOpenHelper(com.alexstyl.specialdates.events.database.EventSQLiteOpenHelper) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Aggregations

AppComponent (com.alexstyl.specialdates.AppComponent)18 MementoApplication (com.alexstyl.specialdates.MementoApplication)17 View (android.view.View)4 Preference (android.preference.Preference)3 ImageView (android.widget.ImageView)3 AndroidPermissions (com.alexstyl.specialdates.permissions.AndroidPermissions)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Toolbar (android.support.v7.widget.Toolbar)2 TextView (android.widget.TextView)2 ExternalNavigator (com.alexstyl.specialdates.ExternalNavigator)2 AndroidDateLabelCreator (com.alexstyl.specialdates.date.AndroidDateLabelCreator)2 AndroidDonationService (com.alexstyl.specialdates.donate.AndroidDonationService)2 Donation (com.alexstyl.specialdates.donate.Donation)2 DonationCallbacks (com.alexstyl.specialdates.donate.DonationCallbacks)2 IabHelper (com.alexstyl.specialdates.donate.util.IabHelper)2 NamedayLocale (com.alexstyl.specialdates.events.namedays.NamedayLocale)2 MementoToolbar (com.alexstyl.specialdates.ui.widget.MementoToolbar)2 AlarmManager (android.app.AlarmManager)1 Context (android.content.Context)1