src/Release/2.2/Bitocle/src/io/github/mthli/Bitocle/Commit/CommitTask.java
public class CommitTask extends AsyncTask<Void, Integer, Boolean> {
    private MainFragment fragment;
    private int flag;

    private RepoItem repoItem;
    private StarItem starItem;

    private CommitService commitService;
    Iterator<RepositoryCommit> iterator;

    private CommitItemAdapter adapter;
    private List<CommitItem> list;

    public CommitTask(
            MainFragment fragment,
            RepoItem repoItem,
            StarItem starItem
    ) {
        this.fragment = fragment;
        this.repoItem = repoItem;
        this.starItem = starItem;
    }

    @Override
    protected void onPreExecute() {
        flag = fragment.getFlag();

        GitHubClient client = fragment.getClient();
        commitService = new CommitService(client);

        adapter = fragment.getCommitItemAdapter();
        list = fragment.getCommitItemList();

        fragment.setContentShown(false);
    }

    @Override
    protected Boolean doInBackground(Void... params) {
        if (flag == Flag.REPO_COMMIT_FIRST || flag == Flag.REPO_COMMIT_REFRESH) {
            RepositoryId id = RepositoryId.create(repoItem.getOwner(), repoItem.getName());
            PageIterator<RepositoryCommit> pageIterator = commitService.pageCommits(id, 17);
            iterator = pageIterator.next().iterator();
        } else {
            RepositoryId id = RepositoryId.create(starItem.getOwner(), starItem.getName());
            PageIterator<RepositoryCommit> pageIterator = commitService.pageCommits(id, 17);
            iterator = pageIterator.next().iterator();
        }

        if (isCancelled()) {
            return false;
        }
        return true;
    }

    @Override
    protected void onCancelled() {
        /* Do nothing */
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        /* Do nothing */
    }

    @Override
    protected void onPostExecute(Boolean result) {
        if (result) {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            list.clear();
            while (iterator.hasNext()) {
                RepositoryCommit commit = iterator.next();
                list.add(
                        new CommitItem(
                                commit.getCommit().getAuthor().getName(),
                                format.format(commit.getCommit().getAuthor().getDate()),
                                commit.getCommit().getMessage()
                        )
                );
            }

            if (list.size() <= 0) {
                fragment.setContentEmpty(true);
                fragment.setEmptyText(R.string.commit_empty_list);
                fragment.setContentShown(true);
            } else {
                fragment.setContentEmpty(false);
                adapter.notifyDataSetChanged();
                fragment.setContentShown(true);
            }
        } else {
            fragment.setContentEmpty(true);
            fragment.setEmptyText(R.string.commit_empty_error);
            fragment.setContentShown(true);
        }
    }
}
src/Release/2.2/Bitocle/src/io/github/mthli/Bitocle/Star/StarTask.java
public class StarTask extends AsyncTask<Void, Integer, Boolean> {
    private MainFragment fragment;

    private StarItemAdapter adapter;
    private List<StarItem> list;

    private MenuItem bookmark;

    private WatcherService service;
    private Iterator<Repository> iterator;

    public StarTask(MainFragment fragment) {
        this.fragment = fragment;
    }

    @Override
    protected void onPreExecute() {
        adapter = fragment.getStarItemAdapter();
        list = fragment.getStarItemList();
        bookmark = fragment.getBookmark();

        GitHubClient client = fragment.getClient();
        service = new WatcherService(client);

        fragment.setContentEmpty(false);
        fragment.setContentShown(false);
        bookmark.setVisible(false);
    }

    @Override
    protected Boolean doInBackground(Void... params) {
        PageIterator<Repository> pageIterator = service.pageWatched(17);
        iterator = pageIterator.next().iterator();

        if (isCancelled()) {
            return false;
        }
        return true;
    }

    @Override
    protected void onCancelled() {
        /* Do nothing */
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        /* Do nothing */
    }

    @Override
    protected void onPostExecute(Boolean result) {
        if (result) {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

            list.clear();
            while (iterator.hasNext()) {
                Repository r = iterator.next();
                list.add(
                        new StarItem(
                                r.getName(),
                                format.format(r.getCreatedAt()),
                                r.getDescription(),
                                r.getLanguage(),
                                r.getWatchers(),
                                r.getForks(),
                                r.getOwner().getLogin(),
                                r.getGitUrl()
                        )
                );
            }

            if (list.size() <= 0) {
                bookmark.setVisible(false);
                fragment.setContentEmpty(true);
                fragment.setEmptyText(R.string.repo_empty_list);
                fragment.setContentShown(true);
            } else {
                bookmark.setVisible(true);
                fragment.setContentEmpty(false);
                adapter.notifyDataSetChanged();
                fragment.setContentShown(true);
            }
        } else {
            bookmark.setVisible(false);
            fragment.setContentEmpty(true);
            fragment.setEmptyText(R.string.repo_empty_error);
            fragment.setContentShown(true);
        }
    }
}
src/Release/2.2/Bitocle/src/io/github/mthli/Bitocle/Star/StarItem.java
public class StarItem {
    private String name;
    private String date;
    private String description;
    private String lang;
    private int star;
    private int fork;
    private String owner;
    private String git;

    public StarItem(
            String name,
            String date,
            String description,
            String lang,
            int star,
            int fork,
            String owner,
            String git
    ) {
        super();

        this.name = name;
        this.date = date;
        this.description = description;
        this.lang = lang;
        this.star = star;
        this.fork = fork;
        this.owner = owner;
        this.git = git;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }

    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }

    public String getLang() {
        return lang;
    }
    public void setLang(String lang) {
        this.lang = lang;
    }

    public int getStar() {
        return star;
    }
    public void setStar(int star) {
        this.star = star;
    }

    public int getFork() {
        return fork;
    }
    public void setFork(int fork) {
        this.fork = fork;
    }

    public String getOwner() {
        return owner;
    }
    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getGit() {
        return git;
    }
    public void setGit(String git) {
        this.git = git;
    }
}
src/Release/2.0/Bitocle/src/io/github/mthli/Bitocle/Commit/CommitItemAdapter.java
public class CommitItemAdapter extends ArrayAdapter<CommitItem> {
    private Context context;
    private int layoutResId;
    private List<CommitItem> commitItemList;

    public CommitItemAdapter (
            Context context,
            int layoutResId,
            List<CommitItem> commitItemList
    ) {
        super(context, layoutResId, commitItemList);

        this.context = context;
        this.layoutResId = layoutResId;
        this.commitItemList = commitItemList;
    }

    private class Holder {
        ImageView icon;
        TextView content;
        TextView date;
        TextView committer;
    }

    @Override
    public View getView(
            int position,
            View convertView,
            ViewGroup viewGroup
    ) {
        Holder holder;
        View view = convertView;

        if (view == null) {
            LayoutInflater inflater = ((Activity) context).getLayoutInflater();
            view = inflater.inflate(layoutResId, viewGroup, false);

            holder = new Holder();
            holder.icon = (ImageView) view.findViewById(R.id.commit_item_icon);
            holder.committer = (TextView) view.findViewById(R.id.commit_item_committer);
            holder.date = (TextView) view.findViewById(R.id.commit_item_date);
            holder.content = (TextView) view.findViewById(R.id.commit_item_content);

            view.setTag(holder);
        } else {
            holder = (Holder) view.getTag();
        }

        if (commitItemList.size() > 0) {
            CommitItem anItem = commitItemList.get(position);
            holder.icon.setImageDrawable(anItem.getIcon());
            holder.committer.setText(anItem.getCommitter());
            holder.date.setText(anItem.getDate());
            holder.content.setText(anItem.getContent());
        }

        return view;
    }
}
src/Release/2.2/Bitocle/src/uk/co/senab/actionbarpulltorefresh/library/PullToRefreshLayout.java
public class PullToRefreshLayout extends FrameLayout {

