Search in sources :

Example 1 with StoragePreferenceCategory

use of org.thoughtcrime.securesms.preferences.widgets.StoragePreferenceCategory in project Signal-Android by WhisperSystems.

the class StoragePreferenceFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle paramBundle) {
    super.onCreate(paramBundle);
    findPreference("pref_storage_clear_message_history").setOnPreferenceClickListener(new ClearMessageHistoryClickListener());
    trimLength = findPreference(SettingsValues.THREAD_TRIM_LENGTH);
    trimLength.setOnPreferenceClickListener(p -> {
        updateToolbarTitle(R.string.preferences__conversation_length_limit);
        pushFragment(BaseSettingsFragment.create(new ConversationLengthLimitConfiguration()));
        return true;
    });
    keepMessages = findPreference(SettingsValues.KEEP_MESSAGES_DURATION);
    keepMessages.setOnPreferenceClickListener(p -> {
        updateToolbarTitle(R.string.preferences__keep_messages);
        pushFragment(BaseSettingsFragment.create(new KeepMessagesConfiguration()));
        return true;
    });
    StoragePreferenceCategory storageCategory = (StoragePreferenceCategory) findPreference("pref_storage_category");
    FragmentActivity activity = requireActivity();
    ApplicationPreferencesViewModel viewModel = ApplicationPreferencesViewModel.getApplicationPreferencesViewModel(activity);
    storageCategory.setOnFreeUpSpace(() -> activity.startActivity(MediaOverviewActivity.forAll(activity)));
    viewModel.getStorageBreakdown().observe(activity, storageCategory::setStorage);
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) StoragePreferenceCategory(org.thoughtcrime.securesms.preferences.widgets.StoragePreferenceCategory)

Example 2 with StoragePreferenceCategory

use of org.thoughtcrime.securesms.preferences.widgets.StoragePreferenceCategory in project Signal-Android by signalapp.

the class StoragePreferenceFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle paramBundle) {
    super.onCreate(paramBundle);
    findPreference("pref_storage_clear_message_history").setOnPreferenceClickListener(new ClearMessageHistoryClickListener());
    trimLength = findPreference(SettingsValues.THREAD_TRIM_LENGTH);
    trimLength.setOnPreferenceClickListener(p -> {
        updateToolbarTitle(R.string.preferences__conversation_length_limit);
        pushFragment(BaseSettingsFragment.create(new ConversationLengthLimitConfiguration()));
        return true;
    });
    keepMessages = findPreference(SettingsValues.KEEP_MESSAGES_DURATION);
    keepMessages.setOnPreferenceClickListener(p -> {
        updateToolbarTitle(R.string.preferences__keep_messages);
        pushFragment(BaseSettingsFragment.create(new KeepMessagesConfiguration()));
        return true;
    });
    StoragePreferenceCategory storageCategory = (StoragePreferenceCategory) findPreference("pref_storage_category");
    FragmentActivity activity = requireActivity();
    ApplicationPreferencesViewModel viewModel = ApplicationPreferencesViewModel.getApplicationPreferencesViewModel(activity);
    storageCategory.setOnFreeUpSpace(() -> activity.startActivity(MediaOverviewActivity.forAll(activity)));
    viewModel.getStorageBreakdown().observe(activity, storageCategory::setStorage);
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) StoragePreferenceCategory(org.thoughtcrime.securesms.preferences.widgets.StoragePreferenceCategory)

Aggregations

FragmentActivity (androidx.fragment.app.FragmentActivity)2 StoragePreferenceCategory (org.thoughtcrime.securesms.preferences.widgets.StoragePreferenceCategory)2