32 | * This activity is mostly just a 'shell' activity containing nothing more than a
33 | * {@link CalendarEventDetailFragment}.
34 | */
35 | public class CalendarEventDetailActivity extends Activity implements NoticeDialogListener,
36 | OnOperationCompleteListener,
37 | View.OnClickListener
38 | {
39 | public O365CalendarModel mCalendarModel;
40 | private O365APIsStart_Application mApplication;
41 | private DeleteDialogFragment mDeleteDialog;
42 | private ProgressDialog mDialog;
43 | private O365CalendarModel.O365Calendar_Event mItem;
44 |
45 | @Override
46 | protected void onCreate(Bundle savedInstanceState) {
47 | super.onCreate(savedInstanceState);
48 | setContentView(R.layout.activity_calendarevent_detail);
49 | mApplication = (O365APIsStart_Application) this.getApplication();
50 | mCalendarModel = mApplication.getCalendarModel();
51 |
52 | // Show the Up button in the action bar.
53 | ActionBar aBar = getActionBar();
54 | if (aBar != null)
55 | aBar.setDisplayHomeAsUpEnabled(true);
56 |
57 | mCalendarModel = ((O365APIsStart_Application) getApplication()).getCalendarModel();
58 |
59 | if (savedInstanceState == null)
60 | {
61 | // Create the detail fragment and add it to the activity
62 | // using a fragment transaction.
63 | Bundle arguments = new Bundle();
64 | if (getIntent()
65 | .getAction()
66 | .equals(Intent.ACTION_INSERT))
67 | {
68 | CalendarEventFragmentView createFragment = new CalendarEventFragmentView();
69 | createFragment.setArguments(arguments);
70 | getFragmentManager()
71 | .beginTransaction()
72 | .add(R.id.calendarevent_detail_container, createFragment)
73 | .commit();
74 | }
75 | else if (getIntent()
76 | .getAction()
77 | .equals(Intent.ACTION_EDIT))
78 | {
79 | // Get the calendar event to update
80 | mItem = mCalendarModel
81 | .getCalendar()
82 | .ITEM_MAP
83 | .get(getIntent().getStringExtra(
84 | CalendarEventDetailFragment.ARG_ITEM_ID));
85 |
86 | // Pass the id of the event to the view fragment that will be opened
87 | arguments.putString(
88 | CalendarEventDetailFragment.ARG_ITEM_ID,
89 | getIntent().getStringExtra(
90 | CalendarEventDetailFragment.ARG_ITEM_ID));
91 |
92 | CalendarEventFragmentView fragment = new CalendarEventFragmentView();
93 | fragment.setArguments(arguments);
94 | getFragmentManager().beginTransaction()
95 | .add(R.id.calendarevent_detail_container, fragment)
96 | .commit();
97 | }
98 | else if (getIntent()
99 | .getAction()
100 | .equals(Intent.ACTION_DELETE))
101 | {
102 | CalendarEventDetailFragment deleteFragment = new CalendarEventDetailFragment();
103 | deleteFragment.setArguments(arguments);
104 | getFragmentManager().beginTransaction()
105 | .add(R.id.calendarevent_detail_container, deleteFragment)
106 | .commit();
107 | }
108 | else
109 | {
110 | CalendarEventDetailFragment deleteFragment = new CalendarEventDetailFragment();
111 | deleteFragment.setArguments(arguments);
112 | getFragmentManager().beginTransaction()
113 | .add(R.id.calendarevent_detail_container, deleteFragment)
114 | .commit();
115 |
116 | }
117 | }
118 | }
119 |
120 | @SuppressLint("NewApi")
121 | @Override
122 | public boolean onOptionsItemSelected(MenuItem item) {
123 | int id = item.getItemId();
124 | if (id == android.R.id.home) {
125 |
126 | navigateUpTo(new Intent(this, CalendarEventListActivity.class));
127 | return true;
128 | }
129 | return super.onOptionsItemSelected(item);
130 | }
131 |
132 | @Override
133 | public void onClick(View v) {
134 | }
135 |
136 | @Override
137 | public void onDialogPositiveClick(Fragment dialog) {
138 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
139 | if (dialog != mDeleteDialog)
140 | {
141 | mDialog = new ProgressDialog(this);
142 | mDialog.setTitle("Updating an event...");
143 | mDialog.setMessage("Please wait.");
144 | mDialog.setCancelable(true);
145 | mDialog.setIndeterminate(true);
146 | mDialog.show();
147 | mCalendarModel.setEventOperationCompleteListener(this);
148 | mCalendarModel.postUpdatedEvent(this, mItem);
149 | }
150 | }
151 |
152 | @Override
153 | public void onDialogPositiveClick(Fragment dialog, O365Calendar_Event editedEvent,
154 | boolean newItemFlag)
155 | {
156 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
157 | // post the event to server based on formAction
158 | mDialog = new ProgressDialog(this);
159 | if (newItemFlag)
160 | mDialog.setTitle("Adding an event...");
161 | else
162 | mDialog.setTitle("Updating an event...");
163 | mDialog.setMessage("Please wait.");
164 | mDialog.setCancelable(true);
165 | mDialog.setIndeterminate(true);
166 | mDialog.show();
167 |
168 | // Register callback with the model for notification of op complete
169 | mCalendarModel.setEventOperationCompleteListener(this);
170 | if (newItemFlag)
171 | mCalendarModel.postCreatedEvent(this, editedEvent);
172 | else
173 | mCalendarModel.postUpdatedEvent(this, editedEvent);
174 | }
175 |
176 | @Override
177 | public void onDialogNegativeClick(Fragment dialog) {
178 | this.finish();
179 | }
180 |
181 | @Override
182 | public void onOperationComplete(final OperationResult opResult) {
183 | this.runOnUiThread(new Runnable() {
184 |
185 | @SuppressWarnings("unchecked")
186 | @Override
187 | public void run() {
188 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
189 |
190 | if (mDialog.isShowing())
191 | {
192 | mDialog.dismiss();
193 | }
194 |
195 | Toast.makeText(CalendarEventDetailActivity.this, opResult.getOperationResult(),
196 | Toast.LENGTH_LONG).show();
197 | CalendarEventListFragment calenderListFragment = (CalendarEventListFragment) getFragmentManager()
198 | .findFragmentById(R.id.calendarevent_list);
199 | }
200 | });
201 | this.finish();
202 | }
203 | }
204 | // *********************************************************
205 | //
206 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
207 | //
208 | // Copyright (c) Microsoft Corporation
209 | // All rights reserved.
210 | //
211 | // MIT License:
212 | // Permission is hereby granted, free of charge, to any person obtaining
213 | // a copy of this software and associated documentation files (the
214 | // "Software"), to deal in the Software without restriction, including
215 | // without limitation the rights to use, copy, modify, merge, publish,
216 | // distribute, sublicense, and/or sell copies of the Software, and to
217 | // permit persons to whom the Software is furnished to do so, subject to
218 | // the following conditions:
219 | //
220 | // The above copyright notice and this permission notice shall be
221 | // included in all copies or substantial portions of the Software.
222 | //
223 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
224 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
225 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
226 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
227 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
228 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
229 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
230 | //
231 | // *********************************************************
232 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/Calendar/CalendarEventDetailFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.Calendar;
6 |
7 | import java.util.Calendar;
8 | import android.os.Bundle;
9 | import android.app.Fragment;
10 | import android.text.Editable;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.DatePicker;
15 | import android.widget.EditText;
16 | import android.widget.TimePicker;
17 |
18 | import com.microsoft.office365.starter.R;
19 |
20 | /**
21 | * A fragment representing a single CalendarEvent detail screen. This fragment is either contained
22 | * in a {@link CalendarEventListActivity} in two-pane mode (on tablets) or a
23 | * {@link com.microsoft.office365.starter.Calendar.CalendarEventDetailActivity} on handsets.
24 | */
25 |
26 | public class CalendarEventDetailFragment extends Fragment
27 | {
28 |
29 | /**
30 | * The fragment argument representing the item ID that this fragment represents.
31 | */
32 | public static final String ARG_ITEM_ID = "item_id";
33 |
34 | /**
35 | * The dummy content this fragment is presenting.
36 | */
37 | private O365CalendarModel.O365Calendar_Event mItem;
38 | private View rootView;
39 |
40 | /**
41 | * Mandatory empty constructor for the fragment manager to instantiate the fragment (e.g. upon
42 | * screen orientation changes).
43 | */
44 | public CalendarEventDetailFragment() {
45 | }
46 |
47 | @Override
48 | public void onCreate(Bundle savedInstanceState) {
49 | super.onCreate(savedInstanceState);
50 |
51 | if (getArguments().containsKey(ARG_ITEM_ID)) {
52 |
53 | // This event detail fragment view is owned by the event list activity in
54 | // large screen landscape mode. If in portrait mode for any screen size, the parent
55 | // activity is the CalenderEventDetailActivity.
56 | if (getActivity() instanceof CalendarEventDetailActivity)
57 |
58 | mItem = ((CalendarEventDetailActivity) getActivity()).mCalendarModel
59 | .getCalendar()
60 | .ITEM_MAP
61 | .get(getArguments()
62 | .getString(ARG_ITEM_ID));
63 |
64 | else
65 |
66 | mItem = ((CalendarEventListActivity) getActivity()).mCalendarModel
67 | .getCalendar()
68 | .ITEM_MAP
69 | .get(getArguments()
70 | .getString(ARG_ITEM_ID));
71 |
72 | }
73 | }
74 |
75 | @Override
76 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
77 | Bundle savedInstanceState) {
78 | rootView = inflater.inflate(
79 | R.layout.fragment_calendarevent_detail, container, false);
80 |
81 | // Show the dummy content as text in a TextView.
82 | if (mItem != null)
83 | loadEventDetails();
84 |
85 | return rootView;
86 | }
87 |
88 | private void loadEventDetails()
89 | {
90 | ((EditText) rootView.findViewById(R.id.locationText))
91 | .setText(mItem.getLocation());
92 |
93 | ((EditText) rootView.findViewById(R.id.subjectText))
94 | .setText(mItem.getSubject());
95 |
96 | ((EditText) rootView.findViewById(R.id.attendeesText))
97 | .setText(mItem.getAttendees());
98 |
99 | DatePicker startDatePicker = ((DatePicker) rootView.findViewById(R.id.StartDatePicker));
100 | startDatePicker.setEnabled(false);
101 | startDatePicker.init(
102 | mItem.getStartDateTime().get(Calendar.YEAR)
103 | , mItem.getStartDateTime().get(Calendar.MONTH)
104 | , mItem.getStartDateTime().get(Calendar.DAY_OF_MONTH), null);
105 |
106 | DatePicker endDatePicker = ((DatePicker) rootView.findViewById(R.id.EndDatePicker));
107 | endDatePicker.setEnabled(false);
108 | endDatePicker.init(
109 | mItem.getEndDateTime().get(Calendar.YEAR)
110 | , mItem.getEndDateTime().get(Calendar.MONTH)
111 | , mItem.getEndDateTime().get(Calendar.DAY_OF_MONTH), null);
112 |
113 | // Fill other calendar fields from calendar item
114 |
115 | TimePicker startClock = (
116 | (TimePicker) rootView
117 | .findViewById(R.id.startTimePicker));
118 |
119 | startClock.setEnabled(false);
120 | startClock.setCurrentHour(
121 | mItem.getStartDateTime()
122 | .get(Calendar.HOUR_OF_DAY));
123 |
124 | startClock.setCurrentMinute(
125 | mItem.getStartDateTime()
126 | .get(Calendar.MINUTE));
127 |
128 | TimePicker endClock = ((TimePicker) rootView.findViewById(R.id.endTimePicker));
129 | endClock.setEnabled(false);
130 | endClock.setCurrentHour(
131 | mItem
132 | .getEndDateTime()
133 | .get(Calendar.HOUR_OF_DAY));
134 |
135 | endClock.setCurrentMinute(
136 | mItem.getEndDateTime()
137 | .get(Calendar.MINUTE));
138 |
139 | }
140 |
141 | public void updateItem()
142 | {
143 | Editable subject = ((EditText) rootView.findViewById(R.id.subjectText))
144 | .getText();
145 | mItem.updateSubject(subject.toString());
146 | Editable location = ((EditText) rootView.findViewById(R.id.locationText))
147 | .getText();
148 | mItem.setLocation(location.toString());
149 | }
150 | }
151 | // *********************************************************
152 | //
153 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
154 | //
155 | // Copyright (c) Microsoft Corporation
156 | // All rights reserved.
157 | //
158 | // MIT License:
159 | // Permission is hereby granted, free of charge, to any person obtaining
160 | // a copy of this software and associated documentation files (the
161 | // "Software"), to deal in the Software without restriction, including
162 | // without limitation the rights to use, copy, modify, merge, publish,
163 | // distribute, sublicense, and/or sell copies of the Software, and to
164 | // permit persons to whom the Software is furnished to do so, subject to
165 | // the following conditions:
166 | //
167 | // The above copyright notice and this permission notice shall be
168 | // included in all copies or substantial portions of the Software.
169 | //
170 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
171 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
172 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
173 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
174 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
175 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
176 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
177 | //
178 | // *********************************************************
179 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/Calendar/CalendarEventListFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.Calendar;
6 |
7 | import android.app.Activity;
8 | import android.app.ProgressDialog;
9 | import android.os.Bundle;
10 | import android.app.ListFragment;
11 | import android.view.View;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.ListView;
14 | import android.widget.Toast;
15 |
16 | import com.microsoft.office365.starter.interfaces.OnEventsAddedListener;
17 |
18 | /**
19 | * A list fragment representing a list of CalendarEvents. This fragment also supports tablet devices
20 | * by allowing list items to be given an 'activated' state upon selection. This helps indicate which
21 | * item is currently being viewed in a {@link com.microsoft.office365.starter.Calendar.CalendarEventDetailFragment}.
22 | *
23 | * Activities containing this fragment MUST implement the {@link Callbacks} interface.
24 | */
25 | public class CalendarEventListFragment extends ListFragment implements OnEventsAddedListener {
26 |
27 | /**
28 | * The serialization (saved instance state) Bundle key representing the activated item position.
29 | * Only used on tablets.
30 | */
31 | private static final String STATE_ACTIVATED_POSITION = "activated_position";
32 |
33 | /**
34 | * The fragment's current callback object, which is notified of list item clicks.
35 | */
36 | private Callbacks mCallbacks = sDummyCallbacks;
37 |
38 | /** The m stored rotation. */
39 | private int mStoredRotation;
40 | private ProgressDialog mDialog;
41 | // public O365CalendarModel mCalendarModel;
42 |
43 | /**
44 | * The current activated item position. Only used on tablets.
45 | */
46 | private int mActivatedPosition = ListView.INVALID_POSITION;
47 | private CalendarEventListActivity mParentActivity;
48 | private CalendarEventListFragment mCalendarEventListFragment;
49 |
50 | /**
51 | * A callback interface that all activities containing this fragment must implement. This
52 | * mechanism allows activities to be notified of item selections.
53 | */
54 | public interface Callbacks {
55 | /**
56 | * Callback for when an item has been selected.
57 | */
58 | public void onItemSelected(String id);
59 | }
60 |
61 | /**
62 | * A dummy implementation of the {@link Callbacks} interface that does nothing. Used only when
63 | * this fragment is not attached to an activity.
64 | */
65 | private static Callbacks sDummyCallbacks = new Callbacks() {
66 | @Override
67 | public void onItemSelected(String id) {
68 | }
69 | };
70 |
71 | /**
72 | * Mandatory empty constructor for the fragment manager to instantiate the fragment (e.g. upon
73 | * screen orientation changes).
74 | */
75 | public CalendarEventListFragment() {
76 | }
77 |
78 |
79 | @Override
80 | public void onViewCreated(View view, Bundle savedInstanceState) {
81 | super.onViewCreated(view, savedInstanceState);
82 |
83 | // Restore the previously serialized activated item position.
84 | if (savedInstanceState != null
85 | && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION))
86 | setActivatedPosition(savedInstanceState
87 | .getInt(STATE_ACTIVATED_POSITION));
88 |
89 | }
90 |
91 | @Override
92 | public void OnEventsAdded(final setEventCollection eventCollection) {
93 | getActivity().runOnUiThread(new Runnable() {
94 | @Override
95 | public void run() {
96 | if (!eventCollection.getEventCollection().isEmpty())
97 | {
98 | mCalendarEventListFragment
99 | .setListAdapter(new ArrayAdapter(
100 | mParentActivity,
101 | android.R.layout.simple_list_item_activated_1,
102 | android.R.id.text1, eventCollection.getEventCollection()));
103 |
104 | if (mDialog.isShowing())
105 | {
106 | mDialog.dismiss();
107 | mParentActivity.setRequestedOrientation(mStoredRotation);
108 | }
109 | Toast.makeText(mParentActivity, "Events loaded",
110 | Toast.LENGTH_LONG).show();
111 | }
112 | else
113 | {
114 | if (mDialog.isShowing())
115 | {
116 | mDialog.dismiss();
117 | mParentActivity.setRequestedOrientation(mStoredRotation);
118 | }
119 | Toast.makeText(mParentActivity, "No events to show",
120 | Toast.LENGTH_LONG).show();
121 | }
122 | }
123 | });
124 | }
125 |
126 | @Override
127 | public void onAttach(Activity activity) {
128 | super.onAttach(activity);
129 |
130 | // Activities containing this fragment must implement its callbacks.
131 | if (!(activity instanceof Callbacks)) {
132 | throw new IllegalStateException(
133 | "Activity must implement fragment's callbacks.");
134 | }
135 | mCallbacks = (Callbacks) activity;
136 | }
137 |
138 | @Override
139 | public void onDetach() {
140 | super.onDetach();
141 |
142 | // Reset the active callbacks interface to the dummy implementation.
143 | mCallbacks = sDummyCallbacks;
144 | }
145 |
146 | @Override
147 | public void onListItemClick(ListView listView, View view, int position,
148 | long id) {
149 | super.onListItemClick(listView, view, position, id);
150 |
151 | // Notify the active callbacks interface (the activity, if the
152 | // fragment is attached to one) that an item has been selected.
153 |
154 | if (getActivity() instanceof CalendarEventListActivity)
155 | mCallbacks.onItemSelected(
156 | ((CalendarEventListActivity) getActivity())
157 | .calendarEvents
158 | .ITEMS
159 | .get(position)
160 | .getID());
161 | }
162 |
163 | @Override
164 | public void onSaveInstanceState(Bundle outState) {
165 | super.onSaveInstanceState(outState);
166 | if (mActivatedPosition != ListView.INVALID_POSITION)
167 | // Serialize and persist the activated item position.
168 | outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
169 |
170 | }
171 |
172 | /**
173 | * Turns on activate-on-click mode. When this mode is on, list items will be given the
174 | * 'activated' state when touched.
175 | */
176 | public void setActivateOnItemClick(boolean activateOnItemClick) {
177 | // When setting CHOICE_MODE_SINGLE, ListView will automatically
178 | // give items the 'activated' state when touched.
179 | getListView().setChoiceMode(
180 | activateOnItemClick ? ListView.CHOICE_MODE_SINGLE
181 | : ListView.CHOICE_MODE_NONE);
182 | }
183 |
184 | private void setActivatedPosition(int position) {
185 | if (position == ListView.INVALID_POSITION)
186 | getListView().setItemChecked(mActivatedPosition, false);
187 | else
188 | getListView().setItemChecked(position, true);
189 |
190 | mActivatedPosition = position;
191 | }
192 | }
193 | // *********************************************************
194 | //
195 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
196 | //
197 | // Copyright (c) Microsoft Corporation
198 | // All rights reserved.
199 | //
200 | // MIT License:
201 | // Permission is hereby granted, free of charge, to any person obtaining
202 | // a copy of this software and associated documentation files (the
203 | // "Software"), to deal in the Software without restriction, including
204 | // without limitation the rights to use, copy, modify, merge, publish,
205 | // distribute, sublicense, and/or sell copies of the Software, and to
206 | // permit persons to whom the Software is furnished to do so, subject to
207 | // the following conditions:
208 | //
209 | // The above copyright notice and this permission notice shall be
210 | // included in all copies or substantial portions of the Software.
211 | //
212 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
213 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
214 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
215 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
216 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
217 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
218 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
219 | //
220 | // *********************************************************
221 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/Email/MailItemComposeFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.Email;
6 |
7 | import android.app.Activity;
8 | import android.os.Bundle;
9 | import android.app.Fragment;
10 | import android.view.KeyEvent;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.view.inputmethod.EditorInfo;
15 | import android.widget.EditText;
16 | import android.widget.TextView;
17 |
18 | import com.microsoft.office365.starter.R;
19 |
20 | public class MailItemComposeFragment extends Fragment {
21 |
22 | String mMailTo;
23 | String mMailCc;
24 | String mMailSubject;
25 | String mMailBody;
26 |
27 | private Callbacks mListener;
28 |
29 | /**
30 | * A callback interface that all activities containing this fragment must
31 | * implement. This mechanism allows activities to be notified of item
32 | * selections.
33 | */
34 | public interface Callbacks {
35 | /**
36 | * Callback for when an item has been selected.
37 | */
38 | public void onSendMail(String mailTo, String mailCc,
39 | String mailSubject, String mailBody);
40 |
41 | public void onSendMailCancelled();
42 | }
43 |
44 | public MailItemComposeFragment() {
45 | }
46 |
47 | @Override
48 | public void onAttach(Activity activity) {
49 | super.onAttach(activity);
50 | try {
51 | mListener = (Callbacks) activity;
52 | } catch (ClassCastException e) {
53 | throw new ClassCastException(
54 | activity.toString()
55 | + " must implement Mail Compose Fragment Callbacks interface");
56 | }
57 |
58 | }
59 |
60 | private void sendMessage(View rootView) {
61 | // Get data from fields on the view
62 | TextView textView = (TextView) rootView
63 | .findViewById(R.id.mail_compose_to);
64 | mMailTo = textView.getText().toString();
65 | textView = (TextView) rootView.findViewById(R.id.mail_compose_cc);
66 | mMailCc = textView.getText().toString();
67 | textView = (TextView) rootView.findViewById(R.id.mail_compose_subject);
68 | mMailSubject = textView.getText().toString();
69 | textView = (TextView) rootView.findViewById(R.id.mail_compose_body);
70 | mMailBody = textView.getText().toString();
71 |
72 | // Inform host activity which will remove this fragment and send email
73 | mListener.onSendMail(mMailTo, mMailCc, mMailSubject, mMailBody);
74 | }
75 |
76 | @Override
77 | public void onCreate(Bundle savedInstanceState) {
78 | super.onCreate(savedInstanceState);
79 |
80 | }
81 |
82 | @Override
83 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
84 | Bundle savedInstanceState) {
85 | final View rootView = inflater.inflate(
86 | R.layout.fragment_mailitem_compose, container, false);
87 |
88 | // Keyboard send button handler
89 | EditText editText = (EditText) rootView
90 | .findViewById(R.id.mail_compose_body);
91 | editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
92 | @Override
93 | public boolean onEditorAction(TextView v, int actionId,
94 | KeyEvent event) {
95 | boolean handled = false;
96 | if (actionId == EditorInfo.IME_ACTION_SEND) {
97 | sendMessage(rootView);
98 | handled = true;
99 | }
100 | return handled;
101 | }
102 | });
103 |
104 | // Done button click event handler
105 | rootView.findViewById(R.id.actionbar_done).setOnClickListener(
106 | new View.OnClickListener() {
107 | @Override
108 | public void onClick(View v) {
109 | sendMessage(rootView);
110 | }
111 | });
112 |
113 | // Cancel button click event handler
114 | rootView.findViewById(R.id.actionbar_cancel).setOnClickListener(
115 | new View.OnClickListener() {
116 | @Override
117 | public void onClick(View v) {
118 | // Call parent activity listener to remove this
119 | // fragment.
120 | mListener.onSendMailCancelled();
121 | mListener = null;
122 | }
123 | });
124 | return rootView;
125 | }
126 | }
127 | // *********************************************************
128 | //
129 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
130 | //
131 | // Copyright (c) Microsoft Corporation
132 | // All rights reserved.
133 | //
134 | // MIT License:
135 | // Permission is hereby granted, free of charge, to any person obtaining
136 | // a copy of this software and associated documentation files (the
137 | // "Software"), to deal in the Software without restriction, including
138 | // without limitation the rights to use, copy, modify, merge, publish,
139 | // distribute, sublicense, and/or sell copies of the Software, and to
140 | // permit persons to whom the Software is furnished to do so, subject to
141 | // the following conditions:
142 | //
143 | // The above copyright notice and this permission notice shall be
144 | // included in all copies or substantial portions of the Software.
145 | //
146 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
147 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
148 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
149 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
150 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
151 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
152 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
153 | //
154 | // *********************************************************
155 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/Email/MailItemDetailActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.Email;
6 |
7 | import android.content.Intent;
8 | import android.os.Bundle;
9 | import android.app.Activity;
10 | import android.support.v4.app.NavUtils;
11 | import android.view.MenuItem;
12 |
13 | import com.microsoft.office365.starter.R;
14 |
15 | /**
16 | * An activity representing a single MailItem detail screen. This activity is
17 | * only used on handset devices. On tablet-size devices, item details are
18 | * presented side-by-side with a list of items in a {@link MailItemListActivity}
19 | * .
20 | *
21 | * This activity is mostly just a 'shell' activity containing nothing more than
22 | * a {@link MailItemDetailFragment}.
23 | */
24 | public class MailItemDetailActivity extends Activity implements
25 | MailItemComposeFragment.Callbacks {
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_mailitem_detail);
31 |
32 | // Show the Up button in the action bar.
33 | getActionBar().setDisplayHomeAsUpEnabled(true);
34 |
35 | // savedInstanceState is non-null when there is fragment state
36 | // saved from previous configurations of this activity
37 | // (e.g. when rotating the screen from portrait to landscape).
38 | // In this case, the fragment will automatically be re-added
39 | // to its container so we don't need to manually add it.
40 | // For more information, see the Fragments API guide at:
41 | //
42 | // http://developer.android.com/guide/components/fragments.html
43 | //
44 |
45 | if (savedInstanceState == null) {
46 | // see if we are creating new email, or viewing existing.
47 | // determines which fragment we need to load.
48 | Intent intent = getIntent();
49 | String actionMode = intent.getAction();
50 | if (Intent.ACTION_INSERT == actionMode) {
51 | // display the compose fragment to compose a new email
52 | MailItemComposeFragment fragment = new MailItemComposeFragment();
53 | getFragmentManager().beginTransaction()
54 | .add(R.id.mailitem_detail_container, fragment).commit();
55 |
56 | } else {
57 | // display the detail view fragment to read an email
58 |
59 | // Create the detail fragment and add it to the activity
60 | // using a fragment transaction.
61 | Bundle arguments = new Bundle();
62 | arguments.putString(
63 | MailItemDetailFragment.ARG_ITEM_ID,
64 | getIntent().getStringExtra(
65 | MailItemDetailFragment.ARG_ITEM_ID));
66 | MailItemDetailFragment fragment = new MailItemDetailFragment();
67 | fragment.setArguments(arguments);
68 | getFragmentManager().beginTransaction()
69 | .add(R.id.mailitem_detail_container, fragment).commit();
70 |
71 | }
72 |
73 | }
74 | }
75 |
76 | @Override
77 | public boolean onOptionsItemSelected(MenuItem item) {
78 | int id = item.getItemId();
79 | if (id == android.R.id.home) {
80 | // This ID represents the Home or Up button. In the case of this
81 | // activity, the Up button is shown. Use NavUtils to allow users
82 | // to navigate up one level in the application structure. For
83 | // more details, see the Navigation pattern on Android Design:
84 | //
85 | // http://developer.android.com/design/patterns/navigation.html#up-vs-back
86 | //
87 | NavUtils.navigateUpTo(this, new Intent(this,
88 | MailItemListActivity.class));
89 | return true;
90 | }
91 | return super.onOptionsItemSelected(item);
92 | }
93 |
94 | @Override
95 | public void onSendMail(String mailTo, String mailCc, String mailSubject,
96 | String mailBody) {
97 | // send mail
98 |
99 | this.finish();
100 | }
101 |
102 | @Override
103 | public void onSendMailCancelled() {
104 |
105 | this.finish();
106 | }
107 | }
108 | // *********************************************************
109 | //
110 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
111 | //
112 | // Copyright (c) Microsoft Corporation
113 | // All rights reserved.
114 | //
115 | // MIT License:
116 | // Permission is hereby granted, free of charge, to any person obtaining
117 | // a copy of this software and associated documentation files (the
118 | // "Software"), to deal in the Software without restriction, including
119 | // without limitation the rights to use, copy, modify, merge, publish,
120 | // distribute, sublicense, and/or sell copies of the Software, and to
121 | // permit persons to whom the Software is furnished to do so, subject to
122 | // the following conditions:
123 | //
124 | // The above copyright notice and this permission notice shall be
125 | // included in all copies or substantial portions of the Software.
126 | //
127 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
128 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
129 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
130 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
131 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
132 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
133 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
134 | //
135 | // *********************************************************
136 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/Email/MailItemDetailFragment.java:
--------------------------------------------------------------------------------
1 | package com.microsoft.office365.starter.Email;
2 |
3 | import android.os.Bundle;
4 | import android.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.webkit.WebView;
9 | import android.widget.TextView;
10 |
11 | import com.microsoft.office365.starter.O365APIsStart_Application;
12 | import com.microsoft.office365.starter.R;
13 |
14 | /**
15 | * A fragment representing a single MailItem detail screen. This fragment is
16 | * either contained in a {@link MailItemListActivity} in two-pane mode (on
17 | * tablets) or a
18 | * {@link com.microsoft.office365.starter.Email.MailItemDetailActivity} on
19 | * handsets.
20 | */
21 | public class MailItemDetailFragment extends Fragment {
22 |
23 | private O365APIsStart_Application mApplication;
24 | private O365MailItemsModel mMailItems;
25 |
26 | /**
27 | * The fragment argument representing the item ID that this fragment
28 | * represents.
29 | */
30 | public static final String ARG_ITEM_ID = "item_id";
31 |
32 | /**
33 | * The dummy content this fragment is presenting.
34 | */
35 | private O365MailItemsModel.O365Mail_Message mMailItem;
36 |
37 | /**
38 | * Mandatory empty constructor for the fragment manager to instantiate the
39 | * fragment (e.g. upon screen orientation changes).
40 | */
41 | public MailItemDetailFragment() {
42 | }
43 |
44 | @Override
45 | public void onCreate(Bundle savedInstanceState) {
46 | super.onCreate(savedInstanceState);
47 |
48 | mApplication = (O365APIsStart_Application) getActivity()
49 | .getApplication();
50 | if (getArguments().containsKey(ARG_ITEM_ID))
51 | // Load the mail item content specified by the fragment
52 | // arguments.
53 | mMailItem = mApplication.getMailItemsModel().getMail().ITEM_MAP
54 | .get(getArguments().getString(ARG_ITEM_ID));
55 |
56 | }
57 |
58 | @Override
59 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
60 | Bundle savedInstanceState) {
61 | View rootView = inflater.inflate(R.layout.fragment_mailitem_detail,
62 | container, false);
63 |
64 | // Show the mail item content as text in a TextView.
65 | if (mMailItem != null) {
66 | String daString;
67 | TextView editTo = (TextView) rootView
68 | .findViewById(R.id.mail_detail_to);
69 | editTo.setText(mMailItem.getMessageRecipients());
70 | TextView editCC = (TextView) rootView
71 | .findViewById(R.id.mail_detail_cc);
72 | editCC.setText(mMailItem.getCCMessageRecipients());
73 | TextView editFrom = (TextView) rootView
74 | .findViewById(R.id.mail_detail_from);
75 | editFrom.setText(mMailItem.getFrom());
76 | TextView editSubject = (TextView) rootView
77 | .findViewById(R.id.mail_detail_subject);
78 | editSubject.setText(mMailItem.getSubject());
79 | WebView editBody = (WebView) rootView
80 | .findViewById(R.id.mail_detail_body);
81 | editBody.loadData(mMailItem.getItemBody(), "text/html", "UTF-8");
82 | }
83 |
84 | return rootView;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/Email/MailItemListFragment.java:
--------------------------------------------------------------------------------
1 | package com.microsoft.office365.starter.Email;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.app.ListFragment;
6 | import android.view.View;
7 | import android.widget.ListView;
8 |
9 | import com.microsoft.office365.starter.O365APIsStart_Application;
10 |
11 | /**
12 | * A list fragment representing a list of MailItems. This fragment also supports
13 | * tablet devices by allowing list items to be given an 'activated' state upon
14 | * selection. This helps indicate which item is currently being viewed in a
15 | * {@link com.microsoft.office365.starter.Email.MailItemDetailFragment}.
16 | *
17 | * Activities containing this fragment MUST implement the {@link Callbacks}
18 | * interface.
19 | */
20 | public class MailItemListFragment extends ListFragment {
21 |
22 | private O365APIsStart_Application mApplication;
23 |
24 | /**
25 | * The serialization (saved instance state) Bundle key representing the
26 | * activated item position. Only used on tablets.
27 | */
28 | private static final String STATE_ACTIVATED_POSITION = "activated_position";
29 |
30 | /**
31 | * The fragment's current callback object, which is notified of list item
32 | * clicks.
33 | */
34 | private Callbacks mCallbacks = sDummyCallbacks;
35 |
36 | /**
37 | * The current activated item position. Only used on tablets.
38 | */
39 | private int mActivatedPosition = ListView.INVALID_POSITION;
40 |
41 | /**
42 | * A callback interface that all activities containing this fragment must
43 | * implement. This mechanism allows activities to be notified of item
44 | * selections.
45 | */
46 | public interface Callbacks {
47 | /**
48 | * Callback for when an item has been selected.
49 | */
50 | public void onItemSelected(String id);
51 | }
52 |
53 | /**
54 | * A dummy implementation of the {@link Callbacks} interface that does
55 | * nothing. Used only when this fragment is not attached to an activity.
56 | */
57 | private static Callbacks sDummyCallbacks = new Callbacks() {
58 | @Override
59 | public void onItemSelected(String id) {
60 | }
61 | };
62 |
63 | /**
64 | * Mandatory empty constructor for the fragment manager to instantiate the
65 | * fragment (e.g. upon screen orientation changes).
66 | */
67 | public MailItemListFragment() {
68 | }
69 |
70 | @Override
71 | public void onCreate(Bundle savedInstanceState) {
72 | super.onCreate(savedInstanceState);
73 |
74 | }
75 |
76 | @Override
77 | public void onViewCreated(View view, Bundle savedInstanceState) {
78 | super.onViewCreated(view, savedInstanceState);
79 |
80 | mApplication = (O365APIsStart_Application) getActivity()
81 | .getApplication();
82 | // Restore the previously serialized activated item position.
83 | if (savedInstanceState != null
84 | && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION))
85 | setActivatedPosition(savedInstanceState
86 | .getInt(STATE_ACTIVATED_POSITION));
87 |
88 | }
89 |
90 | @Override
91 | public void onAttach(Activity activity) {
92 | super.onAttach(activity);
93 |
94 | // Activities containing this fragment must implement its callbacks.
95 | if (!(activity instanceof Callbacks))
96 | throw new IllegalStateException(
97 | "Activity must implement fragment's callbacks.");
98 |
99 | mCallbacks = (Callbacks) activity;
100 | }
101 |
102 | @Override
103 | public void onDetach() {
104 | super.onDetach();
105 |
106 | // Reset the active callbacks interface to the dummy implementation.
107 | mCallbacks = sDummyCallbacks;
108 | }
109 |
110 | @Override
111 | public void onListItemClick(ListView listView, View view, int position,
112 | long id) {
113 | super.onListItemClick(listView, view, position, id);
114 |
115 | // Notify the active callbacks interface (the activity, if the
116 | // fragment is attached to one) that an item has been selected.
117 | mCallbacks
118 | .onItemSelected(mApplication.getMailItemsModel().getMail().ITEMS
119 | .get(position).getID());
120 | }
121 |
122 | @Override
123 | public void onSaveInstanceState(Bundle outState) {
124 | super.onSaveInstanceState(outState);
125 | if (mActivatedPosition != ListView.INVALID_POSITION)
126 | // Serialize and persist the activated item position.
127 | outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
128 |
129 | }
130 |
131 | /**
132 | * Turns on activate-on-click mode. When this mode is on, list items will be
133 | * given the 'activated' state when touched.
134 | */
135 | public void setActivateOnItemClick(boolean activateOnItemClick) {
136 | // When setting CHOICE_MODE_SINGLE, ListView will automatically
137 | // give items the 'activated' state when touched.
138 | getListView().setChoiceMode(
139 | activateOnItemClick ? ListView.CHOICE_MODE_SINGLE
140 | : ListView.CHOICE_MODE_NONE);
141 | }
142 |
143 | private void setActivatedPosition(int position) {
144 | if (position == ListView.INVALID_POSITION)
145 | getListView().setItemChecked(mActivatedPosition, false);
146 | else
147 | getListView().setItemChecked(position, true);
148 | mActivatedPosition = position;
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/FilesFolders/FileDetailActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.FilesFolders;
6 |
7 | import android.app.Activity;
8 | import android.app.FragmentManager;
9 | import android.app.FragmentTransaction;
10 | import android.app.ProgressDialog;
11 | import android.content.Intent;
12 | import android.os.Bundle;
13 | import android.support.v4.app.NavUtils;
14 | import android.view.Menu;
15 | import android.view.MenuInflater;
16 | import android.view.MenuItem;
17 | import android.widget.Toast;
18 |
19 | import com.microsoft.office365.starter.O365APIsStart_Application;
20 | import com.microsoft.office365.starter.R;
21 | import com.microsoft.office365.starter.helpers.ProgressDialogHelper;
22 | import com.microsoft.office365.starter.interfaces.OnOperationCompleteListener;
23 |
24 | /**
25 | * An activity representing a single File detail screen. This activity is
26 | * only used on handset devices. On tablet-size devices, item details are
27 | * presented side-by-side with a list of items in a {@link FileListActivity}.
28 | *
29 | * This activity is mostly just a 'shell' activity containing nothing more than
30 | * a {@link FileDetailFragment}.
31 | */
32 | public class FileDetailActivity extends Activity implements
33 | FileUpdateFragment.Callbacks, OnOperationCompleteListener {
34 |
35 | private static final String UPDATE_FRAGMENT_STACK_STATE = "updateFragment";
36 | private ProgressDialog mDialog;
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_file_detail);
42 |
43 | // Show the Up button in the action bar.
44 | getActionBar().setDisplayHomeAsUpEnabled(true);
45 |
46 | if (savedInstanceState == null) {
47 | // Create the detail fragment and add it to the activity
48 | // using a fragment transaction.
49 | Bundle arguments = new Bundle();
50 | FileDetailFragment fragment = new FileDetailFragment();
51 | getFragmentManager().beginTransaction()
52 | .add(R.id.file_detail_container, fragment).commit();
53 |
54 | }
55 | }
56 |
57 | // Handler for update action from button press
58 | private void updateActionHandler() {
59 | // Display the update fragment
60 | FileUpdateFragment updateFragment = new FileUpdateFragment();
61 | FragmentManager fragmentManager = getFragmentManager();
62 | android.app.FragmentTransaction ft = fragmentManager.beginTransaction();
63 | ft.replace(R.id.file_detail_container, updateFragment,
64 | UPDATE_FRAGMENT_STACK_STATE);
65 | ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
66 | ft.addToBackStack(UPDATE_FRAGMENT_STACK_STATE);
67 | ft.commit();
68 | }
69 |
70 | @Override
71 | public boolean onCreateOptionsMenu(Menu menu) {
72 | // Inflate the menu items for use in the action bar
73 | MenuInflater inflater = getMenuInflater();
74 | inflater.inflate(R.menu.file_detail_menu, menu);
75 | return super.onCreateOptionsMenu(menu);
76 | }
77 |
78 | @Override
79 | public boolean onOptionsItemSelected(MenuItem item) {
80 | // Handle presses on the action bar items
81 | switch (item.getItemId()) {
82 | case R.id.action_file_update:
83 | updateActionHandler();
84 | return true;
85 | case android.R.id.home:
86 | NavUtils.navigateUpTo(this,
87 | new Intent(this, FileListActivity.class));
88 | return true;
89 | default:
90 | return super.onOptionsItemSelected(item);
91 | }
92 | }
93 |
94 | @Override
95 | public void onContentsUpdated(String updatedContent) {
96 | FragmentManager fm = getFragmentManager();
97 | fm.popBackStack(UPDATE_FRAGMENT_STACK_STATE,
98 | FragmentManager.POP_BACK_STACK_INCLUSIVE);
99 |
100 | O365APIsStart_Application application = (O365APIsStart_Application) getApplication();
101 | application.getDisplayedFile().setContents(FileDetailActivity.this,
102 | updatedContent);
103 | mDialog = ProgressDialogHelper.showProgressDialog(
104 | FileDetailActivity.this, "Updating file contents on server...",
105 | "Please wait.");
106 | application.getFileListViewState().setEventOperationCompleteListener(
107 | FileDetailActivity.this);
108 | application.getFileListViewState().postUpdatedFileContents(application,
109 | FileDetailActivity.this, application.getFileClient(),
110 | updatedContent);
111 | }
112 |
113 | @Override
114 | public void onFileUpdateCancelled() {
115 | FragmentManager fm = getFragmentManager();
116 | fm.popBackStack(UPDATE_FRAGMENT_STACK_STATE,
117 | FragmentManager.POP_BACK_STACK_INCLUSIVE);
118 | }
119 |
120 | @Override
121 | public void onOperationComplete(final OperationResult opResult) {
122 | this.runOnUiThread(new Runnable() {
123 |
124 | @Override
125 | public void run() {
126 | if (mDialog.isShowing())
127 | mDialog.dismiss();
128 |
129 |
130 | Toast.makeText(FileDetailActivity.this,
131 | opResult.getOperationResult(), Toast.LENGTH_LONG)
132 | .show();
133 | if (opResult.getId().equals("FileDeleted")) {
134 | // The file displayed may be the one just deleted
135 | // so clear the display to be safe.
136 | O365APIsStart_Application application = (O365APIsStart_Application) getApplication();
137 | application.setDisplayedFile(null);
138 | FragmentManager fm = getFragmentManager();
139 | FileDetailFragment fragment = (FileDetailFragment) fm
140 | .findFragmentById(R.id.file_detail_container);
141 | if (fragment != null)
142 | fragment.refresh(null);
143 | }
144 | if (opResult.getId().equals("FileContentsUpdate")) {
145 | // refresh the display to reflect new file contents
146 | FragmentManager fm = getFragmentManager();
147 | FileDetailFragment fragment = (FileDetailFragment) fm
148 | .findFragmentById(R.id.file_detail_container);
149 | if (fragment != null)
150 | fragment.refresh(((O365APIsStart_Application) getApplication()).getDisplayedFile());
151 | }
152 | }
153 | });
154 |
155 | }
156 |
157 | }
158 | //*********************************************************
159 | //
160 | //O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
161 | //
162 | //Copyright (c) Microsoft Corporation
163 | //All rights reserved.
164 | //
165 | //MIT License:
166 | //Permission is hereby granted, free of charge, to any person obtaining
167 | //a copy of this software and associated documentation files (the
168 | //"Software"), to deal in the Software without restriction, including
169 | //without limitation the rights to use, copy, modify, merge, publish,
170 | //distribute, sublicense, and/or sell copies of the Software, and to
171 | //permit persons to whom the Software is furnished to do so, subject to
172 | //the following conditions:
173 | //
174 | //The above copyright notice and this permission notice shall be
175 | //included in all copies or substantial portions of the Software.
176 | //
177 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
178 | //EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
179 | //MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
180 | //NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
181 | //LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
182 | //OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
183 | //WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
184 | //
185 | //*********************************************************
186 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/FilesFolders/FileDetailFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.FilesFolders;
6 |
7 | import android.os.Bundle;
8 | import android.app.Fragment;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.TextView;
13 |
14 | import com.microsoft.office365.starter.O365APIsStart_Application;
15 | import com.microsoft.office365.starter.R;
16 | import com.microsoft.office365.starter.interfaces.OnFileChangedEventListener;
17 |
18 | /**
19 | * A fragment representing a single File detail screen. This fragment is
20 | * either contained in a {@link FileListActivity} in two-pane mode (on tablets)
21 | * or a {@link com.microsoft.office365.starter.FilesFolders.FileDetailActivity} on handsets.
22 | */
23 | public class FileDetailFragment extends Fragment implements
24 | OnFileChangedEventListener {
25 | private String mContents = null;
26 | private O365APIsStart_Application mApplication = null;
27 | /**
28 | * The fragment argument representing the item ID that this fragment
29 | * represents.
30 | */
31 | public static final String ARG_ITEM_ID = "item_id";
32 |
33 | /**
34 | * Mandatory empty constructor for the fragment manager to instantiate the
35 | * fragment (e.g. upon screen orientation changes).
36 | */
37 | public FileDetailFragment() {
38 | }
39 |
40 | @Override
41 | public void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 |
44 | mApplication = (O365APIsStart_Application) getActivity()
45 | .getApplication();
46 | if (mApplication.getDisplayedFile() != null)
47 | mContents = mApplication.getDisplayedFile().getContents();
48 | }
49 |
50 | @Override
51 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
52 | Bundle savedInstanceState) {
53 | View rootView = inflater.inflate(R.layout.fragment_file_detail,
54 | container, false);
55 |
56 | // Show the file content as text in a TextView.
57 | if (mContents != null)
58 | ((TextView) rootView.findViewById(R.id.file_detail))
59 | .setText(mContents);
60 |
61 |
62 | return rootView;
63 | }
64 |
65 | // Called by parent activity when a new file is being displayed
66 | public void refresh(O365FileModel fileItem) {
67 | onFileChangedEvent(fileItem, null);
68 | }
69 |
70 | // When file contents are changed, or new file was read from server, render
71 | // the new contents to the TextView.
72 | @Override
73 | public void onFileChangedEvent(O365FileModel fileItem, Event event) {
74 | String fileContents;
75 | if (fileItem == null)
76 | fileContents = "";
77 | else
78 | fileContents = fileItem.getContents();
79 |
80 | TextView textView = (TextView) getView().findViewById(
81 | R.id.file_detail);
82 | textView.setText(fileContents);
83 | mApplication.setDisplayedFile(fileItem);
84 | }
85 | }
86 | //*********************************************************
87 | //
88 | //O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
89 | //
90 | //Copyright (c) Microsoft Corporation
91 | //All rights reserved.
92 | //
93 | //MIT License:
94 | //Permission is hereby granted, free of charge, to any person obtaining
95 | //a copy of this software and associated documentation files (the
96 | //"Software"), to deal in the Software without restriction, including
97 | //without limitation the rights to use, copy, modify, merge, publish,
98 | //distribute, sublicense, and/or sell copies of the Software, and to
99 | //permit persons to whom the Software is furnished to do so, subject to
100 | //the following conditions:
101 | //
102 | //The above copyright notice and this permission notice shall be
103 | //included in all copies or substantial portions of the Software.
104 | //
105 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
106 | //EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
107 | //MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
108 | //NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
109 | //LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
110 | //OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
111 | //WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
112 | //
113 | //*********************************************************
114 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/FilesFolders/FileListFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.FilesFolders;
6 |
7 | import com.microsoft.office365.starter.R;
8 |
9 | import android.app.Activity;
10 | import android.app.ListFragment;
11 | import android.os.Bundle;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.ListView;
16 |
17 | /**
18 | * A list fragment representing a list of Files. This fragment also supports
19 | * tablet devices by allowing list items to be given an 'activated' state upon
20 | * selection. This helps indicate which item is currently being viewed in a
21 | * {@link com.microsoft.office365.starter.FilesFolders.FileDetailFragment}.
22 | *
23 | * Activities containing this fragment MUST implement the {@link Callbacks}
24 | * interface.
25 | */
26 | public class FileListFragment extends ListFragment {
27 |
28 | /**
29 | * The serialization (saved instance state) Bundle key representing the
30 | * activated item position. Only used on tablets.
31 | */
32 | private static final String STATE_ACTIVATED_POSITION = "activated_position";
33 |
34 | /**
35 | * The fragment's current callback object, which is notified of list item
36 | * clicks.
37 | */
38 | private Callbacks mCallbacks = null;
39 |
40 | /**
41 | * The current activated item position. Only used on tablets.
42 | */
43 | private int mActivatedPosition = ListView.INVALID_POSITION;
44 |
45 | /**
46 | * A callback interface that all activities containing this fragment must
47 | * implement. This mechanism allows activities to be notified of item
48 | * selections.
49 | */
50 | public interface Callbacks {
51 | /**
52 | * Callback for when an item has been selected.
53 | */
54 | public void onItemSelected(int id);
55 | }
56 |
57 | /**
58 | * Mandatory empty constructor for the fragment manager to instantiate the
59 | * fragment (e.g. upon screen orientation changes).
60 | */
61 | public FileListFragment() {
62 | }
63 |
64 |
65 |
66 | @Override
67 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
68 | Bundle savedInstanceState) {
69 |
70 | return inflater.inflate(R.layout.fragment_file_list, container, false);
71 | }
72 |
73 | @Override
74 | public void onViewCreated(View view, Bundle savedInstanceState) {
75 | super.onViewCreated(view, savedInstanceState);
76 |
77 | // Restore the previously serialized activated item position.
78 | if (savedInstanceState != null
79 | && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION))
80 | setActivatedPosition(savedInstanceState
81 | .getInt(STATE_ACTIVATED_POSITION));
82 |
83 | }
84 |
85 | @Override
86 | public void onAttach(Activity activity) {
87 | super.onAttach(activity);
88 |
89 | // Activities containing this fragment must implement its callbacks.
90 | if (!(activity instanceof Callbacks))
91 | throw new IllegalStateException(
92 | "Activity must implement fragment's callbacks.");
93 |
94 | mCallbacks = (Callbacks) activity;
95 | }
96 |
97 | @Override
98 | public void onListItemClick(ListView listView, View view, int position,
99 | long id) {
100 | super.onListItemClick(listView, view, position, id);
101 | // Notify the active callbacks interface (the activity, if the
102 | // fragment is attached to one) that an item has been selected.
103 | mCallbacks.onItemSelected(position);
104 | }
105 |
106 | @Override
107 | public void onSaveInstanceState(Bundle outState) {
108 | super.onSaveInstanceState(outState);
109 | if (mActivatedPosition != ListView.INVALID_POSITION)
110 | // Serialize and persist the activated item position.
111 | outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
112 |
113 | }
114 |
115 | /**
116 | * Turns on activate-on-click mode. When this mode is on, list items will be
117 | * given the 'activated' state when touched.
118 | */
119 | public void setActivateOnItemClick(boolean activateOnItemClick) {
120 | // When setting CHOICE_MODE_SINGLE, ListView will automatically
121 | // give items the 'activated' state when touched.
122 | getListView().setChoiceMode(
123 | activateOnItemClick ? ListView.CHOICE_MODE_SINGLE
124 | : ListView.CHOICE_MODE_NONE);
125 | }
126 |
127 | private void setActivatedPosition(int position) {
128 | if (position == ListView.INVALID_POSITION)
129 | getListView().setItemChecked(mActivatedPosition, false);
130 | else
131 | getListView().setItemChecked(position, true);
132 |
133 |
134 | mActivatedPosition = position;
135 | }
136 | }
137 | // *********************************************************
138 | //
139 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
140 | //
141 | // Copyright (c) Microsoft Corporation
142 | // All rights reserved.
143 | //
144 | // MIT License:
145 | // Permission is hereby granted, free of charge, to any person obtaining
146 | // a copy of this software and associated documentation files (the
147 | // "Software"), to deal in the Software without restriction, including
148 | // without limitation the rights to use, copy, modify, merge, publish,
149 | // distribute, sublicense, and/or sell copies of the Software, and to
150 | // permit persons to whom the Software is furnished to do so, subject to
151 | // the following conditions:
152 | //
153 | // The above copyright notice and this permission notice shall be
154 | // included in all copies or substantial portions of the Software.
155 | //
156 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
157 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
158 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
159 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
160 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
161 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
162 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
163 | //
164 | // *********************************************************
165 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/FilesFolders/FileUpdateFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.FilesFolders;
6 |
7 | import com.microsoft.office365.starter.O365APIsStart_Application;
8 | import com.microsoft.office365.starter.R;
9 | import android.app.Activity;
10 | import android.app.Fragment;
11 | import android.os.Bundle;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.EditText;
16 |
17 | public class FileUpdateFragment extends Fragment {
18 |
19 | private String mContents = null;
20 | private Callbacks mListener;
21 |
22 | /**
23 | * A callback interface that all activities containing this fragment must
24 | * implement. This mechanism allows activities to be notified of item
25 | * selections.
26 | */
27 | public interface Callbacks {
28 | /**
29 | * Callback for when an item has been selected.
30 | */
31 | public void onContentsUpdated(String updatedContent);
32 |
33 | public void onFileUpdateCancelled();
34 | }
35 |
36 | @Override
37 | public void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 |
40 | O365APIsStart_Application application = (O365APIsStart_Application) getActivity()
41 | .getApplication();
42 | if (application.getDisplayedFile() != null)
43 | mContents = application.getDisplayedFile().getContents();
44 |
45 | }
46 |
47 | @Override
48 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
49 | Bundle savedInstanceState) {
50 | View rootView = inflater.inflate(R.layout.fragment_file_detail_update,
51 | container, false);
52 | final EditText editView = (EditText) rootView
53 | .findViewById(R.id.file_detail_update);
54 | if (editView != null && mContents != null)
55 | editView.setText(mContents);
56 |
57 |
58 | // Done button click event handler
59 | rootView.findViewById(R.id.actionbar_done).setOnClickListener(
60 | new View.OnClickListener() {
61 | @Override
62 | public void onClick(View v) {
63 | mContents = editView.getText().toString();
64 |
65 | // Call parent activity listener to post updated
66 | // contents to server.
67 | mListener.onContentsUpdated(mContents);
68 | }
69 | });
70 |
71 | // Cancel button click event handler
72 | rootView.findViewById(R.id.actionbar_cancel).setOnClickListener(
73 | new View.OnClickListener() {
74 | @Override
75 | public void onClick(View v) {
76 |
77 | // Call parent activity listener to remove this
78 | // fragment.
79 | mListener.onFileUpdateCancelled();
80 | mListener = null;
81 | }
82 | });
83 |
84 | return rootView;
85 | }
86 |
87 | @Override
88 | public void onAttach(Activity activity) {
89 | super.onAttach(activity);
90 | try {
91 | mListener = (Callbacks) activity;
92 | } catch (ClassCastException e) {
93 | throw new ClassCastException(
94 | activity.toString()
95 | + " must implement File Update Fragment Callbacks interface");
96 | }
97 | }
98 |
99 | }
100 | // *********************************************************
101 | //
102 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
103 | //
104 | // Copyright (c) Microsoft Corporation
105 | // All rights reserved.
106 | //
107 | // MIT License:
108 | // Permission is hereby granted, free of charge, to any person obtaining
109 | // a copy of this software and associated documentation files (the
110 | // "Software"), to deal in the Software without restriction, including
111 | // without limitation the rights to use, copy, modify, merge, publish,
112 | // distribute, sublicense, and/or sell copies of the Software, and to
113 | // permit persons to whom the Software is furnished to do so, subject to
114 | // the following conditions:
115 | //
116 | // The above copyright notice and this permission notice shall be
117 | // included in all copies or substantial portions of the Software.
118 | //
119 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
120 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
121 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
122 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
123 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
124 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
125 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
126 | //
127 | // *********************************************************
128 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/FilesFolders/O365FileModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.FilesFolders;
6 |
7 | import android.app.Activity;
8 | import com.microsoft.fileservices.Item;
9 | import com.microsoft.office365.starter.O365APIsStart_Application;
10 | import com.microsoft.office365.starter.interfaces.OnFileChangedEventListener;
11 |
12 | public class O365FileModel {
13 |
14 | private OnFileChangedEventListener eventFileChangedListener;
15 | private Item fileItem = null;
16 | private String fileType = null;
17 |
18 | public String getFileType() {
19 | return fileType;
20 | }
21 |
22 | public Item getItem() {
23 | return fileItem;
24 | }
25 |
26 | private String id;
27 |
28 | public String getId() {
29 | return id;
30 | }
31 |
32 | public void setId(String value) {
33 | if (value != null)
34 | id = value;
35 | }
36 |
37 | private String name;
38 |
39 | public String getName() {
40 | return name;
41 | }
42 |
43 | public void setName(String value) {
44 | if (value != null)
45 | name = value;
46 | }
47 |
48 | private String contents;
49 |
50 | public String getContents() {
51 | return contents;
52 | }
53 |
54 | public void setContents(Activity currentActivity, String value) {
55 | contents = value;
56 | fireContentsChanged(currentActivity);
57 | }
58 |
59 | public void setFileChangedEventListener(OnFileChangedEventListener event) {
60 | this.eventFileChangedListener = event;
61 |
62 | }
63 |
64 | public O365FileModel(O365APIsStart_Application application, Item newFile) {
65 | name = newFile.getname();
66 | id = newFile.getid();
67 | fileItem = newFile;
68 | fileType = newFile.gettype();
69 | }
70 |
71 | @Override
72 | public String toString() {
73 | return name;
74 | }
75 |
76 | private void fireContentsChanged(Activity currentActivity) {
77 | if (eventFileChangedListener != null)
78 | currentActivity.runOnUiThread(new Runnable() {
79 | @Override
80 | public void run() {
81 | try {
82 | OnFileChangedEventListener.Event event = new OnFileChangedEventListener.Event();
83 | event.setEventType(OnFileChangedEventListener.Event.eventType.contentsChanged);
84 | eventFileChangedListener.onFileChangedEvent(
85 | O365FileModel.this, event);
86 | } catch (Exception e) {
87 | e.printStackTrace();
88 | }
89 | }
90 | });
91 |
92 | }
93 | }
94 | // *********************************************************
95 | //
96 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
97 | //
98 | // Copyright (c) Microsoft Corporation
99 | // All rights reserved.
100 | //
101 | // MIT License:
102 | // Permission is hereby granted, free of charge, to any person obtaining
103 | // a copy of this software and associated documentation files (the
104 | // "Software"), to deal in the Software without restriction, including
105 | // without limitation the rights to use, copy, modify, merge, publish,
106 | // distribute, sublicense, and/or sell copies of the Software, and to
107 | // permit persons to whom the Software is furnished to do so, subject to
108 | // the following conditions:
109 | //
110 | // The above copyright notice and this permission notice shall be
111 | // included in all copies or substantial portions of the Software.
112 | //
113 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
114 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
115 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
116 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
117 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
118 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
119 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
120 | //
121 | // *********************************************************
122 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/MainActivity/MainButtonsFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.MainActivity;
6 |
7 | import android.app.Fragment;
8 | import android.content.Context;
9 | import android.graphics.PorterDuff.Mode;
10 | import android.graphics.drawable.Drawable;
11 | import android.os.Bundle;
12 | import android.util.Log;
13 | import android.view.LayoutInflater;
14 | import android.view.View;
15 | import android.view.View.OnClickListener;
16 | import android.view.ViewGroup;
17 | import android.widget.ImageButton;
18 |
19 | import com.microsoft.office365.starter.O365APIsStart_Application;
20 | import com.microsoft.office365.starter.R;
21 | import com.microsoft.office365.starter.helpers.Constants;
22 | import com.microsoft.office365.starter.interfaces.MainActivityCoordinator;
23 |
24 |
25 | public class MainButtonsFragment extends Fragment implements OnClickListener {
26 |
27 | private ImageButton mCalendarButton;
28 | private ImageButton mFilesButton;
29 | private ImageButton mMailButton;
30 | private O365APIsStart_Application mApplication;
31 |
32 | @Override
33 | public void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 |
36 | mApplication = (O365APIsStart_Application) getActivity()
37 | .getApplication();
38 | }
39 |
40 | @Override
41 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
42 | Bundle savedInstanceState) {
43 | View fragmentView = inflater.inflate(R.layout.fragment_main_buttons,
44 | container, false);
45 |
46 | // Create references to ImageButtons
47 | mCalendarButton = (ImageButton) fragmentView
48 | .findViewById(R.id.calendarButton);
49 | mFilesButton = (ImageButton) fragmentView
50 | .findViewById(R.id.filesButton);
51 | mMailButton = (ImageButton) fragmentView
52 | .findViewById(R.id.mailButton);
53 | mCalendarButton.setOnClickListener(this);
54 | mFilesButton.setOnClickListener(this);
55 | mMailButton.setOnClickListener(this);
56 |
57 | // Inflate the layout for this fragment
58 | return fragmentView;
59 | }
60 |
61 | public void setButtonsEnabled(boolean enabled) {
62 | setImageButtonEnabled(getActivity(), enabled, mCalendarButton,
63 | R.drawable.calendar_icon_main);
64 | setImageButtonEnabled(getActivity(), enabled, mFilesButton,
65 | R.drawable.myfiles_icon_main);
66 | setImageButtonEnabled(getActivity(), enabled, mMailButton,
67 | R.drawable.mail_icon_main);
68 | }
69 |
70 | private static void setImageButtonEnabled(Context context, boolean enabled,
71 | ImageButton item, int iconResId) {
72 | item.setEnabled(enabled);
73 | item.setClickable(enabled);
74 | Drawable originalIcon = context.getResources().getDrawable(iconResId);
75 | int overlay = context.getResources().getColor(R.color.DisabledItemBrush);
76 | Drawable icon = enabled ? originalIcon : applyOverlayToDrawable(
77 | originalIcon, overlay);
78 | item.setImageDrawable(icon);
79 | }
80 |
81 | private static Drawable applyOverlayToDrawable(Drawable drawable,
82 | int overlay) {
83 | if (drawable == null) {
84 | return null;
85 | }
86 | Drawable res = drawable.mutate();
87 | res.setColorFilter(overlay, Mode.SRC_IN);
88 | return res;
89 | }
90 |
91 | @Override
92 | public void onClick(View v) {
93 | String capability = "";
94 | switch (v.getId()) {
95 | case R.id.filesButton:
96 | capability = Constants.MYFILES_CAPABILITY;
97 | break;
98 | case R.id.calendarButton:
99 | capability = Constants.CALENDAR_CAPABILITY;
100 | if (mApplication.getCalendarModel() != null) {
101 | mApplication.getCalendarModel().getCalendar().ITEMS.clear();
102 | mApplication.getCalendarModel().getCalendar().ITEM_MAP.clear();
103 | }
104 | break;
105 | case R.id.mailButton:
106 | capability = Constants.MAIL_CAPABILITY;
107 | break;
108 | }
109 |
110 | Log.i("Office 365 Starter Project", "User selected the " + capability + " capability");
111 | MainActivityCoordinator mainActivity = (MainActivityCoordinator) getActivity();
112 | mainActivity.onServiceSelected(capability);
113 | }
114 | }
115 | // *********************************************************
116 | //
117 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
118 | //
119 | // Copyright (c) Microsoft Corporation
120 | // All rights reserved.
121 | //
122 | // MIT License:
123 | // Permission is hereby granted, free of charge, to any person obtaining
124 | // a copy of this software and associated documentation files (the
125 | // "Software"), to deal in the Software without restriction, including
126 | // without limitation the rights to use, copy, modify, merge, publish,
127 | // distribute, sublicense, and/or sell copies of the Software, and to
128 | // permit persons to whom the Software is furnished to do so, subject to
129 | // the following conditions:
130 | //
131 | // The above copyright notice and this permission notice shall be
132 | // included in all copies or substantial portions of the Software.
133 | //
134 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
135 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
136 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
137 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
138 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
139 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
140 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
141 | //
142 | // *********************************************************
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/MainActivity/MainReadmeFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.MainActivity;
6 |
7 | import com.microsoft.office365.starter.R;
8 |
9 | import android.app.Fragment;
10 | import android.os.Bundle;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.webkit.WebView;
15 |
16 | public class MainReadmeFragment extends Fragment {
17 |
18 | private WebView mReadmeWebView;
19 |
20 | @Override
21 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
22 | Bundle savedInstanceState) {
23 | View fragmentView = inflater.inflate(R.layout.fragment_main_readme,
24 | container, false);
25 |
26 | // Load the readme text into the WebView
27 | mReadmeWebView = (WebView) fragmentView
28 | .findViewById(R.id.readmeWebView);
29 | mReadmeWebView.setBackgroundColor(getResources().getColor(
30 | R.color.ApplicationPageBackgroundThemeBrush));
31 | String readmeHtml = getResources().getString(
32 | R.string.mainActivity_Readme);
33 | mReadmeWebView.loadData(readmeHtml, "text/html", "UTF-8");
34 | mReadmeWebView.setVisibility(View.VISIBLE);
35 | // Inflate the layout for this fragment
36 | return fragmentView;
37 | }
38 |
39 |
40 | }
41 | // *********************************************************
42 | //
43 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
44 | //
45 | // Copyright (c) Microsoft Corporation
46 | // All rights reserved.
47 | //
48 | // MIT License:
49 | // Permission is hereby granted, free of charge, to any person obtaining
50 | // a copy of this software and associated documentation files (the
51 | // "Software"), to deal in the Software without restriction, including
52 | // without limitation the rights to use, copy, modify, merge, publish,
53 | // distribute, sublicense, and/or sell copies of the Software, and to
54 | // permit persons to whom the Software is furnished to do so, subject to
55 | // the following conditions:
56 | //
57 | // The above copyright notice and this permission notice shall be
58 | // included in all copies or substantial portions of the Software.
59 | //
60 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
61 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
62 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
63 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
64 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
65 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
66 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67 | //
68 | // *********************************************************
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/helpers/APIErrorMessageHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.helpers;
6 |
7 | import org.json.JSONException;
8 | import org.json.JSONObject;
9 |
10 | public class APIErrorMessageHelper
11 | {
12 | // Takes the string returned from Outlook service in the
13 | // onFailure event, parses for the JSON object, and gets
14 | // the actual error message
15 | public static String getErrorMessage(String result)
16 | {
17 | String errorMessage = "";
18 | try {
19 |
20 | // Gets the JSON object out of the result string
21 | String responseJSON = result
22 | .substring(result.indexOf("{"), result.length());
23 |
24 | JSONObject jObject = new JSONObject(responseJSON);
25 | JSONObject error = (JSONObject) jObject.get("error");
26 | errorMessage = error.getString("message");
27 |
28 | }
29 | catch (JSONException e)
30 | {
31 | e.printStackTrace();
32 | errorMessage = e.getMessage();
33 | }
34 | catch (Exception ex)
35 | {
36 | ex.printStackTrace();
37 | errorMessage = ex.getMessage();
38 | }
39 | return errorMessage;
40 | }
41 |
42 | }
43 | // *********************************************************
44 | //
45 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
46 | //
47 | // Copyright (c) Microsoft Corporation
48 | // All rights reserved.
49 | //
50 | // MIT License:
51 | // Permission is hereby granted, free of charge, to any person obtaining
52 | // a copy of this software and associated documentation files (the
53 | // "Software"), to deal in the Software without restriction, including
54 | // without limitation the rights to use, copy, modify, merge, publish,
55 | // distribute, sublicense, and/or sell copies of the Software, and to
56 | // permit persons to whom the Software is furnished to do so, subject to
57 | // the following conditions:
58 | //
59 | // The above copyright notice and this permission notice shall be
60 | // included in all copies or substantial portions of the Software.
61 | //
62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
63 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
64 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
65 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
66 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
67 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
68 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
69 | //
70 | // *********************************************************
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/helpers/AsyncController.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) Microsoft Open Technologies, Inc.
3 | * All Rights Reserved
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing,
10 | * software distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and limitations under the License.
13 |
14 | ******************************************************************************/
15 | package com.microsoft.office365.starter.helpers;
16 |
17 | import android.app.Activity;
18 | import android.widget.Toast;
19 |
20 | import java.util.concurrent.Callable;
21 | import java.util.concurrent.ExecutorService;
22 | import java.util.concurrent.Executors;
23 |
24 |
25 | /**
26 | * holds the context of execution across activities
27 | */
28 | public class AsyncController {
29 |
30 | private static AsyncController INSTANCE;
31 |
32 | ExecutorService executor;
33 |
34 | private AsyncController() {
35 | this.executor = Executors.newFixedThreadPool(2);
36 | }
37 |
38 | /**
39 | * Creates a singleton instance of the AsyncController
40 | * @return an instance of AsyncController class
41 | */
42 | public static synchronized AsyncController getInstance() {
43 | if (INSTANCE == null) {
44 | INSTANCE = new AsyncController();
45 | }
46 |
47 | return INSTANCE;
48 | }
49 |
50 |
51 |
52 | /**
53 | * post an async task to the executor thread pool
54 | * @param callable the task to be executed
55 | *
56 | */
57 | public void postAsyncTask(Callable callable) {
58 | this.executor.submit(callable);
59 | }
60 |
61 | /**
62 | * notifies about the exception on executing the Future
63 | *
64 | * @param msg error message to be displayed
65 | */
66 | public void handleError(final Activity activity, final String msg) {
67 | activity.runOnUiThread(new Runnable() {
68 | @Override
69 | public void run() {
70 | Toast.makeText(activity, msg, Toast.LENGTH_LONG).show();
71 | }
72 | });
73 | }
74 | }
75 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/helpers/AuthenticationController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | * Portions of this class are adapted from the AuthenticationController.java file from Microsoft Open Technologies, Inc.
4 | * located at https://github.com/OfficeDev/Office-365-SDK-for-Android/blob/master/samples/outlook/app/src/main/java/com/microsoft/services/controllers/AuthenticationController.java
5 | */
6 |
7 | package com.microsoft.office365.starter.helpers;
8 |
9 | import android.app.Activity;
10 | import android.content.Context;
11 | import android.util.Log;
12 |
13 | import com.google.common.util.concurrent.SettableFuture;
14 | import com.microsoft.aad.adal.AuthenticationCallback;
15 | import com.microsoft.aad.adal.AuthenticationContext;
16 | import android.content.SharedPreferences;
17 | import android.content.SharedPreferences.Editor;
18 | import com.microsoft.aad.adal.AuthenticationResult;
19 | import com.microsoft.aad.adal.AuthenticationResult.AuthenticationStatus;
20 | import com.microsoft.aad.adal.PromptBehavior;
21 | import com.microsoft.aad.adal.UserInfo;
22 | import com.microsoft.services.odata.impl.ADALDependencyResolver;
23 | import com.microsoft.services.odata.interfaces.DependencyResolver;
24 | import com.microsoft.services.odata.interfaces.LogLevel;
25 |
26 | /**
27 | * Handles setup of ADAL Dependency Resolver for use in API clients.
28 | */
29 |
30 | public class AuthenticationController {
31 | private static String ComponentID = "AuthenticationController";
32 | private static String mLoggedInUser;
33 |
34 | private AuthenticationContext authContext;
35 | private ADALDependencyResolver dependencyResolver;
36 | private Activity contextActivity;
37 | private String resourceId;
38 |
39 | public static synchronized AuthenticationController getInstance() {
40 | if (INSTANCE == null) {
41 | INSTANCE = new AuthenticationController();
42 | }
43 | return INSTANCE;
44 | }
45 | private static AuthenticationController INSTANCE;
46 |
47 | private AuthenticationController() {
48 | resourceId = Constants.DISCOVERY_RESOURCE_ID;
49 | }
50 |
51 | private AuthenticationController(final Activity contextActivity){
52 | this();
53 | this.contextActivity = contextActivity;
54 | }
55 |
56 | /**
57 | * Set the context activity before initializing to the currently active activity.
58 | *
59 | * @param contextActivity Currently active activity which can be utilized for interactive
60 | * prompt.
61 | */
62 | public void setContextActivity(final Activity contextActivity) {
63 | this.contextActivity = contextActivity;
64 | }
65 |
66 | /**
67 | * Change from the default Resource ID set in ServiceConstants to a different
68 | * resource ID.
69 | * This can be called at anytime without requiring another interactive prompt.
70 | * @param resourceId URL of resource ID to be accessed on behalf of user.
71 | */
72 | public void setResourceId(final String resourceId) {
73 | this.resourceId = resourceId;
74 | this.dependencyResolver.setResourceId(resourceId);
75 | }
76 |
77 | /**
78 | * Turn on logging.
79 | * @param level LogLevel to set.
80 | */
81 | public void enableLogging(LogLevel level) {
82 | this.dependencyResolver.getLogger().setEnabled(true);
83 | this.dependencyResolver.getLogger().setLogLevel(level);
84 | }
85 |
86 | /**
87 | * Turn off logging.
88 | */
89 | public void disableLogging() {
90 | this.dependencyResolver.getLogger().setEnabled(false);
91 | }
92 |
93 | /**
94 | * Description: Calls AuthenticationContext.acquireToken(...) once to initialize with
95 | * user's credentials and avoid interactive prompt on later calls.
96 | * If all tokens expire, app must call initialize() again to prompt user interactively and
97 | * set up authentication context.
98 | *
99 | * @return A signal to wait on before continuing execution.
100 | */
101 | public SettableFuture initialize() {
102 |
103 | final SettableFuture result = SettableFuture.create();
104 |
105 | if (verifyAuthenticationContext()) {
106 | getAuthenticationContext().acquireToken(
107 | this.contextActivity,
108 | this.resourceId,
109 | Constants.CLIENT_ID,
110 | Constants.REDIRECT_URI,
111 | PromptBehavior.Auto,
112 | new AuthenticationCallback() {
113 |
114 | @Override
115 | public void onSuccess(final AuthenticationResult authenticationResult) {
116 |
117 | if (authenticationResult != null && authenticationResult.getStatus() == AuthenticationStatus.Succeeded) {
118 | dependencyResolver = new ADALDependencyResolver(
119 | getAuthenticationContext(),
120 | resourceId,
121 | Constants.CLIENT_ID);
122 | storeUserId(contextActivity, authenticationResult);
123 | result.set(true);
124 | }
125 | }
126 |
127 | @Override
128 | public void onError(Exception t) {
129 | result.setException(t);
130 | }
131 |
132 | private void storeUserId(final Activity rootActivity,
133 | final AuthenticationResult authenticationResult) {
134 |
135 | UserInfo userInfo = authenticationResult.getUserInfo();
136 | SharedPreferences sharedPref = rootActivity
137 | .getPreferences(Context.MODE_PRIVATE);
138 |
139 | if (userInfo != null) {
140 | mLoggedInUser = userInfo.getUserId();
141 | Editor editor = sharedPref.edit();
142 | editor.putString("UserId", mLoggedInUser);
143 | editor.putString("DisplayName", userInfo.getGivenName() + " " + userInfo.getFamilyName());
144 | editor.apply();
145 | } else {
146 | mLoggedInUser = sharedPref.getString("UserId", "");
147 | }
148 | }
149 | }
150 | );
151 | } else {
152 | result.setException(new Throwable("Auth context verification failed. Did you set a context activity?"));
153 | }
154 | return result;
155 | }
156 |
157 | /**
158 | * Gets AuthenticationContext for AAD.
159 | *
160 | * @return authenticationContext, if successful
161 | */
162 | public AuthenticationContext getAuthenticationContext() {
163 | if (authContext == null) {
164 | try {
165 | authContext = new AuthenticationContext(this.contextActivity, Constants.AUTHORITY_URL, false);
166 | } catch (Throwable t) {
167 | Log.e(ComponentID, t.toString());
168 | }
169 | }
170 | return authContext;
171 | }
172 |
173 | public DependencyResolver getDependencyResolver() {
174 | return getInstance().dependencyResolver;
175 | }
176 |
177 | private boolean verifyAuthenticationContext() {
178 | if (this.contextActivity == null) {
179 | Log.e(ComponentID, "Must set context activity");
180 | return false;
181 | }
182 | return true;
183 | }
184 |
185 | }
186 |
187 | // *********************************************************
188 | //
189 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
190 | //
191 | // Copyright (c) Microsoft Corporation
192 | // All rights reserved.
193 | //
194 | // MIT License:
195 | // Permission is hereby granted, free of charge, to any person obtaining
196 | // a copy of this software and associated documentation files (the
197 | // "Software"), to deal in the Software without restriction, including
198 | // without limitation the rights to use, copy, modify, merge, publish,
199 | // distribute, sublicense, and/or sell copies of the Software, and to
200 | // permit persons to whom the Software is furnished to do so, subject to
201 | // the following conditions:
202 | //
203 | // The above copyright notice and this permission notice shall be
204 | // included in all copies or substantial portions of the Software.
205 | //
206 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
207 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
208 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
209 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
210 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
211 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
212 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
213 | //
214 | // *********************************************************
215 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/helpers/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.helpers;
6 |
7 | public interface Constants {
8 | public static final String AUTHORITY_URL = "https://login.windows.net/common";
9 | public static final String DISCOVERY_RESOURCE_URL = "https://api.office.com/discovery/v1.0/me/";
10 | public static final String DISCOVERY_RESOURCE_ID = "https://api.office.com/discovery/";
11 | public static final String MYFILES_CAPABILITY = "MyFiles";
12 | public static final String CALENDAR_CAPABILITY = "Calendar";
13 | public static final String MAIL_CAPABILITY = "Mail";
14 | public static final String CALENDER_ID = "Calendar";
15 | // Update these two constants with the values for your application:
16 | public static final String CLIENT_ID = "";
17 | public static final String REDIRECT_URI = "";
18 | public static final String MAIL_OPERATION_ADD = "Add";
19 | public static final String MAIL_OPERATION_DELETE = "Delete";
20 | public static final String MAIL_OPERATION_RESULT_SUCCESS = "Added";
21 | public static final String MAIL_OPERATION_RESULT_FAIL = "Failed";
22 | public static final String MAIL_DETAIL_FRAGMENT_TAG = "mail_detail_fragment_tag";
23 | }
24 |
25 | // *********************************************************
26 | //
27 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
28 | //
29 | // Copyright (c) Microsoft Corporation
30 | // All rights reserved.
31 | //
32 | // MIT License:
33 | // Permission is hereby granted, free of charge, to any person obtaining
34 | // a copy of this software and associated documentation files (the
35 | // "Software"), to deal in the Software without restriction, including
36 | // without limitation the rights to use, copy, modify, merge, publish,
37 | // distribute, sublicense, and/or sell copies of the Software, and to
38 | // permit persons to whom the Software is furnished to do so, subject to
39 | // the following conditions:
40 | //
41 | // The above copyright notice and this permission notice shall be
42 | // included in all copies or substantial portions of the Software.
43 | //
44 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
45 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
46 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
47 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
48 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
49 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
50 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51 | //
52 | // *********************************************************
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/helpers/DeleteDialogFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.helpers;
6 |
7 | import android.app.Activity;
8 | import android.app.AlertDialog;
9 | import android.app.Dialog;
10 | import android.app.DialogFragment;
11 | import android.content.DialogInterface;
12 | import android.os.Bundle;
13 |
14 | import com.microsoft.office365.starter.R;
15 | import com.microsoft.office365.starter.interfaces.BaseDialogListener;
16 |
17 | public class DeleteDialogFragment extends DialogFragment {
18 | BaseDialogListener mListener;
19 |
20 | @Override
21 | public void onAttach(Activity activity) {
22 | super.onAttach(activity);
23 | try
24 | {
25 | mListener = (BaseDialogListener) activity;
26 | } catch (ClassCastException e)
27 | {
28 | throw new ClassCastException(activity.toString()
29 | + " must implement BaseDialogListener");
30 | }
31 | }
32 |
33 | @Override
34 | public Dialog onCreateDialog(Bundle savedInstanceState) {
35 |
36 | // Use the Builder class for convenient dialog construction
37 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
38 |
39 | if (getArguments().containsKey("MessageString"))
40 | {
41 | builder.setMessage(getArguments().getString("MessageString"));
42 | }
43 | else
44 | {
45 | builder.setMessage(getArguments().getInt("Message"));
46 | }
47 |
48 | builder.setPositiveButton(R.string.Ok, new DialogInterface.OnClickListener()
49 | {
50 | public void onClick(DialogInterface dialog, int id)
51 | {
52 | mListener.onDialogPositiveClick(DeleteDialogFragment.this);
53 | }
54 | })
55 | .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
56 | public void onClick(DialogInterface dialog, int id)
57 | {
58 | mListener.onDialogNegativeClick(DeleteDialogFragment.this);
59 | }
60 | });
61 | // Create the AlertDialog object and return it
62 | return builder.create();
63 | }
64 | }
65 | //*********************************************************
66 | //
67 | //O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
68 | //
69 | //Copyright (c) Microsoft Corporation
70 | //All rights reserved.
71 | //
72 | //MIT License:
73 | //Permission is hereby granted, free of charge, to any person obtaining
74 | //a copy of this software and associated documentation files (the
75 | //"Software"), to deal in the Software without restriction, including
76 | //without limitation the rights to use, copy, modify, merge, publish,
77 | //distribute, sublicense, and/or sell copies of the Software, and to
78 | //permit persons to whom the Software is furnished to do so, subject to
79 | //the following conditions:
80 | //
81 | //The above copyright notice and this permission notice shall be
82 | //included in all copies or substantial portions of the Software.
83 | //
84 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85 | //EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
86 | //MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
87 | //NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
88 | //LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
89 | //OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
90 | //WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
91 | //
92 | //*********************************************************
93 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/helpers/File_UI_State.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.helpers;
6 |
7 | import android.view.MenuItem;
8 | import android.widget.Button;
9 |
10 | //Helper class to manage UI for enabling and disabling buttons
11 | //based on UI state.
12 | public class File_UI_State {
13 |
14 | public boolean isListItemSelected = true;
15 | public boolean isEditing = true;
16 | public boolean isFileContentsDisplayed = true;
17 |
18 | public Button btnGet = null;
19 | public Button btnCreate = null;
20 | public Button btnDelete = null;
21 | public Button btnRead = null;
22 | public Button btnUpdate = null;
23 |
24 | public MenuItem itemGet = null;
25 | public MenuItem itemCreate = null;
26 | public MenuItem itemDelete = null;
27 | public MenuItem itemRead = null;
28 | public MenuItem itemUpdate = null;
29 | public MenuItem itemUpload = null;
30 | public MenuItem itemDownload = null;
31 |
32 | public void setEditMode(boolean mode) {
33 | if (mode == isEditing)
34 | return;
35 | isEditing = mode;
36 | if (btnGet != null)
37 | btnGet.setEnabled(!isEditing);
38 | if (btnCreate != null)
39 | btnCreate.setEnabled(!isEditing);
40 | if (btnDelete != null)
41 | btnDelete.setEnabled(!isEditing);
42 | if (btnRead != null)
43 | btnRead.setEnabled(!isEditing);
44 | if (btnUpdate != null)
45 | btnUpdate.setEnabled(!isEditing);
46 |
47 | if (itemGet != null)
48 | itemGet.setEnabled(!isEditing);
49 | if (itemCreate != null)
50 | itemCreate.setEnabled(!isEditing);
51 | if (itemDelete != null)
52 | itemDelete.setEnabled(!isEditing);
53 | if (itemRead != null)
54 | itemRead.setEnabled(!isEditing);
55 | if (itemUpdate != null)
56 | itemUpdate.setEnabled(!isEditing);
57 | if (itemUpload != null)
58 | itemUpload.setEnabled(!isEditing);
59 | if (itemDownload != null)
60 | itemDownload.setEnabled(!isEditing);
61 |
62 | }
63 |
64 | public void setFileDisplayMode(boolean mode) {
65 | if (mode == isFileContentsDisplayed)
66 | return;
67 | isFileContentsDisplayed = mode;
68 | if (btnUpdate != null)
69 | btnUpdate.setEnabled(isFileContentsDisplayed);
70 |
71 | if (itemUpdate != null)
72 | itemUpdate.setEnabled(isFileContentsDisplayed);
73 |
74 | }
75 |
76 | public void setListSelectedMode(boolean mode) {
77 | if (mode == isListItemSelected)
78 | return;
79 | isListItemSelected = mode;
80 | if (btnDelete != null)
81 | btnDelete.setEnabled(isListItemSelected);
82 | if (btnRead != null)
83 | btnRead.setEnabled(isListItemSelected);
84 |
85 | if (itemDelete != null)
86 | itemDelete.setEnabled(isListItemSelected);
87 | if (itemRead != null)
88 | itemRead.setEnabled(isListItemSelected);
89 |
90 | }
91 | }
92 | // *********************************************************
93 | //
94 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
95 | //
96 | // Copyright (c) Microsoft Corporation
97 | // All rights reserved.
98 | //
99 | // MIT License:
100 | // Permission is hereby granted, free of charge, to any person obtaining
101 | // a copy of this software and associated documentation files (the
102 | // "Software"), to deal in the Software without restriction, including
103 | // without limitation the rights to use, copy, modify, merge, publish,
104 | // distribute, sublicense, and/or sell copies of the Software, and to
105 | // permit persons to whom the Software is furnished to do so, subject to
106 | // the following conditions:
107 | //
108 | // The above copyright notice and this permission notice shall be
109 | // included in all copies or substantial portions of the Software.
110 | //
111 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
112 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
113 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
114 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
115 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
116 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
117 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
118 | //
119 | // *********************************************************
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/helpers/ProgressDialogHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.helpers;
6 |
7 | import android.app.Activity;
8 | import android.app.ProgressDialog;
9 |
10 | public class ProgressDialogHelper {
11 |
12 | // show dialog using the given parameters
13 | static public ProgressDialog showProgressDialog(Activity activity,
14 | String title, String message) {
15 | ProgressDialog dialog = new ProgressDialog(activity);
16 | dialog.setTitle(title);
17 | dialog.setMessage(message);
18 | dialog.setCancelable(true);
19 | dialog.setIndeterminate(true);
20 | dialog.show();
21 | return dialog;
22 | }
23 |
24 | }
25 | // *********************************************************
26 | //
27 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
28 | //
29 | // Copyright (c) Microsoft Corporation
30 | // All rights reserved.
31 | //
32 | // MIT License:
33 | // Permission is hereby granted, free of charge, to any person obtaining
34 | // a copy of this software and associated documentation files (the
35 | // "Software"), to deal in the Software without restriction, including
36 | // without limitation the rights to use, copy, modify, merge, publish,
37 | // distribute, sublicense, and/or sell copies of the Software, and to
38 | // permit persons to whom the Software is furnished to do so, subject to
39 | // the following conditions:
40 | //
41 | // The above copyright notice and this permission notice shall be
42 | // included in all copies or substantial portions of the Software.
43 | //
44 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
45 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
46 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
47 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
48 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
49 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
50 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51 | //
52 | // *********************************************************
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/BaseDialogListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | import android.app.Fragment;
8 |
9 | public interface BaseDialogListener {
10 | public void onDialogPositiveClick(Fragment dialog);
11 |
12 | public void onDialogNegativeClick(Fragment dialog);
13 | }
14 |
15 | // *********************************************************
16 | //
17 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
18 | //
19 | // Copyright (c) Microsoft Corporation
20 | // All rights reserved.
21 | //
22 | // MIT License:
23 | // Permission is hereby granted, free of charge, to any person obtaining
24 | // a copy of this software and associated documentation files (the
25 | // "Software"), to deal in the Software without restriction, including
26 | // without limitation the rights to use, copy, modify, merge, publish,
27 | // distribute, sublicense, and/or sell copies of the Software, and to
28 | // permit persons to whom the Software is furnished to do so, subject to
29 | // the following conditions:
30 | //
31 | // The above copyright notice and this permission notice shall be
32 | // included in all copies or substantial portions of the Software.
33 | //
34 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 | //
42 | // *********************************************************
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/MainActivityCoordinator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | public interface MainActivityCoordinator {
8 | void onServiceSelected(String capability);
9 | }
10 | // *********************************************************
11 | //
12 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
13 | //
14 | // Copyright (c) Microsoft Corporation
15 | // All rights reserved.
16 | //
17 | // MIT License:
18 | // Permission is hereby granted, free of charge, to any person obtaining
19 | // a copy of this software and associated documentation files (the
20 | // "Software"), to deal in the Software without restriction, including
21 | // without limitation the rights to use, copy, modify, merge, publish,
22 | // distribute, sublicense, and/or sell copies of the Software, and to
23 | // permit persons to whom the Software is furnished to do so, subject to
24 | // the following conditions:
25 | //
26 | // The above copyright notice and this permission notice shall be
27 | // included in all copies or substantial portions of the Software.
28 | //
29 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
33 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
34 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
35 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 | //
37 | // *********************************************************
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/NoticeDialogListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | /**
8 | * This interface specifies the callback methods to implement in activities that attach calendar
9 | * event detail fragments whose contents include Ok and Cancel buttons.
10 | */
11 |
12 | import com.microsoft.office365.starter.Calendar.O365CalendarModel.O365Calendar_Event;
13 | import android.app.Fragment;
14 |
15 | public interface NoticeDialogListener extends BaseDialogListener {
16 | public void onDialogPositiveClick(Fragment dialog);
17 |
18 | public void onDialogPositiveClick(Fragment dialog,
19 | O365Calendar_Event newItem, boolean newItemFlag);
20 |
21 | public void onDialogNegativeClick(Fragment dialog);
22 | }
23 | // *********************************************************
24 | //
25 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
26 | //
27 | // Copyright (c) Microsoft Corporation
28 | // All rights reserved.
29 | //
30 | // MIT License:
31 | // Permission is hereby granted, free of charge, to any person obtaining
32 | // a copy of this software and associated documentation files (the
33 | // "Software"), to deal in the Software without restriction, including
34 | // without limitation the rights to use, copy, modify, merge, publish,
35 | // distribute, sublicense, and/or sell copies of the Software, and to
36 | // permit persons to whom the Software is furnished to do so, subject to
37 | // the following conditions:
38 | //
39 | // The above copyright notice and this permission notice shall be
40 | // included in all copies or substantial portions of the Software.
41 | //
42 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
46 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
47 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
48 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49 | //
50 | // *********************************************************
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/OnEventsAddedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | import java.util.List;
8 |
9 | import com.microsoft.office365.starter.Calendar.O365CalendarModel;
10 |
11 | /**
12 | * Defines a callback method and event data class to be used by a class that
13 | * gets a notification when an O365.Event is added.
14 | */
15 | public interface OnEventsAddedListener {
16 | class setEventCollection {
17 | List mEventCollection;
18 |
19 | public List getEventCollection() {
20 | return mEventCollection;
21 | }
22 |
23 | public setEventCollection(
24 | List eventCollection) {
25 | mEventCollection = eventCollection;
26 | }
27 |
28 | }
29 |
30 | public void OnEventsAdded(setEventCollection eventCollection);
31 |
32 | }
33 | // *********************************************************
34 | //
35 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
36 | //
37 | // Copyright (c) Microsoft Corporation
38 | // All rights reserved.
39 | //
40 | // MIT License:
41 | // Permission is hereby granted, free of charge, to any person obtaining
42 | // a copy of this software and associated documentation files (the
43 | // "Software"), to deal in the Software without restriction, including
44 | // without limitation the rights to use, copy, modify, merge, publish,
45 | // distribute, sublicense, and/or sell copies of the Software, and to
46 | // permit persons to whom the Software is furnished to do so, subject to
47 | // the following conditions:
48 | //
49 | // The above copyright notice and this permission notice shall be
50 | // included in all copies or substantial portions of the Software.
51 | //
52 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
53 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
54 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
55 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
56 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
57 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
58 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
59 | //
60 | // *********************************************************
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/OnFileChangedEventListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | import com.microsoft.office365.starter.FilesFolders.O365FileModel;
8 |
9 | public interface OnFileChangedEventListener {
10 | public class Event {
11 | public enum eventType {
12 | contentsChanged, fileCreated, fileDeleted
13 | }
14 |
15 | eventType id = eventType.contentsChanged;
16 |
17 | public eventType getEventType() {
18 | return id;
19 | }
20 |
21 | public void setEventType(eventType value) {
22 | id = value;
23 | }
24 | }
25 |
26 | public void onFileChangedEvent(O365FileModel fileItem, Event event);
27 | }
28 | // *********************************************************
29 | //
30 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
31 | //
32 | // Copyright (c) Microsoft Corporation
33 | // All rights reserved.
34 | //
35 | // MIT License:
36 | // Permission is hereby granted, free of charge, to any person obtaining
37 | // a copy of this software and associated documentation files (the
38 | // "Software"), to deal in the Software without restriction, including
39 | // without limitation the rights to use, copy, modify, merge, publish,
40 | // distribute, sublicense, and/or sell copies of the Software, and to
41 | // permit persons to whom the Software is furnished to do so, subject to
42 | // the following conditions:
43 | //
44 | // The above copyright notice and this permission notice shall be
45 | // included in all copies or substantial portions of the Software.
46 | //
47 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
51 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
52 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
53 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 | //
55 | // *********************************************************
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/OnMessagesAddedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | import com.microsoft.office365.starter.Email.O365MailItemsModel;
8 |
9 | import java.util.List;
10 |
11 | public interface OnMessagesAddedListener {
12 | class MessageCollection {
13 | List mMessageCollection;
14 |
15 | public List getMessageCollection() {
16 | return mMessageCollection;
17 | }
18 |
19 | public MessageCollection(
20 | List messageCollection) {
21 | mMessageCollection = messageCollection;
22 | }
23 |
24 | }
25 |
26 | public void OnMessagesAdded(MessageCollection messageCollection);
27 |
28 | }
29 | // *********************************************************
30 | //
31 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
32 | //
33 | // Copyright (c) Microsoft Corporation
34 | // All rights reserved.
35 | //
36 | // MIT License:
37 | // Permission is hereby granted, free of charge, to any person obtaining
38 | // a copy of this software and associated documentation files (the
39 | // "Software"), to deal in the Software without restriction, including
40 | // without limitation the rights to use, copy, modify, merge, publish,
41 | // distribute, sublicense, and/or sell copies of the Software, and to
42 | // permit persons to whom the Software is furnished to do so, subject to
43 | // the following conditions:
44 | //
45 | // The above copyright notice and this permission notice shall be
46 | // included in all copies or substantial portions of the Software.
47 | //
48 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
49 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
50 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
51 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
52 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
53 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
54 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55 | //
56 | // *********************************************************
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/OnOperationCompleteListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | public interface OnOperationCompleteListener {
8 | class OperationResult {
9 | String mOperationResult;
10 | String mOperation;
11 | String mid;
12 |
13 | public String getOperationResult() {
14 | return mOperationResult;
15 | }
16 |
17 | public String getOperation() {
18 | return mOperation;
19 | }
20 |
21 | public String getId() {
22 | return mid;
23 | }
24 |
25 | // operation: the CRUD operation attempted
26 | // operationResult: The result of the CRUD operation
27 | // id: The id of the entity that was operated on
28 | public OperationResult(String operation, String operationResult,
29 | String id) {
30 | mOperation = operation;
31 | mOperationResult = operationResult;
32 | mid = id;
33 | }
34 |
35 | }
36 |
37 | public void onOperationComplete(OperationResult opResult);
38 | }
39 | // *********************************************************
40 | //
41 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
42 | //
43 | // Copyright (c) Microsoft Corporation
44 | // All rights reserved.
45 | //
46 | // MIT License:
47 | // Permission is hereby granted, free of charge, to any person obtaining
48 | // a copy of this software and associated documentation files (the
49 | // "Software"), to deal in the Software without restriction, including
50 | // without limitation the rights to use, copy, modify, merge, publish,
51 | // distribute, sublicense, and/or sell copies of the Software, and to
52 | // permit persons to whom the Software is furnished to do so, subject to
53 | // the following conditions:
54 | //
55 | // The above copyright notice and this permission notice shall be
56 | // included in all copies or substantial portions of the Software.
57 | //
58 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
59 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
61 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
62 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
63 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
64 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65 | //
66 | // *********************************************************
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/microsoft/office365/starter/interfaces/OnServicesDiscoveredListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
3 | */
4 |
5 | package com.microsoft.office365.starter.interfaces;
6 |
7 | public interface OnServicesDiscoveredListener {
8 | class Event {
9 | private boolean servicesDiscovered = false;
10 |
11 | public boolean servicesAreDiscovered() {
12 | return servicesDiscovered;
13 | }
14 |
15 | public void setServicesAreDiscovered(boolean value) {
16 | servicesDiscovered = value;
17 | }
18 | }
19 |
20 | public void onServicesDiscoveredEvent(Event event);
21 | }
22 | // *********************************************************
23 | //
24 | // O365-Android-Start, https://github.com/OfficeDev/O365-Android-Start
25 | //
26 | // Copyright (c) Microsoft Corporation
27 | // All rights reserved.
28 | //
29 | // MIT License:
30 | // Permission is hereby granted, free of charge, to any person obtaining
31 | // a copy of this software and associated documentation files (the
32 | // "Software"), to deal in the Software without restriction, including
33 | // without limitation the rights to use, copy, modify, merge, publish,
34 | // distribute, sublicense, and/or sell copies of the Software, and to
35 | // permit persons to whom the Software is furnished to do so, subject to
36 | // the following conditions:
37 | //
38 | // The above copyright notice and this permission notice shall be
39 | // included in all copies or substantial portions of the Software.
40 | //
41 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
42 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
44 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
45 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
46 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
47 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48 | //
49 | // *********************************************************
50 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/ic_action_cancel.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/ic_action_download.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/ic_action_new.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/ic_action_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_view_as_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/ic_action_view_as_list.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/tile.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-hdpi/tile.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/calendar_icon_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/calendar_icon_main.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/ic_action_cancel.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/ic_action_download.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/ic_action_new.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/ic_action_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_view_as_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/ic_action_view_as_list.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/mail_icon_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/mail_icon_main.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/myfiles_icon_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/myfiles_icon_main.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/user_default_signedin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/user_default_signedin.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/user_signedout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-mdpi/user_signedout.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xhdpi/ic_action_download.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xhdpi/ic_action_new.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xhdpi/ic_action_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_view_as_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xhdpi/ic_action_view_as_list.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xxhdpi/ic_action_download.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xxhdpi/ic_action_new.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xxhdpi/ic_action_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_view_as_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xxhdpi/ic_action_view_as_list.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_accept.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_accept.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_cancel.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_download.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_edit.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_new_event.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_new_event.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_remove.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_undo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/ic_action_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo_scale_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/logo_scale_100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/small_logo_scale_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/small_logo_scale_100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/splash_screen_scale_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/splash_screen_scale_100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/square_310x310_logo_scale_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/square_310x310_logo_scale_100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/square_70x70_logo_scale_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/square_70x70_logo_scale_100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/store_logo_scale_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/store_logo_scale_100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wide_310x150_logo_scale_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/app/src/main/res/drawable/wide_310x150_logo_scale_100.png
--------------------------------------------------------------------------------
/app/src/main/res/layout-land/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
19 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-sw600dp/activity_mailitem_list.xml:
--------------------------------------------------------------------------------
1 |
8 |
17 |
22 |
29 |
36 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_calendar_event_view.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_calendarevent_detail.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_calendarevent_list.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_calendarevent_twopane.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
26 |
27 |
37 |
38 |
42 |
43 |
50 |
51 |
52 |
63 |
64 |
75 |
76 |
87 |
88 |
99 |
100 |
101 |
105 |
106 |
111 |
112 |
113 |
119 |
120 |
121 |
125 |
126 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_file_detail.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_file_list.xml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_file_twopane.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
26 |
27 |
37 |
38 |
46 |
47 |
53 |
54 |
55 |
65 |
66 |
76 |
77 |
87 |
88 |
98 |
99 |
109 |
110 |
111 |
119 |
120 |
125 |
126 |
127 |
133 |
134 |
135 |
142 |
143 |
147 |
148 |
149 |
150 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_mailitem_detail.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_mailitem_list.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
18 |
19 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/file_list_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_calendarevent_detail.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
18 |
19 |
20 |
24 |
25 |
29 |
30 |
34 |
35 |
39 |
40 |
46 |
47 |
48 |
49 |
50 |
51 |
55 |
56 |
60 |
61 |
67 |
68 |
69 |
70 |
71 |
72 |
76 |
77 |
81 |
82 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
98 |
99 |
103 |
104 |
111 |
112 |
118 |
119 |
120 |
121 |
125 |
126 |
130 |
131 |
139 |
140 |
148 |
149 |
150 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_calendarevent_detail_create.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
20 |
21 |
22 |
26 |
27 |
31 |
32 |
36 |
37 |
42 |
43 |
48 |
49 |
50 |
51 |
52 |
53 |
57 |
58 |
63 |
64 |
69 |
70 |
71 |
72 |
76 |
77 |
82 |
83 |
93 |
94 |
95 |
96 |
100 |
101 |
106 |
107 |
111 |
112 |
116 |
117 |
121 |
122 |
126 |
127 |
131 |
132 |
133 |
134 |
139 |
140 |
144 |
145 |
149 |
150 |
154 |
155 |
159 |
160 |
164 |
165 |
166 |
170 |
171 |
176 |
177 |
181 |
182 |
186 |
187 |
191 |
192 |
196 |
197 |
201 |
202 |
203 |
208 |
209 |
213 |
214 |
218 |
219 |
223 |
224 |
228 |
229 |
233 |
234 |
235 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_file_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
16 |
25 |
26 |
35 |
36 |
45 |
46 |
55 |
56 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_file_detail.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_file_detail_update.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
18 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_file_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_mailitem_compose.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
26 |
27 |
28 |
33 |
34 |
41 |
42 |
47 |
48 |
49 |
54 |
55 |
63 |
64 |
68 |
69 |
70 |
81 |
82 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_mailitem_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
18 |
19 |
25 |
26 |
27 |
28 |
32 |
33 |
40 |
41 |
47 |
48 |
49 |
53 |
54 |
61 |
62 |
68 |
69 |
70 |
74 |
75 |
82 |
83 |
89 |
90 |
91 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_main_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
17 |
18 |
28 |
29 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_main_readme.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/include_cancel_button.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/include_done_button.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/include_ok_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/menu-large/file_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/menu-small/file_detail_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/menu-small/file_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/menu-sw600dp/file_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/calendar_menu.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/mail_detail_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values-large/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 64dp
6 | 4dp
7 |
8 |
9 | 480dp
10 | 144dp
11 | 4dp
12 | 16dp
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values-large/refs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 | @layout/activity_calendarevent_twopane
12 | @layout/activity_file_twopane
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values-sw600dp/refs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 | @layout/activity_calendarevent_twopane
12 | @layout/activity_file_twopane
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 64dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #1799F0
4 | #51B2F3
5 |
6 | #007ACC
7 | #FFECE4FF
8 | #007ACC
9 | #1799F0
10 | #0033FF
11 | #364232
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 | 16dp
9 | 1dp
10 | 0dp
11 |
12 |
13 | 288dp
14 | 72dp
15 | 2dp
16 | 8dp
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
24 |
25 |
26 |
29 |
30 |
34 |
35 |
40 |
41 |
46 |
47 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.0.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | mavenCentral()
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/readme-images/o365-exchange-permissions.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/readme-images/o365-exchange-permissions.JPG
--------------------------------------------------------------------------------
/readme-images/o365-sharepoint-permissions.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Android-Start/46d15e45cbc6262c37ea8287afd5989a4a2ded18/readme-images/o365-sharepoint-permissions.JPG
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------