    private static final boolean DEBUG = false;
    private static final String LOG_TAG = "PullToRefreshLayout";

    private PullToRefreshAttacher mPullToRefreshAttacher;

    public PullToRefreshLayout(Context context) {
        this(context, null);
    }

    public PullToRefreshLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public PullToRefreshLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    /**
     * Manually set this Attacher's refreshing state. The header will be
     * displayed or hidden as requested.
     *
     * @param refreshing
     *            - Whether the attacher should be in a refreshing state,
     */
    public final void setRefreshing(boolean refreshing) {
        ensureAttacher();
        mPullToRefreshAttacher.setRefreshing(refreshing);
    }

    /**
     * @return true if this Attacher is currently in a refreshing state.
     */
    public final boolean isRefreshing() {
        ensureAttacher();
        return mPullToRefreshAttacher.isRefreshing();
    }

    /**
     * Call this when your refresh is complete and this view should reset itself
     * (header view will be hidden).
     *
     * This is the equivalent of calling <code>setRefreshing(false)</code>.
     */
    public final void setRefreshComplete() {
        ensureAttacher();
        mPullToRefreshAttacher.setRefreshComplete();
    }

    /**
     * Set a {@link uk.co.senab.actionbarpulltorefresh.library.listeners.HeaderViewListener} which is called when the visibility
     * state of the Header View has changed.
     *
     * @param listener
     */
    public final void setHeaderViewListener(HeaderViewListener listener) {
        ensureAttacher();
        mPullToRefreshAttacher.setHeaderViewListener(listener);
    }

    /**
     * @return The Header View which is displayed when the user is pulling, or
     *         we are refreshing.
     */
    public final View getHeaderView() {
        ensureAttacher();
        return mPullToRefreshAttacher.getHeaderView();
    }

    /**
     * @return The HeaderTransformer currently used by this Attacher.
     */
    public HeaderTransformer getHeaderTransformer() {
        ensureAttacher();
        return mPullToRefreshAttacher.getHeaderTransformer();
    }


    @Override
    public final boolean onInterceptTouchEvent(MotionEvent event) {
        if (DEBUG) {
            Log.d(LOG_TAG, "onInterceptTouchEvent. " + event.toString());
        }
        if (isEnabled() && mPullToRefreshAttacher != null && getChildCount() > 0) {
            return mPullToRefreshAttacher.onInterceptTouchEvent(event);
        }
        return false;
    }

    @Override
    public final boolean onTouchEvent(MotionEvent event) {
        if (DEBUG) {
            Log.d(LOG_TAG, "onTouchEvent. " + event.toString());
        }
        if (isEnabled() && mPullToRefreshAttacher != null) {
            return mPullToRefreshAttacher.onTouchEvent(event);
        }
        return super.onTouchEvent(event);
    }

    @Override
    public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) {
        return new PullToRefreshLayout.LayoutParams(getContext(), attrs);
    }

    @Override
    protected void onDetachedFromWindow() {
        // Destroy the PullToRefreshAttacher
        if (mPullToRefreshAttacher != null) {
            mPullToRefreshAttacher.destroy();
        }
        super.onDetachedFromWindow();
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        if (mPullToRefreshAttacher != null) {
            mPullToRefreshAttacher.onConfigurationChanged(newConfig);
        }
        super.onConfigurationChanged(newConfig);
    }

    void setPullToRefreshAttacher(PullToRefreshAttacher attacher) {
        if (mPullToRefreshAttacher != null) {
            mPullToRefreshAttacher.destroy();
        }
        mPullToRefreshAttacher = attacher;
    }

    void addAllChildrenAsPullable() {
        ensureAttacher();
        for (int i = 0, z = getChildCount(); i < z; i++) {
            addRefreshableView(getChildAt(i));
        }
    }

    void addChildrenAsPullable(int[] viewIds) {
        for (int i = 0, z = viewIds.length; i < z; i++) {
            View view = findViewById(viewIds[i]);
            if (view != null) {
                addRefreshableView(findViewById(viewIds[i]));
            }
        }
    }

    void addChildrenAsPullable(View[] views) {
        for (int i = 0, z = views.length; i < z; i++) {
            if (views[i] != null) {
                addRefreshableView(views[i]);
            }
        }
    }

    void addRefreshableView(View view) {
        if (mPullToRefreshAttacher != null) {
            mPullToRefreshAttacher.addRefreshableView(view, getViewDelegateFromLayoutParams(view));
        }
    }

    ViewDelegate getViewDelegateFromLayoutParams(View view) {
        if (view != null && view.getLayoutParams() instanceof LayoutParams) {
            LayoutParams lp = (LayoutParams) view.getLayoutParams();
            String clazzName = lp.getViewDelegateClassName();

            if (!TextUtils.isEmpty(clazzName)) {
                // Lets convert any relative class names (i.e. .XYZViewDelegate)
                final int firstDot = clazzName.indexOf('.');
                if (firstDot == -1) {
                    clazzName = getContext().getPackageName() + "." + clazzName;
                } else if (firstDot == 0) {
                    clazzName = getContext().getPackageName() + clazzName;
                }
                return InstanceCreationUtils.instantiateViewDelegate(getContext(), clazzName);
            }
        }
        return null;
    }

    protected PullToRefreshAttacher createPullToRefreshAttacher(Activity activity,
            Options options) {
        return new PullToRefreshAttacher(activity, options != null ? options : new Options());
    }

    private void ensureAttacher() {
        if (mPullToRefreshAttacher == null) {
            throw new IllegalStateException("You need to setup the PullToRefreshLayout before using it");
        }
    }

    static class LayoutParams extends FrameLayout.LayoutParams {
        private final String mViewDelegateClassName;

        LayoutParams(Context c, AttributeSet attrs) {
            super(c, attrs);

            TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.PullToRefreshView);
            mViewDelegateClassName = a
                    .getString(R.styleable.PullToRefreshView_ptrViewDelegateClass);
            a.recycle();
        }

        String getViewDelegateClassName() {
            return mViewDelegateClassName;
        }
    }
}
src/Release/2.0/Bitocle/src/io/github/mthli/Bitocle/Bookmark/BookmarkTask.java
public class BookmarkTask extends AsyncTask<Void, Integer, Boolean> {
    private MainFragment mainFragment;
    private Context context;
    private int refreshType = 0;

    private BookmarkItemAdapter bookmarkItemAdapter;
    private List<BookmarkItem> bookmarkItemList;

    public BookmarkTask(MainFragment mainFragment) {
        this.mainFragment = mainFragment;
    }

    @Override
    protected void onPreExecute() {
        mainFragment.setRefreshStatus(true);
        context = mainFragment.getContentView().getContext();
        refreshType = mainFragment.getRefreshType();

        bookmarkItemAdapter = mainFragment.getBookmarkItemAdapter();
        bookmarkItemList = mainFragment.getBookmarkItemList();
    }

    @Override
    protected Boolean doInBackground(Void... params) {
        BAction bAction = new BAction(context);
        try {
            bAction.openDatabase(true);
        } catch (SQLException s) {
            bAction.closeDatabase();
            return false;
        }

        bookmarkItemList.clear();
        List<Bookmark> bookmarkList = bAction.listBookmarks();
        for (Bookmark b: bookmarkList) {
            if (b.getType().equals(RepositoryContents.TYPE_DIR)) {
                bookmarkItemList.add(
                        new BookmarkItem(
                                context.getResources().getDrawable(R.drawable.ic_type_folder),
                                b.getTitle(),
                                b.getDate(),
                                b.getType(),
                                b.getRepoOwner(),
                                b.getRepoName(),
                                b.getRepoPath(),
                                b.getSha(),
                                b.getKey()
                        )
                );
            } else {
                bookmarkItemList.add(
                        new BookmarkItem(
                                context.getResources().getDrawable(R.drawable.ic_type_file),
                                b.getTitle(),
                                b.getDate(),
                                b.getType(),
                                b.getRepoOwner(),
                                b.getRepoName(),
                                b.getRepoPath(),
                                b.getSha(),
                                b.getKey()
                        )
                );
            }
        }
        Collections.sort(bookmarkItemList);
        bAction.closeDatabase();

        return true;
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        /* Do nothing */
    }

    @Override
    protected void onPostExecute(Boolean result) {
        if (result) {
            if (refreshType == RefreshType.BOOKMARK_FIRST) {
                if (bookmarkItemList.size() == 0) {
                    mainFragment.setContentEmpty(true);
                    mainFragment.setEmptyText(R.string.bookmark_empty_bookmark_empty);
                    mainFragment.setContentShown(true);
                } else {
                    mainFragment.setContentEmpty(false);
                    bookmarkItemAdapter.notifyDataSetChanged();
                    mainFragment.setContentShown(true);
                }
            } else {
                if (bookmarkItemList.size() == 0) {
                    mainFragment.setContentEmpty(true);
                    mainFragment.setEmptyText(R.string.bookmark_empty_bookmark_empty);
                    mainFragment.setContentShown(true);
                } else {
                    mainFragment.setContentEmpty(false);
                    bookmarkItemAdapter.notifyDataSetChanged();
                    mainFragment.setContentShown(true);
                }
                Toast.makeText(
                        context,
                        R.string.bookmark_task_successful,
                        Toast.LENGTH_SHORT
                ).show();
            }
        } else {
            if (refreshType == RefreshType.BOOKMARK_FIRST) {
                mainFragment.setContentEmpty(true);
                mainFragment.setEmptyText(R.string.bookmark_empty_get_data_failed);
                mainFragment.setContentShown(true);
            } else {
                Toast.makeText(
                        context,
                        R.string.bookmark_task_failed,
                        Toast.LENGTH_SHORT
                ).show();
            }
        }
        mainFragment.setRefreshStatus(false);
    }
}
src/Release/2.1/Bitocle/src/io/github/mthli/Bitocle/WebView/WebViewActivity.java
public class WebViewActivity extends FragmentActivity {
    private WebViewFragment fragment;

    private WebViewTask task;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);

        Intent intent = getIntent();
        String title = intent.getStringExtra(getString(R.string.webview_intent_title));
        String subTitle = intent.getStringExtra(getString(R.string.webview_intent_subtitle));

        ActionBar actionBar = getActionBar();
        actionBar.setTitle(title);
        actionBar.setSubtitle(subTitle);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);

        fragment = (WebViewFragment) getSupportFragmentManager().findFragmentById(R.id.webview_fragment);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = WebViewActivity.this.getMenuInflater();
        inflater.inflate(R.menu.webview_menu, menu);

        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        switch (menuItem.getItemId()) {
            case android.R.id.home:
                fragment.allTaskDown();
                finish();
                break;
            case R.id.webview_menu_refresh:
                task = fragment.getTask();
                if (task != null && task.getStatus() == AsyncTask.Status.FINISHED) {
                    task = new WebViewTask(fragment);
                    fragment.setTask(task);
                    task.execute();
                }
                break;
            case R.id.webview_menu_highlight:
                showHighlightDialog();
                break;
            default:
                break;
        }

        return super.onOptionsItemSelected(menuItem);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            fragment.allTaskDown();
            finish();
        }

        return true;
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        if(newConfig.orientation== Configuration.ORIENTATION_LANDSCAPE) {
            /* Do nothing */
        }
        else{
            /* Do nothing */
        }
    }

    private void showHighlightDialog() {
        SharedPreferences preferences = getSharedPreferences(getString(R.string.login_sp), MODE_PRIVATE);
        final SharedPreferences.Editor editor = preferences.edit();

        AlertDialog dialog;
        int num = preferences.getInt(getString(R.string.login_sp_highlight_num), 0);
        AlertDialog.Builder builder = new AlertDialog.Builder(WebViewActivity.this)
                .setSingleChoiceItems(
                        R.array.dialog_highlight_list,
                        num,
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                task = fragment.getTask();
                                if (task != null && task.getStatus() == AsyncTask.Status.FINISHED) {
                                    editor.putInt(getString(R.string.login_sp_highlight_num), which);
                                    String str = getResources().getStringArray(R.array.dialog_highlight_list)[which];
                                    str = str.toLowerCase();
                                    editor.putString(getString(R.string.login_sp_highlight_css), str);
                                    editor.commit();

                                    task = new WebViewTask(fragment);
                                    fragment.setTask(task);
                                    task.execute();
                                }

                                dialog.dismiss();
                            }
                        }
                );
        dialog = builder.create();
        dialog.show();
    }
}
src/Release/2.2/Bitocle/src/io/github/mthli/Bitocle/Bookmark/BookmarkItem.java
public class BookmarkItem {
    private String title;
    private String type;
    private String owner;
    private String name;
    private String path;
    private String sha;
    private String key;

    public BookmarkItem (
            String title,
            String type,
            String owner,
            String name,
            String path,
            String sha,
            String key
    ) {
        super();

        this.title = title;
        this.type = type;
        this.owner = owner;
        this.name = name;
        this.path = path;
        this.sha = sha;
        this.key = key;
    }

    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }

    public String getOwner() {
        return owner;
    }
    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }

    public String getSha() {
        return sha;
    }
    public void setSha(String sha) {
        this.sha = sha;
    }

    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
}
src/Release/2.1/Bitocle/src/io/github/mthli/Bitocle/Database/Bookmark/Bookmark.java
public class Bookmark implements Comparable<Bookmark> {
    public static final String TABLE = "BOOKMARK";

    public static final String TITLE = "TITLE";
    public static final String TYPE = "TYPE";
    public static final String OWNER = "OWNER";
    public static final String NAME = "NAME";
    public static final String PATH = "PATH";
    public static final String SHA = "SHA"; //
    public static final String KEY = "KEY"; //

    public static final String CREATE_SQL = "CREATE TABLE "
            + TABLE
            + " ("
            + " TITLE text,"
            + " TYPE text,"
            + " OWNER text,"
            + " NAME text,"
            + " PATH text,"
            + " SHA text,"
            + " KEY text"
            + ")";

