本文整理汇总了Java中org.fdroid.fdroid.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
R类属于org.fdroid.fdroid包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendFDroid
import org.fdroid.fdroid.R; //导入依赖的package包/类
public void sendFDroid() {
// If Bluetooth has not been enabled/turned on, then enabling device discoverability
// will automatically enable Bluetooth.
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if (adapter != null) {
if (adapter.getState() != BluetoothAdapter.STATE_ON) {
Intent discoverBt = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverBt.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 120);
startActivityForResult(discoverBt, REQUEST_BLUETOOTH_ENABLE_FOR_SEND);
} else {
sendFDroidApk();
}
} else {
new AlertDialog.Builder(this)
.setTitle(R.string.bluetooth_unavailable)
.setMessage(R.string.swap_cant_send_no_bluetooth)
.setNegativeButton(
R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { }
}
).create().show();
}
}
示例2: onCreateView
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.NONE)
.showImageOnLoading(R.drawable.screenshot_placeholder)
.showImageForEmptyUri(R.drawable.screenshot_placeholder)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
View rootView = inflater.inflate(R.layout.activity_screenshots_page, container, false);
ImageView screenshotView = (ImageView) rootView.findViewById(R.id.screenshot);
ImageLoader.getInstance().displayImage(screenshotUrl, screenshotView, displayImageOptions);
return rootView;
}
示例3: initAutoFetchUpdatesPreference
import org.fdroid.fdroid.R; //导入依赖的package包/类
/**
* If a user specifies they want to fetch updates automatically, then start the download of relevant
* updates as soon as they enable the feature.
* Also, if the user has the priv extention installed then change the label to indicate that it
* will actually _install_ apps, not just fetch their .apk file automatically.
*/
private void initAutoFetchUpdatesPreference() {
updateAutoDownloadPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (newValue instanceof Boolean && (boolean) newValue) {
UpdateService.autoDownloadUpdates(getContext());
}
return true;
}
});
if (PrivilegedInstaller.isDefault(getContext())) {
updateAutoDownloadPref.setTitle(R.string.update_auto_install);
updateAutoDownloadPref.setSummary(R.string.update_auto_install_summary);
}
}
示例4: addNameAndDescriptionToRepo
import org.fdroid.fdroid.R; //导入依赖的package包/类
/**
* Add a name and description to the repo table, and updates the two
* default repos with values from strings.xml.
*/
private void addNameAndDescriptionToRepo(SQLiteDatabase db, int oldVersion) {
boolean nameExists = columnExists(db, RepoTable.NAME, RepoTable.Cols.NAME);
boolean descriptionExists = columnExists(db, RepoTable.NAME, RepoTable.Cols.DESCRIPTION);
if (oldVersion >= 21 || (nameExists && descriptionExists)) {
return;
}
if (!nameExists) {
db.execSQL("alter table " + RepoTable.NAME + " add column " + RepoTable.Cols.NAME + " text");
}
if (!descriptionExists) {
db.execSQL("alter table " + RepoTable.NAME + " add column " + RepoTable.Cols.DESCRIPTION + " text");
}
String[] defaultRepos = context.getResources().getStringArray(R.array.default_repos);
for (int i = 0; i < defaultRepos.length / REPO_XML_ARG_COUNT; i++) {
int offset = i * REPO_XML_ARG_COUNT;
insertNameAndDescription(db,
defaultRepos[offset], // name
defaultRepos[offset + 1], // address
defaultRepos[offset + 2] // description
);
}
}
示例5: onClick
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (currentApp == null) {
return;
}
Intent intent = new Intent(activity, AppDetails2.class);
intent.putExtra(AppDetails2.EXTRA_APPID, currentApp.packageName);
if (Build.VERSION.SDK_INT >= 21) {
String transitionAppIcon = activity.getString(R.string.transition_app_item_icon);
Pair<View, String> iconTransitionPair = Pair.create((View) icon, transitionAppIcon);
Bundle bundle = ActivityOptionsCompat
.makeSceneTransitionAnimation(activity, iconTransitionPair).toBundle();
activity.startActivity(intent, bundle);
} else {
activity.startActivity(intent);
}
}
示例6: getCurrentViewState
import org.fdroid.fdroid.R; //导入依赖的package包/类
@NonNull
@Override
protected AppListItemState getCurrentViewState(
@NonNull App app, @Nullable AppUpdateStatusManager.AppUpdateStatus appStatus) {
String mainText;
String actionButtonText;
Apk suggestedApk = ApkProvider.Helper.findSuggestedApk(activity, app);
if (shouldUpgradeInsteadOfUninstall(app, suggestedApk)) {
mainText = activity.getString(R.string.updates__app_with_known_vulnerability__prompt_upgrade, app.name);
actionButtonText = activity.getString(R.string.menu_upgrade);
} else {
mainText = activity.getString(R.string.updates__app_with_known_vulnerability__prompt_uninstall, app.name);
actionButtonText = activity.getString(R.string.menu_uninstall);
}
return new AppListItemState(app)
.setMainText(mainText)
.showActionButton(actionButtonText)
.showSecondaryButton(activity.getString(R.string.updates__app_with_known_vulnerability__ignore));
}
示例7: installPackage
import org.fdroid.fdroid.R; //导入依赖的package包/类
private void installPackage(Uri localApkUri, Uri downloadUri, Apk apk) {
Utils.debugLog(TAG, "Installing: " + localApkUri.getPath());
installer.sendBroadcastInstall(downloadUri, Installer.ACTION_INSTALL_STARTED);
File path = apk.getMediaInstallPath(activity.getApplicationContext());
path.mkdirs();
try {
FileUtils.copyFileToDirectory(new File(localApkUri.getPath()), path);
} catch (IOException e) {
Utils.debugLog(TAG, "Failed to copy: " + e.getMessage());
installer.sendBroadcastInstall(downloadUri, Installer.ACTION_INSTALL_INTERRUPTED);
}
if (apk.isMediaInstalled(activity.getApplicationContext())) { // Copying worked
Utils.debugLog(TAG, "Copying worked: " + localApkUri.getPath());
Toast.makeText(this, String.format(this.getString(R.string.app_installed_media), path.toString()),
Toast.LENGTH_LONG).show();
installer.sendBroadcastInstall(downloadUri, Installer.ACTION_INSTALL_COMPLETE);
} else {
installer.sendBroadcastInstall(downloadUri, Installer.ACTION_INSTALL_INTERRUPTED);
}
finish();
}
示例8: onReceive
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (intent.hasExtra(SwapService.EXTRA_STARTING)) {
Utils.debugLog(TAG, "Bluetooth service is starting (setting toggle to disabled, not checking because we will wait for an intent that bluetooth is actually enabled)");
bluetoothSwitch.setEnabled(false);
textBluetoothVisible.setText(R.string.swap_setting_up_bluetooth);
// bluetoothSwitch.setChecked(true);
} else {
if (intent.hasExtra(SwapService.EXTRA_STARTED)) {
Utils.debugLog(TAG, "Bluetooth service has started (updating text to visible, but not marking as checked).");
textBluetoothVisible.setText(R.string.swap_visible_bluetooth);
bluetoothSwitch.setEnabled(true);
// bluetoothSwitch.setChecked(true);
} else {
Utils.debugLog(TAG, "Bluetooth service has stopped (setting switch to not-visible).");
textBluetoothVisible.setText(R.string.swap_not_visible_bluetooth);
setBluetoothSwitchState(false, true);
}
}
}
示例9: onResume
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
FDroidApp.checkStartTor(this);
if (getIntent().hasExtra(EXTRA_VIEW_UPDATES)) {
getIntent().removeExtra(EXTRA_VIEW_UPDATES);
pager.scrollToPosition(adapter.adapterPositionFromItemId(R.id.updates));
selectedMenuId = R.id.updates;
setSelectedMenuInNav();
} else if (getIntent().hasExtra(EXTRA_VIEW_SETTINGS)) {
getIntent().removeExtra(EXTRA_VIEW_SETTINGS);
pager.scrollToPosition(adapter.adapterPositionFromItemId(R.id.settings));
selectedMenuId = R.id.settings;
setSelectedMenuInNav();
}
// AppDetails2 and RepoDetailsActivity set different NFC actions, so reset here
NfcHelper.setAndroidBeam(this, getApplication().getPackageName());
checkForAddRepoIntent(getIntent());
}
示例10: onCreate
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
((FDroidApp) getApplication()).applyTheme(this);
intent = getIntent();
Uri uri = intent.getData();
Apk apk = ApkProvider.Helper.findByUri(this, uri, Schema.ApkTable.Cols.ALL);
app = AppProvider.Helper.findSpecificApp(getContentResolver(),
apk.packageName, apk.repoId, Schema.AppMetadataTable.Cols.ALL);
appDiff = new AppDiff(getPackageManager(), apk);
setContentView(R.layout.install_start);
// increase dialog to full width
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
installConfirm = findViewById(R.id.install_confirm_panel);
installConfirm.setVisibility(View.INVISIBLE);
startInstallConfirm();
}
示例11: onCreateViewHolder
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Override
public MainViewController onCreateViewHolder(ViewGroup parent, int viewType) {
MainViewController holder = createEmptyView();
switch (viewType) {
case R.id.whats_new:
holder.bindWhatsNewView();
break;
case R.id.categories:
holder.bindCategoriesView();
break;
case R.id.nearby:
holder.bindSwapView();
break;
case R.id.updates:
// Hold of until onViewAttachedToWindow, because that is where we want to start listening
// for broadcast events (which is what the data binding does).
break;
case R.id.settings:
holder.bindSettingsView();
break;
default:
throw new IllegalStateException("Unknown view type " + viewType);
}
return holder;
}
示例12: onFinishInflate
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
((TextView) findViewById(R.id.heading)).setText(R.string.swap_connecting);
findViewById(R.id.back).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().showIntro();
}
});
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(
repoUpdateReceiver, new IntentFilter(UpdateService.LOCAL_ACTION_STATUS));
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(
prepareSwapReceiver, new IntentFilter(SwapWorkflowActivity.PrepareSwapRepo.ACTION));
}
示例13: getInstalledStatus
import org.fdroid.fdroid.R; //导入依赖的package包/类
private String getInstalledStatus(final Apk apk) {
// Definitely not installed.
if (apk.versionCode != app.installedVersionCode) {
return context.getString(R.string.app_not_installed);
}
// Definitely installed this version.
if (apk.sig != null && apk.sig.equals(app.installedSig)) {
return context.getString(R.string.app_installed);
}
// Installed the same version, but from someplace else.
final String installerPkgName;
try {
installerPkgName = context.getPackageManager().getInstallerPackageName(app.packageName);
} catch (IllegalArgumentException e) {
Log.w("AppDetailsAdapter", "Application " + app.packageName + " is not installed anymore");
return context.getString(R.string.app_not_installed);
}
if (TextUtils.isEmpty(installerPkgName)) {
return context.getString(R.string.app_inst_unknown_source);
}
final String installerLabel = InstalledAppProvider
.getApplicationLabel(context, installerPkgName);
return context.getString(R.string.app_inst_known_source, installerLabel);
}
示例14: onFinishInflate
import org.fdroid.fdroid.R; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
setUIFromWifi();
ImageView qrImage = (ImageView) findViewById(R.id.wifi_qr_code);
// Replace all blacks with the background blue.
qrImage.setColorFilter(new LightingColorFilter(0xffffffff, getResources().getColor(R.color.swap_blue)));
Button openQr = (Button) findViewById(R.id.btn_qr_scanner);
openQr.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().initiateQrScan();
}
});
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(
onWifiStateChanged, new IntentFilter(WifiStateChangeService.BROADCAST));
}
示例15: prepareNfcMenuItems
import org.fdroid.fdroid.R; //导入依赖的package包/类
@TargetApi(16)
private void prepareNfcMenuItems(Menu menu) {
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
MenuItem menuItem = menu.findItem(R.id.menu_enable_nfc);
if (nfcAdapter == null) {
menuItem.setVisible(false);
return;
}
boolean needsEnableNfcMenuItem;
if (Build.VERSION.SDK_INT < 16) {
needsEnableNfcMenuItem = !nfcAdapter.isEnabled();
} else {
needsEnableNfcMenuItem = !nfcAdapter.isNdefPushEnabled();
}
menuItem.setVisible(needsEnableNfcMenuItem);
}