mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
parent
219a403f36
commit
155cbf686d
@ -4,11 +4,14 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.preference.PreferenceFragment;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
@ -51,8 +54,9 @@ public class AdvancedPreferenceFragment extends PreferenceFragment {
|
||||
initializePushMessagingToggle();
|
||||
initializeIdentitySelection();
|
||||
|
||||
this.findPreference(SUBMIT_DEBUG_LOG_PREF)
|
||||
.setOnPreferenceClickListener(new SubmitDebugLogListener());
|
||||
Preference submitDebugLog = this.findPreference(SUBMIT_DEBUG_LOG_PREF);
|
||||
submitDebugLog.setOnPreferenceClickListener(new SubmitDebugLogListener());
|
||||
submitDebugLog.setSummary(getVersion(getActivity()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -97,6 +101,20 @@ public class AdvancedPreferenceFragment extends PreferenceFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private @NonNull String getVersion(@Nullable Context context) {
|
||||
try {
|
||||
if (context == null) return "";
|
||||
|
||||
String app = context.getString(R.string.app_name);
|
||||
String version = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
|
||||
|
||||
return String.format("%s %s", app, version);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.w(TAG, e);
|
||||
return context.getString(R.string.app_name);
|
||||
}
|
||||
}
|
||||
|
||||
private class IdentityPreferenceClickListener implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user