本文整理汇总了Java中at.favre.lib.hood.interfaces.Pages类的典型用法代码示例。如果您正苦于以下问题:Java Pages类的具体用法?Java Pages怎么用?Java Pages使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Pages类属于at.favre.lib.hood.interfaces包,在下文中一共展示了Pages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPageData
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
/**
* Sets the page data (required to for the ui to show anything)
*
* @param pages
*/
public void setPageData(@NonNull Pages pages) {
this.viewPager.setAdapter(new DebugViewPageAdapter(viewPager, pages, zebraColor));
this.pages = Hood.ext().createUnmodifiablePages(pages);
if (pages.getConfig().autoLog) {
pages.logPages();
}
setupAutoRefresh(pages);
if (!(getContext() instanceof HoodController)) {
pages.log("activity does not implement IHoodDebugController - some features might not work");
}
if (pages.getAll().size() <= 1 || !pages.getConfig().showPagesIndicator) {
tabs.setVisibility(GONE);
} else {
tabs.setVisibility(VISIBLE);
}
}
示例2: testPagesEqualsLogic
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@Test
public void testPagesEqualsLogic() throws Exception {
Pages defaultPages = DebugPages.Factory.create(Config.newBuilder().build());
Page page1a = DebugPage.Factory.create(defaultPages, "one");
Page page1b = DebugPage.Factory.create(defaultPages, "two");
assertNotSame(page1a, page1b);
Page page2a = DebugPage.Factory.create(DebugPages.Factory.create(Config.newBuilder().setAutoRefresh(true).build()), "same");
Page page2b = DebugPage.Factory.create(DebugPages.Factory.create(Config.newBuilder().setAutoRefresh(false).build()), "same");
assertNotSame(page2a, page2b);
Page page3a = DebugPage.Factory.create(defaultPages, "same");
Page page3b = DebugPage.Factory.create(defaultPages, "same");
page3a.add(Hood.get().createPropertyEntry("key", "value"));
assertNotSame(page3a, page3b);
page3b.add(Hood.get().createPropertyEntry("key_a", "value_a"));
assertNotSame(page3a, page3b);
Page page4a = DebugPage.Factory.create(defaultPages, "one");
Page page4b = DebugPage.Factory.create(defaultPages, "one");
assertEquals(page4a, page4b);
}
示例3: getPageData
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@NonNull
@Override
public Pages getPageData(@NonNull Pages pages) {
final Random random = new Random();
for (int i = 0; i < 10; i++) {
Page page = pages.addNewPage("Page " + i);
for (int j = 0; j < 1000; j++) {
int rand = random.nextInt(15);
if (rand == 0) {
page.add(Hood.get().createSwitchEntry(
DefaultConfigActions.getBoolSharedPreferencesConfigAction(
getPreferences(MODE_PRIVATE), "KEY_TEST", "switch " + j, false)));
} else if (rand == 1) {
page.add(Hood.get().createHeaderEntry("header" + j));
} else if (rand == 2) {
PageUtil.addAction(page, DefaultButtonDefinitions.getGlobalSettingsAction(),
DefaultButtonDefinitions.getNfcSettingsAction());
} else if (rand == 3) {
PageUtil.addAction(page, DefaultButtonDefinitions.getBatterySaverSettingsAction());
} else if (rand == 4) {
page.add(Hood.get().createSpinnerEntry(DefaultConfigActions.getDefaultSharedPrefBackedSpinnerAction("Backend", getPreferences(MODE_PRIVATE), "BACKEND_ID", null, getBackendElements())));
} else {
page.add(Hood.get().createPropertyEntry("key " + j, "value " + j));
}
}
}
return pages;
}
示例4: getPageData
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@NonNull
@Override
public Pages getPageData(@NonNull Pages pages) {
final Random random = new Random(getIntent().getLongExtra(KEY_SEED, 0));
for (int i = 0; i < getIntent().getIntExtra(KEY_PAGES_COUNT, 0); i++) {
Page page = pages.addNewPage("Page " + i);
for (int j = 0; j < getIntent().getIntExtra(KEY_PAGE_COUNT, 0); j++) {
int rand = random.nextInt(15);
if (rand == 0) {
page.add(Hood.get().createSwitchEntry(
DefaultConfigActions.getBoolSharedPreferencesConfigAction(
getPreferences(MODE_PRIVATE), "KEY_TEST", "switch " + j, false)));
} else if (rand == 1) {
page.add(Hood.get().createHeaderEntry("header" + j));
} else if (rand == 2) {
PageUtil.addAction(page, DefaultButtonDefinitions.getGlobalSettingsAction(),
DefaultButtonDefinitions.getNfcSettingsAction());
} else if (rand == 3) {
PageUtil.addAction(page, DefaultButtonDefinitions.getBatterySaverSettingsAction());
} else {
page.add(Hood.get().createPropertyEntry("key " + j, "value " + j));
}
}
}
return pages;
}
示例5: createImmutablePagesList
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
private List<Page> createImmutablePagesList(Pages pages) {
List<Page> copy = new ArrayList<>(pages.size());
for (Page page : pages.getAll()) {
copy.add(new UnmodifiablePageDelegate(page));
}
return Collections.unmodifiableList(copy);
}
示例6: setupAutoRefresh
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
private void setupAutoRefresh(@NonNull Pages pages) {
if (pages.getConfig().autoRefresh) {
final long intervalMs = pages.getConfig().autoRefreshIntervalMs;
refreshHandler.removeCallbacksAndMessages(this);
refreshHandler.postDelayed(new Runnable() {
@Override
public void run() {
refresh();
refreshHandler.postDelayed(this, intervalMs);
}
}, intervalMs);
}
}
示例7: testCreatePages
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@Test
public void testCreatePages() throws Exception {
Config config = Config.newBuilder()
.setShowZebra(false)
.setAutoRefresh(true)
.setLogTag("smth")
.build();
Pages pages = hoodAPI.createPages(config);
assertEquals(config, pages.getConfig());
assertEquals(0, pages.size());
assertEquals(pages.size(), pages.getAll().size());
assertEquals(0, pages.createDataMap().size());
}
示例8: setup
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@Before
public void setup() {
Pages pages = DebugPages.Factory.create(Config.newBuilder().build());
original = pages.addNewPage("empty");
unmodifiablePages = new UnmodifiablePageDelegate(original);
checkEqual(original, unmodifiablePages);
}
示例9: getPageData
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@NonNull
@Override
public Pages getPageData(@NonNull Pages pages) {
Page page = pages.addNewPage();
page.add(DefaultProperties.createSectionSourceControlAndCI(BuildConfig.GIT_REV, BuildConfig.GIT_BRANCH, BuildConfig.GIT_DATE, BuildConfig.BUILD_NUMBER, null, BuildConfig.BUILD_DATE));
page.add(DefaultProperties.createSectionBasicDeviceInfo());
page.add(DefaultProperties.createDetailedDeviceInfo(this));
page.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(BuildConfig.class));
page.add(new PackageInfoAssembler(PackageInfoAssembler.Type.PERMISSIONS,
PackageInfoAssembler.Type.SIGNATURE,
PackageInfoAssembler.Type.USES_FEATURE).createSection(this));
return pages;
}
示例10: getPageData
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@NonNull
@Override
public Pages getPageData(@NonNull Pages emptyPages) {
Page page = emptyPages.addNewPage();
page.add(DefaultProperties.createSectionSourceControlAndCI(BuildConfig.GIT_REV, BuildConfig.GIT_BRANCH, BuildConfig.GIT_DATE, BuildConfig.BUILD_NUMBER, null, BuildConfig.BUILD_DATE));
page.add(DefaultProperties.createSectionBasicDeviceInfo());
page.add(DefaultProperties.createDetailedDeviceInfo(this));
page.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(BuildConfig.class));
page.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(at.favre.lib.dali.BuildConfig.class).removeHeader());
return emptyPages;
}
示例11: getPageData
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@NonNull
@Override
public Pages getPageData(@NonNull Pages pages) {
Page firstPage = pages.addNewPage();
firstPage.add(DefaultProperties.createSectionSourceControlAndCI(BuildConfig.GIT_REV, BuildConfig.GIT_BRANCH, BuildConfig.GIT_DATE, BuildConfig.BUILD_NUMBER, null, BuildConfig.BUILD_DATE));
firstPage.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(at.favre.lib.hood.BuildConfig.class));
firstPage.add(DefaultProperties.createSectionBasicDeviceInfo());
firstPage.add(DefaultProperties.createDetailedDeviceInfo(this));
firstPage.add(Hood.get().createSwitchEntry(DefaultConfigActions.getBoolSharedPreferencesConfigAction(getPreferences(MODE_PRIVATE), "KEY_TEST", false)));
firstPage.add(Hood.get().createSwitchEntry(DefaultConfigActions.getBoolSharedPreferencesConfigAction(getPreferences(MODE_PRIVATE), "KEY_TEST2", false)));
firstPage.add(Hood.get().createSwitchEntry(DefaultConfigActions.getBoolSharedPreferencesConfigAction(getPreferences(MODE_PRIVATE), "KEY_TEST3", "a debug feature", false)));
firstPage.add(Hood.get().createSpinnerEntry(DefaultConfigActions.getDefaultSharedPrefBackedSpinnerAction(null, getPreferences(MODE_PRIVATE), "W_BACKEND_KEY", null, getBackendElements())));
firstPage.add(DefaultProperties.createSectionTelephonyManger(this));
firstPage.add(DefaultProperties.createSectionBatteryInfo(this));
PageUtil.addHeader(firstPage, "Misc Actions");
PageUtil.addAction(firstPage, DefaultButtonDefinitions.getAppInfoAction());
PageUtil.addAction(firstPage, DefaultButtonDefinitions.getCrashAction(), DefaultButtonDefinitions.getUninstallAction());
PageUtil.addAction(firstPage, DefaultButtonDefinitions.getKillProcessAction(this), DefaultButtonDefinitions.getClearAppDataAction());
PageUtil.addAction(firstPage, HoodUtil.getConditionally(DefaultButtonDefinitions.getKillProcessAction(this), at.favre.lib.hood.BuildConfig.DEBUG));
PageUtil.addHeader(firstPage, "System Features");
Map<CharSequence, String> systemFeatureMap = new HashMap<>();
systemFeatureMap.put("hasHce", "android.hardware.nfc.hce");
systemFeatureMap.put("hasCamera", "android.hardware.camera");
systemFeatureMap.put("hasWebview", "android.software.webview");
PageUtil.addAction(firstPage, new ButtonDefinition("Test Loading", new OnClickAction() {
@Override
public void onClick(final View view, Map.Entry<CharSequence, String> value) {
view.setEnabled(false);
getDebugView().setProgressBarVisible(true);
view.postDelayed(new Runnable() {
@Override
public void run() {
view.setEnabled(true);
getDebugView().setProgressBarVisible(false);
}
}, 3000);
}
}));
firstPage.add(DefaultProperties.createSystemFeatureInfo(this, systemFeatureMap));
firstPage.add(DefaultProperties.createSectionConnectivityStatusInfo(this));
logDataMap(pages);
return pages;
}
示例12: logDataMap
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
private void logDataMap(Pages pages) {
Map<String, String> map = pages.createDataMap();
for (Map.Entry<String, String> entry : map.entrySet()) {
Log.v(TAG, entry.getKey() + " - " + entry.getValue());
}
}
示例13: getPageData
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@NonNull
@Override
public Pages getPageData(@NonNull Pages pages) {
return super.getPageData(pages);
}
示例14: createPages
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
public Pages createPages() {
Pages pages = Hood.get().createPages(Config.newBuilder().setShowHighlightContent(false).build());
Page firstPage = pages.addNewPage("Debug Info");
firstPage.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(at.favre.lib.hood.BuildConfig.class));
firstPage.add(DefaultProperties.createSectionBasicDeviceInfo());
firstPage.add(DefaultProperties.createSectionConnectivityStatusInfo(this));
firstPage.add(new PackageInfoAssembler(PackageInfoAssembler.Type.APK_INSTALL_INFO, PackageInfoAssembler.Type.PERMISSIONS, PackageInfoAssembler.Type.SIGNATURE).createSection(this, true));
Page secondPage = pages.addNewPage("Debug Features");
PageUtil.addHeader(secondPage, "System Features");
Map<CharSequence, String> systemFeatureMap = new HashMap<>();
systemFeatureMap.put("hasHce", "android.hardware.nfc.hce");
systemFeatureMap.put("hasCamera", "android.hardware.camera");
systemFeatureMap.put("hasWebview", "android.software.webview");
secondPage.add(DefaultProperties.createSystemFeatureInfo(this, systemFeatureMap));
secondPage.add(Hood.get().createHeaderEntry("Debug Config"));
secondPage.add(Hood.get().createSwitchEntry(DefaultConfigActions.getBoolSharedPreferencesConfigAction(getPreferences(MODE_PRIVATE), "KEY_TEST", "Enable debug feat#1", false)));
secondPage.add(Hood.get().createSwitchEntry(DefaultConfigActions.getBoolSharedPreferencesConfigAction(getPreferences(MODE_PRIVATE), "KEY_TEST2", "Enable debug feat#2", false)));
secondPage.add(Hood.get().createSwitchEntry(DefaultConfigActions.getBoolSharedPreferencesConfigAction(getPreferences(MODE_PRIVATE), "KEY_TEST3", "Enable debug feat#3", false)));
secondPage.add(Hood.get().createSpinnerEntry(DefaultConfigActions.getDefaultSharedPrefBackedSpinnerAction(null, getPreferences(MODE_PRIVATE), "BACKEND_ID", null, getBackendElements())));
PageUtil.addAction(secondPage, new ButtonDefinition("Test Loading", new OnClickAction() {
@Override
public void onClick(final View view, Map.Entry<CharSequence, String> value) {
view.setEnabled(false);
binding.debugView.setProgressBarVisible(true);
view.postDelayed(new Runnable() {
@Override
public void run() {
view.setEnabled(true);
binding.debugView.setProgressBarVisible(false);
}
}, 3000);
}
}));
secondPage.add(Hood.get().createActionEntry(DefaultButtonDefinitions.getCrashAction()));
secondPage.add(Hood.get().createActionEntry(DefaultButtonDefinitions.getKillProcessAction(this), DefaultButtonDefinitions.getClearAppDataAction()));
secondPage.add(Hood.get().createActionEntry(DefaultButtonDefinitions.getKillProcessAction(this)));
return pages;
}
示例15: getCurrentPagesFromThisView
import at.favre.lib.hood.interfaces.Pages; //导入依赖的package包/类
@NonNull
@Override
public Pages getCurrentPagesFromThisView() {
return binding.debugView.getPages();
}