本文整理汇总了Java中com.afollestad.inquiry.Inquiry类的典型用法代码示例。如果您正苦于以下问题:Java Inquiry类的具体用法?Java Inquiry怎么用?Java Inquiry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Inquiry类属于com.afollestad.inquiry包,在下文中一共展示了Inquiry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onDone
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@Override
public void onDone() {
if (Utils.get(this).getDbVersion() == -1) {
onDone();
return;
}
Inquiry.newInstance(this, DATABASE_NAME).databaseVersion(Utils.get(this).getDbVersion()).build();
Inquiry.get(this) // Get db
.selectFrom("icons", App.class) // Get table "icons"
.where("componentName NOT LIKE ?", "%.") // Get all app with component name that not ends with "."
.sortByAsc("label") // Sort them by label ascending
.all(new GetCallback<App>() {
@Override
public void result(@Nullable App[] apps) {
if (apps == null) {
appendLine(getString(R.string.apps_not_found), false);
return;
}
mLoadedApps = apps;
new LoadApps().execute();
}
});
}
开发者ID:DVDAndroid,项目名称:glic,代码行数:27,代码来源:MainActivity.java
示例2: saveDb
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
public static void saveDb(
@Nullable final Context context, @Nullable final WallpapersHolder holder) {
if (context == null || holder == null || holder.length() == 0) {
return;
}
final String iname = "save_walldb_instance";
Inquiry.newInstance(context, DATABASE_NAME)
.databaseVersion(DATABASE_VERSION)
.instanceName(iname)
.build();
try {
Inquiry.get(iname).delete(Wallpaper.class).run();
Inquiry.get(iname)
.insert(Wallpaper.class)
.values(holder.wallpapers)
.run(changed -> Inquiry.destroy(iname));
} catch (Throwable t) {
t.printStackTrace();
}
}
开发者ID:afollestad,项目名称:polar-dashboard,代码行数:21,代码来源:WallpaperUtils.java
示例3: initializeBlacklist
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
public static void initializeBlacklist(Context context) {
if (PrefUtils.isFirstRun(context)) {
AppInfo[] defaultBlacklistApps = new AppInfo[DEFAULT_BLACKLISTED_APPS.length];
for (int i = 0; i < DEFAULT_BLACKLISTED_APPS.length; i++) {
String packageName = DEFAULT_BLACKLISTED_APPS[i];
AppInfo appInfo = new AppInfo();
appInfo.packageName = packageName;
defaultBlacklistApps[i] = appInfo;
}
Inquiry.get().insertInto(TABLE_BLACKLISTED_APPS, AppInfo.class)
.values(defaultBlacklistApps)
.run();
PrefUtils.setFirstRun(context, false);
}
}
开发者ID:plusCubed,项目名称:anticipate,代码行数:19,代码来源:DbUtil.java
示例4: onPause
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@Override
protected void onPause() {
super.onPause();
if (isFinishing()) {
Inquiry.destroy(this);
}
}
开发者ID:DVDAndroid,项目名称:glic,代码行数:9,代码来源:MainActivity.java
示例5: doInBackground
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@Override
protected Boolean doInBackground(Void... voids) {
for (int i = 0; i < mChangedApps.size(); i++) {
Integer app = mChangedApps.get(i);
Inquiry.get(MainActivity.this)
.update("icons", App.class)
.where("componentName = ?", mLoadedApps[app].componentName)
.projection("icon", "icon_low_res")
.values(mLoadedApps[app])
.run();
publishProgress(i);
}
return true;
}
开发者ID:DVDAndroid,项目名称:glic,代码行数:16,代码来源:MainActivity.java
示例6: isBookmarked
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
/**
* Returns true if the item is currently favorited.
*/
public static boolean isBookmarked(String id) {
return Inquiry.get()
.selectFrom(Constants.DATABASE_NAME, BookmarksDB.class)
.where("_id = ?", id)
.one() != null;
}
开发者ID:MaximilianKeppeler,项目名称:Places,代码行数:10,代码来源:Bookmarks.java
示例7: bookmark
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
/**
* Returns true if the item was favorited successfully.
*/
public static boolean bookmark(String id) {
init(context);
if (!isBookmarked(id)) {
Inquiry.get()
.insertInto(Constants.DATABASE_NAME, BookmarksDB.class)
.values(new BookmarksDB(id))
.run();
return true;
} else unbookmark(id);
return false;
}
开发者ID:MaximilianKeppeler,项目名称:Places,代码行数:18,代码来源:Bookmarks.java
示例8: unbookmark
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
/**
* Returns true if the item was unfavorited successfully.
*/
public static boolean unbookmark(String id) {
if (isBookmarked(id)) {
Inquiry.get()
.deleteFrom(Constants.DATABASE_NAME, BookmarksDB.class)
.where("_id = ?", id)
.run();
return true;
} else bookmark(id);
return false;
}
开发者ID:MaximilianKeppeler,项目名称:Places,代码行数:15,代码来源:Bookmarks.java
示例9: LazyLoaderList
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
protected LazyLoaderList(
Inquiry inquiry,
String tableName,
String foreignColumnName,
String inverseFieldName,
Object row,
Class<?> childType) {
this.inquiry = inquiry;
this.tableName = tableName;
this.foreignColumnName = foreignColumnName;
this.inverseFieldName = inverseFieldName;
this.row = row;
this.childType = childType;
items = new ArrayList<>();
}
开发者ID:afollestad,项目名称:inquiry,代码行数:16,代码来源:LazyLoaderList.java
示例10: insertUpdateColor
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
public static void insertUpdateColor(WebsiteToolbarColor websiteToolbarColor) {
//noinspection ResourceType
if (getColor(websiteToolbarColor.hostDomain) == NOT_FOUND) {
Inquiry.get()
.insertInto(TABLE_TOOLBAR_COLOR, WebsiteToolbarColor.class)
.values(websiteToolbarColor)
.run();
} else {
Inquiry.get()
.update(TABLE_TOOLBAR_COLOR, WebsiteToolbarColor.class)
.where("host_domain = ?", websiteToolbarColor.hostDomain)
.values(websiteToolbarColor)
.run();
}
}
开发者ID:plusCubed,项目名称:anticipate,代码行数:16,代码来源:WebsiteToolbarDbUtil.java
示例11: getColor
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@ColorInt
public static int getColor(String url) {
try {
WebsiteToolbarColor websiteToolbarColor = Inquiry.get()
.selectFrom(TABLE_TOOLBAR_COLOR, WebsiteToolbarColor.class)
.where("host_domain = ?", url)
.one();
if (websiteToolbarColor != null) {
return websiteToolbarColor.toolbarColor;
}
if (url.startsWith("www.")) {
url = url.substring(4);
return getColor(url);
} else {
websiteToolbarColor = Inquiry.get()
.selectFrom(TABLE_TOOLBAR_COLOR, WebsiteToolbarColor.class)
.where("host_domain = ?", "www." + url)
.one();
//noinspection ResourceAsColor
return websiteToolbarColor != null ? websiteToolbarColor.toolbarColor : NOT_FOUND;
}
} catch (Exception e) {
Crashlytics.logException(e);
}
//noinspection ResourceAsColor
return NOT_FOUND;
}
开发者ID:plusCubed,项目名称:anticipate,代码行数:29,代码来源:WebsiteToolbarDbUtil.java
示例12: cleanup
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
public static void cleanup() {
WebsiteToolbarColor[] all = Inquiry.get()
.selectFrom(TABLE_TOOLBAR_COLOR, WebsiteToolbarColor.class)
.all();
if (all != null) {
long current = System.currentTimeMillis();
for (WebsiteToolbarColor color : all) {
if (color.expireTimestamp < current) {
Inquiry.get().deleteFrom(TABLE_TOOLBAR_COLOR, WebsiteToolbarColor.class)
.where("host_domain = ?", color.hostDomain)
.run();
}
}
}
}
开发者ID:plusCubed,项目名称:anticipate,代码行数:16,代码来源:WebsiteToolbarDbUtil.java
示例13: onCreate
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (!BuildConfig.DEBUG) {
Fabric.with(this, new Crashlytics());
}
LeakCanary.install(this);
Inquiry.init(this, DB, 1);
Glide.get(this)
.register(AppInfo.class, InputStream.class, new AppIconLoader.Factory());
Glide.get(this)
.register(Uri.class, InputStream.class, new FaviconLoader.Factory());
JobManager.create(this)
.addJobCreator(new JobCreator() {
@Override
public Job create(String tag) {
switch (tag) {
case CleanupJob.TAG:
return new CleanupJob();
default:
throw new RuntimeException("Cannot find job for tag " + tag);
}
}
});
JobManager.instance().cancelAll();
new JobRequest.Builder(CleanupJob.TAG)
//1 day
.setPeriodic(86400000)
.build()
.schedule();
}
开发者ID:plusCubed,项目名称:anticipate,代码行数:39,代码来源:App.java
示例14: getPerAppListApps
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
/**
* Returns sorted list of AppInfos.
* <p/>
* AppInfo's drawable and id are null
*/
@NonNull
public static Single<List<AppInfo>> getPerAppListApps(final Context context) {
return Single.create(new Single.OnSubscribe<List<AppInfo>>() {
@Override
public void call(SingleSubscriber<? super List<AppInfo>> singleSubscriber) {
String table = PrefUtils.isBlacklistMode(context) ? TABLE_BLACKLISTED_APPS : TABLE_WHITELISTED_APPS;
AppInfo[] all = Inquiry.get().selectFrom(table, AppInfo.class)
.all();
if (all != null) {
singleSubscriber.onSuccess(new ArrayList<>(Arrays.asList(all)));
} else {
singleSubscriber.onSuccess(new ArrayList<AppInfo>());
}
}
}).subscribeOn(Schedulers.io())
.flatMapObservable(new Func1<List<AppInfo>, Observable<AppInfo>>() {
@Override
public Observable<AppInfo> call(List<AppInfo> appInfos) {
return Observable.from(appInfos);
}
}).flatMap(new Func1<AppInfo, Observable<AppInfo>>() {
@Override
public Observable<AppInfo> call(AppInfo appInfo) {
try {
final ApplicationInfo info = context.getPackageManager().getApplicationInfo(appInfo.packageName, 0);
appInfo.name = info.loadLabel(context.getPackageManager()).toString();
return Observable.just(appInfo);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return Observable.empty();
}
}
}).toSortedList().toSingle();
}
开发者ID:plusCubed,项目名称:anticipate,代码行数:42,代码来源:DbUtil.java
示例15: refresh
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
private void refresh() {
int permission =
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
if (permission != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_RC);
return;
}
//noinspection VisibleForTests
Inquiry.get(this)
.selectFrom(Uri.parse("content://media/external/images/media"), Photo.class)
.sort("datetaken DESC")
.where("_data IS NOT NULL")
.all(
photos -> {
if (isFinishing()) {
return;
}
if (empty != null) {
adapter.setPhotos(photos);
empty.setVisibility(
photos == null || photos.length == 0 ? View.VISIBLE : View.GONE);
if (photos != null && photos.length > 0 && autoSelectFirst) {
adapter.shiftSelections();
adapter.setSelected(1, true);
autoSelectFirst = false;
}
}
});
}
开发者ID:afollestad,项目名称:photo-affix,代码行数:32,代码来源:MainActivity.java
示例16: onReceive
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
Utils.get(context).loadFromPrefs();
if (LAUNCHER_PKG_NAME == null) {
Log.w(TAG, "No compatible launchers installed!");
return;
}
try {
Log.i(TAG, "Broadcast received");
Uri uri = intent.getData();
String packageName = (uri != null) ? uri.getSchemeSpecificPart() : null;
if (packageName == null) return;
Log.i(TAG, "Package name: " + packageName);
Utils.get(context);
Inquiry.newInstance(context, BAK_DATABASE_NAME).databaseVersion(Utils.get(context).getDbVersion()).build();
App backupApp = Inquiry.get(context).selectFrom("icons", App.class).where("componentName NOT LIKE ?", packageName + "%.").one();
Inquiry.destroy(context);
if (backupApp == null) {
Log.d(TAG, "No compatible backup app found with package name " + packageName);
return;
}
Inquiry.newInstance(context, DATABASE_NAME).databaseVersion(Utils.get(context).getDbVersion()).build();
Inquiry.get(context)
.update("icons", App.class)
.where("componentName = ?", backupApp.componentName)
.values(backupApp)
.projection("icon", "icon_low_res")
.run();
Inquiry.destroy(context);
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
am.killBackgroundProcesses(LAUNCHER_PKG_NAME); // Kill launcher
Shell.Builder builder = new Shell.Builder().useSU();
Shell.Interactive shell = builder.open();
shell.addCommand(String.format("cp -r %1$s %2$s", THIS_DB_PATH, mDatabasePath));
Log.i(TAG, packageName + ": icon replaced");
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
开发者ID:DVDAndroid,项目名称:glic,代码行数:55,代码来源:PackageUpdatedReceiver.java
示例17: onPause
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@Override
protected void onPause() {
super.onPause();
if (isFinishing()) Inquiry.destroy(this);
}
开发者ID:DVDAndroid,项目名称:glic,代码行数:7,代码来源:DetailsAppActivity.java
示例18: onCreateOptionsMenu
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.clear();
menuToolbar = menu;
getMenuInflater().inflate(R.menu.action_place, menu);
Bookmarks.init(context);
if (Bookmarks.isBookmarked(item.getId()))
menu.findItem(R.id.bookmark).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_bookmark).paddingDp(1).color(Color.WHITE).sizeDp(24));
else menu.findItem(R.id.bookmark).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_bookmark_border).paddingDp(1).color(Color.WHITE).sizeDp(24));
Inquiry.deinit();
menu.findItem(R.id.launch).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_open_in_browser).paddingDp(1).color(Color.WHITE).actionBar());
menu.findItem(R.id.report).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_bug_report).paddingDp(1).color(Color.WHITE).actionBar());
return true;
}
开发者ID:MaximilianKeppeler,项目名称:Places,代码行数:22,代码来源:PlaceView.java
示例19: bookmark
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
/**
* Bookmark the respective Place. Drawable transition between the bookmark states.
*/
private void bookmark() {
// TODO: Drawable Transition
Bookmarks.init(context);
if (Bookmarks.bookmark(item.getId())) {
Utils.showSnackBar(context, Utils.colorVariant(color, 1.07f), R.id.coordinatorLayout, R.string.bookmarkedPlace, Snackbar.LENGTH_LONG);
menuToolbar.findItem(R.id.bookmark).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_bookmark).paddingDp(1).color(Color.WHITE).sizeDp(24));
}
else {
Utils.showSnackBar(context, Utils.colorVariant(color, 1.07f), R.id.coordinatorLayout, R.string.removedPlace, Snackbar.LENGTH_LONG);
menuToolbar.findItem(R.id.bookmark).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_bookmark_border).paddingDp(1).color(Color.WHITE).sizeDp(24));
}
FragmentBookmarks.loadBookmarks(context);
Inquiry.deinit();
}
开发者ID:MaximilianKeppeler,项目名称:Places,代码行数:25,代码来源:PlaceView.java
示例20: init
import com.afollestad.inquiry.Inquiry; //导入依赖的package包/类
public static void init(Activity ctxt) {
context = ctxt;
Inquiry.init(ctxt, Constants.DATABASE_NAME, Constants.DATABASE_VERSION);
}
开发者ID:MaximilianKeppeler,项目名称:Places,代码行数:5,代码来源:Bookmarks.java
注:本文中的com.afollestad.inquiry.Inquiry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论