Add content_description to Navigation Drawer options

This commit is contained in:
masensio 2015-05-26 11:46:15 +02:00
parent 101989b70c
commit a9dad9e480
7 changed files with 373 additions and 198 deletions

View file

@ -1,25 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013 The Android Open Source Project
ownCloud Android client application
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Copyright (C) 2015 ownCloud Inc.
http://www.apache.org/licenses/LICENSE-2.0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
as published by the Free Software Foundation.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_textView"
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/itemLayout"
android:layout_width="fill_parent"
android:layout_height="56dp"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#000"
android:textSize="18dp" />
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="horizontal"
android:background="@color/background_color"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/itemTitle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="@color/textColor"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
</LinearLayout>

View file

@ -32,7 +32,7 @@
android:baselineAligned="false"
android:orientation="horizontal" >
<FrameLayout
android:id="@+id/left_fragment_container"
android:layout_width="0dp"
@ -46,51 +46,51 @@
android:layout_weight="2" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/background_color"
android:baselineAligned="false"
android:clickable="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/background_color"
android:baselineAligned="false"
android:clickable="true"
android:orientation="vertical">
<ImageView
android:id="@+id/drawer_userIcon"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/abs__ab_solid_dark_holo" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<ImageView
android:id="@+id/drawer_userIcon"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/abs__ab_solid_dark_holo" />
<TextView
android:id="@+id/drawer_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<TextView
android:id="@+id/drawer_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="@color/list_item_lastmod_and_filesize_text" />
<ListView
android:id="@+id/drawer_list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/background_color"
android:choiceMode="singleChoice"
/>
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="@color/list_item_lastmod_and_filesize_text" />
<ListView
android:id="@+id/drawer_list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/background_color"
android:choiceMode="singleChoice"
/>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
ownCloud Android client application
Copyright (C) 2015 ownCloud Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<!-- Nav Drawer Menu Items -->
<string-array name="drawer_items">
<item>@string/prefs_accounts</item>
<item>@string/drawer_item_all_files</item>
<!--<item>@string/drawer_item_on_device</item>-->
<item>@string/actionbar_settings</item>
<item>@string/actionbar_logger</item>
</string-array>
<!-- Nav Drawer Content Descriptions -->
<string-array name="drawer_content_descriptions">
<item>@string/drawer_item_accounts</item>
<item>@string/drawer_item_all_files</item>
<!--<item>@string/drawer_item_on_device</item>-->
<item>@string/drawer_item_settings</item>
<item>@string/drawer_item_logs</item>
</string-array>
</resources>

View file

@ -20,13 +20,12 @@
<!-- TODO re-enable when server-side folder size calculation is available
<item>Biggest - Smallest</item> -->
</string-array>
<string-array name="drawer_items">
<item>Accounts</item>
<item>All Files</item>
<!--<item>On device</item>-->
<item>Settings</item>
<item>Logs</item>
</string-array>
<string name="drawer_item_accounts">Accounts</string>
<string name="drawer_item_all_files">All files</string>
<!-- TODO re-enable when "On Device" is available
<string name="drawer_item_on_device">On device</string>-->
<string name="drawer_item_settings">Settings</string>
<string name="drawer_item_logs">Logs</string>
<string name="drawer_open">ownCloud</string>
<string name="drawer_close">Close</string>
<string name="prefs_category_general">General</string>

View file

