mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Merge pull request #2 from LukeStonehm/master
Use 'ActionBarDrawerToggle'
This commit is contained in:
commit
278a358b71
@ -161,4 +161,7 @@
|
|||||||
<string name="findmyphone_title">Find My Phone</string>
|
<string name="findmyphone_title">Find My Phone</string>
|
||||||
<string name="findmyphone_description">Rings this phone so you can find it.</string>
|
<string name="findmyphone_description">Rings this phone so you can find it.</string>
|
||||||
<string name="findmyphone_found">Found</string>
|
<string name="findmyphone_found">Found</string>
|
||||||
|
|
||||||
|
<string name="open">Open</string>
|
||||||
|
<string name="close">Close</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -13,6 +13,7 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -39,6 +40,7 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private NavigationView mNavigationView;
|
private NavigationView mNavigationView;
|
||||||
private DrawerLayout mDrawerLayout;
|
private DrawerLayout mDrawerLayout;
|
||||||
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
|
|
||||||
private String mCurrentDevice;
|
private String mCurrentDevice;
|
||||||
|
|
||||||
@ -57,10 +59,19 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
actionBar.setHomeAsUpIndicator(R.drawable.ic_drawer);
|
|
||||||
|
mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
|
||||||
|
mDrawerLayout, /* DrawerLayout object */
|
||||||
|
R.string.open, /* "open drawer" description */
|
||||||
|
R.string.close /* "close drawer" description */
|
||||||
|
);
|
||||||
|
|
||||||
|
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||||
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
mDrawerToggle.setDrawerIndicatorEnabled(true);
|
||||||
|
mDrawerToggle.syncState();
|
||||||
|
|
||||||
String deviceName = DeviceHelper.getDeviceName(this);
|
String deviceName = DeviceHelper.getDeviceName(this);
|
||||||
TextView nameView = (TextView) mDrawerLayout.findViewById(R.id.device_name);
|
TextView nameView = (TextView) mDrawerLayout.findViewById(R.id.device_name);
|
||||||
@ -232,8 +243,7 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode)
|
switch (requestCode) {
|
||||||
{
|
|
||||||
case RESULT_NEEDS_RELOAD:
|
case RESULT_NEEDS_RELOAD:
|
||||||
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user