当前位置: 首页>>代码示例>>Java>>正文


Java Grade类代码示例

本文整理汇总了Java中net.ilexiconn.magister.container.Grade的典型用法代码示例。如果您正苦于以下问题:Java Grade类的具体用法?Java Grade怎么用?Java Grade使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Grade类属于net.ilexiconn.magister.container包,在下文中一共展示了Grade类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showStudyGrades

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
private void showStudyGrades(int index) {
    Grade grade = grades[index];
    try {
        if (grade.gradeRow.rowSort.getID() == 2 || grade.gradeRow.rowSort.getID() == 4) {
            Gson gson = new Gson();
            Intent intent = new Intent(getActivity(), GradesSubjectActivity.class);
            intent.putExtra("Magister", mMagister);
            intent.putExtra("Study", gson.toJson(study));
            intent.putExtra("Subject", gson.toJson(grade.subject));
            startActivity(intent);
        } else if (grade.gradeRow.rowSort.getID() == 6) {
            Toast.makeText(getActivity(), R.string.msg_no_subject, Toast.LENGTH_SHORT).show();
        }
    } catch (NullPointerException e) {
        Log.e(TAG, "showStudyGrades: Ongeldig cijfer!", e);
    }
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:18,代码来源:MainGradesFragment.java

示例2: addGrades

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
public void addGrades(Grade[] grades) {
    if (grades == null || grades.length == 0) {
        Log.d(TAG, "addGrades: No Grades!");
        return;
    }
    SQLiteDatabase db = this.getWritableDatabase();

    ContentValues contentValues = new ContentValues();
    for (Grade grade : grades) {
        if (!isInDataBase(grade, db)) {
            contentValues.put(KEY_DATE_ADDED, grade.filledInDateString);
            contentValues.put(KEY_IS_SEEN, false);
            db.insert(TABLE_GRADES, null, contentValues);
        }
    }

    db.close();
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:19,代码来源:NewGradesDB.java

示例3: hasBeenSeen

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
public Boolean hasBeenSeen(Grade grade) {
    SQLiteDatabase db = this.getWritableDatabase();
    String Query = "Select * from " + TABLE_GRADES + " where " + KEY_DATE_ADDED + " = '" + grade.filledInDateString + "'";
    Cursor cursor = db.rawQuery(Query, null);
    if (cursor.getCount() == 1) {
        if (cursor.moveToFirst()) {
            if (cursor.getInt(cursor.getColumnIndex(KEY_IS_SEEN)) == 1) {
                Log.d(TAG, "hasBeenSeen: Seen Before!");
                return true;
            }
            cursor.close();
        }
    }

    cursor.close();
    isSeen(grade, db);

    return false;
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:20,代码来源:NewGradesDB.java

示例4: read

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
@Override
public Grade[] read(JsonReader in) throws IOException {
    JsonObject object = gson.getAdapter(JsonElement.class).read(in).getAsJsonObject();
    JsonArray array = null;

    if (object.has("Items")) {
        array = object.get("Items").getAsJsonArray();
    } else {
        return new Grade[]{};
    }

    List<Grade> gradeList = new ArrayList<Grade>();
    for (JsonElement element : array) {
        JsonObject object1 = element.getAsJsonObject();
        Grade grade = gson.fromJson(object1, Grade.class);
        if (grade.filledInDateString != null) {
            try {
                grade.filledInDate = DateUtil.stringToDate(grade.filledInDateString);
            } catch (ParseException e) {
                LogUtil.printError("Unable to parse date", e);
            }
        }
        gradeList.add(grade);
    }
    return gradeList.toArray(new Grade[gradeList.size()]);
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:27,代码来源:GradeAdapter.java

示例5: read

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
@Override
public Grade[] read(JsonReader in) throws IOException {
    JsonObject object = gson.getAdapter(JsonElement.class).read(in).getAsJsonObject();
    JsonArray array = object.get("Items").getAsJsonArray();
    List<Grade> gradeList = new ArrayList<Grade>();
    for (JsonElement element : array) {
        JsonObject object1 = element.getAsJsonObject();
        Grade grade = gson.fromJson(object1, Grade.class);
        if (grade.filledInDateString != null) {
            try {
                grade.filledInDate = DateUtil.stringToDate(grade.filledInDateString);
            } catch (ParseException e) {
                LogUtil.printError("Unable to parse date", e);
            }
        }
        gradeList.add(grade);
    }
    return gradeList.toArray(new Grade[gradeList.size()]);
}
 
开发者ID:iLexiconn,项目名称:Magister.java,代码行数:20,代码来源:GradeAdapter.java

示例6: doInBackground

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
@Override
protected Grade[] doInBackground(Void... params) {
    try {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.MINUTE, -15);
        Date date = calendar.getTime();
        List<Grade> gradeList = new ArrayList<>();
        for (Grade grade : MainActivity.getMagister().getHandler(GradeHandler.class).getRecentGrades()) {
            if (grade.filledInDate.after(date)) {
                gradeList.add(grade);
            }
        }
        return gradeList.toArray(new Grade[gradeList.size()]);
    } catch (IOException e) {
        return null;
    }
}
 
开发者ID:iLexiconn,项目名称:Hipster,代码行数:19,代码来源:HipsterBroadcastReceiver.java

示例7: onCreateView

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_new_grades, container, false);
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.layout_refresh);
    mSwipeRefreshLayout.setColorSchemeResources(
            R.color.colorPrimary,
            R.color.setup_color_3,
            R.color.setup_color_5);
    mSwipeRefreshLayout.setOnRefreshListener(
            new SwipeRefreshLayout.OnRefreshListener() {
                @Override
                public void onRefresh() {
                    Log.d(TAG, "onRefresh: Refreshing!");
                    refresh();
                }
            }
    );
    errorView = (ErrorView) view.findViewById(R.id.error_view_new_grades);

    mMagister = getArguments().getParcelable("Magister");

    grades = new Grade[0];

    listView = (ListView) view.findViewById(R.id.list_new_grades);
    mNewGradesAdapter = new NewGradesAdapter(getActivity(), grades);
    listView.setAdapter(mNewGradesAdapter);

    new NewGradesTask(this, mMagister).execute();

    return view;
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:33,代码来源:NewGradesFragment.java

示例8: isInDataBase

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
private Boolean isInDataBase(Grade grade, SQLiteDatabase db) {
    String Query = "Select * from " + TABLE_GRADES + " where " + KEY_GRADE_ID + " = " + grade.id;
    Cursor cursor = db.rawQuery(Query, null);
    if (cursor.getCount() >= 1) {
        cursor.close();
        return true;
    }
    cursor.close();

    return false;
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:12,代码来源:GradesDB.java

示例9: isSeen

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
private void isSeen(Grade grade, SQLiteDatabase db) {
    ContentValues contentValues = new ContentValues();
    contentValues.put(KEY_DATE_ADDED, grade.filledInDateString);
    contentValues.put(KEY_IS_SEEN, true);
    db.update(TABLE_GRADES, contentValues, KEY_DATE_ADDED + " = '" + grade.filledInDateString + "'", null);

    db.close();
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:9,代码来源:NewGradesDB.java

示例10: isInDataBase

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
private Boolean isInDataBase(Grade grade, SQLiteDatabase db) {
    String Query = "Select * from " + TABLE_GRADES + " where " + KEY_DATE_ADDED + " = '" + grade.filledInDateString + "'";
    Cursor cursor = db.rawQuery(Query, null);
    if (cursor.getCount() >= 1) {
        cursor.close();
        return true;
    }
    cursor.close();

    return false;
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:12,代码来源:NewGradesDB.java

示例11: onPostExecute

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
@Override
protected void onPostExecute(final Grade[] grades) {
    if (activity == null) {
        return;
    }
    if (grades == null || grades.length == 0) {
        Log.e(TAG, "onPostExecute: No Grades!");
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                activity.listView.setVisibility(View.GONE);
                activity.mSwipeRefreshLayout.setRefreshing(false);
                activity.mProgressBar.setVisibility(View.GONE);
            }
        });
    } else {
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                activity.grades = grades;
                activity.mGradesAdapter = new GradesAdapter(activity, activity.grades, false);
                activity.mGradesAdapter.notifyDataSetChanged();
                activity.listView.setAdapter(activity.mGradesAdapter);
                activity.listView.setVisibility(View.VISIBLE);
                activity.mSwipeRefreshLayout.setRefreshing(false);
                activity.mProgressBar.setVisibility(View.GONE);
            }
        });
    }
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:31,代码来源:GradesSubjectTask.java