    private String title;
    private String type;
    private String owner;
    private String name;
    private String path;
    private String sha;
    private String key;

    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }

    public String getOwner() {
        return owner;
    }
    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }

    public String getSha() {
        return sha;
    }
    public void setSha(String sha) {
        this.sha = sha;
    }

    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }

    @Override
    public int compareTo(Bookmark item) {
        if (this.type != null) {
            return item.getType().toLowerCase().compareTo(this.type.toLowerCase());
        } else {
            throw new IllegalArgumentException();
        }
    }
}
src/Release/2.1/Bitocle/src/io/github/mthli/Bitocle/Commit/CommitItem.java
public class CommitItem {
    private String committer;
    private String date;
    private String message;

    public CommitItem (
            String committer,
            String date,
            String message
    ) {
        super();

        this.committer = committer;
        this.date = date;
        this.message = message;
    }

    public String getCommitter() {
        return committer;
    }
    public void setCommitter(String committer) {
        this.committer = committer;
    }

    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }

    public String getContent() {
        return message;
    }
    public void setContent(String message) {
        this.message = message;
    }
}
src/Release/2.2/Bitocle/src/io/github/mthli/Bitocle/Database/Bookmark/BAction.java
public class BAction {
    private BHelper bHelper;
    private SQLiteDatabase sqLiteDatabase;

    public BAction(Context context) {
        bHelper = new BHelper(context);
    }

    public void openDatabase(boolean rw) throws SQLException {
        if (rw) {
            sqLiteDatabase = bHelper.getWritableDatabase();
        } else {
            sqLiteDatabase = bHelper.getReadableDatabase();
        }
    }

    public void closeDatabase() {
        bHelper.close();
    }

    public boolean checkBookmark(String sha) {
        Cursor cursor = sqLiteDatabase.query(
                Bookmark.TABLE,
                new String[] {Bookmark.SHA},
                Bookmark.SHA + "=?",
                new String[] {sha},
                null,
                null,
                null
        );

        if (cursor != null) {
            boolean result = false;
            if (cursor.moveToFirst()) {
                result = true;
            }
            cursor.close();
            return result;
        }
        return false;
    }

    public void addBookmark(Bookmark bookmark) {
        ContentValues contentValues = new ContentValues();
        contentValues.put(Bookmark.TITLE, bookmark.getTitle());
        contentValues.put(Bookmark.TYPE, bookmark.getType());
        contentValues.put(Bookmark.OWNER, bookmark.getOwner());
        contentValues.put(Bookmark.NAME, bookmark.getName());
        contentValues.put(Bookmark.PATH, bookmark.getPath());
        contentValues.put(Bookmark.SHA, bookmark.getSha());
        contentValues.put(Bookmark.KEY, bookmark.getKey());
        sqLiteDatabase.insert(Bookmark.TABLE, null, contentValues);
    }

    public void unMarkBySha(String sha) {
        sqLiteDatabase.execSQL("DELETE FROM " + Bookmark.TABLE + " WHERE SHA like \"" + sha + "\"");
    }

    public void unMarkByKey(String key) {
        sqLiteDatabase.execSQL("DELETE FROM " + Bookmark.TABLE + " WHERE KEY like \"" + key + "\"");
    }

    public void unMarkAll() {
        sqLiteDatabase.execSQL("DELETE FROM " + Bookmark.TABLE);
    }

    public List<Bookmark> listBookmarks() {
        List<Bookmark> marks = new ArrayList<Bookmark>();
        Cursor cursor = sqLiteDatabase.query(
                Bookmark.TABLE,
                new String[] {
                        Bookmark.TITLE,
                        Bookmark.TYPE,
                        Bookmark.OWNER,
                        Bookmark.NAME,
                        Bookmark.PATH,
                        Bookmark.SHA,
                        Bookmark.KEY
                },
                null,
                null,
                null,
                null,
                Bookmark.TITLE
        );

        if (cursor == null) {
            return marks;
        }
        cursor.moveToFirst();
        while (!cursor.isAfterLast()) {
            Bookmark mark = readBookmark(cursor);
            marks.add(mark);
            cursor.moveToNext();
        }
        cursor.close();

        return marks;
    }

    private Bookmark readBookmark(Cursor cursor) {
        Bookmark bookmark = new Bookmark();
        bookmark.setTitle(cursor.getString(0));
        bookmark.setType(cursor.getString(1));
        bookmark.setOwner(cursor.getString(2));
        bookmark.setName(cursor.getString(3));
        bookmark.setPath(cursor.getString(4));
        bookmark.setSha(cursor.getString(5));
        bookmark.setKey(cursor.getString(6));

        return bookmark;
    }
}
src/Release/2.2/Bitocle/src/com/github/johnpersano/supertoasts/SuperToast.java
@SuppressWarnings("UnusedDeclaration")
public class SuperToast {

    private static final String TAG = "SuperToast";

    private static final String ERROR_CONTEXTNULL = " - You cannot use a null context.";
    private static final String ERROR_DURATIONTOOLONG = " - You should NEVER specify a duration greater than " +
            "four and a half seconds for a SuperToast.";

    /**
     * Custom OnClickListener to be used with SuperActivityToasts/SuperCardToasts. Note that
     * SuperActivityToasts/SuperCardToasts must use this with an
     * {@link com.github.johnpersano.supertoasts.util.OnClickWrapper}
     */
    public interface OnClickListener {

        public void onClick(View view, Parcelable token);

    }

    /**
     * Custom OnDismissListener to be used with any type of SuperToasts. Note that
     * SuperActivityToasts/SuperCardToasts must use this with an
     * {@link com.github.johnpersano.supertoasts.util.OnDismissWrapper}
     */
    public interface OnDismissListener {

        public void onDismiss(View view);

    }

    /**
     * Backgrounds for all types of SuperToasts.
     */
    public static class Background {

        public static final int BLACK = Style.getBackground(Style.BLACK);
        public static final int BLUE = Style.getBackground(Style.BLUE);
        public static final int GRAY = Style.getBackground(Style.GRAY);
        public static final int GREEN = Style.getBackground(Style.GREEN);
        public static final int ORANGE = Style.getBackground(Style.ORANGE);
        public static final int PURPLE = Style.getBackground(Style.PURPLE);
        public static final int RED = Style.getBackground(Style.RED);
        public static final int WHITE = Style.getBackground(Style.WHITE);

    }

    /**
     * Animations for all types of SuperToasts.
     */
    public enum Animations {

        FADE,
        FLYIN,
        SCALE,
        POPUP

    }

    /**
     * Icons for all types of SuperToasts.
     */
    public static class Icon {

        /**
         * Icons for all types of SuperToasts with a dark background.
         */
        public static class Dark {

            public static final int EDIT = (R.drawable.icon_dark_edit);
            public static final int EXIT = (R.drawable.icon_dark_exit);
            public static final int INFO = (R.drawable.icon_dark_info);
            public static final int REDO = (R.drawable.icon_dark_redo);
            public static final int REFRESH = (R.drawable.icon_dark_refresh);
            public static final int SAVE = (R.drawable.icon_dark_save);
            public static final int SHARE = (R.drawable.icon_dark_share);
            public static final int UNDO = (R.drawable.icon_dark_undo);

        }

        /**
         * Icons for all types of SuperToasts with a light background.
         */
        public static class Light {

            public static final int EDIT = (R.drawable.icon_light_edit);
            public static final int EXIT = (R.drawable.icon_light_exit);
            public static final int INFO = (R.drawable.icon_light_info);
            public static final int REDO = (R.drawable.icon_light_redo);
            public static final int REFRESH = (R.drawable.icon_light_refresh);
            public static final int SAVE = (R.drawable.icon_light_save);
            public static final int SHARE = (R.drawable.icon_light_share);
            public static final int UNDO = (R.drawable.icon_light_undo);

        }

    }

