mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
backward compatible navigation drawer toggle // FREEBIE
This commit is contained in:
parent
6157a0df7a
commit
ed3151bdb5
@ -82,7 +82,7 @@
|
||||
|
||||
<!-- ConversationListAdapter -->
|
||||
<string name="ConversationListAdapter_key_exchange_message">Key exchange message...</string>
|
||||
|
||||
|
||||
<!-- ConversationListFragment -->
|
||||
<string name="ConversationListFragment_delete_threads_question">Delete threads?</string>
|
||||
<string name="ConversationListFragment_are_you_sure_you_wish_to_delete_all_selected_conversation_threads">Are you sure you wish to delete ALL selected conversation threads?</string>
|
||||
@ -686,6 +686,8 @@
|
||||
|
||||
<!-- conversation_list -->
|
||||
<string name="conversation_list__menu_search">Search</string>
|
||||
<string name="conversation_list__drawer_open">Open navigation drawer</string>
|
||||
<string name="conversation_list__drawer_close">Close navigation drawer</string>
|
||||
|
||||
<!-- conversation_secure_verified -->
|
||||
<string name="conversation_secure_verified__menu_security">Security</string>
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.ContentObserver;
|
||||
@ -8,6 +9,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.Telephony;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.util.Log;
|
||||
@ -51,6 +53,7 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
||||
private ConversationListFragment fragment;
|
||||
private MasterSecret masterSecret;
|
||||
private DrawerLayout drawerLayout;
|
||||
private DrawerToggle drawerToggle;
|
||||
private ListView drawerList;
|
||||
|
||||
@Override
|
||||
@ -71,6 +74,12 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
||||
DirectoryRefreshListener.schedule(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostCreate(Bundle bundle) {
|
||||
super.onPostCreate(bundle);
|
||||
drawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@ -217,6 +226,13 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
||||
}
|
||||
|
||||
DrawerLayout drawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
|
||||
drawerToggle = new DrawerToggle(this, drawerLayout,
|
||||
R.drawable.ic_drawer,
|
||||
R.string.conversation_list__drawer_open,
|
||||
R.string.conversation_list__drawer_close);
|
||||
|
||||
drawerLayout.setDrawerListener(drawerToggle);
|
||||
|
||||
ListView drawer = (ListView)findViewById(R.id.left_drawer);
|
||||
SimpleAdapter adapter = new SimpleAdapter(this, items, R.layout.navigation_drawer_item, from, to);
|
||||
|
||||
@ -274,4 +290,31 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
class DrawerToggle extends ActionBarDrawerToggle {
|
||||
|
||||
public DrawerToggle(Activity activity, DrawerLayout drawerLayout,
|
||||
int drawerImageRes, int openDrawerContentDescRes,
|
||||
int closeDrawerContentDescRes) {
|
||||
|
||||
super(activity, drawerLayout, drawerImageRes,
|
||||
openDrawerContentDescRes, closeDrawerContentDescRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerClosed(View drawerView) {
|
||||
|
||||
super.onDrawerClosed(drawerView);
|
||||
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
|
||||
super.onDrawerOpened(drawerView);
|
||||
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user