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

@ -61,13 +61,20 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_exit"/>
</LinearLayout>
</LinearLayout>

View file

@ -149,6 +149,7 @@
<string name="about_mailer_chooser_text">Send bug report with…</string>
<string name="menu_about">About</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="menu_exit">Exit</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;
View exitButton = null;
View sendLogButton = null;
View resetLogButton = null;
private LinphoneCoreListenerBase mListener;
@Override
@ -61,6 +62,10 @@ public class AboutFragment extends Fragment implements OnClickListener {
sendLogButton.setOnClickListener(this);
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.setOnClickListener(this);
exitButton.setVisibility(View.VISIBLE);
@ -118,12 +123,16 @@ public class AboutFragment extends Fragment implements OnClickListener {
@Override
public void onClick(View v) {
if (LinphoneActivity.isInstanciated()) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (v == sendLogButton) {
//LinphoneUtils.collectLogs(LinphoneActivity.instance(), getString(R.string.about_bugreport_email));
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.uploadLogCollection();
}
} else if (v == resetLogButton) {
if (lc != null) {
lc.resetLogCollection();
}
} else {
LinphoneActivity.instance().exit();
}