示例12: onPostExecute

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
@Override
protected void onPostExecute(final Grade[] grades) {
    if (error == null) {
        if (grades != null && grades.length > 0) {
            Log.d(TAG, "onPostExecute: Valid grades");
            fragment.getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    fragment.grades = grades;
                    fragment.mNewGradesAdapter = new NewGradesAdapter(fragment.getActivity(), fragment.grades);
                    fragment.listView.setAdapter(fragment.mNewGradesAdapter);
                    fragment.errorView.setVisibility(View.GONE);
                    fragment.mSwipeRefreshLayout.setRefreshing(false);
                }
            });
        } else {
            Log.d(TAG, "onPostExecute: Invalid grades");
            fragment.mSwipeRefreshLayout.setRefreshing(false);
            fragment.errorView.setVisibility(View.VISIBLE);
            fragment.errorView.setConfig(ErrorViewConfigs.NoNewGradesConfig);
        }
    } else {
        Log.d(TAG, "onPostExecute: Error! " + error);
        fragment.mSwipeRefreshLayout.setRefreshing(false);
        fragment.errorView.setVisibility(View.VISIBLE);
        fragment.errorView.setConfig(ErrorViewConfigs.NoNewGradesConfig);
    }
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:29,代码来源:NewGradesTask.java

示例13: getGradesFromSubjectID

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
public Grade[] getGradesFromSubjectID(int subjectID, boolean onlyAverage, boolean onlyPTA, boolean onlyActiveStudy) throws IOException {
    List<Grade> gradeList = new ArrayList<Grade>();
    for (Grade grade : getGrades(onlyAverage, onlyPTA, onlyActiveStudy)) {
        if (grade.subject.id == subjectID) {
            try {
                grade.singleGrade = getSingleGrade(grade);
            } catch (IOException e) {
            }
            gradeList.add(grade);
        }
    }
    return gradeList.toArray(new Grade[gradeList.size()]);
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:14,代码来源:GradeHandler.java

示例14: getAllGradesFromSubjectID

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
public Grade[] getAllGradesFromSubjectID(int subjectID) throws IOException {
    List<Grade> gradeList = new ArrayList<Grade>();
    for (Grade grade : getAllGrades()) {
        if (grade.subject.id == subjectID) {
            gradeList.add(grade);
        }
    }
    return gradeList.toArray(new Grade[gradeList.size()]);
}
 
开发者ID:Z3r0byte,项目名称:Magis,代码行数:10,代码来源:GradeHandler.java

示例15: getGradesFromSubjectID

import net.ilexiconn.magister.container.Grade; //导入依赖的package包/类
public Grade[] getGradesFromSubjectID(int subjectID, boolean onlyAverage, boolean onlyPTA, boolean onlyActiveStudy) throws IOException {
    List<Grade> gradeList = new ArrayList<Grade>();
    for (Grade grade : getGrades(onlyAverage, onlyPTA, onlyActiveStudy)) {
        if (grade.subject.id == subjectID) {
            gradeList.add(grade);
        }
    }
    return gradeList.toArray(new Grade[gradeList.size()]);
}
 
开发者ID:iLexiconn,项目名称:Magister.java,代码行数:10,代码来源:GradeHandler.java


注:本文中的net.ilexiconn.magister.container.Grade类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。