Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
c77acef0
Commit
c77acef0
authored
May 22, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First very unstable implementation of tablet design.
parent
69ae3543
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
213 additions
and
47 deletions
+213
-47
ChatViewer.java
app/src/main/java/com/xabber/android/ui/ChatViewer.java
+7
-3
ContactList.java
app/src/main/java/com/xabber/android/ui/ContactList.java
+50
-35
MainBasicActivity.java
...rc/main/java/com/xabber/android/ui/MainBasicActivity.java
+57
-0
RecentChatFragment.java
...c/main/java/com/xabber/android/ui/RecentChatFragment.java
+11
-6
ChatScroller.java
.../main/java/com/xabber/android/ui/helper/ChatScroller.java
+3
-3
contact_list.xml
app/src/main/res/layout-w820dp/contact_list.xml
+85
-0
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewer.java
View file @
c77acef0
...
...
@@ -34,7 +34,6 @@ import com.xabber.android.data.intent.EntityIntentBuilder;
import
com.xabber.android.data.message.OnChatChangedListener
;
import
com.xabber.android.data.roster.OnContactChangedListener
;
import
com.xabber.android.ui.helper.ChatScroller
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.android.ui.helper.StatusBarPainter
;
/**
...
...
@@ -43,7 +42,7 @@ import com.xabber.android.ui.helper.StatusBarPainter;
*
* @author alexander.ivanov
*/
public
class
ChatViewer
extends
Ma
naged
Activity
implements
ChatScroller
.
ChatScrollerListener
,
ChatScroller
.
ChatScrollerProvider
{
public
class
ChatViewer
extends
Ma
inBasic
Activity
implements
ChatScroller
.
ChatScrollerListener
,
ChatScroller
.
ChatScrollerProvider
{
/**
* Attention request.
...
...
@@ -150,6 +149,11 @@ public class ChatViewer extends ManagedActivity implements ChatScroller.ChatScro
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
if
(
findViewById
(
R
.
id
.
chat_container
)
!=
null
)
{
finish
();
return
;
}
if
(
isFinishing
())
{
return
;
}
...
...
@@ -302,7 +306,7 @@ public class ChatViewer extends ManagedActivity implements ChatScroller.ChatScro
}
@Override
public
void
on
AccountSelected
(
String
account
)
{
public
void
on
StatusBarNeedPaint
(
String
account
)
{
if
(
account
==
null
)
{
statusBarPainter
.
updateWithDefaultColor
();
}
else
{
...
...
app/src/main/java/com/xabber/android/ui/ContactList.java
View file @
c77acef0
...
...
@@ -27,9 +27,8 @@ import android.os.Bundle;
import
android.os.Handler
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.view.MenuItemCompat
;
import
android.support.v4.
widget.DrawerLayout
;
import
android.support.v4.
view.ViewPager
;
import
android.support.v7.app.ActionBarDrawerToggle
;
import
android.support.v7.widget.Toolbar
;
import
android.view.ContextMenu
;
import
android.view.ContextMenu.ContextMenuInfo
;
import
android.view.Gravity
;
...
...
@@ -37,6 +36,7 @@ import android.view.Menu;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.LinearLayout
;
import
android.widget.SearchView
;
import
android.widget.Toast
;
...
...
@@ -64,10 +64,7 @@ import com.xabber.android.ui.dialog.AccountChooseDialogFragment.OnChoosedListene
import
com.xabber.android.ui.dialog.ContactIntegrationDialogFragment
;
import
com.xabber.android.ui.dialog.StartAtBootDialogFragment
;
import
com.xabber.android.ui.helper.BarPainter
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.android.ui.preferences.AboutViewer
;
import
com.xabber.android.ui.preferences.AccountEditor
;
import
com.xabber.android.ui.preferences.PreferenceEditor
;
import
com.xabber.android.ui.helper.ChatScroller
;
import
com.xabber.xmpp.address.Jid
;
import
com.xabber.xmpp.uri.XMPPUri
;
...
...
@@ -79,8 +76,9 @@ import java.util.Collection;
*
* @author alexander.ivanov
*/
public
class
ContactList
extends
ManagedActivity
implements
OnAccountChangedListener
,
View
.
OnClickListener
,
OnChoosedListener
,
OnContactClickListener
,
ContactListDrawerFragment
.
ContactListDrawerListener
{
public
class
ContactList
extends
MainBasicActivity
implements
OnAccountChangedListener
,
View
.
OnClickListener
,
OnChoosedListener
,
OnContactClickListener
,
ChatScroller
.
ChatScrollerListener
,
ChatScroller
.
ChatScrollerProvider
{
/**
* Select contact to be invited to the room was requested.
...
...
@@ -108,8 +106,9 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
private
SearchView
searchView
;
private
BarPainter
barPainter
;
private
ActionBarDrawerToggle
drawerToggle
;
private
DrawerLayout
drawerLayout
;
private
boolean
isDualPanelView
;
private
ChatScroller
chatScroller
;
public
static
Intent
createPersistentIntent
(
Context
context
)
{
Intent
intent
=
new
Intent
(
context
,
ContactList
.
class
);
...
...
@@ -152,12 +151,19 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
return
;
}
setContentView
(
R
.
layout
.
contact_list
);
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar_default
);
isDualPanelView
=
findViewById
(
R
.
id
.
chat_container
)
!=
null
;
if
(
isDualPanelView
)
{
ViewPager
viewPager
=
(
ViewPager
)
findViewById
(
R
.
id
.
pager
);
LinearLayout
chatScrollIndicatorLayout
=
(
LinearLayout
)
findViewById
(
R
.
id
.
chat_scroll_indicator
);
chatScroller
=
new
ChatScroller
(
this
,
viewPager
,
chatScrollIndicatorLayout
);
chatScroller
.
initChats
(
null
);
}
toolbar
.
setOnClickListener
(
this
);
setSupportActionBar
(
toolbar
);
drawerLayout
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
drawerToggle
=
new
ActionBarDrawerToggle
(
this
,
drawerLayout
,
toolbar
,
R
.
string
.
application_title_short
,
R
.
string
.
application_title_short
);
drawerLayout
.
setDrawerListener
(
drawerToggle
);
...
...
@@ -324,6 +330,10 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
}
}
}
if
(
isDualPanelView
)
{
chatScroller
.
update
();
}
}
@Override
...
...
@@ -445,7 +455,8 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
super
.
onBackPressed
();
}
private
void
exit
()
{
@Override
protected
void
exit
()
{
Application
.
getInstance
().
requestToClose
();
showDialog
(
DIALOG_CLOSE_APPLICATION_ID
);
getContactListFragment
().
unregisterListeners
();
...
...
@@ -508,9 +519,14 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
@Override
public
void
onContactClick
(
AbstractContact
abstractContact
)
{
if
(
action
==
null
)
{
startActivity
(
ChatViewer
.
createSpecificChatIntent
(
this
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
return
;
if
(
isDualPanelView
)
{
chatScroller
.
setSelectedChat
(
abstractContact
);
chatScroller
.
update
();
}
else
{
startActivity
(
ChatViewer
.
createSpecificChatIntent
(
this
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
return
;
}
}
switch
(
action
)
{
case
ACTION_ROOM_INVITE:
{
...
...
@@ -540,8 +556,15 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
break
;
}
default
:
startActivity
(
ChatViewer
.
createSpecificChatIntent
(
this
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
if
(
isDualPanelView
)
{
chatScroller
.
initChats
(
abstractContact
);
chatScroller
.
setSelectedChat
(
abstractContact
);
chatScroller
.
update
();
}
else
{
startActivity
(
ChatViewer
.
createSpecificChatIntent
(
this
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
return
;
}
break
;
}
}
...
...
@@ -579,25 +602,17 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
}
@Override
public
void
onContactListDrawerListener
(
int
viewId
)
{
drawerLayout
.
closeDrawers
();
switch
(
viewId
)
{
case
R
.
id
.
drawer_action_settings
:
startActivity
(
PreferenceEditor
.
createIntent
(
this
));
break
;
case
R
.
id
.
drawer_action_about
:
startActivity
(
AboutViewer
.
createIntent
(
this
));
break
;
case
R
.
id
.
drawer_action_exit
:
exit
();
break
;
public
void
onStatusBarNeedPaint
(
String
account
)
{
}
@Override
public
void
onClose
()
{
}
}
@Override
public
void
onAccountSelected
(
String
account
)
{
drawerLayout
.
closeDrawers
();
startActivity
(
AccountEditor
.
createIntent
(
this
,
account
));
public
ChatScroller
getChatScroller
()
{
return
chatScroller
;
}
}
app/src/main/java/com/xabber/android/ui/MainBasicActivity.java
0 → 100644
View file @
c77acef0
package
com
.
xabber
.
android
.
ui
;
import
android.os.Bundle
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v7.app.ActionBarDrawerToggle
;
import
android.support.v7.widget.Toolbar
;
import
com.xabber.android.R
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.android.ui.preferences.AboutViewer
;
import
com.xabber.android.ui.preferences.AccountEditor
;
import
com.xabber.android.ui.preferences.PreferenceEditor
;
public
class
MainBasicActivity
extends
ManagedActivity
implements
ContactListDrawerFragment
.
ContactListDrawerListener
{
protected
ActionBarDrawerToggle
drawerToggle
;
protected
DrawerLayout
drawerLayout
;
protected
Toolbar
toolbar
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
contact_list
);
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar_default
);
drawerLayout
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
}
@Override
public
void
onContactListDrawerListener
(
int
viewId
)
{
drawerLayout
.
closeDrawers
();
switch
(
viewId
)
{
case
R
.
id
.
drawer_action_settings
:
startActivity
(
PreferenceEditor
.
createIntent
(
this
));
break
;
case
R
.
id
.
drawer_action_about
:
startActivity
(
AboutViewer
.
createIntent
(
this
));
break
;
case
R
.
id
.
drawer_action_exit
:
exit
();
break
;
}
}
protected
void
exit
()
{
}
@Override
public
void
onAccountSelected
(
String
account
)
{
drawerLayout
.
closeDrawers
();
startActivity
(
AccountEditor
.
createIntent
(
this
,
account
));
}
}
app/src/main/java/com/xabber/android/ui/RecentChatFragment.java
View file @
c77acef0
...
...
@@ -65,7 +65,7 @@ public class RecentChatFragment extends ListFragment implements Toolbar.OnMenuIt
if
(
getListAdapter
().
isEmpty
())
{
Activity
activity
=
getActivity
();
Toast
.
makeText
(
activity
,
R
.
string
.
chat_list_is_empty
,
Toast
.
LENGTH_LONG
).
show
();
activity
.
finish
();
//
activity.finish();
}
Toolbar
toolbar
=
(
Toolbar
)
rootView
.
findViewById
(
R
.
id
.
toolbar_default
);
...
...
@@ -89,15 +89,18 @@ public class RecentChatFragment extends ListFragment implements Toolbar.OnMenuIt
@Override
public
void
onResume
()
{
super
.
onResume
();
listener
.
getChatScroller
().
registerRecentChatsList
(
this
);
if
(
null
!=
listener
.
getChatScroller
())
{
listener
.
getChatScroller
().
registerRecentChatsList
(
this
);
}
}
@Override
public
void
onPause
()
{
super
.
onPause
();
listener
.
getChatScroller
().
unregisterRecentChatsList
(
this
);
if
(
null
!=
listener
.
getChatScroller
())
{
listener
.
getChatScroller
().
unregisterRecentChatsList
(
this
);
}
}
@Override
...
...
@@ -111,7 +114,7 @@ public class RecentChatFragment extends ListFragment implements Toolbar.OnMenuIt
public
void
onListItemClick
(
ListView
l
,
View
v
,
int
position
,
long
id
)
{
super
.
onListItemClick
(
l
,
v
,
position
,
id
);
if
(
null
!=
listener
)
{
if
(
null
!=
listener
.
getChatScroller
()
)
{
listener
.
getChatScroller
().
onChatSelected
((
AbstractChat
)
getListAdapter
().
getItem
(
position
));
}
}
...
...
@@ -126,7 +129,9 @@ public class RecentChatFragment extends ListFragment implements Toolbar.OnMenuIt
}
public
void
updateChats
()
{
((
ChatListAdapter
)
getListAdapter
()).
updateChats
(
listener
.
getChatScroller
().
getActiveChats
());
if
(
listener
.
getChatScroller
()
!=
null
)
{
((
ChatListAdapter
)
getListAdapter
()).
updateChats
(
listener
.
getChatScroller
().
getActiveChats
());
}
}
public
interface
RecentChatFragmentInteractionListener
{
...
...
app/src/main/java/com/xabber/android/ui/helper/ChatScroller.java
View file @
c77acef0
...
...
@@ -141,9 +141,9 @@ public class ChatScroller implements
private
void
updateStatusBar
()
{
if
(
isRecentChatsSelected
)
{
listener
.
on
AccountSelected
(
null
);
listener
.
on
StatusBarNeedPaint
(
null
);
}
else
{
listener
.
on
AccountSelected
(
selectedChat
.
getAccount
());
listener
.
on
StatusBarNeedPaint
(
selectedChat
.
getAccount
());
}
}
...
...
@@ -307,7 +307,7 @@ public class ChatScroller implements
}
public
interface
ChatScrollerListener
{
void
on
AccountSelected
(
String
account
);
void
on
StatusBarNeedPaint
(
String
account
);
void
onClose
();
}
...
...
app/src/main/res/layout-w820dp/contact_list.xml
0 → 100644
View file @
c77acef0
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber 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/.
-->
<android.support.v4.widget.DrawerLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/drawer_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<android.support.v7.widget.Toolbar
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/toolbar_default"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
android:background=
"?attr/colorPrimary"
android:elevation=
"4dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
app:titleTextAppearance=
"@style/ToolbarTitle"
/>
<!-- Main layout -->
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<FrameLayout
android:id=
"@+id/container"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:padding=
"8dp"
/>
<FrameLayout
android:id=
"@+id/chat_container"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"2"
android:padding=
"8dp"
>
<android.support.v4.view.ViewPager
android:id=
"@+id/pager"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<LinearLayout
android:id=
"@+id/chat_scroll_indicator"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"80dp"
android:orientation=
"horizontal"
/>
</FrameLayout>
</LinearLayout>
</LinearLayout>
<!-- Nav drawer -->
<fragment
android:id=
"@+id/fragment_drawer"
android:name=
"com.xabber.android.ui.ContactListDrawerFragment"
android:layout_width=
"304dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"left|start"
/>
</android.support.v4.widget.DrawerLayout>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment