8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/shake_left.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/shake_right.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/shake_up.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/line_divider.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/find_my_tag.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/MvpBaseView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 | import android.view.View;
18 |
19 | /**
20 | * Created by legendmohe on 15/2/19.
21 | */
22 | public interface MvpBaseView {
23 | public void setupViews(View rootView);
24 |
25 | public android.content.Context getContext();
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/exit.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/ActionBarControlView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 | /**
18 | * Created by legendmohe on 15/3/2.
19 | */
20 | public interface ActionBarControlView extends MvpBaseView {
21 | public void showActionBar();
22 |
23 | public void hideActionBar();
24 |
25 | public int getActionBarHeight();
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/enter.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/pop_enter.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/pop_exit.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/resend_bg.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/shortcut.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
22 |
--------------------------------------------------------------------------------
/domain/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/model/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_wakeup.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/common/src/main/java/my/home/common/speex/AudioRawData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.common.speex;
16 |
17 | /**
18 | * Created by legendmohe on 15/11/13.
19 | */
20 | public class AudioRawData {
21 | public final short[] data;
22 | public final int len;
23 |
24 | AudioRawData(short[] data, int len) {
25 | this.data = data;
26 | this.len = len;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_navigation_drawer.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
21 |
22 |
--------------------------------------------------------------------------------
/LEHome_android.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/ChatSuggestionView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 | import my.home.model.entities.AutoCompleteItem;
18 |
19 | /**
20 | * Created by legendmohe on 15/2/25.
21 | */
22 | public interface ChatSuggestionView extends MvpBaseView {
23 | public void onShowSuggestion(AutoCompleteItem item);
24 | // public void onGetAutoCompleteItems(List item);
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_item_bg.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/common/src/androidTest/java/home/my/common/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package home.my.common;
16 |
17 | import android.app.Application;
18 | import android.test.ApplicationTestCase;
19 |
20 | /**
21 | * Testing Fundamentals
22 | */
23 | public class ApplicationTest extends ApplicationTestCase {
24 | public ApplicationTest() {
25 | super(Application.class);
26 | }
27 | }
--------------------------------------------------------------------------------
/domain/src/androidTest/java/my/home/domain/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain;
16 |
17 | import android.app.Application;
18 | import android.test.ApplicationTestCase;
19 |
20 | /**
21 | * Testing Fundamentals
22 | */
23 | public class ApplicationTest extends ApplicationTestCase {
24 | public ApplicationTest() {
25 | super(Application.class);
26 | }
27 | }
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/NFCDetectView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 | /**
18 | * Created by legendmohe on 15/12/28.
19 | */
20 | public interface NFCDetectView extends MvpBaseView {
21 |
22 | void onViewStateChange(State state);
23 |
24 | void showStateToast(String content);
25 |
26 | String getTargetContent();
27 |
28 | enum State {
29 | DETECTING, WRITING, SUCCESS, CANCEL, FAIL
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/model/src/androidTest/java/my/home/entities/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.entities;
16 |
17 | import android.app.Application;
18 | import android.test.ApplicationTestCase;
19 |
20 | /**
21 | * Testing Fundamentals
22 | */
23 | public class ApplicationTest extends ApplicationTestCase {
24 | public ApplicationTest() {
25 | super(Application.class);
26 | }
27 | }
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/events/DSendingMsgEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.events;
16 |
17 | /**
18 | * Created by legendmohe on 15/12/8.
19 | */
20 | public class DSendingMsgEvent {
21 | public enum TYPE {
22 | BEGIN, SUCCESS, FAIL
23 | }
24 |
25 | public TYPE type;
26 | public String tag;
27 |
28 | public DSendingMsgEvent(TYPE type, String tag) {
29 | this.type = type;
30 | this.tag = tag;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/entities/ChatItemConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.entities;
16 |
17 | /**
18 | * Created by legendmohe on 15/5/4.
19 | */
20 | public class ChatItemConstants {
21 | public static final int TYPE_CLIENT = 0;
22 | public static final int TYPE_SERVER = 1;
23 | public static final int TYPE_SERVER_IMAGE = 2;
24 | public static final int TYPE_SERVER_LOC = 3;
25 | public static final int TYPE_SERVER_LONG_MSG = 4;
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_add_patten.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
19 |
20 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/MainActivityView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 | import android.content.Context;
18 | import android.net.Uri;
19 |
20 | /**
21 | * Created by legendmohe on 15/3/15.
22 | */
23 | public interface MainActivityView extends MvpBaseView {
24 | public void showServerStateIndicator(boolean isLocal);
25 |
26 | public Context getApplicationContext();
27 |
28 | public void changeNavHeaderBgImage(Uri selectedImageUri);
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
22 | 64dp
23 |
24 |
25 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/entities/AutoCompleteCountHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.entities;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/19.
19 | */
20 | public class AutoCompleteCountHolder {
21 | public String from = "";
22 | public String to = "";
23 | public int count = 0;
24 |
25 | public AutoCompleteCountHolder(String from, String to, int count) {
26 | this.from = from;
27 | this.to = to;
28 | this.count = count;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/cmd_tool.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/presenters/MVPPresenter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.presenters;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/19.
19 | */
20 | public abstract class MVPPresenter {
21 |
22 | /**
23 | * Called when the presenter is initialized
24 | */
25 | public abstract void start();
26 |
27 | /**
28 | * Called when the presenter is stop, i.e when an activity
29 | * or a fragment finishes
30 | */
31 | public abstract void stop();
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
22 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/util/DomainUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.util;
16 |
17 | import android.os.Handler;
18 | import android.os.Looper;
19 |
20 | /**
21 | * Created by legendmohe on 15/2/26.
22 | */
23 | public class DomainUtil {
24 |
25 | public static void runOnMainThread(Runnable runnable) {
26 | if (runnable == null) {
27 | return;
28 | }
29 | Handler handler = new Handler(Looper.getMainLooper());
30 | handler.post(runnable);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/common/src/main/java/my/home/common/collections/LimitedQueue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.common.collections;
16 |
17 | import java.util.LinkedList;
18 |
19 | /**
20 | * Created by legendmohe on 15/3/30.
21 | */
22 | public class LimitedQueue extends LinkedList {
23 |
24 | private int limit;
25 |
26 | public LimitedQueue(int limit) {
27 | this.limit = limit;
28 | }
29 |
30 | @Override
31 | public boolean add(E o) {
32 | boolean added = super.add(o);
33 | return added;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_suggestion_bg.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/ChatItemListView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 | import java.util.List;
18 |
19 | import my.home.model.entities.ChatItem;
20 |
21 | /**
22 | * Created by legendmohe on 15/2/21.
23 | */
24 | public interface ChatItemListView extends MvpBaseView {
25 | public void onResetDatas(List chatItems);
26 |
27 | public void onChatItemRequest(ChatItem reqItem, boolean isUpdate);
28 |
29 | public void onChatItemResponse(int repCode, long reqID, int reqState, ChatItem repItem);
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_left_bg.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/scale_up_dialog.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_right_bg.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/scale_down_dialog.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/global.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/util/ChatItemUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.util;
16 |
17 | import android.text.TextUtils;
18 |
19 | /**
20 | * Created by legendmohe on 15/5/23.
21 | */
22 | public class ChatItemUtils {
23 |
24 | public static String getThumbnailPath(String src) {
25 | if (TextUtils.isEmpty(src))
26 | return null;
27 | int lastIdx = src.lastIndexOf(".");
28 | String suffix = src.substring(lastIdx + 1);
29 | String rest = src.substring(0, lastIdx);
30 | return rest + ".thumbnail." + suffix;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/SendMessageView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 |
18 | /**
19 | * Created by legendmohe on 15/11/28.
20 | */
21 | public interface SendMessageView extends MvpBaseView {
22 |
23 | void onRecordingBegin();
24 |
25 | void onRecordingEnd();
26 |
27 | void onRecordingAmplitude(double amplitude);
28 |
29 | void onSendingMsgBegin(String tag);
30 |
31 | void onSendingMsgSuccess(String tag);
32 |
33 | void onSendingMsgFail(String tag);
34 |
35 | void putDataForWaveform(short[] notProcessData, int len);
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/view/SimpleAnimationListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.view;
16 |
17 | import android.view.animation.Animation;
18 |
19 | /**
20 | * Created by legendmohe on 15/2/27.
21 | */
22 | public class SimpleAnimationListener implements Animation.AnimationListener {
23 | @Override
24 | public void onAnimationStart(Animation animation) {
25 |
26 | }
27 |
28 | @Override
29 | public void onAnimationEnd(Animation animation) {
30 |
31 | }
32 |
33 | @Override
34 | public void onAnimationRepeat(Animation animation) {
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/events/MGetAutoCompleteItemEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.events;
16 |
17 | import java.util.List;
18 |
19 | /**
20 | * Created by legendmohe on 15/2/13.
21 | */
22 | public class MGetAutoCompleteItemEvent {
23 | private List resultList;
24 |
25 | public MGetAutoCompleteItemEvent(List resultList) {
26 | this.resultList = resultList;
27 | }
28 |
29 | public List getResultList() {
30 | return resultList;
31 | }
32 |
33 | public void setResultList(List resultList) {
34 | this.resultList = resultList;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/events/DShowAutoCompleteItemEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.events;
16 |
17 | import java.util.List;
18 |
19 | /**
20 | * Created by legendmohe on 15/2/15.
21 | */
22 | public class DShowAutoCompleteItemEvent {
23 | private List resultList;
24 |
25 | public DShowAutoCompleteItemEvent(List resultList) {
26 | this.resultList = resultList;
27 | }
28 |
29 | public List getResultList() {
30 | return resultList;
31 | }
32 |
33 | public void setResultList(List resultList) {
34 | this.resultList = resultList;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/events/DShowCmdSuggestionEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.events;
16 |
17 | import my.home.model.entities.AutoCompleteItem;
18 |
19 | /**
20 | * Created by legendmohe on 15/2/26.
21 | */
22 | public class DShowCmdSuggestionEvent {
23 | private AutoCompleteItem item;
24 |
25 | public DShowCmdSuggestionEvent(AutoCompleteItem item) {
26 | this.item = item;
27 | }
28 |
29 | public AutoCompleteItem getItem() {
30 | return item;
31 | }
32 |
33 | public void setItem(AutoCompleteItem item) {
34 | this.item = item;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/datasource/AutoCompleteItemDataSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.datasource;
16 |
17 | import android.content.Context;
18 |
19 | /**
20 | * Created by legendmohe on 15/2/13.
21 | */
22 | public interface AutoCompleteItemDataSource {
23 | String PREFERENCE_KEY = "GetAutoCompleteItemUsecase_pref_key";
24 | String CONF_KEY_GET_AUTOCOMPLETE_ITEM = "GetAutoCompleteItemUsecase_conf_key";
25 |
26 | void saveConf(Context context, String confJSONString);
27 |
28 | void loadConf(Context context);
29 |
30 | void getAutoCompleteItems(Context context, String currentInput);
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/delete_shortcut_item.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_left_corner_normal.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_photo_viewer.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_left_corner_pressed.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_right_corner_normal.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_right_corner_pressed.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/common/src/main/java/my/home/common/BusProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.common;
16 |
17 | import com.squareup.otto.Bus;
18 | import com.squareup.otto.ThreadEnforcer;
19 |
20 | /**
21 | * Created by legendmohe on 15/2/8.
22 | */
23 | public class BusProvider {
24 |
25 | private static final Bus REST_BUS = new Bus(ThreadEnforcer.ANY);
26 | private static final Bus UI_BUS = new Bus();
27 |
28 | private BusProvider() {
29 | }
30 |
31 | public static Bus getRestBusInstance() {
32 |
33 | return REST_BUS;
34 | }
35 |
36 | public static Bus getUIBusInstance() {
37 |
38 | return UI_BUS;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/usecase/RecordMsgUsecase.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package my.home.domain.usecase;
17 |
18 | /**
19 | * Created by legendmohe on 15/12/1.
20 | */
21 | public interface RecordMsgUsecase extends Usecase {
22 |
23 | String TAG = "RecordMsgUsecase";
24 |
25 | enum Event {
26 | START(0), CANCEL(1), STOP(2);
27 |
28 | private int value;
29 |
30 | Event(int i) {
31 | value = i;
32 | }
33 |
34 | public int getValue() {
35 | return value;
36 | }
37 | }
38 |
39 | RecordMsgUsecase setEvent(Event event);
40 |
41 | void cleanup();
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_suggestion_normal.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_suggestion_pressed.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/events/DLoadAutoCompleteConfEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.events;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/15.
19 | */
20 | public class DLoadAutoCompleteConfEvent {
21 | public static final int SUCCESS = 0;
22 | public static final int ERROR = 1;
23 |
24 | private int returnCode;
25 |
26 | public DLoadAutoCompleteConfEvent(int code) {
27 | this.returnCode = code;
28 | }
29 |
30 | public int getReturnCode() {
31 | return returnCode;
32 | }
33 |
34 | public void setReturnCode(int returnCode) {
35 | this.returnCode = returnCode;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/events/MConfAutoCompleteItemEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.events;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/13.
19 | */
20 | public class MConfAutoCompleteItemEvent {
21 | public static final int SUCCESS = 0;
22 | public static final int ERROR = 1;
23 |
24 | private int returnCode;
25 |
26 | public MConfAutoCompleteItemEvent(int code) {
27 | this.returnCode = code;
28 | }
29 |
30 | public int getReturnCode() {
31 | return returnCode;
32 | }
33 |
34 | public void setReturnCode(int returnCode) {
35 | this.returnCode = returnCode;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/events/MSaveAutoCompleteLocalHistoryEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.events;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/19.
19 | */
20 | public class MSaveAutoCompleteLocalHistoryEvent {
21 | public static final int SUCCESS = 0;
22 | public static final int ERROR = 1;
23 |
24 | private int returnCode;
25 |
26 | public MSaveAutoCompleteLocalHistoryEvent(int code) {
27 | this.returnCode = code;
28 | }
29 |
30 | public int getReturnCode() {
31 | return returnCode;
32 | }
33 |
34 | public void setReturnCode(int returnCode) {
35 | this.returnCode = returnCode;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/events/DSaveAutoCompleteLocalHistoryEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.events;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/19.
19 | */
20 | public class DSaveAutoCompleteLocalHistoryEvent {
21 | public static final int SUCCESS = 0;
22 | public static final int ERROR = 1;
23 |
24 | private int returnCode;
25 |
26 | public DSaveAutoCompleteLocalHistoryEvent(int code) {
27 | this.returnCode = code;
28 | }
29 |
30 | public int getReturnCode() {
31 | return returnCode;
32 | }
33 |
34 | public void setReturnCode(int returnCode) {
35 | this.returnCode = returnCode;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/chat_item_server_loc.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chatting_setmode_msg_btn.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chatting_setmode_voice_btn.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/top_shadow.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/presenters/MVPActivityPresenter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.presenters;
16 |
17 | import android.app.Activity;
18 |
19 | /**
20 | * Created by legendmohe on 15/3/15.
21 | */
22 | public abstract class MVPActivityPresenter extends MVPPresenter {
23 | public void onActivityStart(Activity activity) {
24 | }
25 |
26 | public void onActivityStop(Activity activity) {
27 | }
28 |
29 | public void onActivityResume(Activity activity) {
30 | }
31 |
32 | public void onActivityPause(Activity activity) {
33 | }
34 |
35 | public void onActivityCreate(Activity activity) {
36 | }
37 |
38 | public void onActivityDestory(Activity activity) {
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bottom_right_shadow.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/common/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | apply plugin: 'com.android.library'
16 |
17 | android {
18 | compileSdkVersion 21
19 | buildToolsVersion "21.1.1"
20 |
21 | defaultConfig {
22 | minSdkVersion 16
23 | targetSdkVersion 21
24 | versionCode 1
25 | versionName "1.0"
26 | }
27 | buildTypes {
28 | release {
29 | minifyEnabled false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 | }
34 |
35 | dependencies {
36 | compile fileTree(dir: 'libs', include: ['*.jar'])
37 | compile 'com.android.support:appcompat-v7:21.0.3'
38 | compile 'com.squareup:otto:1.3.8'
39 | compile 'com.google.code.gson:gson:2.3.1'
40 | }
41 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/usecase/SendMsgUsecase.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package my.home.domain.usecase;
17 |
18 | import java.io.File;
19 |
20 | /**
21 | * Created by legendmohe on 15/12/1.
22 | */
23 | public interface SendMsgUsecase extends Usecase {
24 |
25 | String TAG = "SendMsgUsecase";
26 |
27 | enum Event {
28 | START(0), FINISH(1), CANCEL(2), ERROR(3);
29 |
30 | private int value;
31 |
32 | Event(int i) {
33 | value = i;
34 | }
35 |
36 | public int getValue() {
37 | return value;
38 | }
39 | }
40 |
41 | SendMsgUsecase setTargetFile(File targetFile);
42 |
43 | SendMsgUsecase setEvent(Event event);
44 |
45 | void cleanup();
46 |
47 | void cancel(File file);
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/chat_item_is_me.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
33 |
--------------------------------------------------------------------------------
/domain/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | apply plugin: 'com.android.library'
16 |
17 | android {
18 | compileSdkVersion 21
19 | buildToolsVersion "21.1.1"
20 |
21 | defaultConfig {
22 | minSdkVersion 16
23 | targetSdkVersion 21
24 | versionCode 1
25 | versionName "1.0"
26 | }
27 | buildTypes {
28 | release {
29 | minifyEnabled false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 | }
34 |
35 | dependencies {
36 | compile fileTree(dir: 'libs', include: ['*.jar'])
37 | compile 'com.android.support:appcompat-v7:21.0.3'
38 | compile project(':model')
39 | compile project(':common')
40 |
41 | compile 'com.mcxiaoke.volley:library:1.0.19'
42 | }
43 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/usecase/AutoCompleteItemUsecase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.usecase;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/8.
19 | */
20 | public interface AutoCompleteItemUsecase extends Usecase {
21 |
22 | public static final String TAG = "AutoCompleteItemUsecaseImpl";
23 |
24 | public static final int MODE_DO_NOTHING = -1;
25 | public static final int MODE_GETITEM = 0;
26 | public static final int MODE_SAVE_CONF = 1;
27 | public static final int MODE_LOAD_CONF = 2;
28 |
29 | int getMode();
30 |
31 | AutoCompleteItemUsecase setMode(int mMode);
32 |
33 | AutoCompleteItemUsecase setInputText(String inputText);
34 |
35 | String getConfString();
36 |
37 | AutoCompleteItemUsecase setConfString(String mConfString);
38 | }
39 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/entities/AutoCompleteToolItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.entities;
16 |
17 | /**
18 | * Created by legendmohe on 15/2/23.
19 | */
20 | public class AutoCompleteToolItem extends AutoCompleteItem {
21 | private int specType;
22 |
23 | public static final int SPEC_TYPE_DATE = 0;
24 | public static final int SPEC_TYPE_TIME = 1;
25 | public static final int SPEC_TYPE_FAVOR = 2;
26 |
27 | public AutoCompleteToolItem(String type, String content, int specType) {
28 | super(type, 10000.0f, content, "");
29 | this.specType = specType;
30 | }
31 |
32 | public int getSpecType() {
33 | return specType;
34 | }
35 |
36 | public void setSpecType(int specType) {
37 | this.specType = specType;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/views/FindMyTagDistanceView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.views;
16 |
17 | import android.content.Context;
18 |
19 | import org.altbeacon.beacon.Beacon;
20 |
21 | import java.util.List;
22 |
23 | /**
24 | * Created by legendmohe on 15/4/21.
25 | */
26 | public interface FindMyTagDistanceView extends MvpBaseView {
27 | public Context getApplicationContext();
28 |
29 | void onBeaconEnter(Beacon beacon);
30 | //
31 | // void onBeaconExit(String uid);
32 | //
33 | // void onBeaconState(int var1, String uid);
34 |
35 | void onBeaconDistance(String uid, String bdName, double distance, List data);
36 |
37 | void showBeaconsDialog();
38 |
39 | void onBtEnable();
40 |
41 | void onBtDisable();
42 |
43 | void onBtTurningOn();
44 | }
45 |
--------------------------------------------------------------------------------
/model/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | apply plugin: 'com.android.library'
16 |
17 | android {
18 | compileSdkVersion 21
19 | buildToolsVersion "21.1.1"
20 |
21 | defaultConfig {
22 | minSdkVersion 16
23 | targetSdkVersion 21
24 | versionCode 1
25 | versionName "1.0"
26 | }
27 | buildTypes {
28 | release {
29 | minifyEnabled false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 | }
34 |
35 | dependencies {
36 | compile project(':common')
37 |
38 | compile fileTree(dir: 'libs', include: ['*.jar'])
39 | compile 'com.android.support:appcompat-v7:21.0.3'
40 | compile files('libs/greendao-1.3.0-beta-1.jar')
41 | compile 'com.google.code.gson:gson:2.3.1'
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_nfcdetect.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
24 |
25 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/mvp/presenters/MvpBasePresenter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.mvp.presenters;
16 |
17 | /**
18 | * Created by legendmohe on 16/3/14.
19 | */
20 |
21 | import java.lang.ref.WeakReference;
22 |
23 | import my.home.lehome.mvp.views.MvpBaseView;
24 |
25 | public abstract class MvpBasePresenter {
26 |
27 | private WeakReference mView;
28 |
29 | public MvpBasePresenter(T view) {
30 | mView = new WeakReference(view);
31 | }
32 |
33 | public boolean isViewAttached() {
34 | return mView != null && mView.get() != null;
35 | }
36 |
37 | public T getView() {
38 | if (mView != null) {
39 | return mView.get();
40 | }
41 | return null;
42 | }
43 |
44 | public abstract void start();
45 |
46 | public abstract void stop();
47 | }
48 |
--------------------------------------------------------------------------------
/common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/shortcut_item.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
33 |
34 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/usecase/DeleteAutoCompleteHistoryUsecaseImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.usecase;
16 |
17 | import android.content.Context;
18 |
19 | import java.lang.ref.WeakReference;
20 |
21 | import my.home.model.manager.DBStaticManager;
22 |
23 | /**
24 | * Created by legendmohe on 15/12/30.
25 | */
26 | public class DeleteAutoCompleteHistoryUsecaseImpl implements DeleteAutoCompleteHistoryUsecase {
27 |
28 | WeakReference mContext;
29 |
30 | public DeleteAutoCompleteHistoryUsecaseImpl(Context context) {
31 | mContext = new WeakReference(context);
32 | }
33 |
34 | @Override
35 | public void execute() {
36 | if (mContext.get() != null) {
37 | DBStaticManager.deleteAllHistoryItems(mContext.get());
38 | DBStaticManager.deleteAllMsgHistoryItems(mContext.get());
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/nfc_tech_filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
18 | android.nfc.tech.Ndef
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.navigation/app/raw/main.nvg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
10 |
13 |
14 |
15 |
18 |
21 |
22 |
23 |
26 |
29 |
30 |
31 |
34 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/activity/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.activity;
16 |
17 | import android.os.Bundle;
18 | import android.support.v7.app.AppCompatActivity;
19 |
20 | import my.home.lehome.fragment.SettingsFragment;
21 |
22 | public class SettingsActivity extends AppCompatActivity {
23 | public static final String TAG = "SettingsActivity";
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 |
29 | // Display the fragment as the main content.
30 | getFragmentManager().beginTransaction()
31 | .replace(android.R.id.content, new SettingsFragment())
32 | .commit();
33 | }
34 |
35 | @Override
36 | protected void onResume() {
37 | super.onResume();
38 | }
39 |
40 | @Override
41 | protected void onPause() {
42 | super.onPause();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/res/values/color.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 | #333333
17 | #2d2d2d
18 | #acacac
19 | #acacac
20 | #cccccc
21 | #ffc5c5c5
22 | #ffc5c5c5
23 | #ffe5e5e5
24 | #fff0f0f0
25 | #ffc5c5c5
26 | #fff0f0f0
27 |
28 | #2b2b2b
29 | #282828
30 | #454545
31 |
32 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/events/DRecordingMsgEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.events;
16 |
17 | import java.io.File;
18 |
19 | import my.home.model.entities.MessageItem;
20 |
21 | /**
22 | * Created by legendmohe on 15/12/5.
23 | */
24 | public class DRecordingMsgEvent {
25 | private File resultFile;
26 | private MessageItem msgItem;
27 |
28 | public enum TYPE {
29 | START, FINISH
30 | }
31 |
32 | public DRecordingMsgEvent(File file, MessageItem item) {
33 | msgItem = item;
34 | resultFile = file;
35 | }
36 |
37 | public File getResultFile() {
38 | return resultFile;
39 | }
40 |
41 | public void setResultFile(File resultFile) {
42 | this.resultFile = resultFile;
43 | }
44 |
45 | public MessageItem getMsgItem() {
46 | return msgItem;
47 | }
48 |
49 | public void setMsgItem(MessageItem msgItem) {
50 | this.msgItem = msgItem;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/beacon_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
19 |
20 |
36 |
37 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/entities/HistoryItem.java:
--------------------------------------------------------------------------------
1 | package my.home.model.entities;
2 |
3 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
4 |
5 | /**
6 | * Entity mapped to table HISTORY_ITEM.
7 | */
8 | public class HistoryItem {
9 |
10 | private Long id;
11 | /**
12 | * Not-null value.
13 | */
14 | private String from;
15 | /**
16 | * Not-null value.
17 | */
18 | private String to;
19 |
20 | public HistoryItem() {
21 | }
22 |
23 | public HistoryItem(Long id) {
24 | this.id = id;
25 | }
26 |
27 | public HistoryItem(Long id, String from, String to) {
28 | this.id = id;
29 | this.from = from;
30 | this.to = to;
31 | }
32 |
33 | public Long getId() {
34 | return id;
35 | }
36 |
37 | public void setId(Long id) {
38 | this.id = id;
39 | }
40 |
41 | /**
42 | * Not-null value.
43 | */
44 | public String getFrom() {
45 | return from;
46 | }
47 |
48 | /**
49 | * Not-null value; ensure this value is available before it is saved to the database.
50 | */
51 | public void setFrom(String from) {
52 | this.from = from;
53 | }
54 |
55 | /**
56 | * Not-null value.
57 | */
58 | public String getTo() {
59 | return to;
60 | }
61 |
62 | /**
63 | * Not-null value; ensure this value is available before it is saved to the database.
64 | */
65 | public void setTo(String to) {
66 | this.to = to;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 | 16dp
19 | 16dp
20 | 8dp
21 | 8dp
22 |
23 |
27 | 200dp
28 | 15sp
29 |
30 |
31 | 16dp
32 | 160dp
33 | 180dp
34 | 16dp
35 |
36 |
37 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/entities/MsgHistoryItem.java:
--------------------------------------------------------------------------------
1 | package my.home.model.entities;
2 |
3 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
4 |
5 | /**
6 | * Entity mapped to table MSG_HISTORY_ITEM.
7 | */
8 | public class MsgHistoryItem {
9 |
10 | private Long id;
11 | /**
12 | * Not-null value.
13 | */
14 | private String from;
15 | /**
16 | * Not-null value.
17 | */
18 | private String msg;
19 |
20 | public MsgHistoryItem() {
21 | }
22 |
23 | public MsgHistoryItem(Long id) {
24 | this.id = id;
25 | }
26 |
27 | public MsgHistoryItem(Long id, String from, String msg) {
28 | this.id = id;
29 | this.from = from;
30 | this.msg = msg;
31 | }
32 |
33 | public Long getId() {
34 | return id;
35 | }
36 |
37 | public void setId(Long id) {
38 | this.id = id;
39 | }
40 |
41 | /**
42 | * Not-null value.
43 | */
44 | public String getFrom() {
45 | return from;
46 | }
47 |
48 | /**
49 | * Not-null value; ensure this value is available before it is saved to the database.
50 | */
51 | public void setFrom(String from) {
52 | this.from = from;
53 | }
54 |
55 | /**
56 | * Not-null value.
57 | */
58 | public String getMsg() {
59 | return msg;
60 | }
61 |
62 | /**
63 | * Not-null value; ensure this value is available before it is saved to the database.
64 | */
65 | public void setMsg(String msg) {
66 | this.msg = msg;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/usecase/MarkCurrentInputUsecaseImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.usecase;
16 |
17 | import android.content.Context;
18 |
19 | import java.lang.ref.WeakReference;
20 |
21 | import my.home.model.datasource.AutoCompleteItemDataSourceImpl;
22 |
23 | /**
24 | * Created by legendmohe on 15/2/20.
25 | */
26 | public class MarkCurrentInputUsecaseImpl implements MarkCurrentInputUsecase {
27 | private WeakReference mContext;
28 | private String mInput;
29 |
30 | public MarkCurrentInputUsecaseImpl(Context context, String input) {
31 | this.mContext = new WeakReference(context);
32 | this.mInput = input;
33 | }
34 |
35 | @Override
36 | public void execute() {
37 | // BusProvider.getRestBusInstance().register(this);
38 | if (mContext.get() != null)
39 | AutoCompleteItemDataSourceImpl.getInstance().markCurrentInput(mContext.get(), mInput);
40 | // BusProvider.getRestBusInstance().unregister(this);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_geo_fencing.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
21 |
22 |
23 |
24 |
31 |
32 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/fragment/GeoFencingFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.fragment;
16 |
17 |
18 | import android.os.Bundle;
19 | import android.support.v4.app.Fragment;
20 | import android.view.LayoutInflater;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 |
24 | import my.home.lehome.R;
25 |
26 | /**
27 | * A simple {@link Fragment} subclass.
28 | */
29 | public class GeoFencingFragment extends Fragment {
30 |
31 |
32 | public GeoFencingFragment() {
33 | // Required empty public constructor
34 | }
35 |
36 |
37 | public static GeoFencingFragment newInstance() {
38 | GeoFencingFragment fragment = new GeoFencingFragment();
39 | return fragment;
40 | }
41 |
42 |
43 | @Override
44 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
45 | Bundle savedInstanceState) {
46 | // Inflate the layout for this fragment
47 | return inflater.inflate(R.layout.fragment_geo_fencing, container, false);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/message_item.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
28 |
29 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/shortcut_fragment.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
20 |
21 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
21 |
24 |
25 |
32 |
33 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/receiver/BootCompleteReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.receiver;
16 |
17 | import android.content.BroadcastReceiver;
18 | import android.content.Context;
19 | import android.content.Intent;
20 | import android.util.Log;
21 |
22 | import my.home.common.util.PrefUtil;
23 | import my.home.lehome.helper.PushSDKManager;
24 | import my.home.lehome.mvp.presenters.MainActivityPresenter;
25 |
26 | /**
27 | * Created by legendmohe on 15/4/1.
28 | */
29 | public class BootCompleteReceiver extends BroadcastReceiver {
30 | private final static String TAG = "BootCompleteReceiver";
31 |
32 | @Override
33 | public void onReceive(Context context, Intent intent) {
34 | if (PrefUtil.getbooleanValue(context, MainActivityPresenter.APP_EXIT_KEY, false)) {
35 | Log.d(TAG, "app set exit. ignore boot complete state change.");
36 | return;
37 | }
38 | if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
39 | Log.d(TAG, "start PushSDK.");
40 | PushSDKManager.startPushSDKService(context);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/chat_progressbar.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/draw_item.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
21 |
22 |
29 |
30 |
40 |
41 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/auto_complete_item_layout.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
18 |
19 |
27 |
28 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_home_state.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
21 |
22 |
35 |
36 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/common/src/main/java/my/home/common/speex/Speex.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.common.speex;
16 |
17 | /**
18 | * Created by legendmohe on 15/11/9.
19 | */
20 | public class Speex {
21 | /* quality
22 | * 1 : 4kbps (very noticeable artifacts, usually intelligible)
23 | * 2 : 6kbps (very noticeable artifacts, good intelligibility)
24 | * 4 : 8kbps (noticeable artifacts sometimes)
25 | * 6 : 11kpbs (artifacts usually only noticeable with headphones)
26 | * 8 : 15kbps (artifacts not usually noticeable)
27 | */
28 | private static final int DEFAULT_COMPRESSION = 8;
29 |
30 | public Speex() {
31 | }
32 |
33 | public void init() {
34 | load();
35 | open(DEFAULT_COMPRESSION);
36 | }
37 |
38 | private void load() {
39 | try {
40 | System.loadLibrary("speex");
41 | } catch (Throwable e) {
42 | e.printStackTrace();
43 | }
44 | }
45 |
46 | public native int open(int compression);
47 |
48 | public native int getFrameSize();
49 |
50 | public native int decode(byte encoded[], short lin[], int size);
51 |
52 | public native int encode(short lin[], int offset, byte encoded[], int size);
53 |
54 | public native void close();
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_photo_viewer.xml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
22 |
23 |
29 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/util/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.util;
16 |
17 | public class Constants {
18 |
19 | public static final int CHATITEM_LOAD_LIMIT = 20;
20 | public static final int CHATITEM_LOWEST_INDEX = 1;
21 | public static final float DIALOG_CANCEL_Y_PERSENT = 0.70f;
22 | public static final int CHATITEM_STATE_SUCCESS = 0;
23 | public static final int CHATITEM_STATE_PENDING = 1;
24 | public static final int CHATITEM_STATE_ERROR = 2;
25 | public static final long SHOW_DATE_TEXTVIEW_GAP = 5 * 60 * 1000;
26 |
27 | public static final String BAIDUVOICE_API_KEY = "7P5ZCG6WTAGWr5TuURBgndRH";
28 | public static final String BAIDUVOICE_SECRET_KEY = "gggk30ubCSFGM5uXYfwGll4vILlnQ0em";
29 |
30 | public static final int SETTINGS_ACTIVITY_RESULT_CODE = 100;
31 |
32 | public static final int MESSAGE_SEQ_QUEUE_LIMIT = 150;
33 | public static final long VOLUME_KEY_DOWN_DELAY = 500;
34 |
35 | public static final String MESSAGE_PREFIX = "留言";
36 |
37 | public static final String LOCAL_SERVER_ADDRESS_PREFIX = "http://";
38 | public static final String LOCAL_SERVER_ADDRESS_PORT = "8000";
39 | public static final String LOCAL_SERVER_SUBSCRIBE_PREFIX = "tcp://";
40 | public static final String LOCAL_SERVER_SUBSCRIBE_PORT = "9000";
41 | }
42 |
--------------------------------------------------------------------------------
/common/src/main/java/my/home/common/PrefKeyValueStorgeImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.common;
16 |
17 | import android.content.Context;
18 | import android.content.SharedPreferences;
19 | import android.preference.PreferenceManager;
20 |
21 | /**
22 | * Created by legendmohe on 15/3/29.
23 | */
24 | public class PrefKeyValueStorgeImpl extends CacheKeyValueStorageImpl {
25 |
26 | private final SharedPreferences.Editor mEditor;
27 | private final SharedPreferences mPref;
28 |
29 | public PrefKeyValueStorgeImpl(Context context) {
30 | super();
31 | mPref = PreferenceManager.getDefaultSharedPreferences(context);
32 | mEditor = mPref.edit();
33 | }
34 |
35 | @Override
36 | boolean storageHasKey(String key) {
37 | if (mPref.getString(key, null) == null)
38 | return false;
39 | return true;
40 | }
41 |
42 | @Override
43 | void storagePutString(String key, String value) {
44 | mEditor.putString(key, value);
45 | }
46 |
47 | @Override
48 | String storageGetString(String key) {
49 | return mPref.getString(key, null);
50 | }
51 |
52 | @Override
53 | void storageRemoveString(String key) {
54 | mEditor.remove(key);
55 | }
56 |
57 | @Override
58 | void storageSync() {
59 | mEditor.apply();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/common/src/main/java/my/home/common/State.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.common;
16 |
17 | import java.util.HashMap;
18 |
19 |
20 | /**
21 | * Created by legendmohe on 15/12/5.
22 | */
23 | public abstract class State {
24 |
25 | HashMap, State> mToStates = new HashMap<>();
26 | private StateMachine mStateMachine;
27 |
28 | @SuppressWarnings("unused")
29 | private String mName = "UNKNOWN";
30 |
31 | public State(String name) {
32 | mName = name;
33 | }
34 |
35 | public void linkTo(State toState, Enum> event) {
36 | if (toState == null) {
37 | throw new IllegalArgumentException("toState cannot be null");
38 | }
39 | mToStates.put(event, toState);
40 | }
41 |
42 | public void onStart() {
43 | }
44 |
45 | public void onStop(int cause) {
46 | }
47 |
48 | public void onReset(int cause) {
49 | }
50 |
51 | public void onUnhandleEvent(Enum> event, Object data) {
52 | }
53 |
54 | public void onEnter(State fromState, Enum> event, Object data) {
55 | }
56 |
57 | public void onLeave(State toState, Enum> event, Object data) {
58 | }
59 |
60 | protected StateMachine getStateMachine() {
61 | return mStateMachine;
62 | }
63 |
64 | protected void setStateMachine(StateMachine stateMachine) {
65 | mStateMachine = stateMachine;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/msg_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
18 |
19 |
21 |
24 |
26 |
31 |
32 |
33 |
34 |
35 |
37 |
38 |
39 |
40 |
41 |
44 |
46 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/view/decoration/SimpleDividerItemDecoration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.view.decoration;
16 |
17 | import android.content.res.Resources;
18 | import android.graphics.Canvas;
19 | import android.graphics.drawable.Drawable;
20 | import android.support.v7.widget.RecyclerView;
21 | import android.view.View;
22 |
23 | import my.home.lehome.R;
24 |
25 | /**
26 | * Created by legendmohe on 15/4/29.
27 | */
28 | public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration {
29 | private Drawable mDivider;
30 |
31 | public SimpleDividerItemDecoration(Resources resources) {
32 | mDivider = resources.getDrawable(R.drawable.line_divider);
33 | }
34 |
35 | public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
36 | int left = parent.getPaddingLeft();
37 | int right = parent.getWidth() - parent.getPaddingRight();
38 |
39 | int childCount = parent.getChildCount();
40 | for (int i = 0; i < childCount; i++) {
41 | View child = parent.getChildAt(i);
42 |
43 | RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
44 |
45 | int top = child.getBottom() + params.bottomMargin;
46 | int bottom = top + mDivider.getIntrinsicHeight();
47 |
48 | mDivider.setBounds(left, top, right, bottom);
49 | mDivider.draw(c);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/my/home/lehome/util/CommonUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.lehome.util;
16 |
17 | import android.content.ClipData;
18 | import android.content.ClipboardManager;
19 | import android.content.Context;
20 |
21 | import java.text.SimpleDateFormat;
22 | import java.util.Calendar;
23 | import java.util.Locale;
24 |
25 | public class CommonUtils {
26 |
27 | public static String removeLastChar(String s) {
28 | if (s == null || s.length() == 0) {
29 | return s;
30 | }
31 | return s.substring(0, s.length() - 1);
32 | }
33 |
34 | public static boolean copyStringToClipboard(Context context, String label, String src) {
35 | ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
36 | ClipData clip = ClipData.newPlainText(label, src);
37 | clipboard.setPrimaryClip(clip);
38 | return true;
39 | }
40 |
41 | public static String getDateFormatString(String format) {
42 | Calendar c = Calendar.getInstance();
43 | SimpleDateFormat df = new SimpleDateFormat(format, Locale.getDefault()); //called without pattern
44 | return df.format(c.getTime());
45 | }
46 |
47 | public static String concatenateStrings(String[] targets) {
48 | StringBuilder sb = new StringBuilder();
49 | for (String target :
50 | targets) {
51 | sb.append(target);
52 | }
53 | return sb.toString();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/model/src/main/java/my/home/model/entities/Shortcut.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.model.entities;
16 |
17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
18 |
19 | /**
20 | * Entity mapped to table SHORTCUT.
21 | */
22 | public class Shortcut {
23 |
24 | private Long id;
25 | private String content;
26 | private Integer invoke_count;
27 | private Double weight;
28 |
29 | public Shortcut() {
30 | }
31 |
32 | public Shortcut(Long id) {
33 | this.id = id;
34 | }
35 |
36 | public Shortcut(Long id, String content, Integer invoke_count, Double weight) {
37 | this.id = id;
38 | this.content = content;
39 | this.invoke_count = invoke_count;
40 | this.weight = weight;
41 | }
42 |
43 | public Long getId() {
44 | return id;
45 | }
46 |
47 | public void setId(Long id) {
48 | this.id = id;
49 | }
50 |
51 | public String getContent() {
52 | return content;
53 | }
54 |
55 | public void setContent(String content) {
56 | this.content = content;
57 | }
58 |
59 | public Integer getInvoke_count() {
60 | return invoke_count;
61 | }
62 |
63 | public void setInvoke_count(Integer invoke_count) {
64 | this.invoke_count = invoke_count;
65 | }
66 |
67 | public Double getWeight() {
68 | return weight;
69 | }
70 |
71 | public void setWeight(Double weight) {
72 | this.weight = weight;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/domain/src/main/java/my/home/domain/usecase/SaveAutoCompleteLocalHistoryUsecaseImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | */
14 |
15 | package my.home.domain.usecase;
16 |
17 | import android.content.Context;
18 |
19 | import com.squareup.otto.Subscribe;
20 |
21 | import java.lang.ref.WeakReference;
22 |
23 | import my.home.common.BusProvider;
24 | import my.home.domain.events.DSaveAutoCompleteLocalHistoryEvent;
25 | import my.home.model.events.MSaveAutoCompleteLocalHistoryEvent;
26 |
27 | /**
28 | * Created by legendmohe on 15/2/19.
29 | */
30 | public class SaveAutoCompleteLocalHistoryUsecaseImpl implements SaveAutoCompleteLocalHistoryUsecase {
31 | private WeakReference mContext;
32 |
33 | public SaveAutoCompleteLocalHistoryUsecaseImpl(Context context) {
34 | this.mContext = new WeakReference(context);
35 | }
36 |
37 | @Override
38 | public void execute() {
39 | BusProvider.getRestBusInstance().register(this);
40 | // AutoCompleteItemDataSourceImpl.getInstance().saveLocalHistory(mContext.get());
41 | BusProvider.getRestBusInstance().unregister(this);
42 | }
43 |
44 | @Subscribe
45 | public void onSaveAutoCompleteLocalHistoryItems(MSaveAutoCompleteLocalHistoryEvent event) {
46 | if (event.getReturnCode() == MSaveAutoCompleteLocalHistoryEvent.SUCCESS)
47 | BusProvider.getRestBusInstance().post(new DSaveAutoCompleteLocalHistoryEvent(event.getReturnCode()));
48 | else
49 | BusProvider.getRestBusInstance().post(new DSaveAutoCompleteLocalHistoryEvent(event.getReturnCode()));
50 | }
51 | }
52 |
--------------------------------------------------------------------------------