本文整理汇总了Java中org.fdroid.fdroid.views.ManageReposActivity类的典型用法代码示例。如果您正苦于以下问题:Java ManageReposActivity类的具体用法?Java ManageReposActivity怎么用?Java ManageReposActivity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ManageReposActivity类属于org.fdroid.fdroid.views包,在下文中一共展示了ManageReposActivity类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkForAddRepoIntent
import org.fdroid.fdroid.views.ManageReposActivity; //导入依赖的package包/类
private void checkForAddRepoIntent(Intent intent) {
// Don't handle the intent after coming back to this view (e.g. after hitting the back button)
// http://stackoverflow.com/a/14820849
if (!intent.hasExtra(ADD_REPO_INTENT_HANDLED)) {
intent.putExtra(ADD_REPO_INTENT_HANDLED, true);
NewRepoConfig parser = new NewRepoConfig(this, intent);
if (parser.isValidRepo()) {
if (parser.isFromSwap()) {
Intent confirmIntent = new Intent(this, SwapWorkflowActivity.class);
confirmIntent.putExtra(SwapWorkflowActivity.EXTRA_CONFIRM, true);
confirmIntent.setData(intent.getData());
startActivityForResult(confirmIntent, REQUEST_SWAP);
} else {
startActivity(new Intent(ACTION_ADD_REPO, intent.getData(), this, ManageReposActivity.class));
}
} else if (parser.getErrorMessage() != null) {
Toast.makeText(this, parser.getErrorMessage(), Toast.LENGTH_LONG).show();
}
}
}
示例2: checkForAddRepoIntent
import org.fdroid.fdroid.views.ManageReposActivity; //导入依赖的package包/类
private void checkForAddRepoIntent() {
// Don't handle the intent after coming back to this view (e.g. after hitting the back button)
// http://stackoverflow.com/a/14820849
if (!getIntent().hasExtra("handled")) {
NewRepoConfig parser = new NewRepoConfig(this, getIntent());
if (parser.isValidRepo()) {
getIntent().putExtra("handled", true);
if (parser.isFromSwap()) {
startActivityForResult(new Intent(ACTION_ADD_REPO, getIntent().getData(), this, ConnectSwapActivity.class), REQUEST_SWAP);
} else {
startActivity(new Intent(ACTION_ADD_REPO, getIntent().getData(), this, ManageReposActivity.class));
}
} else if (parser.getErrorMessage() != null) {
Toast.makeText(this, parser.getErrorMessage(), Toast.LENGTH_LONG).show();
}
}
}
示例3: onOptionsItemSelected
import org.fdroid.fdroid.views.ManageReposActivity; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_update_repo:
UpdateService.updateNow(this);
return true;
case R.id.action_manage_repos:
startActivity(new Intent(this, ManageReposActivity.class));
return true;
case R.id.action_settings:
Intent prefs = new Intent(getBaseContext(), PreferencesActivity.class);
startActivityForResult(prefs, REQUEST_PREFS);
return true;
case R.id.action_swap:
startActivity(new Intent(this, SwapWorkflowActivity.class));
return true;
case R.id.action_bluetooth_apk:
/*
* If Bluetooth has not been enabled/turned on, then enabling
* device discoverability will automatically enable Bluetooth
*/
Intent discoverBt = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverBt.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 121);
startActivityForResult(discoverBt, REQUEST_ENABLE_BLUETOOTH);
// if this is successful, the Bluetooth transfer is started
return true;
case R.id.action_about:
View view = LayoutInflater.from(this).inflate(R.layout.about, null);
String versionName = Utils.getVersionName(this);
if (versionName != null) {
((TextView) view.findViewById(R.id.version)).setText(versionName);
}
AlertDialog alrt = new AlertDialog.Builder(this).setView(view).create();
alrt.setTitle(R.string.about_title);
alrt.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alrt.show();
return true;
}
return super.onOptionsItemSelected(item);
}
示例4: scanAndProcess
import org.fdroid.fdroid.views.ManageReposActivity; //导入依赖的package包/类
/**
* search for provision files and process them
*/
public static void scanAndProcess(Context context) {
File provisionDir = new File(context.getExternalFilesDir(null).getAbsolutePath(), NEW_PROVISIONS_DIR);
if (!provisionDir.isDirectory()) {
Utils.debugLog(TAG, "Provisions dir does not exists: '" + provisionDir.getAbsolutePath() + "' moving on ...");
} else if (provisionDir.list().length == 0) {
Utils.debugLog(TAG, "Provisions dir is empty: '" + provisionDir.getAbsolutePath() + "' moving on ...");
} else {
Provisioner p = new Provisioner();
List<File> files = p.findProvisionFiles(context);
List<ProvisionPlaintext> plaintexts = p.extractProvisionsPlaintext(files);
List<Provision> provisions = p.parseProvisions(plaintexts);
if (provisions == null || provisions.size() == 0) {
Utils.debugLog(TAG, "Provision dir does not contain any provisions: '" + provisionDir.getAbsolutePath() + "' moving on ...");
} else {
int cleanupCounter = 0;
for (Provision provision : provisions) {
if (provision.getRepositoryProvision() != null) {
RepositoryProvision repo = provision.getRepositoryProvision();
Repo storedRepo = RepoProvider.Helper.findByAddress(context, repo.getUrl());
if (storedRepo != null) {
Utils.debugLog(TAG, "Provision contains a repo which is already added: '" + provision.getProvisonPath() + "' ignoring ...");
} else {
// Note: only the last started activity will visible to users.
// All other prompting attempts will be lost.
Uri origUrl = Uri.parse(repo.getUrl());
Uri.Builder data = new Uri.Builder();
data.scheme(origUrl.getScheme());
data.encodedAuthority(Uri.encode(repo.getUsername()) + ":" + Uri.encode(repo.getPassword()) + "@" + Uri.encode(origUrl.getAuthority()));
data.path(origUrl.getPath());
data.appendQueryParameter("fingerprint", repo.getSigfp());
Intent i = new Intent(context, ManageReposActivity.class);
i.setData(data.build());
context.startActivity(i);
Utils.debugLog(TAG, "Provision processed: '" + provision.getProvisonPath() + "' prompted user ...");
}
}
// remove provision file
try {
new File(provision.getProvisonPath()).delete();
cleanupCounter++;
} catch (SecurityException e) {
// ignore this exception
Utils.debugLog(TAG, "Removing provision not possible: " + e.getMessage() + " ()");
}
}
Utils.debugLog(TAG, "Provisions done, removed " + cleanupCounter + " provision(s).");
}
}
}