本文整理汇总了Java中org.eclipse.egit.github.core.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.eclipse.egit.github.core包,在下文中一共展示了Repository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@Override
public void start(Bundle savedInstanceState, long repositoryId) {
mView.setLoadingIndicator(true);
mRepositoryId = repositoryId;
mLoaderManager.initLoader(TRAFFIC_LOADER, null, TrafficPresenter.this);
mLoaderManager.initLoader(VIEWS_LOADER, null, TrafficPresenter.this);
mLoaderManager.initLoader(CLONES_LOADER, null, TrafficPresenter.this);
mLoaderManager.initLoader(REFERENCES_LOADER, null, TrafficPresenter.this);
mGithubRepository.getRepositoriesWithAdditionalInfo(repositoryId,
new GithubDataSource.GetRepositoriesCallback() {
@Override
public void onRepositoriesLoaded(List<Repository> repositoryList) {
// Nothing to do
}
@Override
public void onDataNotAvailable() {
// Nothing to do
}
}, false);
}
示例2: onRefresh
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@Override
public void onRefresh() {
mGithubRepository.getRepositoriesWithAdditionalInfo(new GithubDataSource.GetRepositoriesCallback() {
@Override
public void onRepositoriesLoaded(List<Repository> repositoryList) {
mDashboardView.setLoadingIndicator(false);
mDashboardView.setRefreshIndicator(false);
mLoaderManager.restartLoader(REPOSITORIES_LOADER, null,
DashboardPresenter.this);
}
@Override
public void onDataNotAvailable() {
DashboardPresenter.this.onDataNotAvailable(REPOSITORIES_LOADER);
}
}, false);
}
示例3: saveRepositories
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
public boolean saveRepositories(List<Repository> repositories) throws IOException {
Uri uri = RepositoryContract.RepositoryEntry.CONTENT_URI;
for (Repository repository : repositories) {
ContentValues repositoryValues = RepositoryContract.RepositoryEntry.
buildContentValues(repository);
Cursor cursor = mContentResolver.query(uri,
new String[]{RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_ID},
RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_ID + " = "
+ repository.getId(), null, null);
if (cursor != null && cursor.moveToFirst()) {
mContentResolver.update(uri, repositoryValues,
RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_ID + " = "
+ repository.getId(), null);
} else {
mContentResolver.insert(uri, repositoryValues);
}
if (cursor != null) {
cursor.close();
}
}
return true;
}
示例4: buildContentValues
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
public static ContentValues buildContentValues(Repository repo) {
ContentValues contentValues = new ContentValues();
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_ID,
repo.getId());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_NAME,
repo.getName());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_FULL_NAME,
repo.getOwner().getName() + File.separator + repo.getName());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_DESCRIPTION,
repo.getDescription());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_PRIVATE,
repo.isPrivate());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_FORK,
repo.isFork());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_URL,
repo.getUrl());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_HTML_URL,
repo.getHtmlUrl());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_FORKS,
repo.getForks());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_WATCHERS,
repo.getWatchers());
contentValues.put(RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_LANGUAGE,
repo.getLanguage());
return contentValues;
}
示例5: getRepositoriesWithAdditionalInfo
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
/**
* Get the user's' repositories
*
* @param callback called when the repositories are loaded
* @param useCache if false the list of repositories are updated from online
*/
@Override
public void getRepositoriesWithAdditionalInfo(final GetRepositoriesCallback callback, boolean useCache) {
final String key = ReferrerContract.ReferrerEntry.TABLE_NAME;
if (useCache && mSyncSettings.isSynced(key)) {
Log.i(LOG_TAG, "Cache was used for " + key);
callback.onRepositoriesLoaded(new ArrayList<Repository>());
return;
}
mGithubRemoteDataSource.getRepositoriesWithAdditionalInfo(new GetRepositoriesCallback() {
@Override
public void onRepositoriesLoaded(List<Repository> repositories) {
if (repositories.size() > 0) {
mSyncSettings.synced(key);
}
callback.onRepositoriesLoaded(repositories);
}
@Override
public void onDataNotAvailable() {
callback.onDataNotAvailable();
}
}, useCache);
}
示例6: getRepositories
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@Override
public void getRepositories(final GetRepositoriesCallback callback) {
new AsyncTask<Void, Void, List<Repository>>() {
@Override
protected List<Repository> doInBackground(Void... params) {
return getRepositoriesSync();
}
@Override
protected void onPostExecute(List<Repository> repositoryList) {
if (repositoryList != null) {
callback.onRepositoriesLoaded(repositoryList);
} else {
callback.onDataNotAvailable();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例7: getRepositoriesWithAdditionalInfo
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@Override
public void getRepositoriesWithAdditionalInfo(final GetRepositoriesCallback callback, boolean useCache) {
new AsyncTask<Void, Void, List<Repository>>() {
@Override
protected List<Repository> doInBackground(Void... params) {
List<Repository> repositories = getRepositoriesSync();
getRepositoriesWithAdditionalInfoSync(repositories);
return repositories;
}
@Override
protected void onPostExecute(List<Repository> repositoryList) {
if (repositoryList != null) {
callback.onRepositoriesLoaded(repositoryList);
} else {
callback.onDataNotAvailable();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例8: getRepositoryClonesSync
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@WorkerThread
private Clones getRepositoryClonesSync(final Repository repository, String period) {
try {
Clones clones = GitHubAPI.traffic()
.setToken(getToken())
.setTokenType(getTokenType())
.setRepository(repository)
.setPeriod(period)
.getClones();
mLocalDataSource.saveClones(repository.getId(), clones);
return clones;
} catch (IOException e) {
Log.e(LOG_TAG, e.getMessage(), e);
return null;
}
}
示例9: getRepositoryClones
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@Override
public void getRepositoryClones(final Repository repository, final String period,
final GetRepositoryClonesCallback callback) {
new AsyncTask<Void, Void, Clones>() {
@Override
protected Clones doInBackground(Void... params) {
return getRepositoryClonesSync(repository, period);
}
@Override
protected void onPostExecute(Clones clones) {
if (clones != null) {
callback.onRepositoryClonesLoaded(clones);
} else {
callback.onDataNotAvailable();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例10: getRepositoryViewsSync
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@WorkerThread
private Views getRepositoryViewsSync(final Repository repository, String period) {
try {
Views views = GitHubAPI.traffic()
.setToken(getToken())
.setTokenType(getTokenType())
.setRepository(repository)
.setPeriod(period)
.getViews();
mLocalDataSource.saveViews(repository.getId(), views);
return views;
} catch (IOException e) {
if (Utils.isNetworkAvailable()) {
FirebaseCrash.report(e);
}
return null;
}
}
示例11: getRepositoryViews
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@Override
public void getRepositoryViews(final Repository repository, final String period,
final GetRepositoryViewsCallback callback) {
new AsyncTask<Void, Void, Views>() {
@Override
protected Views doInBackground(Void... params) {
return getRepositoryViewsSync(repository, period);
}
@Override
protected void onPostExecute(Views views) {
if (views != null) {
callback.onRepositoryViewsLoaded(views);
} else {
callback.onDataNotAvailable();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例12: getRepositoryReferrersSync
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@SuppressWarnings("unused")
@WorkerThread
private List<ReferringSite> getRepositoryReferrersSync(final Repository repository) {
try {
List<ReferringSite> referringSites = GitHubAPI.traffic()
.setToken(getToken())
.setTokenType(getTokenType())
.setRepository(repository)
.getReferringSites();
mLocalDataSource.saveReferringSites(repository.getId(), referringSites);
return referringSites;
} catch (IOException e) {
if (Utils.isNetworkAvailable()) {
FirebaseCrash.report(e);
}
return null;
}
}
示例13: getRepositoryReferrers
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@Override
public void getRepositoryReferrers(final Repository repository,
final GetRepositoryReferrersCallback callback) {
new AsyncTask<Void, Void, List<ReferringSite>>() {
@Override
protected List<ReferringSite> doInBackground(Void... params) {
return getRepositoryReferrersSync(repository);
}
@Override
protected void onPostExecute(List<ReferringSite> referringSiteList) {
if (referringSiteList != null) {
callback.onRepositoryReferrersLoaded(referringSiteList);
} else {
callback.onDataNotAvailable();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例14: getStargazers
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
public void getStargazers(final Repository repository, final GetStargazersCallback callback) {
new AsyncTask<Void, Void, List<Star>>() {
@Override
protected List<Star> doInBackground(Void... params) {
return getStargazersSync(repository);
}
@Override
protected void onPostExecute(List<Star> starList) {
if (starList != null) {
callback.onStargazersLoaded(starList);
} else {
callback.onDataNotAvailable();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例15: getStargazersSync
import org.eclipse.egit.github.core.Repository; //导入依赖的package包/类
@WorkerThread
private List<Star> getStargazersSync(Repository repository) {
try {
List<Star> stars = GitHubAPI.stargazers()
.setToken(getToken())
.setTokenType(getTokenType())
.setRepository(repository)
.setPage(Service.Pagination.LAST_PAGE)
.setDate(Utils.twoWeeksAgo())
.getStars();
mLocalDataSource.saveStargazers(repository, stars);
return stars;
} catch (IOException e) {
if (Utils.isNetworkAvailable()) {
FirebaseCrash.report(e);
}
return null;
}
}