Add reset log button

This commit is contained in:
Margaux Clerc 2015-02-19 16:19:02 +01:00
parent 377e39175b
commit 589ab3b674
3 changed files with 21 additions and 4 deletions

View file

@ -62,7 +62,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/menu_send_log"/> android:text="@string/menu_send_log"/>
<Button android:id="@+id/exit" <Button
android:id="@+id/reset_log"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_reset_log"
/>
<Button android:id="@+id/exit"
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -149,6 +149,7 @@
<string name="about_mailer_chooser_text">Send bug report with…</string> <string name="about_mailer_chooser_text">Send bug report with…</string>
<string name="menu_about">About</string> <string name="menu_about">About</string>
<string name="menu_send_log">Send log</string> <string name="menu_send_log">Send log</string>
<string name="menu_reset_log">Reset log</string>
<string name="pref_audio">Audio</string> <string name="pref_audio">Audio</string>
<string name="menu_exit">Exit</string> <string name="menu_exit">Exit</string>
<string name="pref_prefix">Prefix</string> <string name="pref_prefix">Prefix</string>

View file

@ -40,6 +40,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
private FragmentsAvailable about = FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT; private FragmentsAvailable about = FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT;
View exitButton = null; View exitButton = null;
View sendLogButton = null; View sendLogButton = null;
View resetLogButton = null;
private LinphoneCoreListenerBase mListener; private LinphoneCoreListenerBase mListener;
@Override @Override
@ -61,6 +62,10 @@ public class AboutFragment extends Fragment implements OnClickListener {
sendLogButton.setOnClickListener(this); sendLogButton.setOnClickListener(this);
sendLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); sendLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
resetLogButton = view.findViewById(R.id.reset_log);
resetLogButton.setOnClickListener(this);
resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
exitButton = view.findViewById(R.id.exit); exitButton = view.findViewById(R.id.exit);
exitButton.setOnClickListener(this); exitButton.setOnClickListener(this);
exitButton.setVisibility(View.VISIBLE); exitButton.setVisibility(View.VISIBLE);
@ -118,12 +123,16 @@ public class AboutFragment extends Fragment implements OnClickListener {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (v == sendLogButton) { if (v == sendLogButton) {
//LinphoneUtils.collectLogs(LinphoneActivity.instance(), getString(R.string.about_bugreport_email)); //LinphoneUtils.collectLogs(LinphoneActivity.instance(), getString(R.string.about_bugreport_email));
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.uploadLogCollection(); lc.uploadLogCollection();
} }
} else if (v == resetLogButton) {
if (lc != null) {
lc.resetLogCollection();
}
} else { } else {
LinphoneActivity.instance().exit(); LinphoneActivity.instance().exit();
} }