Search in sources :

Example 1 with AppBarSV

use of m.co.rh.id.a_medic_log.app.ui.component.AppBarSV in project a-medic-log by rh-id.

the class MedicineReminderDetailPage method provideComponent.

@Override
public void provideComponent(Provider provider) {
    boolean isUpdate = isUpdate();
    mSvProvider = provider.get(StatefulViewProvider.class);
    mRxDisposer = mSvProvider.get(RxDisposer.class);
    if (isUpdate) {
        mNewMedicineReminderCmd = mSvProvider.get(UpdateMedicineReminderCmd.class);
    } else {
        mNewMedicineReminderCmd = mSvProvider.get(NewMedicineReminderCmd.class);
    }
    if (mAppBarSv == null) {
        mAppBarSv = new AppBarSV(R.menu.page_medicine_reminder_detail);
    }
    if (isUpdate) {
        mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_update_medicine_reminder));
    } else {
        mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_add_medicine_reminder));
    }
    mAppBarSv.setMenuItemListener(this);
    initTextWatcher();
}
Also used : AppBarSV(m.co.rh.id.a_medic_log.app.ui.component.AppBarSV) UpdateMedicineReminderCmd(m.co.rh.id.a_medic_log.app.provider.command.UpdateMedicineReminderCmd) StatefulViewProvider(m.co.rh.id.a_medic_log.app.provider.StatefulViewProvider) RxDisposer(m.co.rh.id.a_medic_log.app.rx.RxDisposer) NewMedicineReminderCmd(m.co.rh.id.a_medic_log.app.provider.command.NewMedicineReminderCmd)

Example 2 with AppBarSV

use of m.co.rh.id.a_medic_log.app.ui.component.AppBarSV in project a-medic-log by rh-id.

the class NoteAttachmentDetailPage method provideComponent.

@Override
public void provideComponent(Provider provider) {
    mSvProvider = provider.get(StatefulViewProvider.class);
    mExecutorService = mSvProvider.get(ExecutorService.class);
    mRxDisposer = mSvProvider.get(RxDisposer.class);
    mFileHelper = mSvProvider.get(FileHelper.class);
    mLogger = mSvProvider.get(ILogger.class);
    mNewNoteAttachmentFileCmd = mSvProvider.get(NewNoteAttachmentFileCmd.class);
    mDeleteNoteAttachmentFileCmd = mSvProvider.get(DeleteNoteAttachmentFileCmd.class);
    boolean isUpdate = isUpdate();
    if (isUpdate) {
        mNewNoteAttachmentCmd = mSvProvider.get(UpdateNoteAttachmentCmd.class);
    } else {
        mNewNoteAttachmentCmd = mSvProvider.get(NewNoteAttachmentCmd.class);
    }
    if (mAppBarSV == null) {
        mAppBarSV = new AppBarSV(R.menu.page_note_attachment_detail);
    }
    if (mNoteAttachmentState == null) {
        if (isUpdate) {
            mNoteAttachmentState = getNoteAttachmentState();
        } else {
            mNoteAttachmentState = new NoteAttachmentState();
            if (shouldSave()) {
                mNoteAttachmentState.setNoteId(getNoteId());
            }
        }
    }
    mNameTextWatcher = new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        // leave blank
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        // leave blank
        }

        @Override
        public void afterTextChanged(Editable editable) {
            String name = editable.toString();
            mNoteAttachmentState.setName(name);
            mNewNoteAttachmentCmd.valid(mNoteAttachmentState);
        }
    };
    mNoteAttachmentFileRecyclerViewAdapter = new NoteAttachmentFileRecyclerViewAdapter(mNoteAttachmentState, this, mNavigator, this);
}
Also used : NoteAttachmentState(m.co.rh.id.a_medic_log.base.state.NoteAttachmentState) AppBarSV(m.co.rh.id.a_medic_log.app.ui.component.AppBarSV) DeleteNoteAttachmentFileCmd(m.co.rh.id.a_medic_log.app.provider.command.DeleteNoteAttachmentFileCmd) NewNoteAttachmentFileCmd(m.co.rh.id.a_medic_log.app.provider.command.NewNoteAttachmentFileCmd) StatefulViewProvider(m.co.rh.id.a_medic_log.app.provider.StatefulViewProvider) RxDisposer(m.co.rh.id.a_medic_log.app.rx.RxDisposer) NoteAttachmentFileRecyclerViewAdapter(m.co.rh.id.a_medic_log.app.ui.component.note.attachment.NoteAttachmentFileRecyclerViewAdapter) FileHelper(m.co.rh.id.a_medic_log.base.provider.FileHelper) UpdateNoteAttachmentCmd(m.co.rh.id.a_medic_log.app.provider.command.UpdateNoteAttachmentCmd) NewNoteAttachmentCmd(m.co.rh.id.a_medic_log.app.provider.command.NewNoteAttachmentCmd) ExecutorService(java.util.concurrent.ExecutorService) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) ILogger(m.co.rh.id.alogger.ILogger)