@ -0,0 +1,56 @@
/**
* ownCloud Android client application
*
* @author masensio
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.ui;
public class NavigationDrawerItem {
private String mTitle;
private String mContentDescription;
// Constructors
public NavigationDrawerItem(){}
public NavigationDrawerItem(String title){
mTitle = title;
}
public NavigationDrawerItem(String title, String contentDescription){
mTitle = title;
mContentDescription = contentDescription;
}
// Getters and Setters
public String getTitle() {
return mTitle;
}
public void setTitle(String title) {
this.mTitle = title;
}
public String getContentDescription() {
return mContentDescription;
}
public void setContentDescription(String contentDescription) {
this.mContentDescription = contentDescription;
}
}

View file

@ -23,6 +23,7 @@
package com.owncloud.android.ui.activity;
import java.io.File;
import java.util.ArrayList;
import android.accounts.Account;
import android.accounts.AccountManager;
@ -71,6 +72,7 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.Window;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
@ -99,6 +101,7 @@ import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.NavigationDrawerItem;
import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
@ -161,12 +164,21 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
private static String DIALOG_UPLOAD_SOURCE = "DIALOG_UPLOAD_SOURCE";
private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED";
private NavigationDrawerListAdapter adapter = null;
private OCFile mWaitingToSend;
// Navigation Drawer
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToggle;
private ListView mDrawerList;
// Slide menu items
private String[] mDrawerTitles;
private String[] mDrawerContentDescriptions;
private ArrayList<NavigationDrawerItem> mDrawerItems;
private NavigationDrawerListAdapter mNavigationDrawerAdapter = null;
private boolean mShowAccounts = false;
@Override
@ -199,16 +211,87 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
// Inflate and set the layout view
setContentView(R.layout.files);
// TODO move to another place that all activity can use it
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
// Navigation Drawer
initDrawer();
mDualPane = getResources().getBoolean(R.bool.large_land_layout);
mLeftFragmentContainer = findViewById(R.id.left_fragment_container);
mRightFragmentContainer = findViewById(R.id.right_fragment_container);
if (savedInstanceState == null) {
createMinFragments();
}
// Action bar setup
mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
getSupportActionBar().setDisplayShowCustomEnabled(true); // CRUCIAL - for displaying your custom actionbar
getSupportActionBar().setDisplayShowTitleEnabled(true);
setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); // always AFTER setContentView(...) ; to work around bug in its implementation
// TODO Remove??, it is done in onPostCreate
mDrawerToggle.syncState();
setBackgroundText();
Log_OC.v(TAG, "onCreate() end");
}
private void initDrawer(){
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
// Notification Drawer
LinearLayout navigationDrawerLayout = (LinearLayout) findViewById(R.id.left_drawer);
mDrawerList = (ListView) navigationDrawerLayout.findViewById(R.id.drawer_list);
// load Account in the Drawer Title
// User-Icon
ImageView userIcon = (ImageView) navigationDrawerLayout.findViewById(R.id.drawer_userIcon);
userIcon.setImageResource(DisplayUtils.getSeasonalIconId());
// Username
TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username);
Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
if (account != null) {
int lastAtPos = account.name.lastIndexOf("@");
username.setText(account.name.substring(0, lastAtPos));
}
// load slide menu items
mDrawerTitles = getResources().getStringArray(R.array.drawer_items);
// nav drawer content description from resources
mDrawerContentDescriptions = getResources().
getStringArray(R.array.drawer_content_descriptions);
// nav drawer items
mDrawerItems = new ArrayList<NavigationDrawerItem>();
// adding nav drawer items to array
// Accounts
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0], mDrawerContentDescriptions[0]));
// All Files
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[1], mDrawerContentDescriptions[1]));
// TODO Enable when "On Device" is recovered
// On Device
// mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[2], mDrawerContentDescriptions[2]));
// Settings
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[2], mDrawerContentDescriptions[2]));
// Logs
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[3],mDrawerContentDescriptions[3]));
// setting the nav drawer list adapter
mNavigationDrawerAdapter = new NavigationDrawerListAdapter(getApplicationContext(), this,
mDrawerItems);
mDrawerList.setAdapter(mNavigationDrawerAdapter);
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
R.drawable.ic_drawer,
R.string.drawer_open,
R.string.empty
) {
this,
mDrawerLayout,
R.drawable.ic_drawer,
R.string.drawer_open,
R.string.empty) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
@ -227,96 +310,15 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
invalidateOptionsMenu();
}
};
mDrawerToggle.setDrawerIndicatorEnabled(true);
// Notification Drawer
LinearLayout notificatonDrawer = (LinearLayout) findViewById(R.id.left_drawer);
// ListView
ListView listView = (ListView) notificatonDrawer.findViewById(R.id.drawer_list);
adapter = new NavigationDrawerListAdapter(getApplicationContext(), this);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mShowAccounts && position > 0){
position = position - 1;
}
switch (position){
case 0: // Accounts
mShowAccounts = !mShowAccounts;
adapter.setShowAccounts(mShowAccounts);
adapter.notifyDataSetChanged();
break;
case 1: // All Files
// TODO Enable when "On Device" is recovered ?
//MainApp.showOnlyFilesOnDevice(false);
mDrawerLayout.closeDrawers();
break;
// TODO Enable when "On Device" is recovered ?
// case 2:
// MainApp.showOnlyFilesOnDevice(true);
// mDrawerLayout.closeDrawers();
// break;
case 2: // Settings
Intent settingsIntent = new Intent(getApplicationContext(),
Preferences.class);
startActivity(settingsIntent);
break;
case 3: // Logs
Intent loggerIntent = new Intent(getApplicationContext(),
LogHistoryActivity.class);
startActivity(loggerIntent);
break;
}
}
});
// User-Icon
ImageView userIcon = (ImageView) notificatonDrawer.findViewById(R.id.drawer_userIcon);
userIcon.setImageResource(DisplayUtils.getSeasonalIconId());
// Username
TextView username = (TextView) notificatonDrawer.findViewById(R.id.drawer_username);
Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
if (account != null) {
int lastAtPos = account.name.lastIndexOf("@");
username.setText(account.name.substring(0, lastAtPos));
}
// Set the list's click listener
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
// Set the drawer toggle as the DrawerListener
mDrawerLayout.setDrawerListener(mDrawerToggle);
mDualPane = getResources().getBoolean(R.bool.large_land_layout);
mLeftFragmentContainer = findViewById(R.id.left_fragment_container);
mRightFragmentContainer = findViewById(R.id.right_fragment_container);
if (savedInstanceState == null) {
createMinFragments();
}
// Action bar setup
mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
getSupportActionBar().setDisplayShowCustomEnabled(true); // CRUCIAL - for displaying your custom actionbar
getSupportActionBar().setDisplayShowTitleEnabled(true);
setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); // always AFTER setContentView(...) ; to work around bug in its implementation
mDrawerToggle.syncState();
setBackgroundText();
Log_OC.v(TAG, "onCreate() end");
}
@Override
protected void onStart() {
Log_OC.v(TAG, "onStart() start");
@ -636,19 +638,16 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
builder.setTitle(R.string.actionbar_sort_title)
.setSingleChoiceItems(R.array.actionbar_sortby, sortOrder , new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
switch (which){
case 0:
sortByName(true);
break;
case 1:
sortByDate(false);
break;
case 0:
sortByName(true);
break;
case 1:
sortByDate(false);
break;
}
dialog.dismiss();
}
});
builder.create().show();
@ -908,7 +907,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
super.onResume();
// refresh Navigation Drawer account list
adapter.updateAccountList();
mNavigationDrawerAdapter.updateAccountList();
// refresh list of files
refreshListOfFilesFragment();
@ -1907,4 +1906,43 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
mDrawerLayout.closeDrawers();
}
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mShowAccounts && position > 0){
position = position - 1;
}
switch (position){
case 0: // Accounts
mShowAccounts = !mShowAccounts;
mNavigationDrawerAdapter.setShowAccounts(mShowAccounts);
mNavigationDrawerAdapter.notifyDataSetChanged();
break;
case 1: // All Files
// TODO Enable when "On Device" is recovered ?
//MainApp.showOnlyFilesOnDevice(false);
mDrawerLayout.closeDrawers();
break;
// TODO Enable when "On Device" is recovered ?
// case 2:
// MainApp.showOnlyFilesOnDevice(true);
// mDrawerLayout.closeDrawers();
// break;
case 2: // Settings
Intent settingsIntent = new Intent(getApplicationContext(),
Preferences.class);
startActivity(settingsIntent);
break;
case 3: // Logs
Intent loggerIntent = new Intent(getApplicationContext(),
LogHistoryActivity.class);
startActivity(loggerIntent);
break;
}
}
}
}

View file

@ -1,3 +1,24 @@
/**
* ownCloud Android client application
*
* @author tobiasKaminsky
* @author masensio
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.ui.adapter;
import java.nio.ByteBuffer;
@ -12,6 +33,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.LayoutParams;
@ -21,46 +43,47 @@ import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.NavigationDrawerItem;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.BitmapUtils;
public class NavigationDrawerListAdapter extends BaseAdapter {
private final static String TAG = "NavigationDrawerListAdapter";
private final static String TAG = NavigationDrawerListAdapter.class.getSimpleName();
private Context mContext;
private ArrayList<String> mDrawerItems = new ArrayList<String>();
ArrayList<Object> all = new ArrayList<Object>();
private ArrayList<NavigationDrawerItem> mNavigationDrawerItems;
private ArrayList<Object> mAll = new ArrayList<Object>();
private Account[] mAccounts;
private boolean mShowAccounts;
private Account currentAccount;
private Account mCurrentAccount;
private FileDisplayActivity mFileDisplayActivity;
public NavigationDrawerListAdapter(Context context, FileDisplayActivity fileDisplayActivity){
public NavigationDrawerListAdapter(Context context, FileDisplayActivity fileDisplayActivity,
ArrayList<NavigationDrawerItem> navigationDrawerItems){
mFileDisplayActivity = fileDisplayActivity;
mContext = context;
for (String string : mContext.getResources().getStringArray(R.array.drawer_items)) {
mDrawerItems.add(string);
}
mNavigationDrawerItems = navigationDrawerItems;
updateAccountList();
all.addAll(mDrawerItems);
mAll.addAll(mNavigationDrawerItems);
}
public void updateAccountList(){
AccountManager am = (AccountManager) mContext.getSystemService(mContext.ACCOUNT_SERVICE);
mAccounts = am.getAccountsByType(MainApp.getAccountType());
currentAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
mCurrentAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
}
@Override
public int getCount() {
if (mShowAccounts){
return mDrawerItems.size() + 1;
return mNavigationDrawerItems.size() + 1;
} else {
return mDrawerItems.size();
return mNavigationDrawerItems.size();
}
}
@ -81,21 +104,23 @@ public class NavigationDrawerListAdapter extends BaseAdapter {
LayoutInflater inflator = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (all.size() > position) {
if (mAll.size() > position) {
// Normal entry
if (all.get(position) instanceof String){
if (mAll.get(position) instanceof NavigationDrawerItem){
NavigationDrawerItem navItem = (NavigationDrawerItem) mAll.get(position);
View view = inflator.inflate(R.layout.drawer_list_item, null);
view.setMinimumHeight(40);
TextView textView = (TextView) view.findViewById(R.id.drawer_textView);
String entry = (String) all.get(position);
textView.setText(entry);
LinearLayout itemLayout = (LinearLayout) view.findViewById(R.id.itemLayout);
itemLayout.setContentDescription(navItem.getContentDescription());
TextView itemText = (TextView) view.findViewById(R.id.itemTitle);
itemText.setText(navItem.getTitle());
return view;
}
// Account
if (all.get(position) instanceof Account[]){
if (mAll.get(position) instanceof Account[]){
final View view = inflator.inflate(R.layout.drawer_account_group, null);
final RadioGroup group = (RadioGroup) view.findViewById(R.id.drawer_radio_group);
@ -103,6 +128,7 @@ public class NavigationDrawerListAdapter extends BaseAdapter {
for (Account account : mAccounts) {
RadioButton rb = new RadioButton(mContext);
rb.setText(account.name);
rb.setContentDescription(account.name);
try {
byte[] bytesOfMessage = account.name.substring(0,5).getBytes("UTF-8");
@ -132,7 +158,7 @@ public class NavigationDrawerListAdapter extends BaseAdapter {
params.setMargins(15, 5, 5, 5);
// Check the current account that is being used
if (account.name.equals(currentAccount.name)) {
if (account.name.equals(mCurrentAccount.name)) {
rb.setChecked(true);
} else {
rb.setChecked(false);
@ -163,11 +189,11 @@ public class NavigationDrawerListAdapter extends BaseAdapter {
// TODO update Account List after creating a new account and on fresh installation
public void setShowAccounts(boolean value){
all.clear();
all.addAll(mDrawerItems);
mAll.clear();
mAll.addAll(mNavigationDrawerItems);
if (value){
all.add(1, mAccounts);
mAll.add(1, mAccounts);
}
mShowAccounts = value;
}