    /**
     * Durations for all types of SuperToasts.
     */
    public static class Duration {

        public static final int VERY_SHORT = (1500);
        public static final int SHORT = (2000);
        public static final int MEDIUM = (2750);
        public static final int LONG = (3500);
        public static final int EXTRA_LONG = (4500);

    }

    /**
     * Text sizes for all types of SuperToasts.
     */
    public static class TextSize {

        public static final int EXTRA_SMALL = (12);
        public static final int SMALL = (14);
        public static final int MEDIUM = (16);
        public static final int LARGE = (18);

    }

    /**
     * Types for SuperActivityToasts and SuperCardToasts.
     */
    public enum Type {

        /**
         * Standard type used for displaying messages.
         */
        STANDARD,

        /**
         * Progress type used for showing progress.
         */
        PROGRESS,

        /**
         * Progress type used for showing progress.
         */
        PROGRESS_HORIZONTAL,

        /**
         * Button type used for receiving click actions.
         */
        BUTTON

    }

    /**
     * Positions for icons used in all types of SuperToasts.
     */
    public enum IconPosition {

        /**
         * Set the icon to the left of the text.
         */
        LEFT,

        /**
         * Set the icon to the right of the text.
         */
        RIGHT,

        /**
         * Set the icon on top of the text.
         */
        TOP,

        /**
         * Set the icon on the bottom of the text.
         */
        BOTTOM

    }

    private Animations mAnimations = Animations.FADE;
    private Context mContext;
    private int mGravity = Gravity.BOTTOM | Gravity.CENTER;
    private int mDuration = Duration.SHORT;
    private int mTypefaceStyle;
    private int mBackground;
    private int mXOffset = 0;
    private int mYOffset = 0;
    private LinearLayout mRootLayout;
    private OnDismissListener mOnDismissListener;
    private TextView mMessageTextView;
    private View mToastView;
    private WindowManager mWindowManager;
    private WindowManager.LayoutParams mWindowManagerParams;

    /**
     * Instantiates a new {@value #TAG}.
     *
     * @param context {@link android.content.Context}
     */
    public SuperToast(Context context) {

        if (context == null) {

            throw new IllegalArgumentException(TAG + ERROR_CONTEXTNULL);

        }

        this.mContext = context;

        mYOffset = context.getResources().getDimensionPixelSize(
                R.dimen.toast_hover);

        final LayoutInflater layoutInflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        mToastView = layoutInflater.inflate(R.layout.super_toast, null);

        mWindowManager = (WindowManager) mToastView.getContext()
                .getApplicationContext().getSystemService(Context.WINDOW_SERVICE);

        mRootLayout = (LinearLayout)
                mToastView.findViewById(R.id.root_layout);

        mMessageTextView = (TextView)
                mToastView.findViewById(R.id.message_textview);

    }

    /**
     * Instantiates a new {@value #TAG} with a specified style.
     *
     * @param context {@link android.content.Context}
     * @param style   {@link com.github.johnpersano.supertoasts.util.Style}
     */
    public SuperToast(Context context, Style style) {

        if (context == null) {

            throw new IllegalArgumentException(TAG + ERROR_CONTEXTNULL);

        }

        this.mContext = context;

        mYOffset = context.getResources().getDimensionPixelSize(
                R.dimen.toast_hover);

        final LayoutInflater layoutInflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        mToastView = layoutInflater.inflate(R.layout.super_toast, null);

        mWindowManager = (WindowManager) mToastView.getContext()
                .getApplicationContext().getSystemService(Context.WINDOW_SERVICE);

        mRootLayout = (LinearLayout)
                mToastView.findViewById(R.id.root_layout);

        mMessageTextView = (TextView)
                mToastView.findViewById(R.id.message_textview);

        this.setStyle(style);

    }

    /**
     * Shows the {@value #TAG}. If another {@value #TAG} is showing than
     * this one will be added to a queue and shown when the previous {@value #TAG}
     * is dismissed.
     */
    public void show() {

        mWindowManagerParams = new WindowManager.LayoutParams();

        mWindowManagerParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
        mWindowManagerParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
        mWindowManagerParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
        mWindowManagerParams.format = PixelFormat.TRANSLUCENT;
        mWindowManagerParams.windowAnimations = getAnimation();
        mWindowManagerParams.type = WindowManager.LayoutParams.TYPE_TOAST;
        mWindowManagerParams.gravity = mGravity;
        mWindowManagerParams.x = mXOffset;
        mWindowManagerParams.y = mYOffset;

        ManagerSuperToast.getInstance().add(this);

    }

    /**
     * Sets the message text of the {@value #TAG}.
     *
     * @param text {@link CharSequence}
     */
    public void setText(CharSequence text) {

        mMessageTextView.setText(text);

    }

    /**
     * Returns the message text of the {@value #TAG}.
     *
     * @return {@link CharSequence}
     */
    public CharSequence getText() {

        return mMessageTextView.getText();

    }

    /**
     * Sets the message typeface style of the {@value #TAG}.
     *
     * @param typeface {@link android.graphics.Typeface} int
     */
    public void setTypefaceStyle(int typeface) {

        mTypefaceStyle = typeface;

        mMessageTextView.setTypeface(mMessageTextView.getTypeface(), typeface);

    }

    /**
     * Returns the message typeface style of the {@value #TAG}.
     *
     * @return {@link android.graphics.Typeface} int
     */
    public int getTypefaceStyle() {

        return mTypefaceStyle;

    }

    /**
     * Sets the message text color of the {@value #TAG}.
     *
     * @param textColor {@link android.graphics.Color}
     */
    public void setTextColor(int textColor) {

        mMessageTextView.setTextColor(textColor);

    }

    /**
     * Returns the message text color of the {@value #TAG}.
     *
     * @return int
     */
    public int getTextColor() {

        return mMessageTextView.getCurrentTextColor();

    }

    /**
     * Sets the text size of the {@value #TAG} message.
     *
     * @param textSize int
     */
    public void setTextSize(int textSize) {

        mMessageTextView.setTextSize(textSize);

    }

    /**
     * Returns the text size of the {@value #TAG} message in pixels.
     *
     * @return float
     */
    public float getTextSize() {

        return mMessageTextView.getTextSize();

    }

    /**
     * Sets the duration that the {@value #TAG} will show.
     *
     * @param duration {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
     */
    public void setDuration(int duration) {

        if(duration > Duration.EXTRA_LONG) {

            Log.e(TAG, TAG + ERROR_DURATIONTOOLONG);

            this.mDuration = Duration.EXTRA_LONG;

        } else {

            this.mDuration = duration;

        }

    }

    /**
     * Returns the duration of the {@value #TAG}.
     *
     * @return int
     */
    public int getDuration() {

        return this.mDuration;

    }