Example 3 with AppBarSV

use of m.co.rh.id.a_medic_log.app.ui.component.AppBarSV in project a-medic-log by rh-id.

the class NoteDetailPage method provideComponent.

@Override
public void provideComponent(Provider provider) {
    mExecutorService = provider.get(ExecutorService.class);
    mSvProvider = provider.get(StatefulViewProvider.class);
    mLogger = mSvProvider.get(ILogger.class);
    mRxDisposer = mSvProvider.get(RxDisposer.class);
    mMedicineReminderChangeNotifier = mSvProvider.get(MedicineReminderChangeNotifier.class);
    mNoteAttachmentFileChangeNotifier = mSvProvider.get(NoteAttachmentFileChangeNotifier.class);
    mQueryNoteCmd = mSvProvider.get(QueryNoteCmd.class);
    boolean isUpdate = isUpdate();
    if (isUpdate) {
        mNewNoteCmd = mSvProvider.get(UpdateNoteCmd.class);
    } else {
        mNewNoteCmd = mSvProvider.get(NewNoteCmd.class);
    }
    mDeleteNoteTagCmd = mSvProvider.get(DeleteNoteTagCmd.class);
    mDeleteNoteAttachmentCmd = mSvProvider.get(DeleteNoteAttachmentCmd.class);
    if (mNoteState == null) {
        mNoteState = new NoteState();
        if (isUpdate) {
            mNoteState.setNoteId(getNoteId());
            mRxDisposer.add("provideComponent_queryNoteInfo", mQueryNoteCmd.queryNoteInfo(mNoteState).subscribe((noteState, throwable) -> {
                if (throwable != null) {
                    mLogger.e(TAG, throwable.getMessage(), throwable);
                }
            }));
        } else {
            mNoteState.setNoteProfileId(getProfileId());
        }
    }
    if (mAppBarSv == null) {
        mAppBarSv = new AppBarSV(R.menu.page_note_detail);
    }
    if (isUpdate) {
        mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_update_note));
    } else {
        mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_add_note));
    }
    mAppBarSv.setMenuItemListener(this);
    initTextWatcher();
    mMedicineRecyclerViewAdapter = new MedicineRecyclerViewAdapter(mNoteState, this, this, this, this, mNavigator, this);
    mNoteAttachmentRecyclerViewAdapter = new NoteAttachmentRecyclerViewAdapter(mNoteState, this, this, mNavigator, this);
    mCompositeDisposable = new CompositeDisposable();
}
Also used : DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) Chip(com.google.android.material.chip.Chip) Date(java.util.Date) NoteState(m.co.rh.id.a_medic_log.base.state.NoteState) ILogger(m.co.rh.id.alogger.ILogger) AppBarSV(m.co.rh.id.a_medic_log.app.ui.component.AppBarSV) NoteAttachmentItemSV(m.co.rh.id.a_medic_log.app.ui.component.note.attachment.NoteAttachmentItemSV) MedicineRecyclerViewAdapter(m.co.rh.id.a_medic_log.app.ui.component.medicine.MedicineRecyclerViewAdapter) UiUtils(m.co.rh.id.a_medic_log.app.util.UiUtils) View(android.view.View) Button(android.widget.Button) RecyclerView(androidx.recyclerview.widget.RecyclerView) NoteAttachmentRecyclerViewAdapter(m.co.rh.id.a_medic_log.app.ui.component.note.attachment.NoteAttachmentRecyclerViewAdapter) SerialBehaviorSubject(m.co.rh.id.a_medic_log.base.rx.SerialBehaviorSubject) StatefulView(m.co.rh.id.anavigator.StatefulView) MedicineState(m.co.rh.id.a_medic_log.base.state.MedicineState) DeleteNoteTagCmd(m.co.rh.id.a_medic_log.app.provider.command.DeleteNoteTagCmd) NoteAttachmentFileChangeNotifier(m.co.rh.id.a_medic_log.app.provider.notifier.NoteAttachmentFileChangeNotifier) ViewGroup(android.view.ViewGroup) Serializable(java.io.Serializable) AndroidSchedulers(io.reactivex.rxjava3.android.schedulers.AndroidSchedulers) TextView(android.widget.TextView) StatefulViewProvider(m.co.rh.id.a_medic_log.app.provider.StatefulViewProvider) DeleteMedicineCmd(m.co.rh.id.a_medic_log.app.provider.command.DeleteMedicineCmd) Toolbar(androidx.appcompat.widget.Toolbar) NoteTag(m.co.rh.id.a_medic_log.base.entity.NoteTag) TextWatcher(android.text.TextWatcher) Context(android.content.Context) MedicineItemSV(m.co.rh.id.a_medic_log.app.ui.component.medicine.MedicineItemSV) NewNoteCmd(m.co.rh.id.a_medic_log.app.provider.command.NewNoteCmd) NoteAttachmentState(m.co.rh.id.a_medic_log.base.state.NoteAttachmentState) MedicineReminderChangeNotifier(m.co.rh.id.a_medic_log.app.provider.notifier.MedicineReminderChangeNotifier) ChipGroup(com.google.android.material.chip.ChipGroup) QueryNoteCmd(m.co.rh.id.a_medic_log.app.provider.command.QueryNoteCmd) Editable(android.text.Editable) TreeSet(java.util.TreeSet) MenuItem(android.view.MenuItem) Schedulers(io.reactivex.rxjava3.schedulers.Schedulers) NavInject(m.co.rh.id.anavigator.annotation.NavInject) NavRoute(m.co.rh.id.anavigator.NavRoute) CompositeDisposable(io.reactivex.rxjava3.disposables.CompositeDisposable) RequireNavigator(m.co.rh.id.anavigator.component.RequireNavigator) INavigator(m.co.rh.id.anavigator.component.INavigator) ExecutorService(java.util.concurrent.ExecutorService) Provider(m.co.rh.id.aprovider.Provider) RequireNavRoute(m.co.rh.id.anavigator.component.RequireNavRoute) Routes(m.co.rh.id.a_medic_log.app.constants.Routes) UpdateNoteCmd(m.co.rh.id.a_medic_log.app.provider.command.UpdateNoteCmd) NavExtDialogConfig(m.co.rh.id.anavigator.extension.dialog.ui.NavExtDialogConfig) RequireComponent(m.co.rh.id.anavigator.component.RequireComponent) DeleteNoteAttachmentCmd(m.co.rh.id.a_medic_log.app.provider.command.DeleteNoteAttachmentCmd) RxDisposer(m.co.rh.id.a_medic_log.app.rx.RxDisposer) R(m.co.rh.id.a_medic_log.R) Activity(android.app.Activity) EditText(android.widget.EditText) NoteAttachmentRecyclerViewAdapter(m.co.rh.id.a_medic_log.app.ui.component.note.attachment.NoteAttachmentRecyclerViewAdapter) AppBarSV(m.co.rh.id.a_medic_log.app.ui.component.AppBarSV) UpdateNoteCmd(m.co.rh.id.a_medic_log.app.provider.command.UpdateNoteCmd) NewNoteCmd(m.co.rh.id.a_medic_log.app.provider.command.NewNoteCmd) StatefulViewProvider(m.co.rh.id.a_medic_log.app.provider.StatefulViewProvider) DeleteNoteTagCmd(m.co.rh.id.a_medic_log.app.provider.command.DeleteNoteTagCmd) NoteAttachmentFileChangeNotifier(m.co.rh.id.a_medic_log.app.provider.notifier.NoteAttachmentFileChangeNotifier) MedicineRecyclerViewAdapter(m.co.rh.id.a_medic_log.app.ui.component.medicine.MedicineRecyclerViewAdapter) RxDisposer(m.co.rh.id.a_medic_log.app.rx.RxDisposer) NoteState(m.co.rh.id.a_medic_log.base.state.NoteState) DeleteNoteAttachmentCmd(m.co.rh.id.a_medic_log.app.provider.command.DeleteNoteAttachmentCmd) ExecutorService(java.util.concurrent.ExecutorService) ILogger(m.co.rh.id.alogger.ILogger) MedicineReminderChangeNotifier(m.co.rh.id.a_medic_log.app.provider.notifier.MedicineReminderChangeNotifier) QueryNoteCmd(m.co.rh.id.a_medic_log.app.provider.command.QueryNoteCmd) CompositeDisposable(io.reactivex.rxjava3.disposables.CompositeDisposable)

