This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Background {@link android.app.Service} that adds or removes session Calendar events through | |
* the {@link CalendarContract} API available in Android 4.0 or above. | |
*/ | |
public class SessionCalendarService extends IntentService { | |
private static final String TAG = makeLogTag(SessionCalendarService.class); | |
public SessionCalendarService() { | |
super(TAG); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SessionCalendarUpdater { | |
//... | |
private SessionCalendarDatabase mSessionCalendarDatabase; | |
private SessionCalendarUserPreferences mSessionCalendarUserPreferences; | |
public SessionCalendarUpdater(SessionCalendarDatabase sessionCalendarDatabase, | |
SessionCalendarUserPreferences sessionCalendarUserPreferences) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.google.samples.apps.iosched.service; | |
import android.content.SharedPreferences; | |
/** | |
* Created by MattDupree on 4/30/15. | |
*/ | |
public class AndroidSessionCalendarUserPreferences implements SessionCalendarUserPreferences { | |
private static final String KEY_SHOULD_SYNC_CAL = "com.google.samples.apps.iosched.KEY_SHOULD_SYNC_CAL"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SessionDetailViewPresenter implements RepositoryManagerCallbacks { | |
public SessionDetailViewPresenter(SessionDetailView sessionDetailView, | |
RepositoryManager loaderManager, | |
ServiceStarter serviceStarter, | |
long calendarId | |
) { | |
mSessionDetailView = sessionDetailView; | |
mLoaderManager = loaderManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.google.samples.apps.iosched.test; | |
import com.google.samples.apps.iosched.service.CalendarSession; | |
import com.google.samples.apps.iosched.ui.RepositoryManager; | |
import com.google.samples.apps.iosched.ui.ServiceStarter; | |
import com.google.samples.apps.iosched.ui.sessiondetail.SessionDetailViewPresenter; | |
import com.google.samples.apps.iosched.ui.sessiondetail.SessionDetailViewTranslator; | |
import junit.framework.TestCase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.google.samples.apps.iosched.ui; | |
import android.os.Bundle; | |
import com.google.samples.apps.iosched.io.model.Session; | |
/** | |
* | |
* Created by MattDupree on 5/6/15. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SessionDetailActivity extends Activity implements SessionDetailViewTranslator { | |
@Override | |
public void onCreate(Bundle savedInstanceState) | |
//... | |
ServiceStarter serviceStarter = new AndroidServiceStarter(this); | |
SessionRepositoryManager repositoryManager = new AndroidSessionRepositoryManager(getLoaderManager()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.google.samples.apps.iosched.ui.sessiondetail; | |
import android.os.Bundle; | |
import com.google.samples.apps.iosched.io.model.Session; | |
/** | |
* Created by MattDupree on 5/8/15. | |
*/ | |
public class MockSessionRepositoryManager implements SessionRepositoryManager{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testShouldLaunchAddSessionService() { | |
//Arrange | |
SessionDetailViewTranslator sessionDetailViewTranslator = mock(SessionDetailViewTranslator.class); | |
Session session = new Session(); | |
session.startTimestamp = "1431081943"; | |
SessionRepositoryManager repositoryManager = new MockSessionRepositoryManager(session); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onToggleSessionStarred() { | |
mStarred = !mStarred; | |
} |