    /**
     * Sets an icon resource to the {@value #TAG} with a specified position.
     *
     * @param iconResource {@link com.github.johnpersano.supertoasts.SuperToast.Icon}
     * @param iconPosition {@link com.github.johnpersano.supertoasts.SuperToast.IconPosition}
     */
    public void setIcon(int iconResource, IconPosition iconPosition) {

        if (iconPosition == IconPosition.BOTTOM) {

            mMessageTextView.setCompoundDrawablesWithIntrinsicBounds(null, null,
                    null, mContext.getResources().getDrawable(iconResource));

        } else if (iconPosition == IconPosition.LEFT) {

            mMessageTextView.setCompoundDrawablesWithIntrinsicBounds(mContext.getResources()
                    .getDrawable(iconResource), null, null, null);

        } else if (iconPosition == IconPosition.RIGHT) {

            mMessageTextView.setCompoundDrawablesWithIntrinsicBounds(null, null,
                    mContext.getResources().getDrawable(iconResource), null);

        } else if (iconPosition == IconPosition.TOP) {

            mMessageTextView.setCompoundDrawablesWithIntrinsicBounds(null,
                    mContext.getResources().getDrawable(iconResource), null, null);

        }

    }

    /**
     * Sets the background resource of the {@value #TAG}.
     *
     * @param background {@link com.github.johnpersano.supertoasts.SuperToast.Background}
     */
    public void setBackground(int background) {

        this.mBackground = background;

        mRootLayout.setBackgroundResource(background);

    }

    /**
     * Returns the background resource of the {@value #TAG}.
     *
     * @return int
     */
    public int getBackground() {

        return this.mBackground;

    }

    /**
     * Sets the gravity of the {@value #TAG} along with x and y offsets.
     *
     * @param gravity {@link android.view.Gravity} int
     * @param xOffset int
     * @param yOffset int
     */
    public void setGravity(int gravity, int xOffset, int yOffset) {

        this.mGravity = gravity;
        this.mXOffset = xOffset;
        this.mYOffset = yOffset;

    }

    /**
     * Sets the show/hide animations of the {@value #TAG}.
     *
     * @param animations {@link com.github.johnpersano.supertoasts.SuperToast.Animations}
     */
    public void setAnimations(Animations animations) {

        this.mAnimations = animations;

    }

    /**
     * Returns the show/hide animations of the {@value #TAG}.
     *
     * @return {@link com.github.johnpersano.supertoasts.SuperToast.Animations}
     */
    public Animations getAnimations() {

        return this.mAnimations;

    }

    /**
     * Sets an OnDismissListener defined in this library
     * to the {@value #TAG}. Does not require wrapper.
     *
     * @param onDismissListener {@link com.github.johnpersano.supertoasts.SuperToast.OnDismissListener}
     */
    public void setOnDismissListener(OnDismissListener onDismissListener) {

        this.mOnDismissListener = onDismissListener;

    }

    /**
     * Returns the OnDismissListener set to the {@value #TAG}.
     *
     * @return {@link com.github.johnpersano.supertoasts.SuperToast.OnDismissListener}
     */
    public OnDismissListener getOnDismissListener() {

        return mOnDismissListener;

    }

    /**
     * Dismisses the {@value #TAG}.
     */
    public void dismiss() {

        ManagerSuperToast.getInstance().removeSuperToast(this);

    }

    /**
     * Returns the {@value #TAG} message textview.
     *
     * @return {@link android.widget.TextView}
     */
    public TextView getTextView() {

        return mMessageTextView;

    }

    /**
     * Returns the {@value #TAG} view.
     *
     * @return {@link android.view.View}
     */
    public View getView() {

        return mToastView;

    }

    /**
     * Returns true if the {@value #TAG} is showing.
     *
     * @return boolean
     */
    public boolean isShowing() {

        return mToastView != null && mToastView.isShown();

    }

    /**
     * Returns the window manager that the {@value #TAG} is attached to.
     *
     * @return {@link android.view.WindowManager}
     */
    public WindowManager getWindowManager() {

        return mWindowManager;

    }

    /**
     * Returns the window manager layout params of the {@value #TAG}.
     *
     * @return {@link android.view.WindowManager.LayoutParams}
     */
    public WindowManager.LayoutParams getWindowManagerParams() {

        return mWindowManagerParams;

    }

    /**
     * Private method used to return a specific animation for a animations enum
     */
    private int getAnimation() {

        if (mAnimations == Animations.FLYIN) {

            return android.R.style.Animation_Translucent;

        } else if (mAnimations == Animations.SCALE) {

            return android.R.style.Animation_Dialog;

        } else if (mAnimations == Animations.POPUP) {

            return android.R.style.Animation_InputMethod;

        } else {

            return android.R.style.Animation_Toast;

        }

    }

    /**
     * Private method used to set a default style to the {@value #TAG}
     */
    private void setStyle(Style style) {

        this.setAnimations(style.animations);
        this.setTypefaceStyle(style.typefaceStyle);
        this.setTextColor(style.textColor);
        this.setBackground(style.background);

    }

    /**
     * Returns a standard {@value #TAG}.
     *
     * @param context          {@link android.content.Context}
     * @param textCharSequence {@link CharSequence}
     * @param durationInteger  {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
     *
     * @return {@link SuperToast}
     */
    public static SuperToast create(Context context, CharSequence textCharSequence,
                                              int durationInteger) {

        SuperToast superToast = new SuperToast(context);
        superToast.setText(textCharSequence);
        superToast.setDuration(durationInteger);

        return superToast;

    }

    /**
     * Returns a standard {@value #TAG} with specified animations.
     *
     * @param context          {@link android.content.Context}
     * @param textCharSequence {@link CharSequence}
     * @param durationInteger  {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
     * @param animations       {@link com.github.johnpersano.supertoasts.SuperToast.Animations}
     *
     * @return {@link SuperToast}
     */
    public static SuperToast create(Context context, CharSequence textCharSequence,
                                              int durationInteger, Animations animations) {

        final SuperToast superToast = new SuperToast(context);
        superToast.setText(textCharSequence);
        superToast.setDuration(durationInteger);
        superToast.setAnimations(animations);

        return superToast;

    }

    /**
     * Returns a {@value #TAG} with a specified style.
     *
     * @param context          {@link android.content.Context}
     * @param textCharSequence {@link CharSequence}
     * @param durationInteger  {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
     * @param style            {@link com.github.johnpersano.supertoasts.util.Style}
     *
     * @return SuperCardToast
     */
    public static SuperToast create(Context context, CharSequence textCharSequence, int durationInteger, Style style) {

        final SuperToast superToast = new SuperToast(context);
        superToast.setText(textCharSequence);
        superToast.setDuration(durationInteger);
        superToast.setStyle(style);

        return superToast;

    }

    /**
     * Dismisses and removes all showing/pending {@value #TAG}.
     */
    public static void cancelAllSuperToasts() {

        ManagerSuperToast.getInstance().cancelAllSuperToasts();

    }

}
src/Release/2.2/Bitocle/src/io/github/mthli/Bitocle/Content/RepoContentTask.java
public class RepoContentTask extends AsyncTask<Void, Integer, Boolean> {
    private MainFragment fragment;
    private Context context;
    private int flag = 0;

    private ContentItemAdapter adapter;
    private List<ContentItem> list;
    private MenuItem bookmark;

    private DataService dataService;
    private String owner;
    private String name;

    private Tree root;
    private TreeEntry entry;

    public RepoContentTask(MainFragment fragment) {
        this.fragment = fragment;
    }