Example 4 with AppBarSV

use of m.co.rh.id.a_medic_log.app.ui.component.AppBarSV in project a-medic-log by rh-id.

the class MedicineDetailPage method provideComponent.

@Override
public void provideComponent(Provider provider) {
    boolean isUpdate = isUpdate();
    mExecutorService = provider.get(ExecutorService.class);
    mSvProvider = provider.get(StatefulViewProvider.class);
    mRxDisposer = mSvProvider.get(RxDisposer.class);
    mMedicineReminderChangeNotifier = mSvProvider.get(MedicineReminderChangeNotifier.class);
    if (isUpdate) {
        mNewMedicineCmd = mSvProvider.get(UpdateMedicineCmd.class);
    } else {
        mNewMedicineCmd = mSvProvider.get(NewMedicineCmd.class);
    }
    mQueryMedicineCmd = mSvProvider.get(QueryMedicineCmd.class);
    if (mAppBarSv == null) {
        mAppBarSv = new AppBarSV(R.menu.page_medicine_detail);
    }
    if (isUpdate) {
        mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_update_medicine));
    } else {
        mAppBarSv.setTitle(mNavigator.getActivity().getString(R.string.title_add_medicine));
    }
    mAppBarSv.setMenuItemListener(this);
    if (mMedicineState == null) {
        mMedicineState = getMedicineState();
        if (!isUpdate && shouldSave()) {
            mMedicineState.setNoteId(getNoteId());
        }
    }
    initTextWatcher();
    mMedicineReminderRecyclerViewAdapter = new MedicineReminderRecyclerViewAdapter(mMedicineState, this, this, this, mNavigator, this);
    mSuggestionQuery = s -> mQueryMedicineCmd.searchMedicineName(s).blockingGet();
}
Also used : MedicineReminderRecyclerViewAdapter(m.co.rh.id.a_medic_log.app.ui.component.medicine.reminder.MedicineReminderRecyclerViewAdapter) AppBarSV(m.co.rh.id.a_medic_log.app.ui.component.AppBarSV) QueryMedicineCmd(m.co.rh.id.a_medic_log.app.provider.command.QueryMedicineCmd) NewMedicineCmd(m.co.rh.id.a_medic_log.app.provider.command.NewMedicineCmd) ExecutorService(java.util.concurrent.ExecutorService) StatefulViewProvider(m.co.rh.id.a_medic_log.app.provider.StatefulViewProvider) MedicineReminderChangeNotifier(m.co.rh.id.a_medic_log.app.provider.notifier.MedicineReminderChangeNotifier) RxDisposer(m.co.rh.id.a_medic_log.app.rx.RxDisposer) UpdateMedicineCmd(m.co.rh.id.a_medic_log.app.provider.command.UpdateMedicineCmd)

