aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-02 16:13:25 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-10 00:53:43 +0200
commit502a1bdb9c3f6ddb8cdcf9be8c20862f4d55feaf (patch)
treebea5682f30103256ba79afcb4435dcec604c3399
parent9260ed404750d7e718e12535030104ff4debda68 (diff)
changed support lib to v13. added tabs and fragments to start conversation activity
-rw-r--r--AndroidManifest.xml6
-rw-r--r--libs/android-support-v13.jarbin0 -> 665270 bytes
-rw-r--r--libs/android-support-v4.jarbin621451 -> 0 bytes
-rw-r--r--res/layout/activity_start_conversation.xml7
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java2
-rw-r--r--src/eu/siacs/conversations/ui/StartConversation.java80
7 files changed, 97 insertions, 2 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4feb3a3d..e242c3e3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -48,6 +48,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity
+ android:name="eu.siacs.conversations.ui.StartConversation"
+ android:label="@string/title_activity_start_conversation"
+ android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity"
+ android:logo="@drawable/ic_activity"
+ ></activity>
<activity
android:name="eu.siacs.conversations.ui.SettingsActivity"
android:label="@string/title_activity_settings"
diff --git a/libs/android-support-v13.jar b/libs/android-support-v13.jar
new file mode 100644
index 00000000..cd47212b
--- /dev/null
+++ b/libs/android-support-v13.jar
Binary files differ
diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar
deleted file mode 100644
index 9056828a..00000000
--- a/libs/android-support-v4.jar
+++ /dev/null
Binary files differ
diff --git a/res/layout/activity_start_conversation.xml b/res/layout/activity_start_conversation.xml
new file mode 100644
index 00000000..54341816
--- /dev/null
+++ b/res/layout/activity_start_conversation.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/start_conversation_view_pager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+</android.support.v4.view.ViewPager> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 80bd2052..78961a56 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -21,6 +21,7 @@
<string name="title_activity_contact_details">Contact Details</string>
<string name="title_activity_conversations">Conversations</string>
<string name="title_activity_sharewith">Share with Conversation</string>
+ <string name="title_activity_start_conversation">Start Conversation</string>
<string name="just_now">just now</string>
<string name="minute_ago">1 min ago</string>
<string name="minutes_ago">%d mins ago</string>
@@ -254,4 +255,5 @@
<string name="otr_fingerprint">OTR fingerprint</string>
<string name="verify">Verify</string>
<string name="decrypt">Decrypt</string>
-</resources> \ No newline at end of file
+ <string name="conferences">Conferences</string>
+</resources>
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java
index c11e1d65..c29529ec 100644
--- a/src/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/ConversationActivity.java
@@ -488,7 +488,7 @@ public class ConversationActivity extends XmppActivity {
attachFilePopup.show();
break;
case R.id.action_add:
- startActivity(new Intent(this, ContactsActivity.class));
+ startActivity(new Intent(this, StartConversation.class));
break;
case R.id.action_archive:
this.endConversation(getSelectedConversation());
diff --git a/src/eu/siacs/conversations/ui/StartConversation.java b/src/eu/siacs/conversations/ui/StartConversation.java
index f2dde78e..9dccb411 100644
--- a/src/eu/siacs/conversations/ui/StartConversation.java
+++ b/src/eu/siacs/conversations/ui/StartConversation.java
@@ -1,7 +1,87 @@
package eu.siacs.conversations.ui;
+import android.app.ActionBar;
+import android.app.ActionBar.Tab;
+import android.app.ActionBar.TabListener;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.support.v13.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+import eu.siacs.conversations.R;
+
public class StartConversation extends XmppActivity {
+ private Tab mContactsTab;
+ private Tab mConferencesTab;
+ private ViewPager mViewPager;
+ private ListFragment mContactsListFragment = new ListFragment();
+ private ListFragment mConferenceListFragment = new ListFragment();
+
+ private TabListener mTabListener = new TabListener() {
+
+ @Override
+ public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onTabSelected(Tab tab, FragmentTransaction ft) {
+ mViewPager.setCurrentItem(tab.getPosition());
+ }
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction ft) {
+ // TODO Auto-generated method stub
+
+ }
+ };
+
+ private ViewPager.SimpleOnPageChangeListener mOnPageChangeListener = new ViewPager.SimpleOnPageChangeListener() {
+ @Override
+ public void onPageSelected(int position) {
+ getActionBar().setSelectedNavigationItem(position);
+ }
+ };
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_start_conversation);
+ mViewPager = (ViewPager) findViewById(R.id.start_conversation_view_pager);
+ ActionBar actionBar = getActionBar();
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+
+ mContactsTab = actionBar.newTab().setText(R.string.contacts)
+ .setTabListener(mTabListener);
+ mConferencesTab = actionBar.newTab().setText(R.string.conferences)
+ .setTabListener(mTabListener);
+ actionBar.addTab(mContactsTab);
+ actionBar.addTab(mConferencesTab);
+
+
+ mViewPager.setOnPageChangeListener(mOnPageChangeListener);
+ mViewPager.setAdapter(new FragmentPagerAdapter(getFragmentManager()) {
+
+ @Override
+ public int getCount() {
+ return 2;
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ if (position==0) {
+ return mContactsListFragment;
+ } else {
+ return mConferenceListFragment;
+ }
+ }
+ });
+
+ }
+
@Override
void onBackendConnected() {
// TODO Auto-generated method stub