    @Override
    protected void onPreExecute() {
        context = fragment.getContentView().getContext();
        flag = fragment.getFlag();

        adapter = fragment.getContentItemAdapter();
        list = fragment.getContentItemList();
        bookmark = fragment.getBookmark();

        GitHubClient client = fragment.getClient();
        dataService = new DataService(client);
        owner = fragment.getOwner();
        name = fragment.getName();
        root = fragment.getRoot();
        entry = fragment.getEntry();

        if (flag == Flag.REPO_CONTENT_FIRST || flag == Flag.REPO_CONTENT_REFRESH) {
            fragment.setContentEmpty(false);
            fragment.setContentShown(false);
            bookmark.setVisible(false);
        }
    }

    @Override
    protected Boolean doInBackground(Void... params) {
        if (flag == Flag.REPO_CONTENT_FIRST || flag == Flag.REPO_CONTENT_REFRESH) {
            String master = "heads/master";
            RepositoryId id = RepositoryId.create(owner, name);

            Reference ref;
            String sha;
            if (!fragment.isToggle()) {
                try {
                    ref = dataService.getReference(id, master);
                } catch (IOException i) {
                    return false;
                }
                sha = ref.getObject().getSha();

                if (isCancelled()) {
                    return false;
                }
            } else {
                sha = fragment.getBookmarkItem().getSha();
            }

            try {
                root = dataService.getTree(id, sha, true);
            } catch (IOException i) {
                return false;
            }
        }

        if (isCancelled()) {
            return false;
        }
        return true;
    }

    @Override
    protected void onCancelled() {
        /* Do nothing */
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        /* Do nothing */
    }

    @Override
    protected void onPostExecute(Boolean result) {
        if (result) {
            if (flag == Flag.REPO_CONTENT_FIRST || flag == Flag.REPO_CONTENT_REFRESH) {
                fragment.setRoot(root);
            }
            List<TreeEntry> entries = root.getTree();

            if (flag == Flag.REPO_CONTENT_FIRST || flag == Flag.REPO_CONTENT_REFRESH) {
                list.clear();
                for (TreeEntry e : entries) {
                    String[] a = e.getPath().split("/");
                    if (a.length == 1) {
                        list.add(new ContentItem(e));
                    }
                }
                Collections.sort(list);

                if (list.size() <= 0) {
                    bookmark.setVisible(false);
                    fragment.setContentEmpty(true);
                    fragment.setEmptyText(R.string.content_empty_list);
                    fragment.setContentShown(true);
                } else {
                    bookmark.setVisible(true);
                    fragment.setContentEmpty(false);
                    adapter.notifyDataSetChanged();
                    fragment.setContentShown(true);
                }
            } else {
                list.clear();
                String[] a = entry.getPath().split("/");
                for (TreeEntry e : entries) {
                    String[] r = e.getPath().split("/");
                    if ((r.length - 1 == a.length) && e.getPath().startsWith(entry.getPath())) {
                        list.add(new ContentItem(e));
                    }
                }
                Collections.sort(list);

                if (list.size() <= 0) {
                    bookmark.setVisible(false);
                    fragment.setContentEmpty(true);
                    fragment.setEmptyText(R.string.content_empty_list);
                    fragment.setContentShown(true);
                } else {
                    bookmark.setVisible(true);
                    fragment.setContentEmpty(false);
                    adapter.notifyDataSetChanged();
                    fragment.setContentShown(true);
                }
            }
        } else {
            bookmark.setVisible(false);
            fragment.setContentEmpty(true);
            fragment.setEmptyText(R.string.content_empty_error);
            fragment.setContentShown(true);
        }
    }
}
src/Release/2.0/Bitocle/src/io/github/mthli/Bitocle/Bookmark/BookmarkItemAdapter.java
public class BookmarkItemAdapter extends ArrayAdapter<BookmarkItem> {
    private Context context;
    private int layoutResId;
    private List<BookmarkItem> bookmarkItemList;

    public BookmarkItemAdapter (
            Context context,
            int layoutRedId,
            List<BookmarkItem> bookmarkItemList
    ) {
        super(context, layoutRedId, bookmarkItemList);

        this.context = context;
        this.layoutResId = layoutRedId;
        this.bookmarkItemList = bookmarkItemList;
    }

    private class Holder {
        ImageView icon;
        TextView title;
        TextView date;
        TextView content;
        TextView owner;
    }

    @Override
    public View getView(
            int position,
            View convertView,
            ViewGroup viewGroup
    ) {
        Holder holder;
        View view = convertView;

        if (view == null) {
            LayoutInflater inflater = ((Activity) context).getLayoutInflater();
            view = inflater.inflate(layoutResId, viewGroup, false);

            holder = new Holder();
            holder.icon = (ImageView) view.findViewById(R.id.bookmark_item_icon);
            holder.title = (TextView) view.findViewById(R.id.bookmark_item_title);
            holder.date = (TextView) view.findViewById(R.id.bookmark_item_date);
            holder.content = (TextView) view.findViewById(R.id.bookmark_item_content);
            holder.owner = (TextView) view.findViewById(R.id.bookmark_item_owner);

            view.setTag(holder);
        } else {
            holder = (Holder) view.getTag();
        }

        if (bookmarkItemList.size() > 0) {
            BookmarkItem anItem = bookmarkItemList.get(position);
            holder.icon.setImageDrawable(anItem.getIcon());
            holder.title.setText(anItem.getTitle());
            holder.date.setText(anItem.getDate());
            String str = anItem.getRepoName() + context.getString(R.string.repo_path_root) + anItem.getRepoPath();
            if (anItem.getType().equals(RepositoryContents.TYPE_DIR)) {
                str = str + context.getString(R.string.repo_path_root);
            }
            holder.content.setText(str);
            holder.owner.setText(anItem.getRepoOwner());
        }

        return view;
    }
}
src/Release/2.1/Bitocle/src/io/github/mthli/Bitocle/Content/StarContentTask.java
public class StarContentTask extends AsyncTask<Void, Integer, Boolean> {
    private MainFragment fragment;
    private Context context;
    private int flag = 0;

    private ContentItemAdapter adapter;
    private List<ContentItem> list;
    private MenuItem bookmark;

    private DataService dataService;
    private String owner;
    private String name;
    private Tree root;
    private TreeEntry entry;

    public StarContentTask(MainFragment fragment) {
        this.fragment = fragment;
    }

    @Override
    protected void onPreExecute() {
        context = fragment.getContentView().getContext();
        flag = fragment.getFlag();

        adapter = fragment.getContentItemAdapter();
        list = fragment.getContentItemList();
        bookmark = fragment.getBookmark();

        GitHubClient client = fragment.getClient();
        dataService = new DataService(client);
        owner = fragment.getOwner();
        name = fragment.getName();
        root = fragment.getRoot();
        entry = fragment.getEntry();

        if (flag == Flag.STAR_CONTENT_FIRST || flag == Flag.STAR_CONTENT_REFRESH) {
            fragment.setContentEmpty(false);
            fragment.setContentShown(false);
            bookmark.setVisible(false);
        }
    }

    @Override
    protected Boolean doInBackground(Void... params) {
        if (flag == Flag.STAR_CONTENT_FIRST || flag == Flag.STAR_CONTENT_REFRESH) {
            String master = "heads/master";
            RepositoryId id = RepositoryId.create(owner, name);

            Reference ref;
            String sha;
            if (!fragment.isToggle()) {
                try {
                    ref = dataService.getReference(id, master);
                } catch (IOException i) {
                    return false;
                }
                sha = ref.getObject().getSha();

                if (isCancelled()) {
                    return false;
                }
            } else {
                sha = fragment.getBookmarkItem().getSha();
            }

            try {
                root = dataService.getTree(id, sha, true);
            } catch (IOException i) {
                return false;
            }
        }

        if (isCancelled()) {
            return false;
        }
        return true;
    }

