mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Created debug menu
This commit is contained in:
parent
ea6ffa6f6e
commit
1ba90958af
@ -13,6 +13,7 @@ import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.communiquons.android.comunic.client.BuildConfig;
|
||||
@ -25,6 +26,7 @@ import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper;
|
||||
import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper;
|
||||
import org.communiquons.android.comunic.client.data.runnables.FriendRefreshLoopRunnable;
|
||||
import org.communiquons.android.comunic.client.data.services.NotificationsService;
|
||||
import org.communiquons.android.comunic.client.data.utils.PreferencesUtils;
|
||||
import org.communiquons.android.comunic.client.ui.fragments.SinglePostFragment;
|
||||
import org.communiquons.android.comunic.client.ui.fragments.UserAccessDeniedFragment;
|
||||
import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener;
|
||||
@ -164,6 +166,13 @@ public class MainActivity extends AppCompatActivity implements openConversationL
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.main_menu, menu);
|
||||
|
||||
//Check if the debug menu has to be shown or not
|
||||
if(PreferencesUtils.getBoolean(this, "enable_debug_mode", false)) {
|
||||
SubMenu debugMenu = menu.addSubMenu(R.string.menu_debug_title);
|
||||
getMenuInflater().inflate(R.menu.debug_menu, debugMenu);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
8
app/src/main/res/menu/debug_menu.xml
Normal file
8
app/src/main/res/menu/debug_menu.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/clear_local_db"
|
||||
android:title="@string/menu_clear_local_db"/>
|
||||
|
||||
</menu>
|
@ -16,7 +16,7 @@
|
||||
<item
|
||||
android:id="@+id/action_logout"
|
||||
android:title="@string/main_menu_logout"
|
||||
android:orderInCategory="100"
|
||||
android:orderInCategory="101"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
@ -178,4 +178,8 @@
|
||||
<string name="notice_no_conversation">You do not have any conversation yet.</string>
|
||||
<string name="notice_no_friend">You do not have any friend yet.</string>
|
||||
<string name="err_get_older_conversation_messages">An error occurred while trying to get older messages for the conversation!</string>
|
||||
<string name="preference_debug_mode_title">Enable debug mode</string>
|
||||
<string name="preference_debug_mode_summary">Enable this option to get access to development / debug features.</string>
|
||||
<string name="menu_debug_title">Debug</string>
|
||||
<string name="menu_clear_local_db">Clear local database</string>
|
||||
</resources>
|
||||
|
@ -8,4 +8,12 @@
|
||||
android:title="@string/preference_background_notif_title"
|
||||
android:summary="@string/preference_background_notif_summary"/>
|
||||
|
||||
|
||||
<!-- Enable and / or disable debug mode -->
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="enable_debug_mode"
|
||||
android:title="@string/preference_debug_mode_title"
|
||||
android:summary="@string/preference_debug_mode_summary" />
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user