net.bither.bitherj.ISetting Java Examples

The following examples show how to use net.bither.bitherj.ISetting. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DesktopImplAbstractApp.java    From bither-desktop-java with Apache License 2.0 4 votes vote down vote up
@Override
public ISetting initSetting() {
    return new ISetting() {
        @Override
        public BitherjSettings.AppMode getAppMode() {
            return UserPreference.getInstance().getAppMode();
        }

        @Override
        public boolean getBitherjDoneSyncFromSpv() {
            return UserPreference.getInstance().getBitherjDoneSyncFromSpv();
        }

        @Override
        public void setBitherjDoneSyncFromSpv(boolean isDone) {
            UserPreference.getInstance().setBitherjDoneSyncFromSpv(isDone);
        }

        @Override
        public boolean getDownloadSpvFinish() {
            return UserPreference.getInstance().getDownloadSpvFinish();
        }

        @Override
        public void setDownloadSpvFinish(boolean finish) {
            UserPreference.getInstance().setDownloadSpvFinish(finish);

        }

        @Override
        public BitherjSettings.TransactionFeeMode getTransactionFeeMode() {
            return UserPreference.getInstance().getTransactionFeeMode();
        }

        @Override
        public File getPrivateDir(String dirName) {
            File file = new File(new ApplicationDataDirectoryLocator().getApplicationDataDirectory() + File.separator + dirName);
            if (!file.exists()) {
                file.mkdirs();
            }
            return file;
        }

        @Override
        public boolean isApplicationRunInForeground() {

            return true;
        }

        @Override
        public CookieStore getCookieStore() {
            return PersistentCookieStore.getInstance();
        }

        @Override
        public QRCodeUtil.QRQuality getQRQuality() {
            return UserPreference.getInstance().getQRQuality();
        }
    };
}
 
Example #2
Source File: AndroidImplAbstractApp.java    From bither-android with Apache License 2.0 4 votes vote down vote up
@Override
public ISetting initSetting() {
    return new ISetting() {
        @Override
        public BitherjSettings.AppMode getAppMode() {
            return AppSharedPreference.getInstance().getAppMode();
        }

        @Override
        public boolean getBitherjDoneSyncFromSpv() {
            return AppSharedPreference.getInstance().getBitherjDoneSyncFromSpv();
        }

        @Override
        public void setBitherjDoneSyncFromSpv(boolean isDone) {
            AppSharedPreference.getInstance().setBitherjDoneSyncFromSpv(isDone);
        }

        @Override
        public BitherjSettings.TransactionFeeMode getTransactionFeeMode() {
            return AppSharedPreference.getInstance().getTransactionFeeMode();
        }

        @Override
        public BitherjSettings.ApiConfig getApiConfig() {
            return AppSharedPreference.getInstance().getApiConfig();
        }

        @Override
        public File getPrivateDir(String dirName) {
            File file = BitherApplication.mContext.getDir(dirName, Context.MODE_PRIVATE);
            if (!file.exists()) {
                file.mkdirs();
            }
            return file;
        }

        @Override
        public boolean isApplicationRunInForeground() {
            if (BitherApplication.mContext == null) {
                return false;
            }
            ActivityManager am = (ActivityManager) BitherApplication.mContext
                    .getSystemService(Context.ACTIVITY_SERVICE);
            List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1);
            if (tasks != null && !tasks.isEmpty()) {
                ComponentName topActivity = tasks.get(0).topActivity;
                if (!topActivity.getPackageName().equals(BitherApplication.mContext.getPackageName())) {
                    return false;
                }
                if (topActivity.getClassName().equals(AdActivity.class.getName())) {
                    return false;
                }
            }
            return true;
        }

        @Override
        public QRCodeUtil.QRQuality getQRQuality() {
            return AppSharedPreference.getInstance().getQRQuality();
        }

        @Override
        public boolean getDownloadSpvFinish() {
            return AppSharedPreference.getInstance().getDownloadSpvFinish();
        }

        @Override
        public void setDownloadSpvFinish(boolean finish) {
            AppSharedPreference.getInstance().setDownloadSpvFinish(finish);
        }

        @Override
        public CookieStore getCookieStore() {
            return PersistentCookieStore.getInstance();
        }


        
    };
}
 
Example #3
Source File: TestImplAbstractApp.java    From bitherj with Apache License 2.0 4 votes vote down vote up
@Override
public ISetting initSetting() {
    return new ISetting() {
        @Override
        public BitherjSettings.AppMode getAppMode() {
            return BitherjSettings.AppMode.HOT;
        }

        @Override
        public boolean getBitherjDoneSyncFromSpv() {
            return true;
        }

        @Override
        public void setBitherjDoneSyncFromSpv(boolean isDone) {
            // AppSharedPreference.getInstance().setBitherjDoneSyncFromSpv(isDone);
        }

        @Override
        public BitherjSettings.TransactionFeeMode getTransactionFeeMode() {
            return BitherjSettings.TransactionFeeMode.Low;
        }

        @Override
        public File getPrivateDir(String dirName) {
            File file = new File("test/wallet");
            if (!file.exists()) {
                file.mkdirs();
            }
            return file;
        }

        @Override
        public boolean isApplicationRunInForeground() {

            return true;
        }

        @Override
        public QRCodeUtil.QRQuality getQRQuality() {
            return QRCodeUtil.QRQuality.Normal;
        }

        @Override
        public boolean getDownloadSpvFinish() {
            return true;
        }

        @Override
        public void setDownloadSpvFinish(boolean finish) {
            // AppSharedPreference.getInstance().setDownloadSpvFinish(finish);
        }

        @Override
        public CookieStore getCookieStore() {
            return cookieStore;
        }


    };
}
 
Example #4
Source File: DesktopImplAbstractApp.java    From bither-desktop-java with Apache License 2.0 4 votes vote down vote up
@Override
public ISetting initSetting() {
    return new ISetting() {
        @Override
        public BitherjSettings.AppMode getAppMode() {
            return UserPreference.getInstance().getAppMode();
        }

        @Override
        public boolean getBitherjDoneSyncFromSpv() {
            return UserPreference.getInstance().getBitherjDoneSyncFromSpv();
        }

        @Override
        public void setBitherjDoneSyncFromSpv(boolean isDone) {
            UserPreference.getInstance().setBitherjDoneSyncFromSpv(isDone);
        }

        @Override
        public boolean getDownloadSpvFinish() {
            return UserPreference.getInstance().getDownloadSpvFinish();
        }

        @Override
        public void setDownloadSpvFinish(boolean finish) {
            UserPreference.getInstance().setDownloadSpvFinish(finish);

        }

        @Override
        public BitherjSettings.TransactionFeeMode getTransactionFeeMode() {
            return UserPreference.getInstance().getTransactionFeeMode();
        }

        @Override
        public File getPrivateDir(String dirName) {
            File file = new File(new ApplicationDataDirectoryLocator().getApplicationDataDirectory() + File.separator + dirName);
            if (!file.exists()) {
                file.mkdirs();
            }
            return file;
        }

        @Override
        public boolean isApplicationRunInForeground() {

            return true;
        }

        @Override
        public CookieStore getCookieStore() {
            return PersistentCookieStore.getInstance();
        }

        @Override
        public QRCodeUtil.QRQuality getQRQuality() {
            return UserPreference.getInstance().getQRQuality();
        }
    };
}