Java Code Examples for com.orhanobut.hawk.Hawk#get()

The following examples show how to use com.orhanobut.hawk.Hawk#get() . 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: FirebaseDatabaseHelper.java    From Duolingo-Clone with MIT License 6 votes vote down vote up
@Override
public void setLessonComplete(String lesson, boolean completeness) {

    if (Injection.providesAuthHelper().getAuthInstance().getCurrentUser() != null) {

        String userID = Injection.providesAuthHelper().getAuthInstance().getCurrentUser().getUid();

        String language = Hawk.get("currentLanguage");

        myRef.child("user")
                .child(userID)
                .child("course")
                .child(language)
                .child("lessons")
                .child(lesson)
                .setValue(completeness)
                .addOnSuccessListener(new OnSuccessListener<Void>() {
                    @Override
                    public void onSuccess(Void aVoid) {

                        Log.d(TAG, "User has completed this lesson");
                    }
                });
    }
}
 
Example 2
Source File: ThemedActivity.java    From Liz with GNU General Public License v3.0 5 votes vote down vote up
public void updateTheme(){
    themeHelper.updateTheme();
    coloredNavBar = Hawk.get(getString(R.string.preference_colored_nav_bar), false);
    obscuredStatusBar = Hawk.get(getString(R.string.preference_translucent_status_bar), true);
    applyThemeSingleImgAct = Hawk.get("apply_theme_img_act", true);
    customIconColor = Hawk.get(getString(R.string.preference_custom_icon_color), false);
}
 
Example 3
Source File: AudioRecordService.java    From Android-AudioRecorder-App with Apache License 2.0 5 votes vote down vote up
private void startRecording() {
  boolean prefHighQuality =
      Hawk.get(getApplicationContext().getString(R.string.pref_high_quality_key), false);
  audioRecorder.startRecord(
      prefHighQuality ? Constants.RECORDER_SAMPLE_RATE_HIGH : Constants.RECORDER_SAMPLE_RATE_LOW);
  handler.startDbmThread();
  audioRecorder.subscribeTimer(this::updateNotification);
}
 
Example 4
Source File: HawkKeyValueStorage.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
public boolean isWalkthroughPassed() {
    return Hawk.get(WALKTHROUGH_PASSED_KEY, false);
}
 
Example 5
Source File: PreferenceUtils.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
public static boolean isWalkthroughPassed() {
    return Hawk.get(WALKTHROUGH_PASSED_KEY, false);
}
 
Example 6
Source File: HawkKeyValueStorage.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isWalkthroughPassed() {
    return Hawk.get(WALKTHROUGH_PASSED_KEY, false);
}
 
Example 7
Source File: Benchmark.java    From Iron with Apache License 2.0 4 votes vote down vote up
@Override
public void run(int i, List<Person> extra) {
    String key = "contacts" + i;
    Hawk.<List<Person>>get(key);
}
 
Example 8
Source File: ThemeHelper.java    From Liz with GNU General Public License v3.0 4 votes vote down vote up
public static int getAccentColor(Context context) {
	return Hawk.get(context.getString(R.string.preference_accent_color),
			ContextCompat.getColor(context, R.color.md_light_blue_500));
}
 
Example 9
Source File: PreferenceUtils.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
public static boolean isWalkthroughPassed() {
    return Hawk.get(WALKTHROUGH_PASSED_KEY, false);
}
 