Example 5 with AppBarSV

use of m.co.rh.id.a_medic_log.app.ui.component.AppBarSV in project a-medic-log by rh-id.

the class NoteListPage method provideComponent.

@Override
public void provideComponent(Provider provider) {
    Activity activity = mNavigator.getActivity();
    if (mAppBarSV == null) {
        mAppBarSV = new AppBarSV(R.menu.page_profile_list);
    }
    mAppBarSV.setTitle(activity.getString(R.string.title_note_list));
    mAppBarSV.setMenuItemListener(this);
    if (mNoteListSV == null) {
        mNoteListSV = new NoteListSV(getProfileId());
    }
}
Also used : AppBarSV(m.co.rh.id.a_medic_log.app.ui.component.AppBarSV) Activity(android.app.Activity) NoteListSV(m.co.rh.id.a_medic_log.app.ui.component.note.NoteListSV)

Aggregations

AppBarSV (m.co.rh.id.a_medic_log.app.ui.component.AppBarSV)5 StatefulViewProvider (m.co.rh.id.a_medic_log.app.provider.StatefulViewProvider)4 RxDisposer (m.co.rh.id.a_medic_log.app.rx.RxDisposer)4 ExecutorService (java.util.concurrent.ExecutorService)3 Activity (android.app.Activity)2 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 MedicineReminderChangeNotifier (m.co.rh.id.a_medic_log.app.provider.notifier.MedicineReminderChangeNotifier)2 NoteAttachmentState (m.co.rh.id.a_medic_log.base.state.NoteAttachmentState)2 ILogger (m.co.rh.id.alogger.ILogger)2 Context (android.content.Context)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 Button (android.widget.Button)1 EditText (android.widget.EditText)1 TextView (android.widget.TextView)1 Toolbar (androidx.appcompat.widget.Toolbar)1 DividerItemDecoration (androidx.recyclerview.widget.DividerItemDecoration)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1