Java源码示例:com.grarak.kerneladiutor.R
示例1
private void navigationDrawerInit() {
DDivider mNavigationDrawerDividerCard = new DDivider();
mNavigationDrawerDividerCard.setText(getString(R.string.navigation_drawer));
addView(mNavigationDrawerDividerCard);
if (!Utils.isTV(getActivity())) {
SwitchCardView.DSwitchCard mNavigationDrawerCard = new SwitchCardView.DSwitchCard();
mNavigationDrawerCard.setTitle(getString(R.string.navigation_drawer));
mNavigationDrawerCard.setDescription(getString(R.string.navigation_drawer_summary));
mNavigationDrawerCard.setChecked(Utils.getBoolean("Navbar_Position_Alternate", false, getActivity()));
mNavigationDrawerCard.setOnDSwitchCardListener(new SwitchCardView.DSwitchCard.OnDSwitchCardListener() {
@Override
public void onChecked(SwitchCardView.DSwitchCard dSwitchCard, boolean checked) {
Utils.saveBoolean("Navbar_Position_Alternate", checked, getActivity());
MainActivity.reconfigureNavigationDrawer(getContext());
}
});
addView(mNavigationDrawerCard);
}
}
示例2
public PopupCardView(Context context, final List<String> list) {
super(context, R.layout.popup_cardview);
this.list = list;
if (list != null) {
popup = new PopupMenu(getContext(), valueView);
for (int i = 0; i < list.size(); i++)
popup.getMenu().add(Menu.NONE, i, Menu.NONE, list.get(i));
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (valueView != null) {
valueText = list.get(item.getItemId()) + " ";
valueView.setText(list.get(item.getItemId()) + " ");
}
if (onPopupCardListener != null)
onPopupCardListener.onItemSelected(PopupCardView.this, item.getItemId());
return false;
}
});
}
if (onPopupCardListener != null) setListener();
}
示例3
@Override
public void preInit(Bundle savedInstanceState) {
super.preInit(savedInstanceState);
fabView.setVisibility(View.GONE);
fabView = addButton;
backgroundView.setVisibility(View.GONE);
backgroundView = null;
applyOnBootText.setText(getString(R.string.emulate_initd));
applyOnBootView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Utils.saveBoolean("emulateinit.d", isChecked, getActivity());
}
});
applyOnBootView.setChecked(Utils.getBoolean("emulateinit.d", false, getActivity()));
}
示例4
@Override
public void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
CardViewItem.DCardView kernelVersionCard = new CardViewItem.DCardView();
kernelVersionCard.setTitle(getString(R.string.kernel_version));
kernelVersionCard.setDescription(Info.getKernelVersion());
CardViewItem.DCardView cpuCard = new CardViewItem.DCardView();
cpuCard.setTitle(getString(R.string.cpu_information));
cpuCard.setDescription(Info.getCpuInfo());
CardViewItem.DCardView memCard = new CardViewItem.DCardView();
memCard.setTitle(getString(R.string.memory_information));
memCard.setDescription(Info.getMemInfo());
addView(kernelVersionCard);
addView(cpuCard);
addView(memCard);
}
示例5
private void governorInit() {
if (GPU.hasGpu2dGovernor()) {
m2dGovernorCard = new PopupCardView.DPopupCard(GPU.getGpu2dGovernors());
m2dGovernorCard.setTitle(getString(R.string.gpu_2d_governor));
m2dGovernorCard.setDescription(getString(R.string.gpu_2d_governor_summary));
m2dGovernorCard.setItem(GPU.getGpu2dGovernor());
m2dGovernorCard.setOnDPopupCardListener(this);
addView(m2dGovernorCard);
}
if (GPU.hasGpuGovernor()) {
mGovernorCard = new PopupCardView.DPopupCard(GPU.getGpuGovernors());
mGovernorCard.setTitle(getString(R.string.gpu_governor));
mGovernorCard.setDescription(getString(R.string.gpu_governor_summary));
mGovernorCard.setItem(GPU.getGpuGovernor());
mGovernorCard.setOnDPopupCardListener(this);
addView(mGovernorCard);
}
}
示例6
private void vibrationInit() {
List<String> list = new ArrayList<>();
for (int i = 0; i < 101; i++)
list.add(i + "%");
int max = Misc.getVibrationMax();
int min = Misc.getVibrationMin();
float offset = (max - min) / (float) 101;
mVibrationCard = new SeekBarCardView.DSeekBarCard(list);
mVibrationCard.setTitle(getString(R.string.vibration_strength));
mVibrationCard.setProgress(Math.round((Misc.getCurVibration() - min) / offset));
mVibrationCard.setOnDSeekBarCardListener(this);
addView(mVibrationCard);
}
示例7
private void maxFreqInit() {
if (GPU.hasGpu2dMaxFreq() && hasGpu2DfreqsString) {
mMax2dFreqCard = new PopupCardView.DPopupCard(Gpu2DfreqsString);
mMax2dFreqCard.setTitle(getString(R.string.gpu_2d_max_freq));
mMax2dFreqCard.setDescription(getString(R.string.gpu_2d_max_freq_summary));
mMax2dFreqCard.setItem(GPU.getGpu2dMaxFreq() / 1000000 + getString(R.string.mhz));
mMax2dFreqCard.setOnDPopupCardListener(this);
addView(mMax2dFreqCard);
}
if (GPU.hasGpuMaxFreq() && hasGpufreqsString) {
mMaxFreqCard = new PopupCardView.DPopupCard(GpufreqsString);
mMaxFreqCard.setTitle(getString(R.string.gpu_max_freq));
mMaxFreqCard.setDescription(getString(R.string.gpu_max_freq_summary));
mMaxFreqCard.setItem(GpufreqsString.get(GPU.getGpuMaxPowerLevel()));
mMaxFreqCard.setOnDPopupCardListener(this);
addView(mMaxFreqCard);
}
}
示例8
private void options(final boolean flashing, final RootFile file) {
final LinkedHashMap<String, Backup.PARTITION> menu = new LinkedHashMap<>();
if (Backup.getBootPartition() != null)
menu.put(getString(R.string.boot), Backup.PARTITION.BOOT);
if (Backup.getRecoveryPartition() != null)
menu.put(getString(R.string.recovery), Backup.PARTITION.RECOVERY);
if (Backup.getFotaPartition() != null)
menu.put(getString(R.string.fota), Backup.PARTITION.FOTA);
String[] items = new String[menu.keySet().toArray().length];
for (int i = 0; i < items.length; i++)
items[i] = (String) menu.keySet().toArray()[i];
new AlertDialog.Builder(getActivity()).setItems(items,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (flashing)
restoreDialog(file, (Backup.PARTITION) menu.values().toArray()[which], false);
else backupDialog((Backup.PARTITION) menu.values().toArray()[which]);
}
}).show();
}
示例9
private void externalStorageInit() {
DDivider mExternalStorageDivider = new DDivider();
mExternalStorageDivider.setText(getString(R.string.external_storage));
addView(mExternalStorageDivider);
mExternalSchedulerCard = new PopupCardView.DPopupCard(IO.getSchedulers(IO.StorageType.EXTERNAL));
mExternalSchedulerCard.setDescription(getString(R.string.scheduler));
mExternalSchedulerCard.setItem(IO.getScheduler(IO.StorageType.EXTERNAL));
mExternalSchedulerCard.setOnDPopupCardListener(this);
addView(mExternalSchedulerCard);
mExternalTunableCard = new CardViewItem.DCardView();
mExternalTunableCard.setDescription(getString(R.string.scheduler_tunable));
mExternalTunableCard.setOnDCardListener(this);
addView(mExternalTunableCard);
mExternalReadAheadCard = new PopupCardView.DPopupCard(readheads);
mExternalReadAheadCard.setDescription(getString(R.string.read_ahead));
mExternalReadAheadCard.setItem(IO.getReadahead(IO.StorageType.EXTERNAL) + getString(R.string.kb));
mExternalReadAheadCard.setOnDPopupCardListener(this);
addView(mExternalReadAheadCard);
}
示例10
private void externalStorageInit() {
DDivider mExternalStorageDivider = new DDivider();
mExternalStorageDivider.setText(getString(R.string.external_storage));
addView(mExternalStorageDivider);
mExternalSchedulerCard = new PopupCardView.DPopupCard(IO.getSchedulers(IO.StorageType.EXTERNAL));
mExternalSchedulerCard.setDescription(getString(R.string.scheduler));
mExternalSchedulerCard.setItem(IO.getScheduler(IO.StorageType.EXTERNAL));
mExternalSchedulerCard.setOnDPopupCardListener(this);
addView(mExternalSchedulerCard);
mExternalTunableCard = new CardViewItem.DCardView();
mExternalTunableCard.setDescription(getString(R.string.scheduler_tunable));
mExternalTunableCard.setOnDCardListener(this);
addView(mExternalTunableCard);
mExternalReadAheadCard = new PopupCardView.DPopupCard(readheads);
mExternalReadAheadCard.setDescription(getString(R.string.read_ahead));
mExternalReadAheadCard.setItem(IO.getReadahead(IO.StorageType.EXTERNAL) + getString(R.string.kb));
mExternalReadAheadCard.setOnDPopupCardListener(this);
addView(mExternalReadAheadCard);
}
示例11
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int desiredWidth = getResources().getDisplayMetrics().widthPixels;
int desiredHeight = getResources().getDimensionPixelSize(R.dimen.colorpalette_height);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int width;
int height;
if (widthMode == MeasureSpec.EXACTLY) width = widthSize;
else if (widthMode == MeasureSpec.AT_MOST) width = Math.min(desiredWidth, widthSize);
else width = desiredWidth;
if (heightMode == MeasureSpec.EXACTLY) height = heightSize;
else if (heightMode == MeasureSpec.AT_MOST) height = Math.min(desiredHeight, heightSize);
else height = desiredHeight;
setMeasuredDimension(width, height);
}
示例12
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
for (int appWidgetId: appWidgetIds) {
Intent svcIntent = new Intent(context, WidgetService.class);
svcIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
svcIntent.setData(Uri.parse(svcIntent.toUri(Intent.URI_INTENT_SCHEME)));
RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.profile_widget_layout);
widget.setRemoteAdapter(R.id.profile_list, svcIntent);
widget.setPendingIntentTemplate(R.id.profile_list, getPendingIntent(context, LIST_ITEM_CLICK));
appWidgetManager.updateAppWidget(appWidgetId, widget);
}
}
示例13
@Override
public void run() {
if (searchItem != null) MenuItemCompat.collapseActionView(searchItem);
removeAllViews();
buildpropItem = Buildprop.getProps();
for (int i = 0; i < buildpropItem.size(); i++) {
PopupCardView.DPopupCard mPropCard = new PopupCardView.DPopupCard(null);
mPropCard.setDescription((String) buildpropItem.keySet().toArray()[i]);
mPropCard.setItem((String) buildpropItem.values().toArray()[i]);
mPropCard.setOnClickListener(BuildpropFragment.this);
addView(mPropCard);
}
try {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
title.setText(getString(R.string.items_found, buildpropItem.size()));
refreshLayout.setRefreshing(false);
}
});
} catch (NullPointerException ignored) {
}
}
示例14
private void intelliPlugInit() {
mIntelliPlugCard = new SwitchCardView.DSwitchCard();
mIntelliPlugCard.setTitle(getString(R.string.intelliplug));
mIntelliPlugCard.setDescription(getString(R.string.intelliplug_summary));
mIntelliPlugCard.setChecked(CPUHotplug.isIntelliPlugActive());
mIntelliPlugCard.setOnDSwitchCardListener(this);
addView(mIntelliPlugCard);
}
示例15
public void showApplyOnBoot(boolean visible) {
try {
getParentView(R.layout.recyclerview_vertical).findViewById(R.id.apply_on_boot_layout).setVisibility(
visible ? View.VISIBLE : View.GONE);
int paddingTop = visible ? recyclerView.getPaddingTop() + applyOnBootLayout.getHeight() :
recyclerView.getPaddingTop() - applyOnBootLayout.getHeight();
recyclerView.setPadding(recyclerView.getPaddingLeft(), paddingTop, recyclerView.getPaddingRight(), 0);
} catch (NullPointerException ignored) {}
}
示例16
public SplashView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setBackgroundColor(ContextCompat.getColor(context, R.color.color_primary));
density = getResources().getDisplayMetrics().density;
textColor = ContextCompat.getColor(context, R.color.white);
textSize = getResources().getDimensionPixelSize(R.dimen.splashview_textsize);
mPaintCircle = new Paint();
mPaintCircle.setAntiAlias(true);
mPaintCircle.setStyle(Paint.Style.FILL);
mPaintCircle.setStrokeCap(Paint.Cap.ROUND);
mPaintCircle.setColor(Color.WHITE);
matrix = new Matrix();
icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(17);
rotate++;
((Activity) getContext()).runOnUiThread(new Runnable() {
@Override
public void run() {
invalidate();
}
});
if (finished) break;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
示例17
@Override
public void onReceive(@NonNull final Context context, @NonNull Intent intent) {
if (intent.getAction().equals(LIST_ITEM_CLICK)) {
if (!Utils.getBoolean("profileclicked", false, context)) {
Utils.saveBoolean("profileclicked", true, context);
Utils.toast(context.getString(R.string.press_again_to_apply), context);
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
Utils.saveBoolean("profileclicked", false, context);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
} else {
Utils.saveBoolean("profileclicked", false, context);
int position = intent.getIntExtra(ITEM_ARG, 0);
ProfileDB profileDB = new ProfileDB(context);
ProfileDB.ProfileItem profileItem = profileDB.getAllProfiles().get(position);
RootUtils.SU su = new RootUtils.SU();
List<String> paths = profileItem.getPath();
for (int i = 0; i < paths.size(); i++) {
Control.commandSaver(context, paths.get(i), profileItem.getCommands().get(i));
su.runCommand(profileItem.getCommands().get(i));
}
su.close();
Utils.toast("Profile: \"" + profileItem.getName() + "\" applied.", context);
}
}
super.onReceive(context, intent);
}
示例18
private void forceenglishlanguageInit() {
SwitchCardView.DSwitchCard mForceEnglishLanguageCard = new SwitchCardView.DSwitchCard();
mForceEnglishLanguageCard.setDescription(getString(R.string.force_english_language));
mForceEnglishLanguageCard.setChecked(Utils.getBoolean("forceenglish", false, getActivity()));
mForceEnglishLanguageCard.setOnDSwitchCardListener(
new SwitchCardView.DSwitchCard.OnDSwitchCardListener() {
@Override
public void onChecked(SwitchCardView.DSwitchCard dSwitchCard, boolean checked) {
Utils.saveBoolean("forceenglish", checked, getActivity());
startActivity(new Intent(getActivity(), MainActivity.class));
}
});
addView(mForceEnglishLanguageCard);
}
示例19
private void init(Context context, AttributeSet attrs, int defStyle) {
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ScrimInsetsView, defStyle, 0);
if (a == null) {
return;
}
mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetFg);
a.recycle();
setWillNotDraw(true);
}
示例20
@Override
public void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
int poolsize = Entropy.getPoolsize();
mAvailableCard = new CardViewItem.DCardView();
mAvailableCard.setTitle(getString(R.string.available));
mAvailableCard.setDescription(getAvailableDescription(Entropy.getAvailable(), poolsize));
addView(mAvailableCard);
mPoolsizeCard = new CardViewItem.DCardView();
mPoolsizeCard.setTitle(getString(R.string.poolsize));
mPoolsizeCard.setDescription(String.valueOf(poolsize));
addView(mPoolsizeCard);
items.clear();
for (int i = 64; i < poolsize; i *= 2) if (i < poolsize) items.add(String.valueOf(i));
items.add(String.valueOf(poolsize));
mReadCard = new PopupCardView.DPopupCard(items);
mReadCard.setDescription(getString(R.string.read));
mReadCard.setItem(String.valueOf(Entropy.getRead()));
mReadCard.setOnDPopupCardListener(this);
addView(mReadCard);
mWriteCard = new PopupCardView.DPopupCard(items);
mWriteCard.setDescription(getString(R.string.write));
mWriteCard.setItem(String.valueOf(Entropy.getWrite()));
mWriteCard.setOnDPopupCardListener(this);
addView(mWriteCard);
}
示例21
@Override
public void setMargin() {
int padding = getResources().getDimensionPixelSize(R.dimen.basecard_padding);
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layoutParams.setMargins(0, padding, 0, 0);
setLayoutParams(layoutParams);
}
示例22
@Override
public void onChecked(SwitchCardView.DSwitchCard dSwitchCard, boolean checked) {
if (dSwitchCard == mSmb135xWakeLockCard) {
mSmb135xWakeLockCard.setDescription(String.format(getString(R.string.smb135x_wakelock_summary), checked ? getString(R.string.enabled) : getString(R.string.disabled)));
WakeLock.activateSmb135xWakeLock(checked, getActivity());
}
else if (dSwitchCard == mBlueSleepWakeLockCard) {
mBlueSleepWakeLockCard.setDescription(String.format(getString(R.string.bluesleep_wakelock_summary), checked ? getString(R.string.enabled) : getString(R.string.disabled)));
WakeLock.activateBlueSleepWakeLock(checked, getActivity());
}
else if (dSwitchCard == mSensorIndWakeLockCard) {
mSensorIndWakeLockCard.setDescription(String.format(getString(R.string.sensor_ind_wakelock_summary), checked ? getString(R.string.enabled) : getString(R.string.disabled)));
WakeLock.activateSensorIndWakeLock(checked, getActivity());
}
else if (dSwitchCard == mMsmHsicHostWakeLockCard) {
mMsmHsicHostWakeLockCard.setDescription(String.format(getString(R.string.msm_hsic_host_wakelock_summary), checked ? getString(R.string.enabled) : getString(R.string.disabled)));
WakeLock.activateMsmHsicHostWakeLock(checked, getActivity());
}
else if (dSwitchCard == mWlanrxWakelockCard) {
mWlanrxWakelockCard.setDescription(String.format(getString(R.string.wlan_rx_wakelock_summary), checked ? getString(R.string.enabled) : getString(R.string.disabled)));
WakeLock.activateWlanrxWakeLock(checked, getActivity());
}
else if (dSwitchCard == mWlanctrlWakelockCard) {
mWlanctrlWakelockCard.setDescription(String.format(getString(R.string.wlan_ctrl_wakelock_summary), checked ? getString(R.string.enabled) : getString(R.string.disabled)));
WakeLock.activateWlanctrlWakeLock(checked, getActivity());
}
else if (dSwitchCard == mWlanWakelockCard) {
mWlanWakelockCard.setDescription(String.format(getString(R.string.wlan_wakelock_summary), checked ? getString(R.string.enabled) : getString(R.string.disabled)));
WakeLock.activateWlanWakeLock(checked, getActivity());
}
}
示例23
private void DT2WTimeBetweenTapsInit() {
List<String> list = new ArrayList<>();
for (int i = 25; i <= 100; i++)
list.add(i * 10 + getString(R.string.ms));
mDT2WTimeBetweenTapsCard = new SeekBarCardView.DSeekBarCard(list);
mDT2WTimeBetweenTapsCard.setTitle(getString(R.string.wake_dt2w_timebetweentaps));
mDT2WTimeBetweenTapsCard.setDescription(getString(R.string.wake_dt2w_timebetweentaps_summary));
mDT2WTimeBetweenTapsCard.setProgress(Wake.getDT2WTimeBetweenTaps() - 25);
mDT2WTimeBetweenTapsCard.setOnDSeekBarCardListener(this);
addView(mDT2WTimeBetweenTapsCard);
}
示例24
private void licenseInit() {
CardViewItem.DCardView mLicenseCard = new CardViewItem.DCardView();
mLicenseCard.setTitle(getString(R.string.license));
View view = inflater.inflate(R.layout.app_license_view, container, false);
mLicenseCard.setView(view);
addView(mLicenseCard);
}
示例25
@Override
public void onClick(CardViewItem.DCardView dCardView) {
if (dCardView == mAdditionalProfilesCard) {
final MaterialDialog progressDialog = new MaterialDialog.Builder(getActivity())
.content(getString(R.string.loading))
.progress(true, 0)
.canceledOnTouchOutside(false)
.show();
new WebpageReader(new WebpageReader.WebpageCallback() {
@Override
public void onCallback(String raw, String html) {
progressDialog.dismiss();
if (getActivity() == null) return;
GammaProfiles gammaProfiles = new GammaProfiles(raw);
String path = getActivity().getApplicationContext().getCacheDir() + "/gamma_profiles.json";
if (gammaProfiles.readable()) {
Utils.writeFile(path, raw, false, false);
showMoreGammaProfiles(gammaProfiles);
} else {
if (Utils.existFile(path)) {
gammaProfiles.refresh(Utils.readFile(path));
if (gammaProfiles.readable()) {
showMoreGammaProfiles(gammaProfiles);
return;
}
}
Utils.toast(getString(R.string.no_internet), getActivity());
}
}
}).execute(Constants.GAMMA_URL);
}
}
示例26
private void googlePlusInit() {
CardViewItem.DCardView mGooglePlusCard = new CardViewItem.DCardView();
mGooglePlusCard.setTitle(getString(R.string.google_plus_community));
mGooglePlusCard.setDescription(getString(R.string.google_plus_community_summary));
mGooglePlusCard.setOnDCardListener(new CardViewItem.DCardView.OnDCardListener() {
@Override
public void onClick(CardViewItem.DCardView dCardView) {
Utils.launchUrl(getActivity(), GOOGLE_PLUS_LINK);
}
});
addView(mGooglePlusCard);
}
示例27
private void zenDecisionInit() {
if (CPUHotplug.hasZenDecisionEnable()) {
mZenDecisionEnableCard = new SwitchCardView.DSwitchCard();
mZenDecisionEnableCard.setTitle(getString(R.string.zen_decision));
mZenDecisionEnableCard.setDescription(getString(R.string.zen_decision_summary));
mZenDecisionEnableCard.setChecked(CPUHotplug.isZenDecisionActive());
mZenDecisionEnableCard.setOnDSwitchCardListener(this);
addView(mZenDecisionEnableCard);
}
}
示例28
public void finish() {
if (Utils.DARKTHEME)
mPaintCircle.setColor(getResources().getColor(R.color.navigationdrawer_background_dark));
new Thread(new Runnable() {
@Override
public void run() {
try {
for (int i = 1; i <= getHeight() / 2; i += 15) {
radius = i;
((Activity) getContext()).runOnUiThread(new Runnable() {
@Override
public void run() {
invalidate();
}
});
Thread.sleep(17);
}
((Activity) getContext()).runOnUiThread(new Runnable() {
@Override
public void run() {
setVisibility(GONE);
finished = true;
startAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_out));
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
示例29
private void addAction(Recovery.RECOVERY_COMMAND recovery_command, File file) {
String description = null;
switch (recovery_command) {
case WIPE_DATA:
description = getString(R.string.wipe_data);
break;
case WIPE_CACHE:
description = getString(R.string.wipe_cache);
break;
case FLASH_ZIP:
description = file.getAbsolutePath();
if (!description.endsWith(".zip")) {
Utils.toast(getString(R.string.went_wrong), getActivity());
return;
}
break;
}
final Recovery recovery = new Recovery(recovery_command, new File(description));
mCommands.add(recovery);
// null parent avoid Layout Inflation without a Parent
ViewGroup base_parent = (ViewGroup) getActivity().findViewById(R.id.base_parent);
View view = LayoutInflater.from(getActivity()).inflate(R.layout.recovery_actionview, base_parent, false);
final CardViewItem.DCardView mActionCard = new CardViewItem.DCardView();
((TextView) view.findViewById(R.id.action_text)).setText(description);
view.findViewById(R.id.delete_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
removeView(mActionCard);
mCommands.remove(recovery);
}
});
mActionCard.setView(view);
addView(mActionCard);
}
示例30
private void selinuxInit() {
mSELinuxCard = new SwitchCardView.DSwitchCard();
mSELinuxCard.setTitle(getString(R.string.se_linux));
mSELinuxCard.setDescription(getString(R.string.se_linux_summary) + " " + Misc.getSELinuxStatus());
mSELinuxCard.setChecked(Misc.isSELinuxActive());
mSELinuxCard.setOnDSwitchCardListener(this);
addView(mSELinuxCard);
}