Example 10
Source File: LessonCompletedActivity.java    From Duolingo-Clone with MIT License 4 votes vote down vote up
private void setupWeekBar() {

        if (Hawk.get("mondayXp") != null) {
            mondayProgress = (int) Hawk.get("mondayXp");
        } else {
            mondayProgress = 0;
        }
        if (Hawk.get("tuesdayXp") != null) {
            tuesdayProgress = (int) Hawk.get("tuesdayXp");
        } else {
            tuesdayProgress = 0;
        }
        if (Hawk.get("wednesdayXp") != null) {
            wednesdayProgress = (int) Hawk.get("wednesdayXp");
        } else {
            wednesdayProgress = 0;
        }
        if (Hawk.get("thursdayXp") != null) {
            thursdayProgress = (int) Hawk.get("thursdayXp");
        } else {
            thursdayProgress = 0;
        }
        if (Hawk.get("fridayXp") != null) {
            fridayProgress = (int) Hawk.get("fridayXp");
        } else {
            fridayProgress = 0;
        }
        if (Hawk.get("saturdayXp") != null) {
            saturdayProgress = (int) Hawk.get("saturdayXp");
        } else {
            saturdayProgress = 0;
        }
        if (Hawk.get("sundayXp") != null) {
            sundayProgress = (int) Hawk.get("sundayXp");
        } else {
            sundayProgress = 0;
        }

        mondayBar.setProgress(mondayProgress);
        tuesdayBar.setProgress(tuesdayProgress);
        wednesdayBar.setProgress(wednesdayProgress);
        thursdayBar.setProgress(thursdayProgress);
        fridayBar.setProgress(fridayProgress);
        saturdayBar.setProgress(saturdayProgress);
        sundayBar.setProgress(sundayProgress);

        mondayBar.setMax(dailyGoal);
        tuesdayBar.setMax(dailyGoal);
        wednesdayBar.setMax(dailyGoal);
        thursdayBar.setMax(dailyGoal);
        fridayBar.setMax(dailyGoal);
        saturdayBar.setMax(dailyGoal);
        sundayBar.setMax(dailyGoal);
    }
 
Example 11
Source File: ThemeHelper.java    From Android-AudioRecorder-App with Apache License 2.0 4 votes vote down vote up
public static int getPrimaryColor(Context context) {
  return Hawk.get(context.getString(R.string.preference_primary_color),
      ContextCompat.getColor(context, R.color.md_indigo_500));
}
 
Example 12
Source File: Benchmark.java    From Paper with Apache License 2.0 4 votes vote down vote up
@Override
public void run(int i, List<Person> extra) {
    String key = "contacts" + i;
    Hawk.put(key, extra);
    Hawk.<List<Person>>get(key);
}
 
Example 13
Source File: Security.java    From leafpicrevived with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isPasswordOnDelete() {
    return Hawk.get("password_hash", null) != null && Hawk.get("password_on_delete", false);
}
 
Example 14
Source File: HawkKeyValueStorage.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isWalkthroughPassed() {
    return Hawk.get(WALKTHROUGH_PASSED_KEY, false);
}
 
Example 15
Source File: ThemeHelper.java    From Android-AudioRecorder-App with Apache License 2.0 4 votes vote down vote up
public static int getAccentColor(Context context) {
  return Hawk.get(context.getString(R.string.preference_accent_color),
      ContextCompat.getColor(context, R.color.md_light_blue_500));
}
 
Example 16
Source File: Security.java    From leafpicrevived with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isPasswordSet() {
    return Hawk.get("password_hash", null) != null;
}
 
Example 17
Source File: AlbumsHelper.java    From leafpicrevived with GNU General Public License v3.0 4 votes vote down vote up
public static ArrayList<String> getLastHiddenPaths() {
    return Hawk.get("h", new ArrayList<>());
}
 
Example 18
Source File: StorageHelper.java    From leafpicrevived with GNU General Public License v3.0 4 votes vote down vote up
private static String getSavedSdcardPath(Context context) {
    return Hawk.get("sd_card_path", null);
}
 
Example 19
Source File: UserStorage.java    From mvvm-starter with MIT License 4 votes vote down vote up
@Override
public Maybe<User> get (Integer id)
{
    User user = isCacheValid() ? Hawk.get(String.format(K.USER_DETAIL, id), new User(0, "", "")) : null;
    return user == null ? Maybe.<User>empty() : Maybe.just(user).subscribeOn(Schedulers.io());
}
 
Example 20
Source File: WordTaskActivity.java    From Duolingo-Clone with MIT License 3 votes vote down vote up
private void initData() {

        checkButton.setEnabled(false);

        repository = Injection.provideRepository();

        answers = repository.getAnswer();
        questionModel = repository.getRandomQuestionObj();

        Hawk.init(this).build();

        progressBarValue = 0;

        if (Hawk.get("progressBarValue") != null) {

            progressBarValue = Hawk.get("progressBarValue");

            progressBar.setProgress(progressBarValue);
        }

        tvQuestion.setText(questionModel.getQuestion());

        randomizeCustomWords();

        activityNavigation = ActivityNavigation.getInstance(this);

        checkAnswer();
    }