This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

remove module MULTI and reengineering

  • Loading branch information...
kryukov committed Jul 25, 2013
1 parent 048f0dc commit c2431d04a90ef92185a5c3372ef0fb57cebb79d6
Showing with 1,757 additions and 1,141 deletions.
  1. +48 −0 android/res/layout/chat.xml
  2. +32 −0 android/res/layout/chat_message.xml
  3. +1 −1 android/src/ru/net/jimm/input/Input.java
  4. +35 −0 android/src/ru/net/jimm/ui/chat/ChatActivity.java
  5. +68 −0 android/src/ru/net/jimm/ui/chat/ChatAdapter.java
  6. +2 −2 build.xml
  7. +1 −25 generic/src/jimm/Options.java
  8. +0 −13 generic/src/protocol/Profile.java
  9. +16 −9 generic/src/protocol/ui/InfoFactory.java
  10. +6 −57 j2me/src/jimm/AccountsForm.java
  11. +1 −11 j2me/src/jimm/FileTransfer.java
  12. +0 −4 j2me/src/jimm/OptionsForm.java
  13. +8 −13 j2me/src/jimm/cl/ContactList.java
  14. +0 −4 j2me/src/jimm/cl/JimmModel.java
  15. +0 −8 j2me/src/jimm/cl/ProtocolMenu.java
  16. +0 −6 j2me/src/jimm/modules/Traffic.java
  17. +0 −2 j2me/src/jimmui/model/roster/ProtocolContactModel.java
  18. +0 −2 j2me/src/jimmui/model/roster/ProtocolGroupContactModel.java
  19. +6 −5 j2me/src/jimmui/updater/ChatUpdater.java
  20. +1 −1 j2me/src/jimmui/updater/MessageBuilder.java
  21. +6 −8 j2me/src/jimmui/updater/RosterUpdater.java
  22. +6 −0 j2me/src/jimmui/view/base/Binder.java
  23. +7 −0 j2me/src/jimmui/view/base/CanvasEx.java
  24. +5 −6 j2me/src/jimmui/view/base/MyActionBar.java
  25. +0 −1 j2me/src/jimmui/view/base/RosterToolBar.java
  26. +441 −6 j2me/src/jimmui/view/base/SomeContent.java
  27. +127 −15 j2me/src/jimmui/view/base/SomeContentList.java
  28. +7 −384 j2me/src/jimmui/view/chat/Chat.java
  29. +421 −10 j2me/src/jimmui/view/chat/ChatContent.java
  30. +0 −6 j2me/src/jimmui/view/icons/ImageList.java
  31. +0 −2 j2me/src/jimmui/view/roster/ProtocolBranch.java
  32. +474 −0 j2me/src/jimmui/view/roster/RosterContent.java
  33. +26 −487 j2me/src/jimmui/view/roster/VirtualContactList.java
  34. +0 −10 networking/src/protocol/Protocol.java
  35. +12 −35 networking/src/protocol/jabber/Jabber.java
  36. +0 −8 networking/src/protocol/jabber/JabberXml.java
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/chat_title"
android:layout_alignParentTop="true">

<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Title"
android:id="@+id/textView1"/>
</LinearLayout>

<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/chat_messages"
android:layout_below="@+id/chat_title"
android:layout_above="@+id/chat_input"/>

<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/chat_input"
android:layout_alignParentBottom="true">

<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Bottom"
android:id="@+id/textView"/>
</LinearLayout>
</RelativeLayout>

</LinearLayout>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="time"
android:id="@+id/chat_message_time"
android:layout_alignParentRight="true"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="from"
android:id="@+id/chat_message_from"/>
</RelativeLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Message"
android:id="@+id/chat_message_text"/>

