├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── vcs.xml ├── libraries │ ├── gson_2_2_4.xml │ ├── jsr305_2_0_1.xml │ ├── wasync_1_4_3.xml │ ├── guava_15_0_sliced.xml │ ├── grizzly_http_2_3_18.xml │ ├── protobuf_java_2_5_0.xml │ ├── wave_in_a_box_0_6_0.xml │ ├── slf4j_android_1_6_1_RC1.xml │ ├── async_http_client_1_8_14.xml │ ├── grizzly_framework_2_3_18.xml │ ├── grizzly_websockets_2_3_18.xml │ ├── design_22_2_0.xml │ ├── appcompat_v7_22_2_0.xml │ ├── slf4j_api_1_6_1.xml │ ├── butterknife_6_1_0.xml │ ├── netty_3_2_4_Final.xml │ ├── async_http_client_1_6_4.xml │ ├── support_annotations_22_2_0.xml │ └── support_v4_22_2_0.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── test.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── drawable │ │ │ │ ├── letter_a.png │ │ │ │ ├── letter_b.png │ │ │ │ ├── letter_c.png │ │ │ │ ├── letter_d.png │ │ │ │ ├── letter_e.png │ │ │ │ ├── letter_f.png │ │ │ │ ├── letter_g.png │ │ │ │ ├── letter_h.png │ │ │ │ ├── letter_i.png │ │ │ │ ├── letter_j.png │ │ │ │ ├── letter_k.png │ │ │ │ ├── letter_l.png │ │ │ │ ├── letter_m.png │ │ │ │ ├── letter_n.png │ │ │ │ ├── letter_o.png │ │ │ │ ├── letter_p.png │ │ │ │ ├── letter_q.png │ │ │ │ ├── letter_r.png │ │ │ │ ├── letter_s.png │ │ │ │ ├── letter_t.png │ │ │ │ ├── letter_u.png │ │ │ │ ├── letter_v.png │ │ │ │ ├── letter_w.png │ │ │ │ ├── letter_x.png │ │ │ │ ├── letter_y.png │ │ │ │ ├── letter_z.png │ │ │ │ ├── backgroud.jpg │ │ │ │ ├── ic_action.png │ │ │ │ ├── ic_profile.png │ │ │ │ ├── ic_search.png │ │ │ │ ├── ic_search2.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_action_backward.png │ │ │ │ ├── ic_action_drawer.png │ │ │ │ ├── ic_action_forword.png │ │ │ │ ├── ic_action_next_item.png │ │ │ │ ├── ic_action_search_back.png │ │ │ │ ├── ic_action_search_forward.png │ │ │ │ ├── ic_arrow_forward_white_1.png │ │ │ │ ├── ic_arrow_forward_white_2.png │ │ │ │ └── circle.xml │ │ │ ├── drawable-hdpi │ │ │ │ ├── check_sm.9.png │ │ │ │ └── ic_action_search.png │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_action_search.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_action_search.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_action_search.png │ │ │ ├── layout │ │ │ │ ├── chat_activity.xml │ │ │ │ ├── chat_fragment.xml │ │ │ │ ├── chat_new_friend_activity.xml │ │ │ │ ├── chat_new_friend_fragment.xml │ │ │ │ ├── test_activity.xml │ │ │ │ ├── toolbar.xml │ │ │ │ ├── chat_new_wave_fragment.xml │ │ │ │ ├── select_friend_fragment.xml │ │ │ │ ├── main_activity.xml │ │ │ │ ├── nav_drawer_row.xml │ │ │ │ ├── custom_row.xml │ │ │ │ ├── inbox_fragment.xml │ │ │ │ ├── chat_new_wave_activtiy.xml │ │ │ │ ├── select_friend_activity.xml │ │ │ │ ├── list_item.xml │ │ │ │ ├── fragment_navigation_drawer.xml │ │ │ │ ├── list_item_layout.xml │ │ │ │ ├── custom_message_row.xml │ │ │ │ ├── search_activity.xml │ │ │ │ ├── inbox_activity.xml │ │ │ │ ├── tool_bar.xml │ │ │ │ ├── header.xml │ │ │ │ ├── login_activity.xml │ │ │ │ └── signup_activity.xml │ │ │ ├── anim │ │ │ │ ├── move.xml │ │ │ │ └── rotate.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ ├── menu_main2.xml │ │ │ │ └── menu_main.xml │ │ │ └── values-v21 │ │ │ │ └── styles.xml │ │ ├── ic_launcher-web.png │ │ ├── java │ │ │ └── app │ │ │ │ └── android │ │ │ │ └── box │ │ │ │ └── waveprotocol │ │ │ │ └── org │ │ │ │ └── androidwave │ │ │ │ ├── activities │ │ │ │ ├── ChatNewFriendActivity.java │ │ │ │ ├── ChatNewFriendFragment.java │ │ │ │ ├── NavDrawerItem.java │ │ │ │ ├── DataItem.java │ │ │ │ ├── SearchActivity.java │ │ │ │ ├── ChatNewWaveFragment.java │ │ │ │ ├── NavigationDrawerAdapter.java │ │ │ │ ├── Friendadapter.java │ │ │ │ ├── MessageAdapter.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── SelectFriendFragment.java │ │ │ │ ├── InboxFragment.java │ │ │ │ ├── ChatNewWaveActivity.java │ │ │ │ ├── LoginActivity.java │ │ │ │ ├── SelectFriendActivity.java │ │ │ │ ├── SignUpActivity.java │ │ │ │ ├── DataSource.java │ │ │ │ ├── TestMainActivity.java │ │ │ │ ├── DrawableProvider.java │ │ │ │ └── FragmentDrawer.java │ │ │ │ ├── service │ │ │ │ ├── models │ │ │ │ │ ├── ListElementInitializer.java │ │ │ │ │ ├── IdGeneratorGeneric.java │ │ │ │ │ ├── MapSerializer.java │ │ │ │ │ ├── TypeIdGenerator.java │ │ │ │ │ ├── Type.java │ │ │ │ │ ├── ListElementFactory.java │ │ │ │ │ ├── StringType.java │ │ │ │ │ └── TextType.java │ │ │ │ ├── SubmitResponseCallback.java │ │ │ │ ├── WaveWebSocketCallback.java │ │ │ │ ├── documents │ │ │ │ │ ├── DocumentRegistry.java │ │ │ │ │ └── WaveDocuments.java │ │ │ │ ├── concurrencycontrol │ │ │ │ │ ├── Connector.java │ │ │ │ │ ├── StaticChannelBinder.java │ │ │ │ │ ├── ProxyOperationSink.java │ │ │ │ │ ├── LiveTarget.java │ │ │ │ │ ├── WaveletOperationalizer.java │ │ │ │ │ └── LiveChannelBinder.java │ │ │ │ ├── WaveWebSocket.java │ │ │ │ ├── scheduler │ │ │ │ │ ├── SimpleTimer.java │ │ │ │ │ ├── OptimalGroupingScheduler.java │ │ │ │ │ ├── JobRegistry.java │ │ │ │ │ ├── AndroidSimpleTimer.java │ │ │ │ │ ├── TimerService.java │ │ │ │ │ ├── Controller.java │ │ │ │ │ ├── SchedulerInstance.java │ │ │ │ │ ├── SchedulerTimerService.java │ │ │ │ │ ├── Scheduler.java │ │ │ │ │ └── BrowserBackedScheduler.java │ │ │ │ ├── RemoteViewServiceMultiplexer.java │ │ │ │ ├── logger │ │ │ │ │ └── WaveLogger.java │ │ │ │ ├── ClientPercentEncoderDecoder.java │ │ │ │ ├── RemoteWaveViewService.java │ │ │ │ ├── WaveSignUp.java │ │ │ │ ├── WaveSignIn.java │ │ │ │ └── WaveService.java │ │ │ │ └── util │ │ │ │ └── Util.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── app │ │ └── android │ │ └── box │ │ └── waveprotocol │ │ └── org │ │ └── androidwave │ │ └── ApplicationTest.java ├── libs │ ├── gson-2.2.4.jar │ ├── jsr305-2.0.1.jar │ ├── wasync-1.4.3.jar │ ├── guava-15.0-sliced.jar │ ├── grizzly-http-2.3.18.jar │ ├── protobuf-java-2.5.0.jar │ ├── wave-in-a-box-0.6.0.jar │ ├── async-http-client-1.8.14.jar │ ├── grizzly-framework-2.3.18.jar │ ├── grizzly-websockets-2.3.18.jar │ └── slf4j-android-1.6.1-RC1.jar ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── RETIRED.txt ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── android-wave.iml ├── README.md ├── .gitignore ├── gradlew.bat └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | android-wave -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /app/src/main/res/values/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /RETIRED.txt: -------------------------------------------------------------------------------- 1 | This podling has been retired, please see: http://incubator.apache.org/projects/index.html#wave 2 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /app/libs/jsr305-2.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/jsr305-2.0.1.jar -------------------------------------------------------------------------------- /app/libs/wasync-1.4.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/wasync-1.4.3.jar -------------------------------------------------------------------------------- /app/libs/guava-15.0-sliced.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/guava-15.0-sliced.jar -------------------------------------------------------------------------------- /app/libs/grizzly-http-2.3.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/grizzly-http-2.3.18.jar -------------------------------------------------------------------------------- /app/libs/protobuf-java-2.5.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/protobuf-java-2.5.0.jar -------------------------------------------------------------------------------- /app/libs/wave-in-a-box-0.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/wave-in-a-box-0.6.0.jar -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/libs/async-http-client-1.8.14.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/async-http-client-1.8.14.jar -------------------------------------------------------------------------------- /app/libs/grizzly-framework-2.3.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/grizzly-framework-2.3.18.jar -------------------------------------------------------------------------------- /app/libs/grizzly-websockets-2.3.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/grizzly-websockets-2.3.18.jar -------------------------------------------------------------------------------- /app/libs/slf4j-android-1.6.1-RC1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/libs/slf4j-android-1.6.1-RC1.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_a.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_b.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_c.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_d.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_e.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_f.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_g.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_h.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_i.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_j.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_j.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_k.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_l.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_m.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_n.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_o.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_o.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_p.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_q.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_q.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_r.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_s.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_t.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_u.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_u.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_v.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_w.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_x.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_y.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/letter_z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/letter_z.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/backgroud.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/backgroud.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_action.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_profile.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_search2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/check_sm.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable-hdpi/check_sm.9.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action_backward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_action_backward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_action_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action_forword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_action_forword.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action_next_item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_action_next_item.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable-hdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable-mdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable-xhdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable-xxhdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action_search_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_action_search_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action_search_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_action_search_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_forward_white_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_arrow_forward_white_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_forward_white_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patterns/incubator-retired-wave-android/master/app/src/main/res/drawable/ic_arrow_forward_white_2.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/chat_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/chat_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/ChatNewFriendActivity.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | /** 4 | * Created by roshan on 9/5/15. 5 | */ 6 | public class ChatNewFriendActivity { 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/ChatNewFriendFragment.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | /** 4 | * Created by roshan on 9/5/15. 5 | */ 6 | public class ChatNewFriendFragment { 7 | } 8 | -------------------------------------------------------------------------------- /.idea/libraries/gson_2_2_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/jsr305_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/wasync_1_4_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/chat_new_friend_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/chat_new_friend_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/guava_15_0_sliced.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /.idea/libraries/grizzly_http_2_3_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/protobuf_java_2_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/wave_in_a_box_0_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/slf4j_android_1_6_1_RC1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/ListElementInitializer.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | public interface ListElementInitializer { 4 | 5 | String getType(); 6 | 7 | String getBackendId(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 260dp 6 | 7 | -------------------------------------------------------------------------------- /.idea/libraries/async_http_client_1_8_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/grizzly_framework_2_3_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/grizzly_websockets_2_3_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/SubmitResponseCallback.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service; 2 | 3 | import org.waveprotocol.box.common.comms.ProtocolSubmitResponse; 4 | 5 | public interface SubmitResponseCallback { 6 | 7 | void run(ProtocolSubmitResponse response); 8 | } -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/WaveWebSocketCallback.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service; 2 | 3 | import org.waveprotocol.box.common.comms.ProtocolWaveletUpdate; 4 | 5 | public interface WaveWebSocketCallback { 6 | void onWaveletUpdate(ProtocolWaveletUpdate message); 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/documents/DocumentRegistry.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.documents; 2 | 3 | import org.waveprotocol.wave.model.conversation.ConversationBlip; 4 | 5 | public interface DocumentRegistry { 6 | D get(ConversationBlip blip); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/test_activity.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/move.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/concurrencycontrol/Connector.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.concurrencycontrol; 2 | 3 | public interface Connector { 4 | 5 | public interface Command { 6 | 7 | public void execute(); 8 | 9 | } 10 | 11 | void connect(Command onOpened); 12 | 13 | void close(); 14 | } -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/IdGeneratorGeneric.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | import org.waveprotocol.wave.model.id.IdGenerator; 4 | import org.waveprotocol.wave.model.id.WaveId; 5 | 6 | public interface IdGeneratorGeneric { 7 | 8 | IdGeneratorGeneric initialize(IdGenerator idGenerator); 9 | 10 | WaveId newWaveId(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #2586B3 4 | #0B7BBA 5 | #FFFFFF 6 | #FFFFFF 7 | #0B7BBA 8 | #70C8FA 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/design_22_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/WaveWebSocket.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service; 2 | 3 | public interface WaveWebSocket { 4 | 5 | interface WaveSocketCallback { 6 | void onConnect(); 7 | void onDisconnect(); 8 | void onMessage(String message); 9 | } 10 | 11 | void connect(); 12 | void disconnect(); 13 | void sendMessage(String message); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/anim/rotate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_22_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/SimpleTimer.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | import java.util.TimerTask; 4 | 5 | public interface SimpleTimer { 6 | 7 | public interface Factory { 8 | SimpleTimer create(TimerTask runnable); 9 | } 10 | 11 | double getTime(); 12 | 13 | void schedule(); 14 | 15 | void schedule(double when); 16 | 17 | void cancel(); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/androidTest/java/app/android/box/waveprotocol/org/androidwave/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main2.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/slf4j_api_1_6_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/libraries/butterknife_6_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/netty_3_2_4_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/async_http_client_1_6_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_22_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_22_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/chat_new_wave_fragment.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/select_friend_fragment.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/main_activity.xml: -------------------------------------------------------------------------------- 1 | 8 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nav_drawer_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/OptimalGroupingScheduler.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | import org.waveprotocol.wave.model.util.FuzzingBackOffScheduler; 4 | import org.waveprotocol.wave.model.util.FuzzingBackOffScheduler.CollectiveScheduler; 5 | import org.waveprotocol.wave.model.util.Scheduler; 6 | 7 | 8 | public class OptimalGroupingScheduler implements CollectiveScheduler { 9 | 10 | public OptimalGroupingScheduler(Object lowPriorityTimer) { 11 | } 12 | 13 | @Override 14 | public FuzzingBackOffScheduler.Cancellable schedule(Scheduler.Command command, int i, int i1) { 15 | return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/RemoteViewServiceMultiplexer.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service; 2 | 3 | import org.waveprotocol.box.common.comms.ProtocolWaveletUpdate; 4 | 5 | public class RemoteViewServiceMultiplexer implements WaveWebSocketCallback { 6 | 7 | private final WaveWebSocketClient socket; 8 | 9 | private final String userId; 10 | 11 | public RemoteViewServiceMultiplexer(WaveWebSocketClient socket, String userId) { 12 | this.socket = socket; 13 | this.userId = userId; 14 | 15 | socket.attachHandler(this); 16 | } 17 | 18 | @Override 19 | public void onWaveletUpdate(ProtocolWaveletUpdate message) { 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\roshan\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/concurrencycontrol/StaticChannelBinder.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.concurrencycontrol; 2 | 3 | import org.waveprotocol.wave.concurrencycontrol.wave.CcDocument; 4 | 5 | import app.android.box.waveprotocol.org.androidwave.service.documents.WaveDocuments; 6 | 7 | public final class StaticChannelBinder { 8 | 9 | private final WaveletOperationalizer operationalizer; 10 | private final WaveDocuments docRegistry; 11 | 12 | public StaticChannelBinder( 13 | WaveletOperationalizer operationalizer, WaveDocuments docRegistry) { 14 | this.operationalizer = operationalizer; 15 | this.docRegistry = docRegistry; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/custom_row.xml: -------------------------------------------------------------------------------- 1 | 7 | 13 | 14 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/JobRegistry.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | import org.waveprotocol.wave.model.util.CollectionUtils; 4 | import org.waveprotocol.wave.model.util.IntMap; 5 | 6 | import java.util.LinkedList; 7 | import java.util.Queue; 8 | 9 | public class JobRegistry { 10 | 11 | private int jobCount; 12 | 13 | private final Controller jobCounter; 14 | 15 | private final IntMap> priorities = CollectionUtils.createIntMap(); 16 | 17 | public JobRegistry(Controller jobCounter) { 18 | this.jobCounter = jobCounter; 19 | 20 | for (Scheduler.Priority p : Scheduler.Priority.values()) { 21 | priorities.put(p.ordinal(), new LinkedList()); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/NavDrawerItem.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | /** 4 | * Created by Ravi on 29/07/15. 5 | */ 6 | public class NavDrawerItem { 7 | private boolean showNotify; 8 | private String title; 9 | 10 | 11 | public NavDrawerItem() { 12 | 13 | } 14 | 15 | public NavDrawerItem(boolean showNotify, String title) { 16 | this.showNotify = showNotify; 17 | this.title = title; 18 | } 19 | 20 | public boolean isShowNotify() { 21 | return showNotify; 22 | } 23 | 24 | public void setShowNotify(boolean showNotify) { 25 | this.showNotify = showNotify; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public void setTitle(String title) { 33 | this.title = title; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/logger/WaveLogger.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.logger; 2 | 3 | import org.waveprotocol.wave.common.logging.AbstractLogger; 4 | import org.waveprotocol.wave.common.logging.Logger; 5 | import org.waveprotocol.wave.common.logging.LoggerBundle; 6 | 7 | public class WaveLogger implements LoggerBundle { 8 | 9 | @Override 10 | public void log(AbstractLogger.Level level, Object... objects) { 11 | 12 | } 13 | 14 | @Override 15 | public Logger trace() { 16 | return null; 17 | } 18 | 19 | @Override 20 | public Logger error() { 21 | return null; 22 | } 23 | 24 | @Override 25 | public Logger fatal() { 26 | return null; 27 | } 28 | 29 | @Override 30 | public boolean isModuleEnabled() { 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/DataItem.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.graphics.drawable.Drawable; 4 | 5 | /** 6 | * @author amulya 7 | * @datetime 17 Oct 2014, 3:50 PM 8 | */ 9 | public class DataItem { 10 | 11 | private String label; 12 | 13 | private Drawable drawable; 14 | 15 | private int navigationInfo; 16 | 17 | public DataItem(String label, Drawable drawable, int navigationInfo) { 18 | this.label = label; 19 | this.drawable = drawable; 20 | this.navigationInfo = navigationInfo; 21 | } 22 | 23 | public String getLabel() { 24 | return label; 25 | } 26 | 27 | public Drawable getDrawable() { 28 | return drawable; 29 | } 30 | 31 | public int getNavigationInfo() { 32 | return navigationInfo; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/AndroidSimpleTimer.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | import java.util.TimerTask; 4 | 5 | public class AndroidSimpleTimer implements SimpleTimer { 6 | 7 | private final TimerTask task; 8 | 9 | public static final SimpleTimer.Factory FACTORY = new SimpleTimer.Factory() { 10 | public SimpleTimer create(TimerTask task) { 11 | return new AndroidSimpleTimer(task); 12 | } 13 | }; 14 | 15 | public AndroidSimpleTimer(TimerTask task) { 16 | this.task = task; 17 | } 18 | 19 | @Override 20 | public double getTime() { 21 | return 0; 22 | } 23 | 24 | @Override 25 | public void schedule() { 26 | 27 | } 28 | 29 | @Override 30 | public void schedule(double when) { 31 | 32 | } 33 | 34 | @Override 35 | public void cancel() { 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/TimerService.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | import app.android.box.waveprotocol.org.androidwave.service.scheduler.Scheduler.Task; 4 | import app.android.box.waveprotocol.org.androidwave.service.scheduler.Scheduler.IncrementalTask; 5 | import app.android.box.waveprotocol.org.androidwave.service.scheduler.Scheduler.Schedulable; 6 | 7 | public interface TimerService { 8 | 9 | void schedule(Task task); 10 | 11 | void schedule(IncrementalTask process); 12 | 13 | void scheduleDelayed(Task task, int minimumTime); 14 | 15 | void scheduleDelayed(IncrementalTask process, int minimumTime); 16 | 17 | void scheduleRepeating(IncrementalTask process, int minimumTime, int interval); 18 | 19 | void cancel(Schedulable job); 20 | 21 | boolean isScheduled(Schedulable job); 22 | 23 | int elapsedMillis(); 24 | 25 | double currentTimeMillis(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/inbox_fragment.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 15 | 23 | -------------------------------------------------------------------------------- /android-wave.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/chat_new_wave_activtiy.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 17 | 18 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/select_friend_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 17 | 18 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | 18 | 19 | 25 | 26 | 27 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_navigation_drawer.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | 18 | 19 | 25 | 26 | 27 | 33 | 34 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 21 5 | buildToolsVersion "21.1.2" 6 | 7 | defaultConfig { 8 | applicationId "app.android.box.waveprotocol.org.androidwave" 9 | minSdkVersion 21 10 | targetSdkVersion 21 11 | versionCode 1 12 | versionName "1.0" 13 | multiDexEnabled true 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | compile 'com.android.support:appcompat-v7:22.2.0' 24 | compile 'com.android.support:design:22.2.0' 25 | compile 'com.jakewharton:butterknife:6.1.0' 26 | compile 'com.ning:async-http-client:1.6.4' 27 | compile 'com.android.support:recyclerview-v7:22.2.+' 28 | compile 'com.melnykov:floatingactionbutton:1.3.0' 29 | compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' 30 | 31 | } 32 | } 33 | 34 | dependencies { 35 | compile fileTree(dir: 'libs', include: ['*.jar']) 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/SearchActivity.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.ImageButton; 8 | 9 | import app.android.box.waveprotocol.org.androidwave.R; 10 | 11 | /** 12 | * Created by roellk on 8/9/2015. 13 | */ 14 | public class SearchActivity extends Activity{ 15 | ImageButton back; 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.search_activity); 20 | 21 | back = (ImageButton)findViewById(R.id.button_back); 22 | 23 | back.setOnClickListener(new View.OnClickListener() { 24 | @Override 25 | public void onClick(View v) { 26 | Intent openNewWavectivity = new Intent("app.android.box.waveprotocol.org.androidwave.INBOXACTIVITY"); 27 | startActivity(openNewWavectivity); 28 | //test 29 | //setContentView(R.layout.activity_new_wave); 30 | } 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/Controller.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | public interface Controller { 4 | 5 | void jobAdded(Scheduler.Priority priority, Scheduler.Schedulable job); 6 | 7 | void jobRemoved(Scheduler.Priority priority, Scheduler.Schedulable job); 8 | 9 | boolean isRunnable(Scheduler.Priority priority); 10 | 11 | boolean isSuppressed(Scheduler.Priority priority, Scheduler.Schedulable job); 12 | 13 | public static final Controller NOOP = new Controller() { 14 | 15 | 16 | @Override 17 | public void jobAdded(Scheduler.Priority priority, Scheduler.Schedulable job) { 18 | // Do nothing 19 | } 20 | 21 | @Override 22 | public void jobRemoved(Scheduler.Priority priority, Scheduler.Schedulable job) { 23 | // Do nothing 24 | } 25 | 26 | @Override 27 | public boolean isRunnable(Scheduler.Priority priority) { 28 | return true; 29 | } 30 | 31 | @Override 32 | public boolean isSuppressed(Scheduler.Priority priority, Scheduler.Schedulable job) { 33 | return false; 34 | } 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/SchedulerInstance.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | 4 | 5 | public class SchedulerInstance { 6 | 7 | private static TimerService low; 8 | private static TimerService high; 9 | private static TimerService medium; 10 | 11 | private static BrowserBackedScheduler instance; 12 | 13 | private static void init() { 14 | if (instance == null) { 15 | setSchedulerInstance(new BrowserBackedScheduler(AndroidSimpleTimer.FACTORY, Controller.NOOP)); 16 | } 17 | } 18 | 19 | public static void setSchedulerInstance(BrowserBackedScheduler instance) { 20 | SchedulerInstance.instance = instance; 21 | setDefaultTimerService(); 22 | } 23 | 24 | private static void setDefaultTimerService() { 25 | low = new SchedulerTimerService(instance, Scheduler.Priority.LOW); 26 | high = new SchedulerTimerService(instance, Scheduler.Priority.HIGH); 27 | medium = new SchedulerTimerService(instance, Scheduler.Priority.MEDIUM); 28 | } 29 | 30 | public static TimerService getLowPriorityTimer() { 31 | init(); 32 | return low; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/ClientPercentEncoderDecoder.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.net.URLDecoder; 5 | import java.net.URLEncoder; 6 | 7 | import org.waveprotocol.wave.model.id.URIEncoderDecoder; 8 | import org.waveprotocol.wave.model.id.URIEncoderDecoder.EncodingException; 9 | 10 | public class ClientPercentEncoderDecoder implements URIEncoderDecoder.PercentEncoderDecoder { 11 | 12 | @Override 13 | public String encode(String encodingValue) throws EncodingException { 14 | String encodedValue; 15 | try { 16 | return URLEncoder.encode(encodingValue, "UTF-8"); 17 | } catch (UnsupportedEncodingException e) { 18 | throw new EncodingException("Unable to encoding value " + encodingValue ); 19 | } 20 | } 21 | 22 | @Override 23 | public String decode(String decodingValue) throws EncodingException { 24 | try { 25 | return URLDecoder.decode(decodingValue, "UTF-8"); 26 | } catch (UnsupportedEncodingException e) { 27 | throw new EncodingException("Unable to decoding value " + decodingValue ); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/util/Util.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.util; 2 | 3 | /** 4 | * Created by charith on 8/1/15. 5 | */ 6 | public class Util { 7 | 8 | /** 9 | * This method get Wave username as input and it split it to username and hostname 10 | * 11 | * @param username Wave user's username 12 | * @return hostname and username 13 | */ 14 | public static String[] getHostAndUserNames(String username) { 15 | 16 | String[] usernameAndHost = username.split("@"); 17 | 18 | if (usernameAndHost.length > 1) { 19 | return usernameAndHost; 20 | } 21 | 22 | return null; 23 | } 24 | 25 | /** 26 | * This method generate http url for given hostname 27 | * 28 | * @param hostname Apache Wave server name 29 | * @return http url of the host 30 | */ 31 | public static String hostCreator(String hostname, String servlet) { 32 | 33 | StringBuilder hostUrl = new StringBuilder(); 34 | 35 | if (hostname.equalsIgnoreCase("local.net")) { 36 | hostname = "10.0.2.2:9898"; 37 | } 38 | 39 | return hostUrl.append("http://").append(hostname).append("/").append(servlet).toString(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/custom_message_row.xml: -------------------------------------------------------------------------------- 1 | 7 | 13 | 14 | 18 | 19 | 27 | 28 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/search_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 16 | 17 | 25 | 26 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/ChatNewWaveFragment.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.app.Activity; 4 | import android.app.Fragment; 5 | import android.os.Bundle; 6 | import android.support.v4.app.ListFragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ListView; 11 | import android.widget.Toast; 12 | 13 | import app.android.box.waveprotocol.org.androidwave.R; 14 | 15 | /** 16 | * Created by roellk on 8/24/2015. 17 | */ 18 | public class ChatNewWaveFragment extends ListFragment { 19 | 20 | 21 | public ChatNewWaveFragment() { 22 | // Required empty public constructor 23 | } 24 | 25 | @Override 26 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 27 | Bundle savedInstanceState) { 28 | View rootView = inflater.inflate(R.layout.chat_new_wave_fragment, container, false); 29 | // Inflate the layout for this fragment 30 | return rootView; 31 | } 32 | 33 | @Override 34 | public void onAttach(Activity activity) { 35 | super.onAttach(activity); 36 | } 37 | 38 | @Override 39 | public void onDetach() { 40 | super.onDetach(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/MapSerializer.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | public class MapSerializer implements org.waveprotocol.wave.model.util.Serializer { 4 | 5 | protected Model model; 6 | 7 | protected MapSerializer(Model model) { 8 | this.model = model; 9 | } 10 | 11 | @Override 12 | public String toString(Type x) { 13 | return x.serializeToModel(); 14 | } 15 | 16 | @Override 17 | public Type fromString(String s) { 18 | 19 | if (s.startsWith(StringType.PREFIX)) { 20 | 21 | return StringType.createAndAttach(model, s); 22 | 23 | } else if (s.startsWith(MapType.PREFIX)) { 24 | 25 | return MapType.createAndAttach(model, s); 26 | 27 | } else if (s.startsWith(ListType.PREFIX)) { 28 | 29 | return ListType.createAndAttach(model, s); 30 | 31 | } else if (s.startsWith(TextType.PREFIX)) { 32 | 33 | return TextType.createAndAttach(model, s); 34 | } 35 | 36 | 37 | return null; 38 | } 39 | 40 | @Override 41 | public Type fromString(String s, Type defaultValue) { 42 | if (s == null) return defaultValue; 43 | Type instance = fromString(s); 44 | return instance != null ? instance : defaultValue; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Apache Wave Client for Android 2 | ------------------------------- 3 | 4 | "Wave in a Box" (WIAB) project is a stand alone wave server and rich web client that serves as an Apache Wave reference implementation. 5 | Apache Wave site: http://incubator.apache.org/wave/ 6 | This project lets developers and enterprise users run wave servers and host waves on their own hardware. And then share those waves with other wave servers. 7 | 8 | Build 9 | ----- 10 | 11 | The Android client requires Java 7, and an Android device running Android 5.0 or higher. 12 | 13 | The client can be built using gradle, from the command line, or via an IDE (IDEA files can be found in this repository). 14 | 15 | You will need to install the Android SDK first, the latest version can always be found at https://developer.android.com/sdk/index.html. 16 | 17 | To build everything, run: 18 | gradle assemble 19 | 20 | To run the tests, run: 21 | gradle check 22 | 23 | A full list of gradle tasks can be found by running: 24 | gradle tasks 25 | 26 | To learn more about Wave and the Wave Protocols: 27 | ------ 28 | 1. Subscribe to the wave-dev mailing list, find instructions at http://incubator.apache.org/wave/mailing-lists.html. 29 | 2. Take a look at the developer docs at https://incubator.apache.org/wave/documentation.html 30 | 3. Visit the Apache Wave wiki at https://cwiki.apache.org/confluence/display/WAVE/Home. 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/SchedulerTimerService.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | /** 4 | * Created by charith on 8/12/15. 5 | */ 6 | public class SchedulerTimerService implements TimerService { 7 | public SchedulerTimerService(BrowserBackedScheduler instance, Object p1) { 8 | } 9 | 10 | @Override 11 | public void schedule(Scheduler.Task task) { 12 | 13 | } 14 | 15 | @Override 16 | public void schedule(Scheduler.IncrementalTask process) { 17 | 18 | } 19 | 20 | @Override 21 | public void scheduleDelayed(Scheduler.Task task, int minimumTime) { 22 | 23 | } 24 | 25 | @Override 26 | public void scheduleDelayed(Scheduler.IncrementalTask process, int minimumTime) { 27 | 28 | } 29 | 30 | @Override 31 | public void scheduleRepeating(Scheduler.IncrementalTask process, int minimumTime, int interval) { 32 | 33 | } 34 | 35 | @Override 36 | public void cancel(Scheduler.Schedulable job) { 37 | 38 | } 39 | 40 | @Override 41 | public boolean isScheduled(Scheduler.Schedulable job) { 42 | return false; 43 | } 44 | 45 | @Override 46 | public int elapsedMillis() { 47 | return 0; 48 | } 49 | 50 | @Override 51 | public double currentTimeMillis() { 52 | return 0; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/TypeIdGenerator.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | import org.waveprotocol.wave.model.id.IdGenerator; 4 | import org.waveprotocol.wave.model.id.WaveId; 5 | 6 | public class TypeIdGenerator implements IdGeneratorGeneric { 7 | 8 | 9 | public static final String WAVE_ID_PREFIX = "s"; 10 | private static TypeIdGenerator singleton = null; 11 | private IdGenerator idGenerator; 12 | 13 | TypeIdGenerator() { 14 | 15 | } 16 | 17 | public static TypeIdGenerator get() { 18 | if (singleton == null) singleton = new TypeIdGenerator(); 19 | return singleton; 20 | } 21 | 22 | public static TypeIdGenerator get(IdGenerator idGenerator) { 23 | if (singleton == null) singleton = new TypeIdGenerator(); 24 | singleton.idGenerator = idGenerator; 25 | return singleton; 26 | } 27 | 28 | @Override 29 | public IdGeneratorGeneric initialize(IdGenerator idGenerator) { 30 | this.idGenerator = idGenerator; 31 | return this; 32 | } 33 | 34 | @Override 35 | public WaveId newWaveId() { 36 | return WaveId.of(idGenerator.getDefaultDomain(), idGenerator.newId(WAVE_ID_PREFIX)); 37 | } 38 | 39 | public String newDocumentId(String prefix) { 40 | return idGenerator.newId(prefix); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/Type.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | public abstract class Type { 4 | 5 | public static Type createInstance(String type, String backendId, Model model) { 6 | 7 | Type instance = null; 8 | 9 | if (StringType.PREFIX.equals(type)) { 10 | 11 | instance = StringType.createAndAttach(model, backendId); 12 | 13 | } else if (ListType.PREFIX.equals(type)) { 14 | 15 | instance = ListType.createAndAttach(model, backendId); 16 | 17 | } else if (MapType.PREFIX.equals(type)) { 18 | 19 | instance = MapType.createAndAttach(model, backendId); 20 | 21 | } else if (TextType.PREFIX.equals(type)) { 22 | 23 | instance = TextType.createAndAttach(model, backendId); 24 | } 25 | 26 | return instance; 27 | } 28 | 29 | protected abstract void attach(String docId); 30 | 31 | protected abstract void deAttach(); 32 | 33 | protected abstract ListElementInitializer getListElementInitializer(); 34 | 35 | protected abstract String getPrefix(); 36 | 37 | protected abstract boolean isAttached(); 38 | 39 | protected abstract String serializeToModel(); 40 | 41 | public abstract String getDocumentId(); 42 | 43 | public abstract Model getModel(); 44 | 45 | public abstract String getType(); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 30 | 31 | *.iml 32 | 33 | ## Directory-based project format: 34 | .idea/ 35 | # if you remove the above rule, at least ignore the following: 36 | 37 | # User-specific stuff: 38 | # .idea/workspace.xml 39 | # .idea/tasks.xml 40 | # .idea/dictionaries 41 | 42 | # Sensitive or high-churn files: 43 | # .idea/dataSources.ids 44 | # .idea/dataSources.xml 45 | # .idea/sqlDataSources.xml 46 | # .idea/dynamic.xml 47 | # .idea/uiDesigner.xml 48 | 49 | # Gradle: 50 | # .idea/gradle.xml 51 | # .idea/libraries 52 | 53 | # Mongo Explorer plugin: 54 | # .idea/mongoSettings.xml 55 | 56 | ## File-based project format: 57 | *.ipr 58 | *.iws 59 | 60 | ## Plugin-specific files: 61 | 62 | # IntelliJ 63 | /out/ 64 | 65 | # mpeltonen/sbt-idea plugin 66 | .idea_modules/ 67 | 68 | # JIRA plugin 69 | atlassian-ide-plugin.xml 70 | 71 | # Crashlytics plugin (for Android Studio and IntelliJ) 72 | com_crashlytics_export_strings.xml 73 | crashlytics.properties 74 | crashlytics-build.properties -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/Scheduler.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | public interface Scheduler { 4 | 5 | public interface Listener { 6 | void onJobExecuted(Schedulable job, int timeSpent); 7 | } 8 | 9 | public interface Schedulable { 10 | } 11 | 12 | public interface Task extends Schedulable { 13 | 14 | void execute(); 15 | } 16 | 17 | public interface IncrementalTask extends Schedulable { 18 | 19 | boolean execute(); 20 | } 21 | 22 | public enum Priority { 23 | CRITICAL, 24 | HIGH, 25 | MEDIUM, 26 | LOW, 27 | INTERNAL_SUPPRESS; 28 | } 29 | 30 | public void noteUserActivity(); 31 | 32 | void schedule(Priority priority, Task task); 33 | 34 | void schedule(Priority priority, IncrementalTask process); 35 | 36 | void scheduleDelayed(Priority priority, Task task, int minimumTime); 37 | 38 | void scheduleDelayed(Priority priority, IncrementalTask process, 39 | int minimumTime); 40 | 41 | void scheduleRepeating(Priority priority, IncrementalTask process, 42 | int minimumTime, int interval); 43 | 44 | void cancel(Schedulable job); 45 | 46 | boolean isScheduled(Schedulable job); 47 | 48 | void addListener(Listener listener); 49 | 50 | void removeListener(Listener listener); 51 | 52 | public String debugShortDescription(); 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/concurrencycontrol/ProxyOperationSink.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.concurrencycontrol; 2 | 3 | import com.google.common.base.Preconditions; 4 | 5 | import org.waveprotocol.wave.model.operation.Operation; 6 | import org.waveprotocol.wave.model.operation.SilentOperationSink; 7 | import org.waveprotocol.wave.model.util.CollectionUtils; 8 | 9 | import java.util.Queue; 10 | 11 | public final class ProxyOperationSink> implements SilentOperationSink { 12 | 13 | private Queue queue; 14 | private SilentOperationSink target; 15 | 16 | private ProxyOperationSink() { 17 | } 18 | 19 | public static > ProxyOperationSink create() { 20 | return new ProxyOperationSink(); 21 | } 22 | 23 | public void setTarget(SilentOperationSink target) { 24 | Preconditions.checkState(this.target == null); 25 | this.target = target; 26 | 27 | if (queue != null) { 28 | while (!queue.isEmpty()) { 29 | target.consume(queue.poll()); 30 | } 31 | queue = null; 32 | } 33 | } 34 | 35 | @Override 36 | public void consume(O op) { 37 | if (target != null) { 38 | target.consume(op); 39 | } else { 40 | if (queue == null) { 41 | queue = CollectionUtils.createQueue(); 42 | } 43 | queue.add(op); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/RemoteWaveViewService.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service; 2 | 3 | import org.waveprotocol.wave.concurrencycontrol.channel.WaveViewService; 4 | import org.waveprotocol.wave.concurrencycontrol.wave.CcDataDocumentImpl; 5 | import org.waveprotocol.wave.model.id.IdFilter; 6 | import org.waveprotocol.wave.model.id.WaveId; 7 | import org.waveprotocol.wave.model.id.WaveletId; 8 | import org.waveprotocol.wave.model.id.WaveletName; 9 | import org.waveprotocol.wave.model.operation.wave.WaveletDelta; 10 | import org.waveprotocol.wave.model.version.HashedVersion; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | import app.android.box.waveprotocol.org.androidwave.service.documents.WaveDocuments; 16 | 17 | 18 | public class RemoteWaveViewService implements WaveViewService { 19 | 20 | public RemoteWaveViewService(WaveId waveId, RemoteViewServiceMultiplexer channel, WaveDocuments documentRegistry) { 21 | } 22 | 23 | @Override 24 | public void viewOpen(IdFilter idFilter, Map> map, OpenCallback openCallback) { 25 | 26 | } 27 | 28 | @Override 29 | public String viewSubmit(WaveletName waveletName, WaveletDelta waveletDelta, String s, SubmitCallback submitCallback) { 30 | return null; 31 | } 32 | 33 | @Override 34 | public void viewClose(WaveId waveId, String s, CloseCallback closeCallback) { 35 | 36 | } 37 | 38 | @Override 39 | public String debugGetProfilingInfo(String s) { 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/inbox_activity.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 13 | 14 | 19 | 20 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/tool_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 22 | 23 | 32 | 33 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/header.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 32 | 33 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/concurrencycontrol/LiveTarget.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.concurrencycontrol; 2 | 3 | import org.waveprotocol.wave.model.operation.Operation; 4 | import org.waveprotocol.wave.model.operation.OperationException; 5 | import org.waveprotocol.wave.model.operation.OperationRuntimeException; 6 | import org.waveprotocol.wave.model.operation.SilentOperationSink; 7 | 8 | public final class LiveTarget> { 9 | 10 | private final T target; 11 | 12 | private final SilentOperationSink executor; 13 | 14 | private final ProxyOperationSink output; 15 | 16 | private LiveTarget(T target, SilentOperationSink executor, ProxyOperationSink output) { 17 | this.target = target; 18 | this.executor = executor; 19 | this.output = output; 20 | } 21 | 22 | public static > LiveTarget create(final T data) { 23 | ProxyOperationSink output = ProxyOperationSink.create(); 24 | SilentOperationSink executor = new SilentOperationSink() { 25 | @Override 26 | public void consume(O operation) { 27 | try { 28 | operation.apply(data); 29 | } catch (OperationException e) { 30 | // Fail this object permanently 31 | throw new OperationRuntimeException("Error applying op", e); 32 | } 33 | } 34 | }; 35 | return new LiveTarget(data, executor, output); 36 | } 37 | 38 | public T getTarget() { 39 | return target; 40 | } 41 | 42 | public SilentOperationSink getExecutorSink() { 43 | return executor; 44 | } 45 | 46 | public ProxyOperationSink getOutputSink() { 47 | return output; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/NavigationDrawerAdapter.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | /** 4 | * Created by Ravi on 29/07/15. 5 | */ 6 | 7 | import android.content.Context; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.TextView; 13 | 14 | import java.util.Collections; 15 | import java.util.List; 16 | 17 | import app.android.box.waveprotocol.org.androidwave.R; 18 | 19 | public class NavigationDrawerAdapter extends RecyclerView.Adapter { 20 | List data = Collections.emptyList(); 21 | private LayoutInflater inflater; 22 | private Context context; 23 | 24 | public NavigationDrawerAdapter(Context context, List data) { 25 | this.context = context; 26 | inflater = LayoutInflater.from(context); 27 | this.data = data; 28 | } 29 | 30 | public void delete(int position) { 31 | data.remove(position); 32 | notifyItemRemoved(position); 33 | } 34 | 35 | @Override 36 | public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 37 | View view = inflater.inflate(R.layout.nav_drawer_row, parent, false); 38 | MyViewHolder holder = new MyViewHolder(view); 39 | return holder; 40 | } 41 | 42 | @Override 43 | public void onBindViewHolder(MyViewHolder holder, int position) { 44 | NavDrawerItem current = data.get(position); 45 | holder.title.setText(current.getTitle()); 46 | } 47 | 48 | @Override 49 | public int getItemCount() { 50 | return data.size(); 51 | } 52 | 53 | class MyViewHolder extends RecyclerView.ViewHolder { 54 | TextView title; 55 | 56 | public MyViewHolder(View itemView) { 57 | super(itemView); 58 | title = (TextView) itemView.findViewById(R.id.title); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/ListElementFactory.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | import org.waveprotocol.wave.model.document.Doc.E; 4 | import org.waveprotocol.wave.model.document.util.DocumentEventRouter; 5 | import org.waveprotocol.wave.model.util.Preconditions; 6 | 7 | import java.util.Map; 8 | 9 | public class ListElementFactory implements 10 | org.waveprotocol.wave.model.adt.docbased.Factory { 11 | 12 | 13 | private Model model; 14 | 15 | protected ListElementFactory(Model model) { 16 | this.model = model; 17 | } 18 | 19 | @Override 20 | public Type adapt(DocumentEventRouter router, E element) { 21 | 22 | Map attributes = router.getDocument().getAttributes(element); 23 | Preconditions.checkArgument(attributes != null, 24 | "Adapting a list element to Type but attributes not found"); 25 | 26 | String type = attributes.get("t"); 27 | Preconditions.checkArgument(type != null, 28 | "Adapting a list element to Type but attribute for type not found"); 29 | 30 | String value = attributes.get("r"); 31 | Preconditions.checkArgument(value != null, 32 | "Adapting a list element to Type but attribute for reference not found"); 33 | 34 | return Type.createInstance(type, value, model); 35 | 36 | } 37 | 38 | @Override 39 | public org.waveprotocol.wave.model.adt.docbased.Initializer createInitializer( 40 | final ListElementInitializer initialState) { 41 | 42 | return new org.waveprotocol.wave.model.adt.docbased.Initializer() { 43 | 44 | @Override 45 | public void initialize(Map target) { 46 | target.put("t", initialState.getType()); 47 | if (initialState.getBackendId() != null) { 48 | target.put("r", initialState.getBackendId()); 49 | } 50 | } 51 | 52 | }; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/Friendadapter.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import app.android.box.waveprotocol.org.androidwave.R; 12 | 13 | /** 14 | * Created by roellk on 8/15/2015. 15 | */ 16 | public class Friendadapter extends BaseAdapter{ 17 | private Context context; 18 | String[] friendNames; 19 | int[] images = {R.drawable.letter_a,R.drawable.letter_r,R.drawable.letter_e,R.drawable.letter_g,R.drawable.letter_u,R.drawable.letter_b,R.drawable.letter_m,R.drawable.letter_p,R.drawable.letter_y,R.drawable.letter_d}; 20 | 21 | public Friendadapter(Context context){ 22 | this.context = context; 23 | friendNames = context.getResources().getStringArray(R.array.friend_names); 24 | } 25 | 26 | @Override 27 | public int getCount() { 28 | return friendNames.length; 29 | } 30 | 31 | @Override 32 | public Object getItem(int position) { 33 | return friendNames[position]; 34 | } 35 | 36 | @Override 37 | public long getItemId(int position) { 38 | return position; 39 | } 40 | 41 | @Override 42 | public View getView(int position, View convertView, ViewGroup parent) { 43 | View row =null; 44 | if(convertView == null){ 45 | 46 | LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 47 | row = inflater.inflate(R.layout.custom_row,parent,false); 48 | }else{ 49 | row = convertView; 50 | } 51 | TextView textViewFriend =(TextView) row.findViewById(R.id.textViewFriend); 52 | ImageView imageViewFriend = (ImageView)row.findViewById(R.id.imageViewFriend); 53 | 54 | textViewFriend.setText(friendNames[position]); 55 | imageViewFriend.setImageResource(images[position]); 56 | return row; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/MessageAdapter.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import app.android.box.waveprotocol.org.androidwave.R; 12 | 13 | /** 14 | * Created by roellk on 8/19/2015. 15 | */ 16 | public class MessageAdapter extends BaseAdapter { 17 | private Context context; 18 | String[] header; 19 | String[] content; 20 | int[] images = {R.drawable.letter_a,R.drawable.letter_r,R.drawable.letter_e,R.drawable.letter_g,R.drawable.letter_u,R.drawable.letter_b,R.drawable.letter_m,R.drawable.letter_p,R.drawable.letter_y,R.drawable.letter_d}; 21 | 22 | public MessageAdapter(Context context){ 23 | this.context = context; 24 | header = context.getResources().getStringArray(R.array.friend_names); 25 | content = context.getResources().getStringArray(R.array.friend_names2); 26 | } 27 | 28 | @Override 29 | public int getCount() { 30 | return header.length; 31 | } 32 | 33 | @Override 34 | public Object getItem(int position) { 35 | return header[position]; 36 | } 37 | 38 | @Override 39 | public long getItemId(int position) { 40 | return position; 41 | } 42 | 43 | @Override 44 | public View getView(int position, View convertView, ViewGroup parent) { 45 | View row =null; 46 | if(convertView == null){ 47 | 48 | LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 49 | row = inflater.inflate(R.layout.custom_message_row,parent,false); 50 | }else{ 51 | row = convertView; 52 | } 53 | TextView textViewHeader =(TextView) row.findViewById(R.id.textViewHeader); 54 | TextView textViewContent =(TextView) row.findViewById(R.id.textViewContent); 55 | ImageView imageViewFriend = (ImageView)row.findViewById(R.id.imageViewMessage); 56 | 57 | 58 | textViewHeader.setText(header[position]); 59 | textViewContent.setText(content[position]); 60 | imageViewFriend.setImageResource(images[position]); 61 | return row; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/WaveSignUp.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service; 2 | 3 | import android.content.Intent; 4 | import android.os.AsyncTask; 5 | import android.widget.Toast; 6 | 7 | import java.io.IOException; 8 | import java.io.OutputStream; 9 | import java.io.UnsupportedEncodingException; 10 | import java.net.HttpURLConnection; 11 | import java.net.URL; 12 | import java.net.URLEncoder; 13 | 14 | import app.android.box.waveprotocol.org.androidwave.util.Util; 15 | 16 | public class WaveSignUp { 17 | 18 | private static final String CHARSET = "utf-8"; 19 | 20 | /** 21 | * This method get Wave server name, Wave user's username and Wave user's password as input parameters 22 | * and it will invoke UserRegistrationServlet in the Wave server. If sign up get success the method 23 | * will return true if not it return false 24 | * 25 | * @param host Apache Wave hostname 26 | * @param username Apache Wave user's username 27 | * @param password Apache Wave user's password 28 | * @return True or false 29 | */ 30 | 31 | public boolean waveSignUp(String host, String username, String password) { 32 | 33 | String servlet = "auth/register"; 34 | String hostURL = Util.hostCreator(host, servlet); 35 | String httpQuery = ""; 36 | HttpURLConnection connection = null; 37 | 38 | try { 39 | httpQuery = "address=" + URLEncoder.encode(username, CHARSET) + "&password=" 40 | + URLEncoder.encode(password, CHARSET); 41 | } catch (UnsupportedEncodingException e) { 42 | e.printStackTrace(); 43 | } 44 | 45 | try { 46 | URL url = new URL(hostURL); 47 | connection = (HttpURLConnection) url.openConnection(); 48 | connection.setDoOutput(true); 49 | connection.setRequestProperty("Accept-Charset", CHARSET); 50 | connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" 51 | + CHARSET); 52 | 53 | OutputStream out = connection.getOutputStream(); 54 | out.write(httpQuery.getBytes(CHARSET)); 55 | 56 | return connection.getResponseCode() == 200; 57 | 58 | } catch (IOException e) { 59 | e.printStackTrace(); 60 | return false; 61 | } finally { 62 | connection.disconnect(); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/MainActivity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package app.android.box.waveprotocol.org.androidwave.activities; 21 | 22 | import android.app.Activity; 23 | import android.content.Intent; 24 | import android.os.Bundle; 25 | import android.view.animation.Animation; 26 | import android.view.animation.AnimationUtils; 27 | import android.widget.ImageView; 28 | 29 | import app.android.box.waveprotocol.org.androidwave.R; 30 | 31 | 32 | public class MainActivity extends Activity{ 33 | 34 | Animation move; 35 | ImageView myImageView; 36 | 37 | @Override 38 | protected void onCreate(Bundle savedInstanceState) { 39 | super.onCreate(savedInstanceState); 40 | setContentView(R.layout.main_activity); 41 | 42 | myImageView = (ImageView) findViewById(R.id.myImage); 43 | move = AnimationUtils.loadAnimation(getApplicationContext(), 44 | R.anim.move); 45 | myImageView.startAnimation(move); 46 | 47 | 48 | Thread timer = new Thread(){ 49 | public void run(){ 50 | try { 51 | sleep(2000); 52 | }catch (InterruptedException e){ 53 | e.printStackTrace(); 54 | }finally { 55 | Intent openLoginActivity = new Intent("app.android.box.waveprotocol.org.androidwave.LOGINACTIVITY"); 56 | startActivity(openLoginActivity); 57 | } 58 | } 59 | }; 60 | timer.start(); 61 | } 62 | 63 | @Override 64 | protected void onPause() { 65 | super.onPause(); 66 | finish(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/res/layout/login_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | 20 | 25 | 30 | 31 | 32 | 33 | 38 | 43 | 44 | 45 | 53 | 54 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Android Wave 4 | Inbox 5 | Create Wave 6 | 7 | Hello world! 8 | Settings 9 | 10 | Inbox 11 | Inbox 12 | 13 | Search 14 | 15 | Search wave 16 | 17 | Search 18 | Open 19 | Close 20 | 21 | Inbox 22 | Friends 23 | Waves 24 | Sign out 25 | 26 | 27 | 28 | @string/nav_item_home 29 | @string/nav_item_friends 30 | @string/nav_item_notifications 31 | @string/nav_item_signout 32 | 33 | 34 | Waves 35 | Friends 36 | Inbox 37 | Sign out 38 | 39 | 40 | Ali 41 | Roshan 42 | Evan 43 | Grobmeier 44 | Upayavira 45 | Blossom 46 | Michael 47 | Pablo 48 | Yuri 49 | Dain 50 | 51 | 52 | 53 | >wave message from Ali 54 | >wave message from Roshan 55 | >wave message from Evan 56 | >wave message from Grobmeier 57 | >wave message from Upayavira 58 | >wave message from Blossom 59 | >wave message from Michael 60 | >wave message from Pablo 61 | >wave message from Yuri 62 | >wave message from Dain 63 | 64 | 65 | Forward 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/SelectFriendFragment.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | /** 4 | * Created by Ravi on 29/07/15. 5 | */ 6 | import android.app.Activity; 7 | import android.os.Bundle; 8 | import android.support.v4.app.ListFragment; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.ListView; 13 | import android.widget.Toast; 14 | 15 | import app.android.box.waveprotocol.org.androidwave.R; 16 | 17 | 18 | public class SelectFriendFragment extends ListFragment { 19 | 20 | Friendadapter friendadapter; 21 | 22 | public SelectFriendFragment() { 23 | // Required empty public constructor 24 | } 25 | 26 | @Override 27 | public void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | 30 | // String[] values = new String[] { "friend1", "friend2", "friend3", 31 | // "friend4", "friend5", "friend6", "friend7", "friend8", 32 | // "friend9", "friend10" }; 33 | // 34 | // ArrayAdapter adapter = new ArrayAdapter(getActivity(), 35 | // android.R.layout.simple_list_item_1, values); 36 | // setListAdapter(adapter); 37 | 38 | 39 | // ArrayAdapter adapter = new ArrayAdapter(getActivity(), 40 | // android.R.layout.simple_list_item_1, values); 41 | 42 | friendadapter = new Friendadapter(getActivity()); 43 | setListAdapter(friendadapter); 44 | 45 | } 46 | 47 | @Override 48 | public void onListItemClick(ListView l, View v, int position, long id) { 49 | String item = (String) getListAdapter().getItem(position); 50 | Toast.makeText(getActivity(), item + " selected", Toast.LENGTH_LONG).show(); 51 | // ImageView img= (ImageView) findViewById(R.id.image); 52 | // img.setImageResource(R.drawable.my_image); 53 | 54 | // ImageView img = new ImageView(this); 55 | // img.setImageResource(R.drawable.my_image); 56 | 57 | } 58 | 59 | @Override 60 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 61 | Bundle savedInstanceState) { 62 | View rootView = inflater.inflate(R.layout.select_friend_fragment, container, false); 63 | // Inflate the layout for this fragment 64 | return rootView; 65 | } 66 | 67 | @Override 68 | public void onAttach(Activity activity) { 69 | super.onAttach(activity); 70 | } 71 | 72 | @Override 73 | public void onDetach() { 74 | super.onDetach(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/scheduler/BrowserBackedScheduler.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.scheduler; 2 | 3 | import java.util.TimerTask; 4 | 5 | public class BrowserBackedScheduler implements Scheduler { 6 | 7 | private final JobRegistry jobs; 8 | private final SimpleTimer timer; 9 | private final Controller controller; 10 | private double nextSliceRunTime = Double.MAX_VALUE; 11 | private int timeSliceMillis = 100; 12 | 13 | public BrowserBackedScheduler(SimpleTimer.Factory timerFactory, Controller controller) { 14 | this.timer = timerFactory.create(runner); 15 | this.controller = controller; 16 | this.jobs = new JobRegistry(controller); 17 | } 18 | 19 | private final TimerTask runner = new TimerTask() { 20 | 21 | @Override 22 | public void run() { 23 | nextSliceRunTime = Double.MAX_VALUE; 24 | workSlice(timeSliceMillis); 25 | double next = getNextRunTime(); 26 | if (next == 0) { 27 | maybeScheduleSlice(); 28 | } else if (next > 0) { 29 | maybeScheduleSlice(next); 30 | } 31 | } 32 | }; 33 | 34 | private void workSlice(int maxMillis) { 35 | 36 | } 37 | 38 | private double getNextRunTime() { 39 | return 0; 40 | } 41 | 42 | private void maybeScheduleSlice(){ 43 | 44 | } 45 | 46 | private void maybeScheduleSlice(double when){ 47 | 48 | } 49 | 50 | @Override 51 | public void noteUserActivity() { 52 | 53 | } 54 | 55 | @Override 56 | public void schedule(Priority priority, Task task) { 57 | 58 | } 59 | 60 | @Override 61 | public void schedule(Priority priority, IncrementalTask process) { 62 | 63 | } 64 | 65 | @Override 66 | public void scheduleDelayed(Priority priority, Task task, int minimumTime) { 67 | 68 | } 69 | 70 | @Override 71 | public void scheduleDelayed(Priority priority, IncrementalTask process, int minimumTime) { 72 | 73 | } 74 | 75 | @Override 76 | public void scheduleRepeating(Priority priority, IncrementalTask process, int minimumTime, int interval) { 77 | 78 | } 79 | 80 | @Override 81 | public void cancel(Schedulable job) { 82 | 83 | } 84 | 85 | @Override 86 | public boolean isScheduled(Schedulable job) { 87 | return false; 88 | } 89 | 90 | @Override 91 | public void addListener(Listener listener) { 92 | 93 | } 94 | 95 | @Override 96 | public void removeListener(Listener listener) { 97 | 98 | } 99 | 100 | @Override 101 | public String debugShortDescription() { 102 | return null; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/InboxFragment.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | /** 4 | * Created by Ravi on 29/07/15. 5 | */ 6 | import android.app.Activity; 7 | import android.content.Intent; 8 | import android.os.Bundle; 9 | import android.support.design.widget.FloatingActionButton; 10 | import android.support.v4.app.ListFragment; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.widget.ListView; 15 | import android.widget.Toast; 16 | 17 | import app.android.box.waveprotocol.org.androidwave.R; 18 | 19 | 20 | public class InboxFragment extends ListFragment { 21 | 22 | MessageAdapter myadapter; 23 | 24 | public InboxFragment() { 25 | // Required empty public constructor 26 | } 27 | 28 | @Override 29 | public void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | 32 | // String[] values = new String[] { "Message1", "Message2", "Message3", 33 | // "Message4", "Message5", "Message6", "Message7", "Message8", 34 | // "Message9", "Message10" }; 35 | // 36 | // ArrayAdapter adapter = new ArrayAdapter(getActivity(), 37 | // android.R.layout.simple_list_item_1, values); 38 | // setListAdapter(adapter); 39 | myadapter = new MessageAdapter(getActivity()); 40 | setListAdapter(myadapter); 41 | 42 | } 43 | 44 | @Override 45 | public void onListItemClick(ListView l, View v, int position, long id) { 46 | String item = (String) getListAdapter().getItem(position); 47 | Toast.makeText(getActivity(), item + " selected", Toast.LENGTH_LONG).show(); 48 | // ImageView img= (ImageView) findViewById(R.id.image); 49 | // img.setImageResource(R.drawable.my_image); 50 | 51 | // ImageView img = new ImageView(this); 52 | // img.setImageResource(R.drawable.my_image); 53 | 54 | } 55 | 56 | @Override 57 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 58 | Bundle savedInstanceState) { 59 | View rootView = inflater.inflate(R.layout.inbox_fragment, container, false); 60 | 61 | 62 | FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab); 63 | 64 | fab.setOnClickListener(new View.OnClickListener() { 65 | @Override 66 | public void onClick(View v) { 67 | Intent openNewWavectivity = new Intent("app.android.box.waveprotocol.org.androidwave.NEWWAVEACTIVITY"); 68 | startActivity(openNewWavectivity); 69 | //test5 70 | //setContentView(R.layout.activity_new_wave); 71 | } 72 | }); 73 | // Inflate the layout for this fragment 74 | return rootView; 75 | } 76 | 77 | @Override 78 | public void onAttach(Activity activity) { 79 | super.onAttach(activity); 80 | } 81 | 82 | @Override 83 | public void onDetach() { 84 | super.onDetach(); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/res/layout/signup_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 38 | 43 | 44 | 45 | 46 | 51 | 56 | 57 | 58 | 66 | 67 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/documents/WaveDocuments.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.documents; 2 | 3 | import com.google.common.base.Preconditions; 4 | 5 | import org.waveprotocol.wave.model.conversation.ConversationBlip; 6 | import org.waveprotocol.wave.model.document.operation.DocInitialization; 7 | import org.waveprotocol.wave.model.id.IdUtil; 8 | import org.waveprotocol.wave.model.id.ModernIdSerialiser; 9 | import org.waveprotocol.wave.model.id.WaveletId; 10 | import org.waveprotocol.wave.model.util.CollectionUtils; 11 | import org.waveprotocol.wave.model.util.StringMap; 12 | import org.waveprotocol.wave.model.wave.data.DocumentFactory; 13 | import org.waveprotocol.wave.model.wave.data.DocumentOperationSink; 14 | 15 | public final class WaveDocuments 16 | implements DocumentFactory, DocumentRegistry { 17 | 18 | private final DocumentFactory blipDocFactory; 19 | private final DocumentFactory dataDocFactory; 20 | private final StringMap> blips = CollectionUtils.createStringMap(); 21 | 22 | private WaveDocuments(DocumentFactory blip, DocumentFactory data) { 23 | this.blipDocFactory = blip; 24 | this.dataDocFactory = data; 25 | } 26 | 27 | public static WaveDocuments create( 28 | DocumentFactory blipDocFactory, DocumentFactory dataDocFactory) { 29 | return new WaveDocuments(blipDocFactory, dataDocFactory); 30 | } 31 | 32 | @Override 33 | public DocumentOperationSink create( 34 | final WaveletId waveletId, final String blipId, final DocInitialization content) { 35 | 36 | String waveletIdStr = ModernIdSerialiser.INSTANCE.serialiseWaveletId(waveletId); 37 | if (IdUtil.isBlipId(blipId)) { 38 | BlipDocument document = blipDocFactory.create(waveletId, blipId, content); 39 | StringMap convDocuments = getConversationDocuments(waveletIdStr); 40 | Preconditions.checkState(!convDocuments.containsKey(blipId)); 41 | convDocuments.put(blipId, document); 42 | return document; 43 | } else { 44 | return dataDocFactory.create(waveletId, blipId, content); 45 | } 46 | } 47 | 48 | private StringMap getConversationDocuments(String id) { 49 | StringMap convDocuments = blips.get(id); 50 | if (convDocuments == null) { 51 | convDocuments = CollectionUtils.createStringMap(); 52 | blips.put(id, convDocuments); 53 | } 54 | return convDocuments; 55 | } 56 | 57 | public BlipDocument get(ConversationBlip blip) { 58 | return getBlipDocument(blip.getConversation().getId(), blip.getId()); 59 | } 60 | 61 | public BlipDocument getBlipDocument(String waveletId, String docId) { 62 | StringMap convDocuments = blips.get(waveletId); 63 | return convDocuments != null ? convDocuments.get(docId) : null; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/ChatNewWaveActivity.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentTransaction; 9 | import android.support.v4.app.NavUtils; 10 | import android.support.v7.app.AppCompatActivity; 11 | import android.support.v7.widget.Toolbar; 12 | import android.view.Menu; 13 | import android.view.MenuItem; 14 | import android.widget.ImageButton; 15 | 16 | 17 | import app.android.box.waveprotocol.org.androidwave.R; 18 | 19 | /** 20 | * Created by roellk on 8/23/2015. 21 | */ 22 | public class ChatNewWaveActivity extends AppCompatActivity { 23 | 24 | private Toolbar mToolbar; 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.chat_new_wave_activtiy); 29 | 30 | mToolbar = (Toolbar) findViewById(R.id.toolbar); 31 | 32 | setSupportActionBar(mToolbar); 33 | getSupportActionBar().setHomeButtonEnabled(true); 34 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 35 | 36 | Fragment fragment = null; 37 | String title = getString(R.string.app_name); 38 | ImageButton myImage; 39 | 40 | 41 | fragment = new ChatNewWaveFragment(); 42 | title = getString(R.string.new_wave_name); 43 | 44 | 45 | if (fragment != null) { 46 | FragmentManager fragmentManager = getSupportFragmentManager(); 47 | FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); 48 | fragmentTransaction.replace(R.id.container_body_chat_newWave, fragment); 49 | fragmentTransaction.commit(); 50 | 51 | // set the toolbar title 52 | getSupportActionBar().setTitle(title); 53 | } 54 | } 55 | 56 | @Override 57 | public boolean onCreateOptionsMenu(Menu menu) { 58 | // Inflate the menu; this adds items to the action bar if it is present. 59 | getMenuInflater().inflate(R.menu.menu_main2, menu); 60 | return true; 61 | } 62 | 63 | @Override 64 | public boolean onOptionsItemSelected(MenuItem item) { 65 | // Handle action bar item clicks here. The action bar will 66 | // automatically handle clicks on the Home/Up button, so long 67 | // as you specify a parent activity in AndroidManifest.xml. 68 | int id = item.getItemId(); 69 | 70 | if(id == R.id.home){ 71 | NavUtils.navigateUpFromSameTask(this); 72 | } 73 | //noinspection SimplifiableIfStatement 74 | if (id == R.id.action_settings) { 75 | return true; 76 | } 77 | 78 | if (id == R.id.action_forward) { 79 | Intent openLoginActivity = new Intent("app.android.box.waveprotocol.org.androidwave.INBOXACTIVITY"); 80 | startActivity(openLoginActivity); 81 | } 82 | 83 | return super.onOptionsItemSelected(item); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/LoginActivity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | *

10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | *

12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package app.android.box.waveprotocol.org.androidwave.activities; 21 | 22 | import android.app.Activity; 23 | import android.content.Intent; 24 | import android.os.Bundle; 25 | import android.view.View; 26 | import android.widget.Button; 27 | import android.widget.EditText; 28 | import android.widget.TextView; 29 | 30 | import app.android.box.waveprotocol.org.androidwave.R; 31 | import app.android.box.waveprotocol.org.androidwave.service.WaveService; 32 | 33 | public class LoginActivity extends Activity { 34 | 35 | Button login; 36 | TextView sighup; 37 | EditText username; 38 | EditText password; 39 | 40 | // AsyncTask waveSignInTask; 41 | 42 | @Override 43 | protected void onCreate(Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | setContentView(R.layout.login_activity); 46 | 47 | login = (Button) findViewById(R.id.btn_login); 48 | sighup = (TextView) findViewById(R.id.link_signup); 49 | username = (EditText) findViewById(R.id.input_email); 50 | password = (EditText) findViewById(R.id.input_password); 51 | 52 | login.setOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View v) { 55 | //startLoginSession(Util.getHostAndUserNames(username.getText().toString())[1], Util.getHostAndUserNames(username.getText().toString())[0], password.getText().toString()); 56 | Intent openLoginActivity = new Intent("app.android.box.waveprotocol.org.androidwave.INBOXACTIVITY"); 57 | startActivity(openLoginActivity); 58 | // Intent openTest= new Intent("app.android.box.waveprotocol.org.androidwave.TEST"); 59 | // startActivity(openTest); 60 | } 61 | }); 62 | 63 | sighup.setOnClickListener(new View.OnClickListener() { 64 | @Override 65 | public void onClick(View v) { 66 | Intent openSignupActivity = new Intent("app.android.box.waveprotocol.org.androidwave.SINGUPACTIVITY"); 67 | startActivity(openSignupActivity); 68 | } 69 | }); 70 | 71 | } 72 | 73 | private void startLoginSession(String hostname, String username, String password) { 74 | WaveService waveService = new WaveService(); 75 | waveService.waveLoginTask(hostname, username, password); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/concurrencycontrol/WaveletOperationalizer.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.concurrencycontrol; 2 | 3 | import com.google.common.base.Preconditions; 4 | 5 | import org.waveprotocol.wave.model.id.ModernIdSerialiser; 6 | import org.waveprotocol.wave.model.id.WaveId; 7 | import org.waveprotocol.wave.model.operation.wave.WaveletOperation; 8 | import org.waveprotocol.wave.model.operation.wave.WaveletOperationContext; 9 | import org.waveprotocol.wave.model.operation.wave.BasicWaveletOperationContextFactory; 10 | import org.waveprotocol.wave.model.operation.wave.WaveletOperationContext.Factory; 11 | import org.waveprotocol.wave.model.util.CollectionUtils; 12 | import org.waveprotocol.wave.model.util.ReadableStringMap; 13 | import org.waveprotocol.wave.model.util.StringMap; 14 | import org.waveprotocol.wave.model.wave.ParticipantId; 15 | import org.waveprotocol.wave.model.wave.ParticipationHelper; 16 | import org.waveprotocol.wave.model.wave.data.ObservableWaveletData; 17 | import org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet; 18 | 19 | import java.util.Collection; 20 | 21 | public class WaveletOperationalizer { 22 | 23 | private final WaveId waveId; 24 | private final StringMap> wavelets = 25 | CollectionUtils.createStringMap(); 26 | private final WaveletOperationContext.Factory opContextFactory; 27 | 28 | private WaveletOperationalizer(WaveId waveId, Factory opContextFactory) { 29 | this.waveId = waveId; 30 | this.opContextFactory = opContextFactory; 31 | } 32 | 33 | public static WaveletOperationalizer create(WaveId wave, ParticipantId user) { 34 | WaveletOperationContext.Factory opContexts = new BasicWaveletOperationContextFactory(user); 35 | return new WaveletOperationalizer(wave, opContexts); 36 | } 37 | 38 | public OpBasedWavelet operationalize(ObservableWaveletData data) { 39 | LiveTarget target = createSinks(data); 40 | return new OpBasedWavelet(waveId, 41 | data, 42 | opContextFactory, 43 | ParticipationHelper.DEFAULT, 44 | target.getExecutorSink(), 45 | target.getOutputSink()); 46 | } 47 | 48 | private LiveTarget createSinks( 49 | ObservableWaveletData data) { 50 | return putAndReturn(wavelets, 51 | ModernIdSerialiser.INSTANCE.serialiseWaveletId(data.getWaveletId()), 52 | LiveTarget.create(data)); 53 | } 54 | 55 | private static V putAndReturn(StringMap map, String key, V value) { 56 | Preconditions.checkState(!map.containsKey(key)); 57 | map.put(key, value); 58 | return value; 59 | } 60 | 61 | public Collection getWavelets() { 62 | final Collection targets = CollectionUtils.createQueue(); 63 | this.wavelets.each(new ReadableStringMap.ProcV>() { 64 | @Override 65 | public void apply(String id, LiveTarget triple) { 66 | targets.add(triple.getTarget()); 67 | } 68 | }); 69 | return targets; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/SelectFriendActivity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | *

10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | *

12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package app.android.box.waveprotocol.org.androidwave.activities; 21 | 22 | import android.content.Intent; 23 | import android.os.Bundle; 24 | import android.support.v4.app.Fragment; 25 | import android.support.v4.app.FragmentManager; 26 | import android.support.v4.app.FragmentTransaction; 27 | import android.support.v4.app.NavUtils; 28 | import android.support.v7.app.AppCompatActivity; 29 | import android.support.v7.widget.Toolbar; 30 | import android.view.Menu; 31 | import android.view.MenuItem; 32 | import android.widget.ImageButton; 33 | 34 | import app.android.box.waveprotocol.org.androidwave.R; 35 | 36 | public class SelectFriendActivity extends AppCompatActivity{ 37 | private Toolbar mToolbar; 38 | 39 | @Override 40 | protected void onCreate(Bundle savedInstanceState) { 41 | super.onCreate(savedInstanceState); 42 | setContentView(R.layout.select_friend_activity); 43 | 44 | mToolbar = (Toolbar) findViewById(R.id.toolbar); 45 | 46 | setSupportActionBar(mToolbar); 47 | getSupportActionBar().setHomeButtonEnabled(true); 48 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 49 | 50 | Fragment fragment = null; 51 | String title = getString(R.string.app_name); 52 | ImageButton myImage; 53 | 54 | 55 | fragment = new SelectFriendFragment(); 56 | title = getString(R.string.title_friends); 57 | 58 | 59 | if (fragment != null) { 60 | FragmentManager fragmentManager = getSupportFragmentManager(); 61 | FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); 62 | fragmentTransaction.replace(R.id.container_body_newWave, fragment); 63 | fragmentTransaction.commit(); 64 | 65 | // set the toolbar title 66 | getSupportActionBar().setTitle(title); 67 | } 68 | } 69 | 70 | @Override 71 | public boolean onCreateOptionsMenu(Menu menu) { 72 | // Inflate the menu; this adds items to the action bar if it is present. 73 | getMenuInflater().inflate(R.menu.menu_main2, menu); 74 | return true; 75 | } 76 | 77 | @Override 78 | public boolean onOptionsItemSelected(MenuItem item) { 79 | // Handle action bar item clicks here. The action bar will 80 | // automatically handle clicks on the Home/Up button, so long 81 | // as you specify a parent activity in AndroidManifest.xml. 82 | int id = item.getItemId(); 83 | 84 | if(id == R.id.home){ 85 | NavUtils.navigateUpFromSameTask(this); 86 | } 87 | //noinspection SimplifiableIfStatement 88 | if (id == R.id.action_settings) { 89 | return true; 90 | } 91 | 92 | if (id == R.id.action_forward) { 93 | Intent openChatNewWaveActivity = new Intent("app.android.box.waveprotocol.org.androidwave.CHATNEWWAVEACTIVITY"); 94 | startActivity(openChatNewWaveActivity); 95 | } 96 | 97 | return super.onOptionsItemSelected(item); 98 | } 99 | 100 | // 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/SignUpActivity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | *

10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | *

12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package app.android.box.waveprotocol.org.androidwave.activities; 21 | 22 | import android.app.Activity; 23 | import android.content.Intent; 24 | import android.os.AsyncTask; 25 | import android.os.Bundle; 26 | import android.view.View; 27 | import android.widget.Button; 28 | import android.widget.EditText; 29 | import android.widget.TextView; 30 | import android.widget.Toast; 31 | 32 | import app.android.box.waveprotocol.org.androidwave.R; 33 | import app.android.box.waveprotocol.org.androidwave.service.WaveService; 34 | import app.android.box.waveprotocol.org.androidwave.util.Util; 35 | 36 | public class SignUpActivity extends Activity { 37 | 38 | EditText username; 39 | EditText password; 40 | EditText reEnterPassword; 41 | Button signUp; 42 | TextView signIn; 43 | 44 | AsyncTask waveSignUpTask; 45 | 46 | @Override 47 | protected void onCreate(Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | setContentView(R.layout.signup_activity); 50 | 51 | username = (EditText) findViewById(R.id.input_username); 52 | password = (EditText) findViewById(R.id.input_password); 53 | reEnterPassword = (EditText) findViewById(R.id.input_reEnterPassword); 54 | signUp = (Button) findViewById(R.id.btn_signIn); 55 | signIn = (TextView) findViewById(R.id.link_signup); 56 | 57 | waveSignUpTask = new AsyncTask() { 58 | 59 | @Override 60 | protected Boolean doInBackground(String... params) { 61 | WaveService waveService = new WaveService(); 62 | return waveService.waveSignUpTask(params[0], params[1], params[2]); 63 | } 64 | 65 | 66 | @Override 67 | protected void onPostExecute(Boolean signUpResult) { 68 | if (signUpResult) { 69 | Intent openLoginActivity = new Intent("app.android.box.waveprotocol.org.androidwave.LOGINACTIVITY"); 70 | startActivity(openLoginActivity); 71 | Toast.makeText(SignUpActivity.this, "User sign up successfully", Toast.LENGTH_LONG).show(); 72 | } else { 73 | Toast.makeText(SignUpActivity.this, "User sign up fail", Toast.LENGTH_LONG).show(); 74 | Toast.makeText(SignUpActivity.this, "Please try again later...", Toast.LENGTH_LONG).show(); 75 | } 76 | } 77 | }; 78 | 79 | signUp.setOnClickListener(new View.OnClickListener() { 80 | @Override 81 | public void onClick(View v) { 82 | waveSignUpTask.execute(Util.getHostAndUserNames(username.getText().toString())[1], Util.getHostAndUserNames(username.getText().toString())[0], password.getText().toString()); 83 | } 84 | }); 85 | 86 | signIn.setOnClickListener(new View.OnClickListener() { 87 | @Override 88 | public void onClick(View v) { 89 | Intent openLoginActivity = new Intent("app.android.box.waveprotocol.org.androidwave.LOGINACTIVITY"); 90 | startActivity(openLoginActivity); 91 | } 92 | }); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/WaveSignIn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | *

10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | *

12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package app.android.box.waveprotocol.org.androidwave.service; 21 | 22 | import android.util.Log; 23 | 24 | import java.io.OutputStream; 25 | import java.io.UnsupportedEncodingException; 26 | import java.net.HttpURLConnection; 27 | import java.net.URL; 28 | import java.net.URLEncoder; 29 | import java.util.List; 30 | 31 | import app.android.box.waveprotocol.org.androidwave.util.Util; 32 | 33 | public class WaveSignIn { 34 | 35 | private static final String CHARSET = "utf-8"; 36 | private static String WAVE_SESSION_COOKIE = "WSESSIONID"; 37 | 38 | /** 39 | * This method get Wave server name, Wave user's username and Wave user's password as input parameters 40 | * and it will invoke AuthenticationServlet in the Wave server. If sign in get success the method 41 | * will return session id 42 | * 43 | * @param host Apache Wave hostname 44 | * @param username Apache Wave user's username 45 | * @param password Apache Wave user's password 46 | * @return Apache Wave user's sessionId 47 | */ 48 | public String waveSignIn(String host, String username, String password) { 49 | 50 | String sessionId = null; 51 | 52 | String servlet = "auth/signin?r=none"; 53 | String hostURL = Util.hostCreator(host, servlet); 54 | String httpQuery = ""; 55 | HttpURLConnection connection = null; 56 | 57 | try { 58 | httpQuery = "address=" + URLEncoder.encode(username, "UTF-8") + "&password=" 59 | + URLEncoder.encode(password, CHARSET) + "&signIn=" 60 | + URLEncoder.encode("Sign+in", CHARSET); 61 | 62 | } catch (UnsupportedEncodingException e) { 63 | e.printStackTrace(); 64 | } 65 | 66 | try { 67 | 68 | URL url = new URL(hostURL); 69 | connection = (HttpURLConnection) url.openConnection(); 70 | 71 | connection.setDoOutput(true); 72 | connection.setRequestProperty("Accept-Charset", CHARSET); 73 | connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" 74 | + CHARSET); 75 | 76 | OutputStream out = connection.getOutputStream(); 77 | out.write(httpQuery.getBytes(CHARSET)); 78 | 79 | 80 | if (connection.getResponseCode() == 200) { 81 | 82 | List cookies = connection.getHeaderFields().get("Set-Cookie"); 83 | 84 | for (String c : cookies) { 85 | if (c.startsWith(WAVE_SESSION_COOKIE)) { 86 | 87 | String cookie = c; 88 | 89 | if (cookie.contains(";")) 90 | cookie = cookie.split(";")[0]; 91 | 92 | sessionId = cookie.split("=")[1]; 93 | break; 94 | } 95 | } 96 | 97 | } 98 | 99 | } catch (Exception e) { 100 | e.printStackTrace(); 101 | return sessionId; 102 | } finally { 103 | 104 | if(connection != null){ 105 | connection.disconnect(); 106 | } 107 | } 108 | 109 | return sessionId; 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/DataSource.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.Drawable; 5 | 6 | import java.util.ArrayList; 7 | 8 | /** 9 | * @author amulya 10 | * @datetime 17 Oct 2014, 3:49 PM 11 | */ 12 | public class DataSource { 13 | 14 | public static final int NO_NAVIGATION = -1; 15 | 16 | private ArrayList mDataSource; 17 | private DrawableProvider mProvider; 18 | 19 | public DataSource(Context context) { 20 | mProvider = new DrawableProvider(context); 21 | mDataSource = new ArrayList(); 22 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_RECT)); 23 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_ROUND_RECT)); 24 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_ROUND)); 25 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_RECT_BORDER)); 26 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_ROUND_RECT_BORDER)); 27 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_ROUND_BORDER)); 28 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_MULTIPLE_LETTERS)); 29 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_FONT)); 30 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_SIZE)); 31 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_ANIMATION)); 32 | mDataSource.add(itemFromType(DrawableProvider.SAMPLE_MISC)); 33 | } 34 | 35 | public int getCount() { 36 | return mDataSource.size(); 37 | } 38 | 39 | public DataItem getItem(int position) { 40 | return mDataSource.get(position); 41 | } 42 | 43 | private DataItem itemFromType(int type) { 44 | String label = null; 45 | Drawable drawable = null; 46 | switch (type) { 47 | case DrawableProvider.SAMPLE_RECT: 48 | label = "Rectangle with Text"; 49 | drawable = mProvider.getRect("A"); 50 | break; 51 | case DrawableProvider.SAMPLE_ROUND_RECT: 52 | label = "Round Corner with Text"; 53 | drawable = mProvider.getRoundRect("B"); 54 | break; 55 | case DrawableProvider.SAMPLE_ROUND: 56 | label = "Round with Text"; 57 | drawable = mProvider.getRound("C"); 58 | break; 59 | case DrawableProvider.SAMPLE_RECT_BORDER: 60 | label = "Rectangle with Border"; 61 | drawable = mProvider.getRectWithBorder("D"); 62 | break; 63 | case DrawableProvider.SAMPLE_ROUND_RECT_BORDER: 64 | label = "Round Corner with Border"; 65 | drawable = mProvider.getRoundRectWithBorder("E"); 66 | break; 67 | case DrawableProvider.SAMPLE_ROUND_BORDER: 68 | label = "Round with Border"; 69 | drawable = mProvider.getRoundWithBorder("F"); 70 | break; 71 | case DrawableProvider.SAMPLE_MULTIPLE_LETTERS: 72 | label = "Support multiple letters"; 73 | drawable = mProvider.getRectWithMultiLetter(); 74 | type = NO_NAVIGATION; 75 | break; 76 | case DrawableProvider.SAMPLE_FONT: 77 | label = "Support variable font styles"; 78 | drawable = mProvider.getRoundWithCustomFont(); 79 | type = NO_NAVIGATION; 80 | break; 81 | case DrawableProvider.SAMPLE_SIZE: 82 | label = "Support for custom size"; 83 | drawable = mProvider.getRectWithCustomSize(); 84 | type = NO_NAVIGATION; 85 | break; 86 | case DrawableProvider.SAMPLE_ANIMATION: 87 | label = "Support for animations"; 88 | drawable = mProvider.getRectWithAnimation(); 89 | type = NO_NAVIGATION; 90 | break; 91 | case DrawableProvider.SAMPLE_MISC: 92 | label = "Miscellaneous"; 93 | drawable = mProvider.getRect("\u03c0"); 94 | type = NO_NAVIGATION; 95 | break; 96 | } 97 | return new DataItem(label, drawable, type); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/concurrencycontrol/LiveChannelBinder.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.concurrencycontrol; 2 | 3 | 4 | import org.waveprotocol.wave.concurrencycontrol.channel.Accessibility; 5 | import org.waveprotocol.wave.concurrencycontrol.channel.OperationChannel; 6 | import org.waveprotocol.wave.concurrencycontrol.channel.OperationChannelMultiplexer; 7 | import org.waveprotocol.wave.concurrencycontrol.common.CorruptionDetail; 8 | import org.waveprotocol.wave.concurrencycontrol.wave.CcDocument; 9 | import org.waveprotocol.wave.model.id.IdFilter; 10 | import org.waveprotocol.wave.model.id.WaveletId; 11 | import org.waveprotocol.wave.model.util.CollectionUtils; 12 | import org.waveprotocol.wave.model.wave.ObservableWavelet; 13 | import org.waveprotocol.wave.model.wave.WaveViewListener; 14 | import org.waveprotocol.wave.model.wave.data.ObservableWaveletData; 15 | import org.waveprotocol.wave.model.wave.opbased.OpBasedWavelet; 16 | import org.waveprotocol.wave.model.wave.opbased.WaveViewImpl; 17 | 18 | import java.util.Collection; 19 | 20 | import app.android.box.waveprotocol.org.androidwave.service.documents.WaveDocuments; 21 | 22 | public final class LiveChannelBinder 23 | implements WaveViewListener, OperationChannelMultiplexer.Listener { 24 | 25 | private final StaticChannelBinder binder; 26 | private final WaveletOperationalizer operationalizer; 27 | private final WaveViewImpl wave; 28 | private final OperationChannelMultiplexer mux; 29 | private final Connector.Command whenOpened; 30 | 31 | private LiveChannelBinder(StaticChannelBinder binder, WaveletOperationalizer operationalizer, 32 | WaveViewImpl wave, OperationChannelMultiplexer mux, Connector.Command whenOpened) { 33 | this.binder = binder; 34 | this.operationalizer = operationalizer; 35 | this.wave = wave; 36 | this.mux = mux; 37 | this.whenOpened = whenOpened; 38 | } 39 | 40 | public static void openAndBind(WaveletOperationalizer operationalizer, 41 | WaveViewImpl wave, 42 | WaveDocuments docRegistry, 43 | OperationChannelMultiplexer mux, 44 | IdFilter filter, 45 | Connector.Command whenOpened) { 46 | 47 | StaticChannelBinder staticBinder = new StaticChannelBinder(operationalizer, docRegistry); 48 | 49 | LiveChannelBinder liveBinder = 50 | new LiveChannelBinder(staticBinder, operationalizer, wave, mux, whenOpened); 51 | 52 | final Collection remoteWavelets = CollectionUtils.createQueue(); 53 | final Collection localWavelets = CollectionUtils.createQueue(); 54 | for (ObservableWaveletData wavelet : operationalizer.getWavelets()) { 55 | 56 | if (wavelet.getVersion() > 0) { 57 | remoteWavelets.add( 58 | new OperationChannelMultiplexer.KnownWavelet(wavelet, wavelet.getHashedVersion(), Accessibility.READ_WRITE)); 59 | } else { 60 | localWavelets.add(wavelet); 61 | } 62 | } 63 | 64 | wave.addListener(liveBinder); 65 | 66 | mux.open(liveBinder, filter, remoteWavelets); 67 | for (ObservableWaveletData local : localWavelets) { 68 | mux.createOperationChannel(local.getWaveletId(), local.getCreator()); 69 | } 70 | } 71 | 72 | @Override 73 | public void onOperationChannelCreated(OperationChannel operationChannel, ObservableWaveletData observableWaveletData, Accessibility accessibility) { 74 | 75 | } 76 | 77 | @Override 78 | public void onOperationChannelRemoved(OperationChannel operationChannel, WaveletId waveletId) { 79 | 80 | } 81 | 82 | @Override 83 | public void onOpenFinished() { 84 | 85 | } 86 | 87 | @Override 88 | public void onFailed(CorruptionDetail corruptionDetail) { 89 | 90 | } 91 | 92 | @Override 93 | public void onWaveletAdded(ObservableWavelet observableWavelet) { 94 | 95 | } 96 | 97 | @Override 98 | public void onWaveletRemoved(ObservableWavelet observableWavelet) { 99 | 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 48 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 70 | 71 | 72 | 73 | 74 | 75 | 81 | 82 | 83 | 84 | 85 | 86 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/TestMainActivity.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.app.ListActivity; 4 | import android.content.Intent; 5 | import android.graphics.drawable.AnimationDrawable; 6 | import android.graphics.drawable.Drawable; 7 | import android.os.Bundle; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.AdapterView; 12 | import android.widget.BaseAdapter; 13 | import android.widget.ImageView; 14 | import android.widget.ListView; 15 | import android.widget.TextView; 16 | 17 | import app.android.box.waveprotocol.org.androidwave.R; 18 | 19 | /** 20 | * Created by roellk on 8/20/2015. 21 | */ 22 | public class TestMainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener{ 23 | public static final String TYPE = "TYPE"; 24 | private DataSource mDataSource; 25 | private ListView mListView; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.main_activity); 31 | 32 | mListView = (ListView) findViewById(R.id.listView); 33 | mDataSource = new DataSource(this); 34 | mListView.setAdapter(new SampleAdapter()); 35 | mListView.setOnItemClickListener(this); 36 | } 37 | 38 | @Override 39 | public void onItemClick(AdapterView parent, View view, int position, long id) { 40 | DataItem item = (DataItem) mListView.getItemAtPosition(position); 41 | 42 | // if navigation is supported, open the next activity 43 | if (item.getNavigationInfo() != DataSource.NO_NAVIGATION) { 44 | Intent intent = new Intent(this, ListActivity.class); 45 | intent.putExtra(TYPE, item.getNavigationInfo()); 46 | startActivity(intent); 47 | } 48 | } 49 | 50 | private class SampleAdapter extends BaseAdapter { 51 | 52 | @Override 53 | public int getCount() { 54 | return mDataSource.getCount(); 55 | } 56 | 57 | @Override 58 | public DataItem getItem(int position) { 59 | return mDataSource.getItem(position); 60 | } 61 | 62 | @Override 63 | public long getItemId(int position) { 64 | return position; 65 | } 66 | 67 | @Override 68 | public View getView(int position, View convertView, ViewGroup parent) { 69 | ViewHolder holder; 70 | if (convertView == null) { 71 | convertView = View.inflate(TestMainActivity.this, R.layout.list_item_layout, null); 72 | holder = new ViewHolder(convertView); 73 | convertView.setTag(holder); 74 | } else { 75 | holder = (ViewHolder) convertView.getTag(); 76 | } 77 | 78 | DataItem item = getItem(position); 79 | 80 | final Drawable drawable = item.getDrawable(); 81 | holder.imageView.setImageDrawable(drawable); 82 | holder.textView.setText(item.getLabel()); 83 | 84 | // if navigation is supported, show the ">" navigation icon 85 | if (item.getNavigationInfo() != DataSource.NO_NAVIGATION) { 86 | holder.textView.setCompoundDrawablesWithIntrinsicBounds(null, 87 | null, 88 | getResources().getDrawable(R.drawable.ic_action_next_item), 89 | null); 90 | } 91 | else { 92 | holder.textView.setCompoundDrawablesWithIntrinsicBounds(null, 93 | null, 94 | null, 95 | null); 96 | } 97 | 98 | // fix for animation not playing for some below 4.4 devices 99 | if (drawable instanceof AnimationDrawable) { 100 | holder.imageView.post(new Runnable() { 101 | @Override 102 | public void run() { 103 | ((AnimationDrawable) drawable).stop(); 104 | ((AnimationDrawable) drawable).start(); 105 | } 106 | }); 107 | } 108 | 109 | return convertView; 110 | } 111 | } 112 | 113 | private static class ViewHolder { 114 | 115 | private ImageView imageView; 116 | 117 | private TextView textView; 118 | 119 | private ViewHolder(View view) { 120 | imageView = (ImageView) view.findViewById(R.id.imageView); 121 | textView = (TextView) view.findViewById(R.id.textView); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/StringType.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | import org.waveprotocol.wave.model.adt.ObservableBasicValue; 4 | import org.waveprotocol.wave.model.util.CopyOnWriteSet; 5 | import org.waveprotocol.wave.model.util.Preconditions; 6 | import org.waveprotocol.wave.model.wave.SourcesEvents; 7 | 8 | public class StringType extends Type implements SourcesEvents { 9 | 10 | 11 | public final static String PREFIX = "str"; 12 | public final static String VALUE_ATTR = "v"; 13 | private final CopyOnWriteSet listeners = CopyOnWriteSet.create(); 14 | private ObservableBasicValue observableValue; 15 | private ObservableBasicValue.Listener observableValueListener; 16 | private Model model; 17 | private int indexStringPos; 18 | private String initValue; 19 | private boolean isAttached; 20 | 21 | protected StringType(Model model) { 22 | 23 | this.model = model; 24 | this.initValue = null; 25 | this.observableValueListener = new ObservableBasicValue.Listener() { 26 | 27 | @Override 28 | public void onValueChanged(String oldValue, String newValue) { 29 | for (Listener l : listeners) 30 | l.onValueChanged(oldValue, newValue); 31 | } 32 | }; 33 | } 34 | 35 | public StringType(Model model, String value) { 36 | 37 | this.model = model; 38 | this.initValue = value != null ? value : ""; // null string is not valid 39 | 40 | this.observableValueListener = new ObservableBasicValue.Listener() { 41 | 42 | @Override 43 | public void onValueChanged(String oldValue, String newValue) { 44 | for (Listener l : listeners) 45 | l.onValueChanged(oldValue, newValue); 46 | } 47 | }; 48 | } 49 | 50 | protected static Type createAndAttach(Model model, String id) { 51 | 52 | Preconditions.checkArgument(id.startsWith(PREFIX), 53 | "StringType.createAndAttach() not a string id"); 54 | StringType string = new StringType(model); 55 | string.attach(id); 56 | return string; 57 | 58 | } 59 | 60 | @Override 61 | protected String getPrefix() { 62 | return PREFIX; 63 | } 64 | 65 | @Override 66 | protected void attach(String stringId) { 67 | 68 | if (stringId == null) { 69 | 70 | indexStringPos = model.getStringIndex().size(); 71 | observableValue = model.getStringIndex().add(indexStringPos, initValue); 72 | 73 | } else { 74 | 75 | indexStringPos = Integer.valueOf(stringId.split("\\+")[1]); 76 | observableValue = model.getStringIndex().get(indexStringPos); 77 | initValue = observableValue.get(); 78 | 79 | } 80 | 81 | observableValue.addListener(observableValueListener); 82 | 83 | this.isAttached = true; 84 | 85 | } 86 | 87 | protected void deAttach() { 88 | Preconditions.checkArgument(isAttached, "Unable to deAttach an unattached MapType"); 89 | } 90 | 91 | @Override 92 | protected boolean isAttached() { 93 | return isAttached; 94 | } 95 | 96 | @Override 97 | protected String serializeToModel() { 98 | Preconditions.checkArgument(isAttached, "Unable to serialize an unattached StringType"); 99 | return PREFIX + "+" + Integer.toString(indexStringPos); 100 | } 101 | 102 | @Override 103 | protected ListElementInitializer getListElementInitializer() { 104 | return new ListElementInitializer() { 105 | 106 | @Override 107 | public String getType() { 108 | return PREFIX; 109 | } 110 | 111 | @Override 112 | public String getBackendId() { 113 | Preconditions.checkArgument(isAttached, "Unable to initialize an unattached StringType"); 114 | return serializeToModel(); 115 | } 116 | 117 | }; 118 | } 119 | 120 | @Override 121 | public void addListener(Listener listener) { 122 | listeners.add(listener); 123 | } 124 | 125 | @Override 126 | public void removeListener(Listener listener) { 127 | listeners.remove(listener); 128 | } 129 | 130 | public String getValue() { 131 | if (!isAttached()) 132 | return initValue; 133 | else 134 | return observableValue.get(); 135 | } 136 | 137 | public void setValue(String value) { 138 | if (isAttached()) observableValue.set(value); 139 | } 140 | 141 | @Override 142 | public String getDocumentId() { 143 | return null; 144 | } 145 | 146 | @Override 147 | public Model getModel() { 148 | return model; 149 | } 150 | 151 | @Override 152 | public String getType() { 153 | return "StringType"; 154 | } 155 | 156 | public interface Listener { 157 | void onValueChanged(String oldValue, String newValue); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/DrawableProvider.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.graphics.Color; 6 | import android.graphics.Typeface; 7 | import android.graphics.drawable.AnimationDrawable; 8 | import android.graphics.drawable.Drawable; 9 | import android.graphics.drawable.InsetDrawable; 10 | import android.graphics.drawable.LayerDrawable; 11 | import android.util.TypedValue; 12 | 13 | import com.amulyakhare.textdrawable.TextDrawable; 14 | import com.amulyakhare.textdrawable.util.ColorGenerator; 15 | 16 | /** 17 | * @author amulya 18 | * @datetime 17 Oct 2014, 4:02 PM 19 | */ 20 | public class DrawableProvider { 21 | 22 | public static final int SAMPLE_RECT = 1; 23 | public static final int SAMPLE_ROUND_RECT = 2; 24 | public static final int SAMPLE_ROUND = 3; 25 | public static final int SAMPLE_RECT_BORDER = 4; 26 | public static final int SAMPLE_ROUND_RECT_BORDER = 5; 27 | public static final int SAMPLE_ROUND_BORDER = 6; 28 | public static final int SAMPLE_MULTIPLE_LETTERS = 7; 29 | public static final int SAMPLE_FONT = 8; 30 | public static final int SAMPLE_SIZE = 9; 31 | public static final int SAMPLE_ANIMATION = 10; 32 | public static final int SAMPLE_MISC = 11; 33 | 34 | private final ColorGenerator mGenerator; 35 | private final Context mContext; 36 | 37 | public DrawableProvider(Context context) { 38 | mGenerator = ColorGenerator.DEFAULT; 39 | mContext = context; 40 | } 41 | 42 | public TextDrawable getRect(String text) { 43 | return TextDrawable.builder() 44 | .buildRect(text, mGenerator.getColor(text)); 45 | } 46 | 47 | public TextDrawable getRound(String text) { 48 | return TextDrawable.builder() 49 | .buildRound(text, mGenerator.getColor(text)); 50 | } 51 | 52 | public TextDrawable getRoundRect(String text) { 53 | return TextDrawable.builder() 54 | .buildRoundRect(text, mGenerator.getColor(text), toPx(10)); 55 | } 56 | 57 | public TextDrawable getRectWithBorder(String text) { 58 | return TextDrawable.builder() 59 | .beginConfig() 60 | .withBorder(toPx(2)) 61 | .endConfig() 62 | .buildRect(text, mGenerator.getColor(text)); 63 | } 64 | 65 | public TextDrawable getRoundWithBorder(String text) { 66 | return TextDrawable.builder() 67 | .beginConfig() 68 | .withBorder(toPx(2)) 69 | .endConfig() 70 | .buildRound(text, mGenerator.getColor(text)); 71 | } 72 | 73 | public TextDrawable getRoundRectWithBorder(String text) { 74 | return TextDrawable.builder() 75 | .beginConfig() 76 | .withBorder(toPx(2)) 77 | .endConfig() 78 | .buildRoundRect(text, mGenerator.getColor(text), toPx(10)); 79 | } 80 | 81 | public TextDrawable getRectWithMultiLetter() { 82 | String text = "AK"; 83 | return TextDrawable.builder() 84 | .beginConfig() 85 | .fontSize(toPx(20)) 86 | .toUpperCase() 87 | .endConfig() 88 | .buildRect(text, mGenerator.getColor(text)); 89 | } 90 | 91 | public TextDrawable getRoundWithCustomFont() { 92 | String text = "Bold"; 93 | return TextDrawable.builder() 94 | .beginConfig() 95 | .useFont(Typeface.DEFAULT) 96 | .fontSize(toPx(15)) 97 | .textColor(0xfff58559) 98 | .bold() 99 | .endConfig() 100 | .buildRect(text, Color.DKGRAY /*toPx(5)*/); 101 | } 102 | 103 | public Drawable getRectWithCustomSize() { 104 | String leftText = "I"; 105 | String rightText = "J"; 106 | 107 | TextDrawable.IBuilder builder = TextDrawable.builder() 108 | .beginConfig() 109 | .width(toPx(29)) 110 | .withBorder(toPx(2)) 111 | .endConfig() 112 | .rect(); 113 | 114 | TextDrawable left = builder 115 | .build(leftText, mGenerator.getColor(leftText)); 116 | 117 | TextDrawable right = builder 118 | .build(rightText, mGenerator.getColor(rightText)); 119 | 120 | Drawable[] layerList = { 121 | new InsetDrawable(left, 0, 0, toPx(31), 0), 122 | new InsetDrawable(right, toPx(31), 0, 0, 0) 123 | }; 124 | return new LayerDrawable(layerList); 125 | } 126 | 127 | public Drawable getRectWithAnimation() { 128 | TextDrawable.IBuilder builder = TextDrawable.builder() 129 | .rect(); 130 | 131 | AnimationDrawable animationDrawable = new AnimationDrawable(); 132 | for (int i = 10; i > 0; i--) { 133 | TextDrawable frame = builder.build(String.valueOf(i), mGenerator.getRandomColor()); 134 | animationDrawable.addFrame(frame, 1200); 135 | } 136 | animationDrawable.setOneShot(false); 137 | animationDrawable.start(); 138 | 139 | return animationDrawable; 140 | } 141 | 142 | public int toPx(int dp) { 143 | Resources resources = mContext.getResources(); 144 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics()); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/models/TextType.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.service.models; 2 | 3 | import org.waveprotocol.wave.model.document.AnnotationInterval; 4 | import org.waveprotocol.wave.model.document.Doc.N; 5 | import org.waveprotocol.wave.model.document.Document; 6 | import org.waveprotocol.wave.model.document.ObservableDocument; 7 | import org.waveprotocol.wave.model.document.util.Point; 8 | import org.waveprotocol.wave.model.document.util.XmlStringBuilder; 9 | import org.waveprotocol.wave.model.util.CopyOnWriteSet; 10 | import org.waveprotocol.wave.model.util.Preconditions; 11 | import org.waveprotocol.wave.model.wave.Blip; 12 | import org.waveprotocol.wave.model.wave.SourcesEvents; 13 | 14 | import java.util.Collections; 15 | 16 | public class TextType extends Type implements SourcesEvents { 17 | 18 | public final static String PREFIX = "b"; 19 | public final static String VALUE_ATTR = "t"; 20 | private final CopyOnWriteSet listeners = CopyOnWriteSet.create(); 21 | private Model model; 22 | private Blip blip; 23 | private String initContent; 24 | private boolean isAttached; 25 | 26 | protected TextType(Model model) { 27 | this.model = model; 28 | this.isAttached = false; 29 | } 30 | 31 | protected static Type createAndAttach(Model model, String id) { 32 | Preconditions.checkArgument(id.startsWith(PREFIX), "Not a TextType instance id"); 33 | TextType txt = new TextType(model); 34 | txt.attach(id); 35 | return txt; 36 | } 37 | 38 | protected void setInitContent(String textOrXml) { 39 | this.initContent = textOrXml; 40 | } 41 | 42 | @Override 43 | protected void attach(String docId) { 44 | 45 | if (docId == null) { 46 | docId = model.generateDocId(PREFIX); 47 | blip = model.createBlip(docId); 48 | 49 | if (initContent == null) 50 | initContent = ""; 51 | XmlStringBuilder sb = XmlStringBuilder.createFromXmlString("" + this.initContent + ""); 52 | blip.getContent().appendXml(sb); 53 | 54 | } else { 55 | blip = model.getBlip(docId); 56 | } 57 | Preconditions.checkNotNull(blip, "Unable to attach TextType, couldn't create or get blip"); 58 | isAttached = true; 59 | } 60 | 61 | @Override 62 | protected void deAttach() { 63 | Preconditions.checkArgument(isAttached, "Unable to deAttach an unattached TextType"); 64 | } 65 | 66 | @Override 67 | protected ListElementInitializer getListElementInitializer() { 68 | return new ListElementInitializer() { 69 | 70 | @Override 71 | public String getType() { 72 | return PREFIX; 73 | } 74 | 75 | @Override 76 | public String getBackendId() { 77 | return serializeToModel(); 78 | } 79 | }; 80 | } 81 | 82 | @Override 83 | protected String getPrefix() { 84 | return PREFIX; 85 | } 86 | 87 | @Override 88 | protected boolean isAttached() { 89 | return isAttached; 90 | } 91 | 92 | @Override 93 | protected String serializeToModel() { 94 | Preconditions.checkArgument(isAttached, "Unable to serialize an unattached TextType"); 95 | return blip.getId(); 96 | } 97 | 98 | @Override 99 | public void addListener(Listener listener) { 100 | listeners.add(listener); 101 | } 102 | 103 | @Override 104 | public void removeListener(Listener listener) { 105 | listeners.remove(listener); 106 | } 107 | 108 | @Override 109 | public String getDocumentId() { 110 | return blip.getId(); 111 | } 112 | 113 | @Override 114 | public Model getModel() { 115 | return model; 116 | } 117 | 118 | @Override 119 | public String getType() { 120 | return "TextType"; 121 | } 122 | 123 | public ObservableDocument getMutableDocument() { 124 | return blip.getWavelet().getDocument(blip.getId()); 125 | } 126 | 127 | public void insertText(int location, String text) { 128 | Document doc = blip.getContent(); 129 | doc.insertText(location, text); 130 | } 131 | 132 | public void insertNewLine(int location) { 133 | Document doc = blip.getContent(); 134 | Point point = doc.locate(location); 135 | doc.createElement(point, "line", Collections.emptyMap()); 136 | } 137 | 138 | public void deleteText(int start, int end) { 139 | Document doc = blip.getContent(); 140 | doc.deleteRange(start, end); 141 | } 142 | 143 | public int getSize() { 144 | Document doc = blip.getContent(); 145 | return doc.size(); 146 | } 147 | 148 | public String getXml() { 149 | Document doc = blip.getContent(); 150 | return doc.toXmlString(); 151 | } 152 | 153 | public void setAnnotation(int start, int end, String key, String value) { 154 | Document doc = blip.getContent(); 155 | doc.setAnnotation(start, end, key, value); 156 | } 157 | 158 | public String getAnnotation(int location, String key) { 159 | Document doc = blip.getContent(); 160 | return doc.getAnnotation(location, key); 161 | } 162 | 163 | public Iterable> getAllAnnotations(int start, int end) { 164 | Document doc = blip.getContent(); 165 | return doc.annotationIntervals(start, end, null); 166 | } 167 | 168 | public interface Listener { 169 | 170 | } 171 | 172 | } 173 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/service/WaveService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | *

10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | *

12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package app.android.box.waveprotocol.org.androidwave.service; 21 | 22 | import android.os.AsyncTask; 23 | 24 | import org.waveprotocol.wave.model.document.WaveContext; 25 | import org.waveprotocol.wave.model.id.IdGenerator; 26 | import org.waveprotocol.wave.model.id.IdGeneratorImpl; 27 | import org.waveprotocol.wave.model.id.WaveId; 28 | import org.waveprotocol.wave.model.wave.ParticipantId; 29 | import org.waveprotocol.wave.model.waveref.WaveRef; 30 | import org.waveprotocol.wave.model.util.Pair; 31 | 32 | import java.util.Collections; 33 | import java.util.Timer; 34 | import java.util.Map; 35 | 36 | import app.android.box.waveprotocol.org.androidwave.service.concurrencycontrol.Connector.Command; 37 | import app.android.box.waveprotocol.org.androidwave.service.models.Model; 38 | import app.android.box.waveprotocol.org.androidwave.service.models.TypeIdGenerator; 39 | 40 | public class WaveService { 41 | 42 | private String waveHost; 43 | private String waveSessionId; 44 | private String waveUsername; 45 | 46 | private Timer timer; 47 | 48 | private ParticipantId waveParticipantId; 49 | private IdGenerator waveIdGenerator; 50 | private TypeIdGenerator waveTypeIdGenerator; 51 | 52 | private WaveWebSocketClient waveWebSocketClient; 53 | private RemoteViewServiceMultiplexer waveChannel; 54 | 55 | private Map> waveStore; 56 | 57 | 58 | 59 | public boolean waveSignUpTask(String host, String username, String password){ 60 | WaveSignUp waveSignUpService = new WaveSignUp(); 61 | return waveSignUpService.waveSignUp(host,username,password); 62 | } 63 | 64 | public void waveLoginTask(String host, String username, String password){ 65 | new WaveSession().execute(host,username,password); 66 | } 67 | 68 | public String getWaveSessionId() { 69 | return waveSessionId; 70 | } 71 | 72 | public void setWaveSessionId(String waveSessionId) { 73 | this.waveSessionId = waveSessionId; 74 | } 75 | 76 | public String getWaveHost() { 77 | return waveHost; 78 | } 79 | 80 | public void setWaveHost(String waveHost) { 81 | this.waveHost = waveHost; 82 | } 83 | 84 | public String getWaveUsername() { 85 | return waveUsername; 86 | } 87 | 88 | public void setWaveUsername(String waveUsername) { 89 | this.waveUsername = waveUsername; 90 | } 91 | 92 | public boolean isWaveSessionStarted() { 93 | return waveSessionId != null; 94 | } 95 | 96 | private void openWebSocketConnection(String hostName, String SessionId){ 97 | 98 | String waveWebSocketUrl = "http://"+ hostName +"/atmosphere"; 99 | 100 | waveIdGenerator = new IdGeneratorImpl(waveWebSocketUrl, new IdGeneratorImpl.Seed() { 101 | @Override 102 | public String get() { 103 | return waveSessionId.substring(0, 5); 104 | } 105 | }); 106 | 107 | waveTypeIdGenerator = TypeIdGenerator.get(waveIdGenerator); 108 | 109 | waveWebSocketClient = new WaveWebSocketClient(waveWebSocketUrl, waveSessionId); 110 | 111 | waveWebSocketClient.connect(new WaveWebSocketClient.ConnectionListener() { 112 | @Override 113 | public void onConnect() { 114 | 115 | } 116 | 117 | @Override 118 | public void onReconnect() { 119 | 120 | } 121 | 122 | @Override 123 | public void onDisconnect() { 124 | 125 | } 126 | }); 127 | 128 | waveChannel = new RemoteViewServiceMultiplexer(waveWebSocketClient, waveParticipantId.getAddress()); 129 | 130 | } 131 | 132 | private void closeWebSocket() { 133 | 134 | waveIdGenerator = null; 135 | waveChannel = null; 136 | waveWebSocketClient = null; 137 | } 138 | 139 | public String createModel() { 140 | 141 | WaveId newWaveId = waveTypeIdGenerator.newWaveId(); 142 | final WaveRef waveRef = WaveRef.of(newWaveId); 143 | 144 | final WaveRender waveRender = new WaveRender(true, waveRef, waveChannel, waveParticipantId, 145 | Collections.emptySet(), waveIdGenerator, null, timer); 146 | 147 | waveRender.init(new Command() { 148 | 149 | @Override 150 | public void execute() { 151 | 152 | WaveContext wave = waveRender.getWaveContext(); 153 | Model model = Model.create(wave, waveHost, waveParticipantId, true, waveIdGenerator); 154 | 155 | waveStore.put(waveRef, new Pair(waveRender, model)); 156 | } 157 | }); 158 | 159 | return waveRef.getWaveId().serialise(); 160 | } 161 | 162 | public void openModel(String modelId) { 163 | 164 | } 165 | 166 | public Model getModel(String modelId) { 167 | 168 | return null; 169 | } 170 | 171 | public void closeModel(String modelId) { 172 | 173 | } 174 | 175 | public class WaveSession extends AsyncTask { 176 | 177 | @Override 178 | protected String doInBackground(String... params) { 179 | WaveSignIn waveSignIn = new WaveSignIn(); 180 | waveSessionId = waveSignIn.waveSignIn(params[0], params[1], params[2]); 181 | return waveSessionId; 182 | } 183 | 184 | @Override 185 | protected void onPostExecute(String result) { 186 | if (result != null) { 187 | openWebSocketConnection(waveHost, waveSessionId); 188 | } 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /app/src/main/java/app/android/box/waveprotocol/org/androidwave/activities/FragmentDrawer.java: -------------------------------------------------------------------------------- 1 | package app.android.box.waveprotocol.org.androidwave.activities; 2 | 3 | /** 4 | * Created by Ravi on 29/07/15. 5 | */ 6 | 7 | import android.content.Context; 8 | import android.os.Bundle; 9 | import android.support.v4.app.Fragment; 10 | import android.support.v4.widget.DrawerLayout; 11 | import android.support.v7.app.ActionBarDrawerToggle; 12 | import android.support.v7.widget.LinearLayoutManager; 13 | import android.support.v7.widget.RecyclerView; 14 | import android.support.v7.widget.Toolbar; 15 | import android.view.GestureDetector; 16 | import android.view.LayoutInflater; 17 | import android.view.MotionEvent; 18 | import android.view.View; 19 | import android.view.ViewGroup; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import app.android.box.waveprotocol.org.androidwave.R; 25 | 26 | public class FragmentDrawer extends Fragment { 27 | 28 | private static String TAG = FragmentDrawer.class.getSimpleName(); 29 | 30 | private RecyclerView recyclerView; 31 | private ActionBarDrawerToggle mDrawerToggle; 32 | private DrawerLayout mDrawerLayout; 33 | private NavigationDrawerAdapter adapter; 34 | private View containerView; 35 | private static String[] titles = null; 36 | private FragmentDrawerListener drawerListener; 37 | 38 | public FragmentDrawer() { 39 | 40 | } 41 | 42 | public void setDrawerListener(FragmentDrawerListener listener) { 43 | this.drawerListener = listener; 44 | } 45 | 46 | public static List getData() { 47 | List data = new ArrayList<>(); 48 | 49 | 50 | // preparing navigation drawer items 51 | for (int i = 0; i < titles.length; i++) { 52 | NavDrawerItem navItem = new NavDrawerItem(); 53 | navItem.setTitle(titles[i]); 54 | data.add(navItem); 55 | } 56 | return data; 57 | } 58 | 59 | @Override 60 | public void onCreate(Bundle savedInstanceState) { 61 | super.onCreate(savedInstanceState); 62 | 63 | // drawer labels 64 | titles = getActivity().getResources().getStringArray(R.array.nav_drawer_labels); 65 | } 66 | 67 | @Override 68 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 69 | Bundle savedInstanceState) { 70 | // Inflating view layout 71 | View layout = inflater.inflate(R.layout.fragment_navigation_drawer, container, false); 72 | recyclerView = (RecyclerView) layout.findViewById(R.id.drawerList); 73 | 74 | adapter = new NavigationDrawerAdapter(getActivity(), getData()); 75 | recyclerView.setAdapter(adapter); 76 | recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); 77 | recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getActivity(), recyclerView, new ClickListener() { 78 | @Override 79 | public void onClick(View view, int position) { 80 | drawerListener.onDrawerItemSelected(view, position); 81 | mDrawerLayout.closeDrawer(containerView); 82 | } 83 | 84 | @Override 85 | public void onLongClick(View view, int position) { 86 | 87 | } 88 | })); 89 | 90 | return layout; 91 | } 92 | 93 | 94 | public void setUp(int fragmentId, DrawerLayout drawerLayout, final Toolbar toolbar) { 95 | containerView = getActivity().findViewById(fragmentId); 96 | mDrawerLayout = drawerLayout; 97 | mDrawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close) { 98 | @Override 99 | public void onDrawerOpened(View drawerView) { 100 | super.onDrawerOpened(drawerView); 101 | getActivity().invalidateOptionsMenu(); 102 | } 103 | 104 | @Override 105 | public void onDrawerClosed(View drawerView) { 106 | super.onDrawerClosed(drawerView); 107 | getActivity().invalidateOptionsMenu(); 108 | } 109 | 110 | @Override 111 | public void onDrawerSlide(View drawerView, float slideOffset) { 112 | super.onDrawerSlide(drawerView, slideOffset); 113 | toolbar.setAlpha(1 - slideOffset / 2); 114 | } 115 | }; 116 | 117 | mDrawerLayout.setDrawerListener(mDrawerToggle); 118 | mDrawerLayout.post(new Runnable() { 119 | @Override 120 | public void run() { 121 | mDrawerToggle.syncState(); 122 | } 123 | }); 124 | 125 | } 126 | 127 | public static interface ClickListener { 128 | public void onClick(View view, int position); 129 | 130 | public void onLongClick(View view, int position); 131 | } 132 | 133 | static class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { 134 | 135 | private GestureDetector gestureDetector; 136 | private ClickListener clickListener; 137 | 138 | public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final ClickListener clickListener) { 139 | this.clickListener = clickListener; 140 | gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { 141 | @Override 142 | public boolean onSingleTapUp(MotionEvent e) { 143 | return true; 144 | } 145 | 146 | @Override 147 | public void onLongPress(MotionEvent e) { 148 | View child = recyclerView.findChildViewUnder(e.getX(), e.getY()); 149 | if (child != null && clickListener != null) { 150 | clickListener.onLongClick(child, recyclerView.getChildPosition(child)); 151 | } 152 | } 153 | }); 154 | } 155 | 156 | @Override 157 | public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { 158 | 159 | View child = rv.findChildViewUnder(e.getX(), e.getY()); 160 | if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { 161 | clickListener.onClick(child, rv.getChildPosition(child)); 162 | } 163 | return false; 164 | } 165 | 166 | @Override 167 | public void onTouchEvent(RecyclerView rv, MotionEvent e) { 168 | } 169 | 170 | @Override 171 | public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { 172 | 173 | } 174 | 175 | 176 | } 177 | 178 | public interface FragmentDrawerListener { 179 | public void onDrawerItemSelected(View view, int position); 180 | } 181 | } 182 | --------------------------------------------------------------------------------