    @Override
    protected void onCancelled() {
        /* Do nothing */
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        /* Do nothing */
    }

    @Override
    protected void onPostExecute(Boolean result) {
        if (result) {
            if (flag == Flag.STAR_CONTENT_FIRST || flag == Flag.STAR_CONTENT_REFRESH) {
                fragment.setRoot(root);
            }
            List<TreeEntry> entries = root.getTree();

            if (flag == Flag.STAR_CONTENT_FIRST || flag == Flag.STAR_CONTENT_REFRESH) {
                list.clear();
                for (TreeEntry e : entries) {
                    String[] a = e.getPath().split("/");
                    if (a.length == 1) {
                        list.add(new ContentItem(e));
                    }
                }
                Collections.sort(list);

                if (list.size() <= 0) {
                    bookmark.setVisible(false);
                    fragment.setContentEmpty(true);
                    fragment.setEmptyText(R.string.content_empty_list);
                    fragment.setContentShown(true);
                } else {
                    bookmark.setVisible(true);
                    fragment.setContentEmpty(false);
                    adapter.notifyDataSetChanged();
                    fragment.setContentShown(true);
                }
            } else {
                list.clear();
                String[] a = entry.getPath().split("/");
                for (TreeEntry e : entries) {
                    String[] r = e.getPath().split("/");
                    if ((r.length - 1 == a.length) && e.getPath().startsWith(entry.getPath())) {
                        list.add(new ContentItem(e));
                    }
                }
                Collections.sort(list);

                if (list.size() <= 0) {
                    bookmark.setVisible(false);
                    fragment.setContentEmpty(true);
                    fragment.setEmptyText(R.string.content_empty_list);
                    fragment.setContentShown(true);
                } else {
                    bookmark.setVisible(true);
                    fragment.setContentEmpty(false);
                    adapter.notifyDataSetChanged();
                    fragment.setContentShown(true);
                }
            }
        } else {
            bookmark.setVisible(false);
            fragment.setContentEmpty(true);
            fragment.setEmptyText(R.string.content_empty_error);
            fragment.setContentShown(true);
        }
    }
}
src/Release/2.1/Bitocle/src/io/github/mthli/Bitocle/Content/ContentItemAdapter.java
public class ContentItemAdapter extends ArrayAdapter<ContentItem> {
    private Context context;
    private int layoutResId;
    private List<ContentItem> list;

    public ContentItemAdapter(
            Context context,
            int layoutResId,
            List<ContentItem> list
    ) {
        super(context, layoutResId, list);

        this.context = context;
        this.layoutResId = layoutResId;
        this.list = list;
    }

    private class Holder {
        ImageView icon;
        TextView title;
        TextView info;
    }

    @Override
    public View getView(
            int position,
            View convertView,
            ViewGroup viewGroup
    ) {
        Holder holder;
        View view = convertView;

        if (view == null) {
            LayoutInflater inflater = ((Activity) context).getLayoutInflater();
            view = inflater.inflate(layoutResId, viewGroup, false);

            holder = new Holder();
            holder.icon = (ImageView) view.findViewById(R.id.content_item_icon);
            holder.title = (TextView) view.findViewById(R.id.content_item_title);
            holder.info = (TextView) view.findViewById(R.id.content_item_info);

            view.setTag(holder);
        } else {
            holder = (Holder) view.getTag();
        }

        ContentItem item = list.get(position);
        TreeEntry entry = item.getEntry();
        if (entry.getType().equals("tree")) {
            holder.icon.setImageDrawable(
                    context.getResources().getDrawable(R.drawable.ic_type_folder)
            );
            holder.info.setText("#");
        } else {
            holder.icon.setImageDrawable(
                    context.getResources().getDrawable(R.drawable.ic_type_file)
            );
            if (item.getEntry().getSize() < 1024) {
                holder.info.setText(item.getEntry().getSize() + " " + "B");
            } else {
                double r = round(item.getEntry().getSize() / 1024);
                String size = r + " " + "KB";
                holder.info.setText(size);
            }
        }
        holder.title.setText(getName(item.getEntry().getPath()));

        return view;
    }

    private static String getName(String path) {
        String[] arr = path.split("/");
        return arr[arr.length - 1];
    }

    /* Maybe do something */
    private static double round(double value) {
        BigDecimal bigDecimal = new BigDecimal(value);
        bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
        double d = bigDecimal.doubleValue();

        return d;
    }
}


Question: package io.github.mthli.Bitocle.Main;
import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.SQLException;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.SparseBooleanArray;
import android.view.*;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.*;
import com.devspark.progressfragment.ProgressFragment;
import com.github.johnpersano.supertoasts.SuperToast;
import com.github.johnpersano.supertoasts.util.Style;
import io.github.mthli.Bitocle.Bookmark.BookmarkItem;
import io.github.mthli.Bitocle.Bookmark.BookmarkItemAdapter;
import io.github.mthli.Bitocle.Bookmark.BookmarkTask;
import io.github.mthli.Bitocle.Commit.CommitItem;
import io.github.mthli.Bitocle.Commit.CommitItemAdapter;
import io.github.mthli.Bitocle.Commit.CommitTask;
import io.github.mthli.Bitocle.Content.ContentItem;
import io.github.mthli.Bitocle.Content.ContentItemAdapter;
import io.github.mthli.Bitocle.Content.RepoContentTask;
import io.github.mthli.Bitocle.Content.StarContentTask;
import io.github.mthli.Bitocle.Database.Bookmark.BAction;
import io.github.mthli.Bitocle.Database.Bookmark.Bookmark;
import io.github.mthli.Bitocle.R;
import io.github.mthli.Bitocle.Repo.*;
import io.github.mthli.Bitocle.Star.StarItem;
import io.github.mthli.Bitocle.Star.StarItemAdapter;
import io.github.mthli.Bitocle.Star.StarTask;
import io.github.mthli.Bitocle.WebView.MimeType;
import io.github.mthli.Bitocle.WebView.WebViewActivity;
import org.eclipse.egit.github.core.Tree;
import org.eclipse.egit.github.core.TreeEntry;
import org.eclipse.egit.github.core.client.GitHubClient;
import uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh;
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout;
import java.util.*;



public class MainFragment extends ProgressFragment {
    public static final int REPO_ID = 0;
    public static final int STAR_ID = 1;
    public static final int BOOKMARK_ID = 2;
    public static final int REPO_CONTENT_ID = 3;
    public static final int STAR_CONTENT_ID = 4;
    public static final int COMMIT_ID = 5;

    private int currentId = 0;
    private int flag = 0;

    private View view;
    private ListView listView;
    private ActionBar actionBar;
    private PullToRefreshLayout pull;
    private String title;
    private String subTitle;

    private SharedPreferences sp;
    private MenuItem hor;
    private MenuItem night;


    private MenuItem star;
    private MenuItem bookmark;
    private MenuItem about;
    private MenuItem logout;
    private AutoCompleteTextView search;
    private View line;
    private InputMethodManager imm;

    private RepoItemAdapter repoItemAdapter;
    private List<RepoItem> repoItemList = new ArrayList<RepoItem>();

Answer:     private BookmarkItemAdapter bookmarkItemAdapter;