</LinearLayout>
@@ -187,7 +187,7 @@ public boolean canAdd(String what) {
public void setOwner(Chat owner) {
if (this.owner != owner) {
this.owner = owner;
String name = (null != owner) ? owner.getContact().getName() : null;
String name = (null != owner) ? owner.getModel().getContact().getName() : null;
final String hint = (null == name)
? getContext().getString(R.string.hint_message)
: getContext().getString(R.string.hint_message_to, name);
@@ -0,0 +1,35 @@
package ru.net.jimm.ui.chat;

import android.app.Activity;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.Window;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import jimmui.model.chat.ChatModel;
import ru.net.jimm.R;
import ru.net.jimm.input.Input;

/**
* Created with IntelliJ IDEA.
* <p/>
* Date: 21.07.13 12:53
*
* @author vladimir
*/
public class ChatActivity extends Activity {
private ChatAdapter chatAdapter;
private Input input;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
setContentView(R.layout.chat);
chatAdapter = new ChatAdapter(this, new ChatModel());

input = new Input(this, null, R.id.input_line);
((LinearLayout)findViewById(R.id.chat_input)).addView(input);
final ListView messages = (ListView) findViewById(R.id.chat_messages);
}
}
@@ -0,0 +1,68 @@
package ru.net.jimm.ui.chat;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import jimmui.model.chat.ChatModel;
import ru.net.jimm.R;

/**
* Created with IntelliJ IDEA.
* <p/>
* Date: 21.07.13 2:54
*
* @author vladimir
*/
public class ChatAdapter extends BaseAdapter {
private ChatModel chat;
private LayoutInflater layoutInflater;
public ChatAdapter(Context context, ChatModel chat) {
this.chat = chat;
layoutInflater = LayoutInflater.from(context);
}

@Override
public int getCount() {
return chat.size();
}

@Override
public Object getItem(int i) {
return chat.getMessage(i);
}

@Override
public long getItemId(int i) {
return i;
}

@Override
public View getView(int index, View view, ViewGroup viewGroup) {
ViewHolder holder;
if (view == null) {
view = layoutInflater.inflate(R.layout.chat_message, null);
holder = new ViewHolder();
holder.from = (TextView) view.findViewById(R.id.chat_message_from);
holder.date = (TextView) view.findViewById(R.id.chat_message_time);
holder.text = (TextView) view.findViewById(R.id.chat_message_text);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}

holder.from.setText(chat.getMessage(index).getNick());
holder.date.setText("By, " + chat.getMessage(index).getTime());
holder.text.setText(chat.getMessage(index).getText());

return view;
}

private static class ViewHolder {
TextView from;
TextView date;
TextView text;
}
}
@@ -45,8 +45,8 @@ Author(s): Manuel Linsmayer, Andreas Rossbacher
<!-- This property must point at the MIDP API classes and all extension -->
<!-- classes required by the chosen target. -->
<property name=":" value="${path.separator}"/>
<property name="MIDP2/midp/lib" location="${MIDP2/midp}/lib/cldcapi11.jar${:}${MIDP2/midp}/lib/midpapi20.jar${:}${MIDP2/midp}/lib/wma11.jar${:}${MIDP2/midp}/lib/mmapi.jar${:}${MIDP2/midp}/lib/jsr75.jar${:}res/TARGETS/MIDP2/lib/nokia.zip${:}res/TARGETS/MIDP2/lib/se-activityui.zip"/>
<property name="MOTOROLA/midp/lib" location="${MIDP2/midp}/lib/cldcapi10.jar${:}${MIDP2/midp}/lib/midpapi20.jar${:}${MIDP2/midp}/lib/mmapi.jar${:}res/TARGETS/MOTOROLA/lib/fileaccess.jar${:}${MIDP2/midp}/lib/jsr75.jar" />
<property name="MIDP2/midp/lib" location="${MIDP2/midp}/lib/cldcapi11.jar${:}${MIDP2/midp}/lib/midpapi20.jar${:}${MIDP2/midp}/lib/wma11.jar${:}${MIDP2/midp}/lib/mmapi.jar${:}${MIDP2/midp}/lib/jsr75.jar${:}j2me/res/TARGETS/MIDP2/lib/nokia.zip${:}j2me/res/TARGETS/MIDP2/lib/se-activityui.zip"/>
<property name="MOTOROLA/midp/lib" location="${MIDP2/midp}/lib/cldcapi10.jar${:}${MIDP2/midp}/lib/midpapi20.jar${:}${MIDP2/midp}/lib/mmapi.jar${:}j2me/res/TARGETS/MOTOROLA/lib/fileaccess.jar${:}${MIDP2/midp}/lib/jsr75.jar" />

<!-- ******************************************************************* -->
<!-- Change this to the directory where ProGuard is installed. You can -->
@@ -70,7 +70,7 @@
// static final int OPTION_NICK3 = 23; /* String */
// static final int OPTION_UIN3 = 15; /* String */
// static final int OPTION_PASSWORD3 = 230; /* String */
static final int OPTIONS_CURR_ACCOUNT = 86; /* int */
// static final int OPTIONS_CURR_ACCOUNT = 86; /* int */

// public static final int OPTION_SRV_HOST = 1; /* String */
// public static final int OPTION_SRV_PORT = 2; /* String */
@@ -251,30 +251,10 @@ public static int getAccountIndex(Profile profile) {
return Math.max(0, Util.getIndex(listOfProfiles, profile));
}
}
public static void setCurrentAccount(int num) {
num = Math.min(num, getAccountCount());
Options.setInt(Options.OPTIONS_CURR_ACCOUNT, num);
}
public static int getCurrentAccount() {
return Options.getInt(Options.OPTIONS_CURR_ACCOUNT);
}
public static void delAccount(int num) {
synchronized (listOfProfiles) {
listOfProfiles.removeElementAt(num);

// correct current position
int current = getCurrentAccount();
if (current == num) {
current = 0;
}
if (num < current) {
current--;
}
if (listOfProfiles.size() < current) {
current = 0;
}
setCurrentAccount(current);

// remove profile
Storage s = new Storage("j-accounts");
try {
@@ -453,16 +433,12 @@ public static void loadOptions() {
// Try to load option values from record store and construct options form
try {
setDefaults();
initAccounts();
load();
// Use default values if loading option values from record store failed
} catch (Exception e) {
setDefaults();
}
}
private static void initAccounts() {
setInt (Options.OPTIONS_CURR_ACCOUNT, 0);
}
/* Set default values
This is done before loading because older saves may not contain all new values */
private static void setDefaults() {
@@ -25,7 +25,6 @@
public static final int PROTOCOL_FACEBOOK = 10;
public static final int PROTOCOL_LJ = 11;
public static final int PROTOCOL_YANDEX = 12;
public static final int PROTOCOL_VK = 13;
public static final int PROTOCOL_GTALK = 14;
public static final int PROTOCOL_QIP = 15;
public static final int PROTOCOL_ODNOKLASSNIKI = 16;
@@ -39,16 +38,13 @@
// #sijapp cond.end #
// #sijapp cond.if protocols_JABBER is "true" #
+ "|Jabber"
// #sijapp cond.if modules_MULTI is "true" #
+ "|Facebook"
+ "|\u041e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043d\u0438\u043a\u0438"
+ "|VKontakte"
+ "|LiveJournal"
+ "|GTalk"
+ "|Ya.Online"
+ "|QIP"
// #sijapp cond.end #
// #sijapp cond.end #
// #sijapp cond.if protocols_OBIMP is "true" #
+ "|OBIMP"
// #sijapp cond.end #
@@ -65,16 +61,13 @@
// #sijapp cond.end #
// #sijapp cond.if protocols_JABBER is "true" #
PROTOCOL_JABBER,
// #sijapp cond.if modules_MULTI is "true" #
PROTOCOL_FACEBOOK,
PROTOCOL_ODNOKLASSNIKI,
PROTOCOL_VK,
PROTOCOL_LJ,
PROTOCOL_GTALK,
PROTOCOL_YANDEX,
PROTOCOL_QIP,
// #sijapp cond.end #
// #sijapp cond.end #
// #sijapp cond.if protocols_OBIMP is "true" #
PROTOCOL_OBIMP,
// #sijapp cond.end #
@@ -91,16 +84,13 @@
// #sijapp cond.end #
// #sijapp cond.if protocols_JABBER is "true" #
"jid",
// #sijapp cond.if modules_MULTI is "true" #
"Login",
"ID",
"ID",
"Login",
"Login",
"Login",
"Login",
// #sijapp cond.end #
// #sijapp cond.end #
// #sijapp cond.if protocols_OBIMP is "true" #
"ObimpID",
// #sijapp cond.end #
@@ -132,19 +122,16 @@ public boolean isConnected() {

public byte getEffectiveType() {
// #sijapp cond.if protocols_JABBER is "true" #
// #sijapp cond.if modules_MULTI is "true" #
switch (protocolType) {
case Profile.PROTOCOL_GTALK:
case Profile.PROTOCOL_FACEBOOK:
case Profile.PROTOCOL_LJ:
case Profile.PROTOCOL_YANDEX:
case Profile.PROTOCOL_VK:
case Profile.PROTOCOL_QIP:
case Profile.PROTOCOL_ODNOKLASSNIKI:
return Profile.PROTOCOL_JABBER;
}
// #sijapp cond.end #
// #sijapp cond.end #
return protocolType;
}

Oops, something went wrong.

0 comments on commit c2431d0

Please sign in to comment.