本文整理汇总了Java中net.ilexiconn.magister.container.Appointment类的典型用法代码示例。如果您正苦于以下问题:Java Appointment类的具体用法?Java Appointment怎么用?Java Appointment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Appointment类属于net.ilexiconn.magister.container包,在下文中一共展示了Appointment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doSilent
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
private Boolean doSilent(Appointment[] appointments) {
if (appointments.length < 1) {
return false;
}
for (Appointment appointment :
appointments) {
try {
if (appointment.type.getID() != AppointmentType.PERSONAL.getID() || configUtil.getBoolean("silent_own_appointments")) {
Log.d(TAG, "doSilent: valid appointment");
return true;
} else {
Log.d(TAG, "doSilent: No valid appointment");
}
} catch (NullPointerException e) {
Log.d(TAG, "doSilent: No valid appointments found");
}
}
return false;
}
示例2: getSilentAppointments
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
public Appointment[] getSilentAppointments(int margin) {
SQLiteDatabase db = this.getWritableDatabase();
Integer startdateInt = parseInt(formatDate(addMinutes(getToday(), margin), "MMddHHmm"));
Integer enddateInt = parseInt(formatDate(addMinutes(getToday(), -margin), "MMddHHmm"));
String Query = "SELECT * FROM " + TABLE_CALENDAR + " WHERE " + KEY_FORMATTED_START_2 + " <= " + startdateInt + " AND "
+ KEY_FORMATTED_END_2 + " >= " + enddateInt;
Cursor cursor = db.rawQuery(Query, null);
Appointment[] results = new Appointment[cursor.getCount()];
int i = 0;
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
Appointment appointment = new Appointment();
appointment.id = cursor.getInt(cursor.getColumnIndex(KEY_CALENDAR_ID));
appointment.type = AppointmentType.getTypeById(cursor.getInt(cursor.getColumnIndex(KEY_TYPE)));
results[i] = appointment;
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return results;
}
示例3: updateAppointment
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
private void updateAppointment(final Appointment appointment) {
this.appointment = appointment;
runOnUiThread(new Runnable() {
@Override
public void run() {
TextView ContentTitle = (TextView) findViewById(R.id.card_title_content);
if (appointment.finished) {
ContentTitle.setText(Type + " (" + getString(R.string.msg_finished) + ")");
} else {
ContentTitle.setText(Type);
}
}
});
CalendarDB dbHelper = new CalendarDB(this);
dbHelper.finishAppointment(appointment);
}
示例4: finishAppointment
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
public Boolean finishAppointment(Appointment appointment) throws IOException, JSONException {
String rawAppointment = getRawAppointment(appointment.id);
Log.d(TAG, "finishAppointment: " + rawAppointment);
JSONObject jsonObject = new JSONObject(rawAppointment);
jsonObject.put("Afgerond", appointment.finished);
String data = jsonObject.toString();
Log.d(TAG, "finishAppointment: data: " + data);
BufferedReader reader = new BufferedReader(HttpUtil.httpPut(magister.school.url + "/api/personen/" + magister.profile.id
+ "/afspraken/" + appointment.id, data));
StringBuilder responseBuilder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
responseBuilder.append(line);
}
String result = responseBuilder.toString();
if (result.contains("{\"Uri\":\"/api/personen/" + magister.profile.id + "/afspraken/" + appointment.id + "\"}")) {
return true;
} else {
return false;
}
}
示例5: onPostExecute
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
@Override
protected void onPostExecute(Appointment[] appointments) {
if (appointments != null) {
Date now = new Date();
SimpleDateFormat format = new SimpleDateFormat("HH:mm", Locale.getDefault());
List<Item> itemList = new ArrayList<>();
for (Appointment appointment : appointments) {
if (appointment.endDate.after(now)) {
String string1 = appointment.subjects.length > 0 ? appointment.subjects[0].name == null ? "???" : appointment.subjects[0].name : "???";
string1 = string1.substring(0, 1).toUpperCase() + string1.substring(1).toLowerCase();
String string2 = appointment.location;
String string3 = appointment.teachers.length > 0 ? appointment.teachers[0].abbreviation : "???";
String string4 = format.format(appointment.startDate) + " - " + format.format(appointment.endDate);
itemList.add(new Item(string1, string2, string3, string4));
}
}
if (itemList.isEmpty()) {
itemList.add(new Item(getActivity().getString(R.string.no_appointments)));
}
LinearLayout todayLayout = (LinearLayout) getTabFragment().view.findViewById(R.id.appointments_container);
getTabFragment().populateLayout(todayLayout, new ItemAdapter(itemList));
} else {
Snackbar.make(getTabFragment().view, getActivity().getString(R.string.no_internet), Snackbar.LENGTH_LONG);
}
getTabFragment().swipeRefresh.setRefreshing(false);
}
示例6: onExecute
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
@Override
protected Appointment[] onExecute() {
AppointmentHandler appointmentHandler = MainActivity.getMagister().getHandler(AppointmentHandler.class);
Calendar date = new GregorianCalendar();
date.set(Calendar.HOUR_OF_DAY, 0);
date.set(Calendar.MINUTE, 0);
date.set(Calendar.SECOND, 0);
date.set(Calendar.MILLISECOND, 0);
date.add(Calendar.DAY_OF_WEEK, 1);
Date tomorrow = date.getTime();
try {
return appointmentHandler.getAppointments(tomorrow, tomorrow);
} catch (IOException e) {
return null;
}
}
示例7: isCandidate
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
private boolean isCandidate(Appointment appointment) {
if (configUtil.getBoolean("show_own_appointments")) {
return true;
} else {
if (appointment.type == AppointmentType.PERSONAL) {
return false;
} else {
return true;
}
}
}
示例8: finishAppointment
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
public void finishAppointment(Appointment appointment) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(KEY_FINISHED, appointment.finished);
db.update(TABLE_CALENDAR, contentValues, KEY_CALENDAR_ID + "=" + appointment.id, null);
}
示例9: onPostExecute
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
@Override
protected void onPostExecute(Appointment[] appointments) {
if (appointments != null) {
activity.mAppointments = appointments;
activity.mSwipeRefreshLayout.setRefreshing(false);
activity.errorView.setVisibility(View.GONE);
activity.mHomeworkAdapter = new HomeworkAdapter(activity, activity.mAppointments);
activity.listView.setAdapter(activity.mHomeworkAdapter);
} else {
CalendarDB db = new CalendarDB(activity);
appointments = db.getHomework(date1);
if (appointments != null && appointments.length != 0) {
activity.mAppointments = appointments;
activity.mSwipeRefreshLayout.setRefreshing(false);
activity.errorView.setVisibility(View.GONE);
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(activity, activity.getString(R.string.msg_using_cache), Toast.LENGTH_SHORT).show();
}
});
activity.mHomeworkAdapter = new HomeworkAdapter(activity, activity.mAppointments);
activity.listView.setAdapter(activity.mHomeworkAdapter);
} else {
activity.mSwipeRefreshLayout.setRefreshing(false);
activity.errorView.setVisibility(View.VISIBLE);
activity.errorView.setConfig(ErrorViewConfigs.NoHomeworkConfig);
Log.e(TAG, error);
}
}
}
示例10: useCache
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
private void useCache() {
CalendarDB db = new CalendarDB(activity);
Appointment[] appointments = db.getAppointmentsByDate(activity.date);
activity.mAppointments = appointments;
activity.mAppointmentAdapter = new AppointmentsAdapter(activity, activity.mAppointments);
activity.listView.setAdapter(activity.mAppointmentAdapter);
if (appointments.length == 0) {
activity.errorView.setVisibility(View.VISIBLE);
activity.errorView.setConfig(ErrorViewConfigs.NoLessonConfig);
} else {
activity.errorView.setVisibility(View.GONE);
}
}
示例11: onCreate
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_appointment_details);
Bundle extras = getIntent().getExtras();
if (extras != null) {
appointment = new Gson().fromJson(extras.getString("Appointment"), Appointment.class);
mMagister = GlobalMagister.MAGISTER;
} else {
Log.e(TAG, "onCreate: Impossible to show details of a null Appointment!", new IllegalArgumentException());
Toast.makeText(this, R.string.err_unknown, Toast.LENGTH_SHORT).show();
finish();
}
Toolbar toolbar = (Toolbar) findViewById(R.id.Toolbar);
toolbar.setTitle(appointment.description);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setupDetailscard(appointment);
if (appointment.content != null && appointment.content != "") {
setupContentCard(appointment);
} else {
CardView cardView = (CardView) findViewById(R.id.card_view_2);
cardView.setVisibility(View.GONE);
}
}
示例12: onCreate
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_appointment_details);
Bundle extras = getIntent().getExtras();
if (extras != null) {
appointment = new Gson().fromJson(extras.getString("Appointment"), Appointment.class);
mMagister = GlobalMagister.MAGISTER;
} else {
Log.e(TAG, "onCreate: Impossible to show details of a null Appointment!", new IllegalArgumentException());
Toast.makeText(AppointmentDetails.this, R.string.err_unknown, Toast.LENGTH_SHORT).show();
finish();
}
if (appointment != null) {
Log.d(TAG, "onCreate: appointment: " + appointment.toString());
} else {
Log.e(TAG, "onCreate: Appointment is null!", new IllegalArgumentException());
}
Toolbar toolbar = (Toolbar) findViewById(R.id.Toolbar);
toolbar.setTitle(appointment.description);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setupDetailscard(appointment);
if (appointment.content != null && appointment.content != "") {
setupContentCard(appointment);
} else {
CardView cardView = (CardView) findViewById(R.id.card_view_2);
cardView.setVisibility(View.GONE);
}
}
示例13: createAppointment
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
/**
* Adds an appointment to magister. It wil return the Url of this Appointment, if it fails null will be
* returned
*
* @param personalAppointment the personal appointment instance.
* @return the appointment instance with more info.
* @throws IOException if there is no active internet connection.
* @throws PrivilegeException if the profile doesn't have the privilege to perform this action.
*/
public Appointment createAppointment(PersonalAppointment personalAppointment) throws IOException {
String data = gson.toJson(personalAppointment);
BufferedReader reader = new BufferedReader(HttpUtil.httpPostRaw(magister.school.url + "/api/personen/" + magister.profile.id + "/afspraken", data));
StringBuilder responseBuilder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
responseBuilder.append(line);
}
responseBuilder.toString();
//String url = GsonUtil.getFromJson(responseBuilder.toString(), "Url").getAsString();
return null;
}
示例14: read
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
@Override
public Presence[] read(JsonReader in) throws IOException {
JsonObject object = gson.getAdapter(JsonElement.class).read(in).getAsJsonObject();
JsonArray array = object.get("Items").getAsJsonArray();
List<Presence> presenceList = new ArrayList<Presence>();
for (JsonElement element : array) {
Presence presence = gson.fromJson(element.getAsJsonObject(), Presence.class);
presence.appointment = gson.fromJson(element.getAsJsonObject().get("Afspraak"), Appointment[].class)[0];
presenceList.add(presence);
}
return presenceList.toArray(new Presence[presenceList.size()]);
}
示例15: onExecute
import net.ilexiconn.magister.container.Appointment; //导入依赖的package包/类
@Override
protected Appointment[] onExecute() {
AppointmentHandler appointmentHandler = MainActivity.getMagister().getHandler(AppointmentHandler.class);
try {
return appointmentHandler.getAppointmentsOfToday();
} catch (IOException e) {
return null;
}
}