Search in sources :

Example 1 with SourceEditor

use of com.github.pockethub.android.util.SourceEditor in project PocketHub by pockethub.

the class CommitFileViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_commit_file_view);
    repo = getIntent().getParcelableExtra(EXTRA_REPOSITORY);
    commit = getStringExtra(EXTRA_HEAD);
    sha = getStringExtra(EXTRA_BASE);
    path = getStringExtra(EXTRA_PATH);
    file = CommitUtils.getName(path);
    isMarkdownFile = MarkdownUtils.isMarkdown(file);
    editor = new SourceEditor(codeView);
    editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean(WRAP, false));
    ActionBar actionBar = getSupportActionBar();
    int lastSlash = path.lastIndexOf('/');
    if (lastSlash != -1) {
        actionBar.setTitle(path.substring(lastSlash + 1));
    } else {
        actionBar.setTitle(path);
    }
    actionBar.setSubtitle(getString(R.string.commit_prefix) + CommitUtils.abbreviate(commit));
    avatars.bind(actionBar, repo.owner());
    loadContent();
}
Also used : ActionBar(android.support.v7.app.ActionBar) SourceEditor(com.github.pockethub.android.util.SourceEditor)

Example 2 with SourceEditor

use of com.github.pockethub.android.util.SourceEditor in project PocketHub by pockethub.

the class GistFileFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    editor = new SourceEditor(webView);
    editor.setWrap(PreferenceUtils.getCodePreferences(getActivity()).getBoolean(WRAP, false));
    if (file.content() != null) {
        showSource();
    } else {
        loadSource();
    }
}
Also used : SourceEditor(com.github.pockethub.android.util.SourceEditor)

Example 3 with SourceEditor

use of com.github.pockethub.android.util.SourceEditor in project PocketHub by pockethub.

the class BranchFileViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_commit_file_view);
    repo = getParcelableExtra(EXTRA_REPOSITORY);
    sha = getStringExtra(EXTRA_BASE);
    path = getStringExtra(EXTRA_PATH);
    branch = getStringExtra(EXTRA_HEAD);
    codeView.getSettings().setBuiltInZoomControls(true);
    codeView.getSettings().setUseWideViewPort(true);
    file = CommitUtils.getName(path);
    isMarkdownFile = MarkdownUtils.isMarkdown(file);
    editor = new SourceEditor(codeView);
    editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean(WRAP, false));
    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(file);
    actionBar.setSubtitle(branch);
    avatars.bind(actionBar, repo.owner());
    loadContent();
}
Also used : ActionBar(android.support.v7.app.ActionBar) SourceEditor(com.github.pockethub.android.util.SourceEditor)

Aggregations

SourceEditor (com.github.pockethub.android.util.SourceEditor)3 ActionBar (android.support.v7.app.ActionBar)2