diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-09-21 23:10:57 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-09-21 23:10:57 +0900 |
commit | 6420d8f147cd36bcc0533a7f647af07b301743a2 (patch) | |
tree | af8899c4fbcfd56cfd5ca2279d0159ee044ddc33 /app | |
parent | 98dbbc435aa270c6f9ce101b230399b8c712a753 (diff) | |
download | SmileEssence-6420d8f147cd36bcc0533a7f647af07b301743a2.tar.gz |
使っていない機能を削除
Diffstat (limited to 'app')
63 files changed, 7 insertions, 3138 deletions
diff --git a/app/src/androidTest/java/net/lacolaco/smileessence/command/CommandsTest.java b/app/src/androidTest/java/net/lacolaco/smileessence/command/CommandsTest.java deleted file mode 100644 index d7c77831..00000000 --- a/app/src/androidTest/java/net/lacolaco/smileessence/command/CommandsTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command; - -import android.test.ActivityInstrumentationTestCase2; - -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.util.TwitterMock; - -public class CommandsTest extends ActivityInstrumentationTestCase2<MainActivity> { - - TwitterMock mock; - - public CommandsTest() { - super(MainActivity.class); - } - - @Override - public void setUp() throws Exception { - mock = new TwitterMock(getInstrumentation().getContext()); - } - -// public void testStatusCommand() throws Exception -// { -// final Activity activity = getActivity(); -// final Account account = new Account(mock.getAccessToken(), mock.getAccessTokenSecret(), mock.getUserMock().getId(), mock.getUserMock().getScreenName()); -// final Status status = mock.getTweetMock(); -// Tweet.fromTwitter(status); -// getActivity().runOnUiThread(new Runnable() -// { -// @Override -// public void run() -// { -// StatusCommand reply = new StatusCommandReply(activity, status); -// assertTrue(reply.isEnabled()); -// assertEquals(R.id.key_command_status_reply, reply.getKey()); -// assertEquals(activity.getString(R.string.command_status_reply), reply.getText()); -// assertTrue(reply.execute()); -// assertEquals("@laco0416_2 ", PostState.getState().getText()); -// assertEquals(status.getId(), PostState.getState().getInReplyToStatusID()); -// assertEquals(status.getUser().getScreenName(), PostState.getState().getInReplyToScreenName()); -// assertEquals(status.getText(), PostState.getState().getInReplyToText()); -// StatusCommandNanigaja nanigaja = new StatusCommandNanigaja(activity, status, account); -// assertEquals("@laco0416_2 な~にがテスト #test http://t.co/nd7Bzal2EU http://t.co/yANfRHC4KWじゃ", StatusCommandNanigaja.build(activity, status, account)); -// assertEquals("???「テスト #test http://t.co/nd7Bzal2EU http://t.co/yANfRHC4KW」", StatusCommandMakeAnonymous.build(activity, status, account)); -// } -// }); -// } -// -// public void testUserCommand() throws Exception -// { -// final Activity activity = getActivity(); -// Account account = new Account(mock.getAccessToken(), mock.getAccessTokenSecret(), mock.getUserMock().getId(), mock.getUserMock().getScreenName()); -// final User user = mock.getUserMock(); -// getActivity().runOnUiThread(new Runnable() -// { -// @Override -// public void run() -// { -// UserCommand reply = new UserCommandReply(activity, user); -// assertTrue(reply.isEnabled()); -// assertEquals(activity.getString(R.string.command_user_reply), reply.getText()); -// assertTrue(reply.execute()); -// assertEquals("@laco0416 ", PostState.getState().getText()); -// assertEquals(-1, PostState.getState().getInReplyToStatusID()); -// assertEquals(user.getScreenName(), PostState.getState().getInReplyToScreenName()); -// assertEquals("", PostState.getState().getInReplyToText()); -// UserCommandAddToReply addToReply = new UserCommandAddToReply(activity, user); -// addToReply.execute(); -// assertEquals("@laco0416 @laco0416 ", PostState.getState().getText()); -// } -// }); -// } -// -// public void testMessageCommand() throws Exception -// { -// final Activity activity = getActivity(); -// Account account = new Account(mock.getAccessToken(), mock.getAccessTokenSecret(), mock.getUserMock().getId(), mock.getUserMock().getScreenName()); -// final DirectMessage message = mock.getDirectMessageMock(); -// getActivity().runOnUiThread(new Runnable() -// { -// @Override -// public void run() -// { -// MessageCommand reply = new MessageCommandReply(activity, message); -// assertTrue(reply.isEnabled()); -// assertEquals(activity.getString(R.string.command_message_reply), reply.getText()); -// assertTrue(reply.execute()); -// assertEquals("", PostState.getState().getText()); -// assertEquals(-1, PostState.getState().getInReplyToStatusID()); -// assertEquals(message.getSenderScreenName(), PostState.getState().getInReplyToScreenName()); -// assertTrue(PostState.getState().isDirectMessage()); -// assertEquals(message.getText(), PostState.getState().getInReplyToText()); -// } -// }); -// -// } -} diff --git a/app/src/androidTest/java/net/lacolaco/smileessence/command/NanigajaTest.java b/app/src/androidTest/java/net/lacolaco/smileessence/command/NanigajaTest.java deleted file mode 100644 index b0973f40..00000000 --- a/app/src/androidTest/java/net/lacolaco/smileessence/command/NanigajaTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command; - -import android.content.Context; -import android.content.res.Configuration; -import android.test.ActivityInstrumentationTestCase2; -import net.lacolaco.smileessence.Application; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.command.status.StatusCommandNanigaja; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.util.TwitterMock; - -import java.util.Locale; - -public class NanigajaTest extends ActivityInstrumentationTestCase2<MainActivity> { - - private TwitterMock mock; - - public NanigajaTest() { - super(MainActivity.class); - } - - @Override - public void setUp() throws Exception { - this.mock = new TwitterMock(getInstrumentation().getContext()); - Context context = getActivity(); - Application.getInstance().setCurrentAccount(mock.getAccount()); - Configuration config = context.getResources().getConfiguration(); - config.locale = Locale.JAPANESE; - context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics()); - } - - public void testBuildNormal() throws Exception { - Tweet status = mock.getTweetMock(); - StatusCommandNanigaja nanigaja = new StatusCommandNanigaja(getActivity(), status); - assertEquals("な~にが" + status.getText() + "じゃ", nanigaja.build()); - } - - public void testBuildReply() throws Exception { - Tweet status = mock.getReplyMock(); - StatusCommandNanigaja nanigaja = new StatusCommandNanigaja(getActivity(), status); - assertTrue(nanigaja.build().startsWith("@" + status.getUser().getScreenName() + " な~にが")); - } - - public void testBuildRetweet() throws Exception { - Tweet status = mock.getRetweetMock(); - StatusCommandNanigaja nanigaja = new StatusCommandNanigaja(getActivity(), status); - assertTrue(nanigaja.build().startsWith("@" + status.getRetweetedTweet().getUser().getScreenName() + " な~にが")); - } - - @Override - public void tearDown() throws Exception { - getActivity().forceFinish(); - } -} diff --git a/app/src/androidTest/java/net/lacolaco/smileessence/command/PostCommandsTest.java b/app/src/androidTest/java/net/lacolaco/smileessence/command/PostCommandsTest.java deleted file mode 100644 index 3897c89f..00000000 --- a/app/src/androidTest/java/net/lacolaco/smileessence/command/PostCommandsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command; - -import android.test.ActivityInstrumentationTestCase2; - -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.command.post.PostCommandInsert; -import net.lacolaco.smileessence.command.post.PostCommandMorse; -import net.lacolaco.smileessence.command.post.PostCommandZekamashi; -import net.lacolaco.smileessence.util.Morse; -import net.lacolaco.smileessence.data.PostState; - -public class PostCommandsTest extends ActivityInstrumentationTestCase2<MainActivity> { - - public PostCommandsTest() { - super(MainActivity.class); - } - - @Override - public void tearDown() throws Exception { - getActivity().forceFinish(); - } - - public void testMorse() throws Exception { - PostState.getState().removeListener(); - String s = "テスト(テスト)"; - PostCommandMorse morse = new PostCommandMorse(getActivity()); - assertEquals(Morse.jaToMorse(s), morse.build(s)); - } - - public void testSubString() throws Exception { - String s = "テスト(テスト)"; - PostCommandMorse morse = new PostCommandMorse(getActivity()); - PostState.getState().removeListener(); - PostState.newState().beginTransaction().setText(s).setSelection(0, 3).commit(); - morse.execute(); - assertEquals(Morse.jaToMorse("テスト") + "(テスト)", PostState.getState().getText()); - } - - public void testInsert() throws Exception { - String s = "テスト"; - String inserted = "AAA"; - PostCommandInsert insert = new PostCommandInsert(getActivity(), inserted); - assertEquals("テストAAA", insert.build(s)); - } - - public void testZekamashi() throws Exception { - String s = "(しまかぜ)"; - PostCommandZekamashi zekamashi = new PostCommandZekamashi(getActivity()); - assertEquals("(ぜかまし)", zekamashi.build(s)); - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 34850971..954b94dd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -105,11 +105,6 @@ android:label="@string/activity_setting" android:parentActivityName="net.lacolaco.smileessence.activity.MainActivity" /> <activity - android:name=".activity.EditTemplateActivity" - android:configChanges="keyboardHidden|orientation" - android:label="@string/activity_edit_template" - android:parentActivityName="net.lacolaco.smileessence.activity.MainActivity" /> - <activity android:name=".activity.ManageAccountsActivity" android:configChanges="keyboardHidden|orientation" android:label="@string/activity_manage_accounts" diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/EditTemplateActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/EditTemplateActivity.java deleted file mode 100644 index 49ac38f9..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/activity/EditTemplateActivity.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.activity; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.NavUtils; -import android.text.TextUtils; -import android.util.SparseBooleanArray; -import android.view.*; -import android.widget.AbsListView; -import android.widget.AdapterView; -import android.widget.ListView; -import net.lacolaco.smileessence.Application; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.Template; -import net.lacolaco.smileessence.logging.Logger; -import net.lacolaco.smileessence.view.DialogHelper; -import net.lacolaco.smileessence.view.adapter.UnorderedCustomListAdapter; -import net.lacolaco.smileessence.view.dialog.EditTextDialogFragment; - -import java.util.List; - -public class EditTemplateActivity extends Activity implements AdapterView.OnItemClickListener, - AbsListView.MultiChoiceModeListener { - - // ------------------------------ FIELDS ------------------------------ - - private UnorderedCustomListAdapter<Template> adapter; - - // --------------------- GETTER / SETTER METHODS --------------------- - - private ListView getListView() { - return (ListView) findViewById(R.id.listview_edit_list); - } - - private List<Template> getTemplates() { - return Template.getAll(); - } - - // ------------------------ INTERFACE METHODS ------------------------ - - - // --------------------- Interface Callback --------------------- - - @Override - public boolean onCreateActionMode(ActionMode mode, Menu menu) { - menu.clear(); - MenuInflater inflater = mode.getMenuInflater(); - inflater.inflate(R.menu.edit_list, menu); - return true; - } - - @Override - public boolean onPrepareActionMode(ActionMode mode, Menu menu) { - return false; - } - - @Override - public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_edit_list_delete: { - deleteSelectedItems(); - } - } - mode.finish(); - return true; - } - - @Override - public void onDestroyActionMode(ActionMode mode) { - } - - // --------------------- Interface MultiChoiceModeListener --------------------- - - @Override - public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { - } - - // --------------------- Interface OnItemClickListener --------------------- - - @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - openEditTemplateDialog(position); - } - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(Application.getInstance().getThemeResId()); - super.onCreate(savedInstanceState); - setContentView(R.layout.layout_edit_list); - - initializeViews(); - Logger.debug("onCreate"); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuItem add = menu.add(Menu.NONE, R.id.menu_edit_list_add, Menu.NONE, ""); - add.setIcon(android.R.drawable.ic_menu_add); - add.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_edit_list_add: { - addNewTemplate(); - break; - } - case android.R.id.home: { - NavUtils.navigateUpFromSameTask(this); - return true; - } - } - return true; - } - - // -------------------------- OTHER METHODS -------------------------- - - public void deleteSelectedItems() { - SparseBooleanArray checkedItems = getListView().getCheckedItemPositions(); - for (int i = adapter.getCount() - 1; i > -1; i--) { - if (checkedItems.get(i)) { - Template template = adapter.getItem(i); - template.delete(); - adapter.removeItem(template); - } - } - adapter.notifyDataSetChanged(); - updateListView(); - } - - public void openEditTemplateDialog(int position) { - final Template template = adapter.getItem(position); - EditTextDialogFragment dialogFragment = new EditTextDialogFragment() { - @Override - public void onTextInput(String text) { - if (TextUtils.isEmpty(text.trim())) { - return; - } - template.text = text; - template.save(); - adapter.notifyDataSetChanged(); - updateListView(); - } - }; - dialogFragment.setParams(getString(R.string.dialog_title_edit), template.text); - DialogHelper.showDialog(this, dialogFragment); - } - - private void addNewTemplate() { - final Template template = new Template(); - EditTextDialogFragment dialogFragment = new EditTextDialogFragment() { - @Override - public void onTextInput(String text) { - if (TextUtils.isEmpty(text.trim())) { - return; - } - template.text = text; - template.save(); - adapter.addItemToBottom(template); - adapter.notifyDataSetChanged(); - updateListView(); - } - }; - dialogFragment.setParams(getString(R.string.dialog_title_add), ""); - DialogHelper.showDialog(this, dialogFragment); - } - - private void initializeViews() { - ListView listView = getListView(); - adapter = new UnorderedCustomListAdapter<>(this); - adapter.addItemsToBottom(getTemplates()); - adapter.update(); - listView.setAdapter(adapter); - listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); - listView.setOnItemClickListener(this); - listView.setMultiChoiceModeListener(this); - } - - private void updateListView() { - getListView().requestLayout(); - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java index 1f0da75a..505317bc 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java @@ -330,10 +330,6 @@ public class MainActivity extends Activity implements Application.OnCurrentAccou startActivity(new Intent(this, ManageAccountsActivity.class)); return true; } - case R.id.actionbar_edit_templates: { - startActivity(new Intent(this, EditTemplateActivity.class)); - return true; - } case R.id.actionbar_edit_extraction: { startActivity(new Intent(this, EditExtractionActivity.class)); return true; diff --git a/app/src/main/java/net/lacolaco/smileessence/command/Command.java b/app/src/main/java/net/lacolaco/smileessence/command/Command.java index 2811ca67..7c6240ea 100644 --- a/app/src/main/java/net/lacolaco/smileessence/command/Command.java +++ b/app/src/main/java/net/lacolaco/smileessence/command/Command.java @@ -30,9 +30,6 @@ import android.view.View; import android.widget.TextView; import net.lacolaco.smileessence.R; import net.lacolaco.smileessence.command.message.MessageCommandCopyTextToClipboard; -import net.lacolaco.smileessence.command.message.MessageCommandSearchOnGoogle; -import net.lacolaco.smileessence.command.message.MessageCommandShare; -import net.lacolaco.smileessence.command.message.MessageCommandTofuBuster; import net.lacolaco.smileessence.command.status.*; import net.lacolaco.smileessence.command.user.*; import net.lacolaco.smileessence.entity.CommandSetting; @@ -62,16 +59,12 @@ public abstract class Command implements IViewModel { public static List<Command> getUserCommands(Activity activity, User user) { List<Command> commands = new ArrayList<>(); - commands.add(new UserCommandReply(activity, user)); commands.add(new UserCommandAddToReply(activity, user)); commands.add(new UserCommandSendMessage(activity, user)); commands.add(new UserCommandBlock(activity, user)); commands.add(new UserCommandUnblock(activity, user)); commands.add(new UserCommandReportForSpam(activity, user)); - commands.add(new UserCommandOpenFavstar(activity, user)); commands.add(new UserCommandOpenAclog(activity, user)); - commands.add(new UserCommandOpenTwilog(activity, user)); - commands.add(new UserCommandIntroduce(activity, user)); return commands; } @@ -79,28 +72,15 @@ public abstract class Command implements IViewModel { List<Command> commands = new ArrayList<>(); commands.add(new StatusCommandAddToReply(activity, tweet)); commands.add(new StatusCommandOpenTalkView(activity, tweet)); - commands.add(new StatusCommandFavAndRT(activity, tweet)); - commands.add(new StatusCommandOpenQuoteDialog(activity, tweet)); - commands.add(new StatusCommandShare(activity, tweet)); commands.add(new StatusCommandOpenInBrowser(activity, tweet)); commands.add(new StatusCommandCopyTextToClipboard(activity, tweet)); commands.add(new StatusCommandCopyURLToClipboard(activity, tweet)); - commands.add(new StatusCommandCopy(activity, tweet)); - commands.add(new StatusCommandSearchOnGoogle(activity, tweet)); - commands.add(new StatusCommandTofuBuster(activity, tweet)); - commands.add(new StatusCommandNanigaja(activity, tweet)); - commands.add(new StatusCommandMakeAnonymous(activity, tweet)); - commands.add(new StatusCommandCongratulate(activity, tweet)); - commands.add(new StatusCommandReview(activity, tweet)); return commands; } public static List<Command> getMessageCommands(Activity activity, DirectMessage message) { List<Command> commands = new ArrayList<>(); - commands.add(new MessageCommandShare(activity, message)); commands.add(new MessageCommandCopyTextToClipboard(activity, message)); - commands.add(new MessageCommandSearchOnGoogle(activity, message)); - commands.add(new MessageCommandTofuBuster(activity, message)); return commands; } @@ -145,5 +125,5 @@ public abstract class Command implements IViewModel { public boolean isEnabled() { return true; // default - }; + } } diff --git a/app/src/main/java/net/lacolaco/smileessence/command/CommandOpenTemplateList.java b/app/src/main/java/net/lacolaco/smileessence/command/CommandOpenTemplateList.java deleted file mode 100644 index aac25efe..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/CommandOpenTemplateList.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.view.DialogHelper; -import net.lacolaco.smileessence.view.dialog.ChooseTemplateDialogFragment; - -public class CommandOpenTemplateList extends Command { - - // --------------------------- CONSTRUCTORS --------------------------- - - public CommandOpenTemplateList(Activity activity) { - super(-1, activity); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_open_template_list); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - ChooseTemplateDialogFragment fragment = new ChooseTemplateDialogFragment(); - DialogHelper.showDialog(getActivity(), fragment); - return false; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/CommandPasteToPost.java b/app/src/main/java/net/lacolaco/smileessence/command/CommandPasteToPost.java deleted file mode 100644 index 4eacda93..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/CommandPasteToPost.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.data.PostState; - -public class CommandPasteToPost extends Command { - - // ------------------------------ FIELDS ------------------------------ - - private final String text; - - // --------------------------- CONSTRUCTORS --------------------------- - - public CommandPasteToPost(Activity activity, String text) { - super(-1, activity); - this.text = text; - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_paste_to_post); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - PostState.getState().beginTransaction() - .appendText(" " + text) - .commitWithOpen((MainActivity) getActivity()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/CommandSaveAsTemplate.java b/app/src/main/java/net/lacolaco/smileessence/command/CommandSaveAsTemplate.java deleted file mode 100644 index 8b96f7a4..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/CommandSaveAsTemplate.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.Template; -import net.lacolaco.smileessence.notification.Notificator; - -public class CommandSaveAsTemplate extends Command { - - // ------------------------------ FIELDS ------------------------------ - - private final String text; - - // --------------------------- CONSTRUCTORS --------------------------- - - public CommandSaveAsTemplate(Activity activity, String text) { - super(-1, activity); - this.text = text; - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_save_as_template); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - new Template(text, 0).save(); - Notificator.getInstance().publish(R.string.notice_save_as_template); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandSearchOnGoogle.java b/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandSearchOnGoogle.java deleted file mode 100644 index d709bd64..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandSearchOnGoogle.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.message; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.DirectMessage; -import net.lacolaco.smileessence.view.DialogHelper; -import net.lacolaco.smileessence.view.dialog.SearchOnGoogleDialogFragment; - -public class MessageCommandSearchOnGoogle extends MessageCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public MessageCommandSearchOnGoogle(Activity activity, DirectMessage message) { - super(R.id.key_command_message_search_on_google, activity, message); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_search_on_google); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - SearchOnGoogleDialogFragment dialogFragment = new SearchOnGoogleDialogFragment(); - dialogFragment.setText(getMessage().getText()); - DialogHelper.showDialog(getActivity(), dialogFragment); - return false; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandShare.java b/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandShare.java deleted file mode 100644 index d1297723..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandShare.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.message; - -import android.app.Activity; -import android.content.Intent; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.DirectMessage; -import net.lacolaco.smileessence.util.IntentUtils; - -public class MessageCommandShare extends MessageCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public MessageCommandShare(Activity activity, DirectMessage message) { - super(R.id.key_command_message_share, activity, message); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_share); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - Intent intent = new Intent(); - intent.setAction(Intent.ACTION_SEND); - intent.setType("text/plain"); - intent.putExtra(Intent.EXTRA_TEXT, getMessage().getMessageSummary()); - IntentUtils.startActivityIfFound(getActivity(), intent); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandTofuBuster.java b/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandTofuBuster.java deleted file mode 100644 index 177aa4ab..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/message/MessageCommandTofuBuster.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.message; - -import android.app.Activity; -import android.content.ActivityNotFoundException; -import android.content.Intent; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.DirectMessage; -import net.lacolaco.smileessence.notification.Notificator; - -public class MessageCommandTofuBuster extends MessageCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public MessageCommandTofuBuster(Activity activity, DirectMessage message) { - super(R.id.key_command_message_tofubuster, activity, message); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_tofubuster); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - String ACTION_SHOW_TEXT = "com.product.kanzmrsw.tofubuster.ACTION_SHOW_TEXT"; - Intent i = new Intent(ACTION_SHOW_TEXT); - i.putExtra(Intent.EXTRA_TEXT, getMessage().getText()); - i.putExtra(Intent.EXTRA_SUBJECT, getActivity().getString(R.string.app_name)); - i.putExtra("isCopyEnabled", true); - try { - getActivity().startActivity(i); - } catch (ActivityNotFoundException e) { - Notificator.getInstance().alert(R.string.notice_tofubuster_not_found); - } - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommand.java b/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommand.java deleted file mode 100644 index e918b531..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommand.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.post; - -import android.app.Activity; -import net.lacolaco.smileessence.command.Command; -import net.lacolaco.smileessence.data.PostState; - -public abstract class PostCommand extends Command { - - // --------------------------- CONSTRUCTORS --------------------------- - - public PostCommand(Activity activity) { - super(-1, activity); - } - - // -------------------------- OTHER METHODS -------------------------- - - public abstract String build(String s); - - @Override - public boolean execute() { - PostState state = PostState.getState(); - String text = state.getText(); - int start = state.getSelectionStart(); - int end = state.getSelectionEnd(); - if (start == end && isReplaceCommand()) { - start = 0; - end = text.length(); - } - String substring = text.substring(start, end); - String replacedText = build(substring); - StringBuilder builder = new StringBuilder(text); - String builtString = builder.replace(start, end, replacedText).toString(); - PostState.PostStateTransaction transaction = state.beginTransaction(); - int incremental = replacedText.length() - substring.length(); - if (incremental > 0) { - transaction.setCursor(end + incremental); - } - transaction.setText(builtString).commit(); - return true; - } - - public abstract boolean isReplaceCommand(); -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandInsert.java b/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandInsert.java deleted file mode 100644 index 63575a16..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandInsert.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.post; - -import android.app.Activity; - -public class PostCommandInsert extends PostCommand { - - // ------------------------------ FIELDS ------------------------------ - - private final String inserted; - - // --------------------------- CONSTRUCTORS --------------------------- - - public PostCommandInsert(Activity activity, String inserted) { - super(activity); - this.inserted = inserted; - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return inserted; - } - - @Override - public boolean isReplaceCommand() { - return false; - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public String build(String s) { - return s + inserted; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandMakeAnonymous.java b/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandMakeAnonymous.java deleted file mode 100644 index f045a36f..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandMakeAnonymous.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.post; - -import android.app.Activity; -import android.text.TextUtils; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.data.PostState; - -public class PostCommandMakeAnonymous extends PostCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public PostCommandMakeAnonymous(Activity activity) { - super(activity); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_make_anonymous); - } - - @Override - public boolean isEnabled() { - return !TextUtils.isEmpty(PostState.getState().getText()); - } - - @Override - public boolean isReplaceCommand() { - return true; - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public String build(String s) { - return getActivity().getString(R.string.format_status_command_make_anonymous, s).trim(); - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandMorse.java b/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandMorse.java deleted file mode 100644 index 229cc193..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandMorse.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.post; - -import android.app.Activity; -import android.text.TextUtils; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.data.PostState; -import net.lacolaco.smileessence.util.Morse; - -public class PostCommandMorse extends PostCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public PostCommandMorse(Activity activity) { - super(activity); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_post_morse); - } - - @Override - public boolean isEnabled() { - return !TextUtils.isEmpty(PostState.getState().getText()); - } - - @Override - public boolean isReplaceCommand() { - return true; - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public String build(String s) { - return Morse.jaToMorse(s); - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandUseTemplate.java b/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandUseTemplate.java deleted file mode 100644 index 6cc7c860..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandUseTemplate.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.post; - -import android.app.Activity; -import net.lacolaco.smileessence.entity.Template; - -public class PostCommandUseTemplate extends PostCommandInsert { - - // ------------------------------ FIELDS ------------------------------ - - private final Template template; - - // --------------------------- CONSTRUCTORS --------------------------- - - public PostCommandUseTemplate(Activity activity, Template template) { - super(activity, template.text); - this.template = template; - } - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - public boolean execute() { - template.count++; - template.save(); - return super.execute(); - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandZekamashi.java b/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandZekamashi.java deleted file mode 100644 index 5d9bec23..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/post/PostCommandZekamashi.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.post; - -import android.app.Activity; -import android.text.TextUtils; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.data.PostState; - -public class PostCommandZekamashi extends PostCommand { - - private static final String[] brackets = new String[]{"(,)", "(,)", "「,」", "[,]", "{,}", "<,>", "/,\\", "\,/"}; - - // --------------------------- CONSTRUCTORS --------------------------- - - public PostCommandZekamashi(Activity activity) { - super(activity); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_post_zekamashi); - } - - @Override - public boolean isEnabled() { - return !TextUtils.isEmpty(PostState.getState().getText()); - } - - @Override - public boolean isReplaceCommand() { - return true; - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public String build(String s) { - StringBuilder builder = new StringBuilder(s); - builder.reverse(); - String reversed = builder.toString(); - String temp = "########TEMP########"; - for (String bracket : brackets) { - String first = bracket.split(",")[0]; - String second = bracket.split(",")[1]; - reversed = reversed.replace(first, temp).replace(second, first).replace(temp, second); - } - return reversed; - - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandCongratulate.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandCongratulate.java deleted file mode 100644 index 19e8fa48..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandCongratulate.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.Application; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.command.IConfirmable; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.notification.Notificator; -import net.lacolaco.smileessence.twitter.TweetBuilder; -import net.lacolaco.smileessence.twitter.task.FavoriteTask; -import net.lacolaco.smileessence.twitter.task.TweetTask; -import twitter4j.StatusUpdate; - -import java.util.Random; - -public class StatusCommandCongratulate extends StatusCommand implements IConfirmable { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandCongratulate(Activity activity, Tweet tweet) { - super(R.id.key_command_status_congratulate, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_congratulate); - } - - @Override - public boolean isEnabled() { - return !getOriginalStatus().getUser().isProtected(); - } - - // -------------------------- OTHER METHODS -------------------------- - - private String build() { - int favCount; - Random rand = new Random(); - int r = rand.nextInt(100); - if (r < 50) { - favCount = 50; - } else if (r < 80) { - favCount = 100; - } else if (r < 90) { - favCount = 250; - } else if (r < 99) { - favCount = 1000; - } else { - favCount = 10000; - } - return String.format("@%s Congrats on your %s ★ tweet! http://favstar.fm/t/%s", - getOriginalStatus().getUser().getScreenName(), favCount, getOriginalStatus().getId()); - } - - @Override - public boolean execute() { - StatusUpdate update = new TweetBuilder().setText(build()) - .setInReplyToStatusID(getOriginalStatus().getId()) - .build(); - new TweetTask(Application.getInstance().getCurrentAccount(), update).execute(); - new FavoriteTask(Application.getInstance().getCurrentAccount(), getOriginalStatus().getId()) - .onDone(x -> Notificator.getInstance().publish(R.string.notice_favorite_succeeded)) - .onFail(x -> Notificator.getInstance().alert(R.string.notice_favorite_failed)) - .execute(); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandCopy.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandCopy.java deleted file mode 100644 index 197be2fa..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandCopy.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.data.PostState; -import net.lacolaco.smileessence.entity.Tweet; - -public class StatusCommandCopy extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandCopy(Activity activity, Tweet tweet) { - super(R.id.key_command_status_copy, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_copy); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - PostState.newState().beginTransaction() - .setText(getOriginalStatus().getText()) - .commitWithOpen((MainActivity) getActivity()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandFavAndRT.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandFavAndRT.java deleted file mode 100644 index 989bd869..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandFavAndRT.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.Application; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.command.IConfirmable; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.entity.User; -import net.lacolaco.smileessence.notification.Notificator; -import net.lacolaco.smileessence.twitter.task.FavoriteTask; -import net.lacolaco.smileessence.twitter.task.RetweetTask; - - -public class StatusCommandFavAndRT extends StatusCommand implements IConfirmable { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandFavAndRT(Activity activity, Tweet tweet) { - super(R.id.key_command_status_fav_and_rt, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_fav_and_rt); - } - - @Override - public boolean isEnabled() { - User user = getOriginalStatus().getUser(); - return !user.isProtected() && user != Application.getInstance().getCurrentAccount().getUser(); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - new FavoriteTask(Application.getInstance().getCurrentAccount(), getOriginalStatus().getId()) - .onDone(x -> Notificator.getInstance().publish(R.string.notice_favorite_succeeded)) - .onFail(x -> Notificator.getInstance().alert(R.string.notice_favorite_failed)) - .execute(); - new RetweetTask(Application.getInstance().getCurrentAccount(), getOriginalStatus().getId()) - .onDone(x -> Notificator.getInstance().publish(R.string.notice_retweet_succeeded)) - .onFail(x -> Notificator.getInstance().alert(R.string.notice_retweet_failed)) - .execute(); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandMakeAnonymous.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandMakeAnonymous.java deleted file mode 100644 index 9c7b1f5d..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandMakeAnonymous.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.Application; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.command.IConfirmable; -import net.lacolaco.smileessence.entity.Account; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.entity.User; -import net.lacolaco.smileessence.notification.Notificator; -import net.lacolaco.smileessence.twitter.TweetBuilder; -import net.lacolaco.smileessence.twitter.task.FavoriteTask; -import net.lacolaco.smileessence.twitter.task.TweetTask; -import twitter4j.StatusUpdate; - -public class StatusCommandMakeAnonymous extends StatusCommand implements IConfirmable { - - // -------------------------- STATIC METHODS -------------------------- - - public StatusCommandMakeAnonymous(Activity activity, Tweet tweet) { - super(R.id.key_command_status_make_anonymous, activity, tweet); - } - - // --------------------------- CONSTRUCTORS --------------------------- - - private static String build(Activity activity, Tweet tweet, Account account) { - User user = account.getUser(); - String str = tweet.getText(); - if (str.startsWith(".")) { - str = str.replaceFirst(".", ""); - } - if (str.startsWith(String.format("@%s", user.getScreenName()))) { - str = str.replaceFirst(String.format("@%s", user.getScreenName()), "").trim(); - } - str = activity.getString(R.string.format_status_command_make_anonymous, str).trim(); - return str; - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_make_anonymous); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - StatusUpdate update = new TweetBuilder().setText(build(getActivity(), getOriginalStatus(), Application.getInstance().getCurrentAccount())).build(); - new TweetTask(Application.getInstance().getCurrentAccount(), update).execute(); - new FavoriteTask(Application.getInstance().getCurrentAccount(), getOriginalStatus().getId()) - .onDone(x -> Notificator.getInstance().publish(R.string.notice_favorite_succeeded)) - .onFail(x -> Notificator.getInstance().alert(R.string.notice_favorite_failed)) - .execute(); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandNanigaja.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandNanigaja.java deleted file mode 100644 index 15e35ddc..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandNanigaja.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.Application; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.command.IConfirmable; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.entity.User; -import net.lacolaco.smileessence.notification.Notificator; -import net.lacolaco.smileessence.twitter.TweetBuilder; -import net.lacolaco.smileessence.twitter.task.FavoriteTask; -import net.lacolaco.smileessence.twitter.task.TweetTask; -import twitter4j.StatusUpdate; - -public class StatusCommandNanigaja extends StatusCommand implements IConfirmable { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandNanigaja(Activity activity, Tweet tweet) { - super(R.id.key_command_status_nanigaja, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_nanigaja); - } - - // -------------------------- OTHER METHODS -------------------------- - - private String build() { - User user = Application.getInstance().getCurrentAccount().getUser(); - String str = getOriginalStatus().getText(); - String header = ""; - if (str.startsWith(".")) { - str = str.replaceFirst(".", ""); - } - if (str.startsWith(String.format("@%s", user.getScreenName()))) { - str = str.replaceFirst(String.format("@%s", user.getScreenName()), "").trim(); - header = "@" + getOriginalStatus().getUser().getScreenName(); - } - str = header + " " + String.format(getActivity().getString(R.string.format_status_command_nanigaja), str); - return str.trim(); - } - - @Override - public boolean execute() { - StatusUpdate update = new TweetBuilder().setText(build()) - .setInReplyToStatusID(getOriginalStatus().getId()) - .build(); - new TweetTask(Application.getInstance().getCurrentAccount(), update).execute(); - new FavoriteTask(Application.getInstance().getCurrentAccount(), getOriginalStatus().getId()) - .onDone(x -> Notificator.getInstance().publish(R.string.notice_favorite_succeeded)) - .onFail(x -> Notificator.getInstance().alert(R.string.notice_favorite_failed)) - .execute(); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandOpenQuoteDialog.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandOpenQuoteDialog.java deleted file mode 100644 index 76b0ef40..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandOpenQuoteDialog.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.view.DialogHelper; -import net.lacolaco.smileessence.view.dialog.QuoteDialogFragment; - -public class StatusCommandOpenQuoteDialog extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandOpenQuoteDialog(Activity activity, Tweet tweet) { - super(R.id.key_command_status_quote, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_quote); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - QuoteDialogFragment dialogFragment = new QuoteDialogFragment(); - dialogFragment.setStatusID(getOriginalStatus().getId()); - DialogHelper.showDialog(getActivity(), dialogFragment); - return false; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandOpenTalkView.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandOpenTalkView.java index e02386f6..c86046b5 100644 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandOpenTalkView.java +++ b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandOpenTalkView.java @@ -45,11 +45,6 @@ public class StatusCommandOpenTalkView extends StatusCommand { return getActivity().getString(R.string.command_status_open_talk_view); } - @Override - public boolean isEnabled() { - return getOriginalStatus().getInReplyToStatusId() >= 0; - } - // -------------------------- OTHER METHODS -------------------------- @Override diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandReview.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandReview.java deleted file mode 100644 index 7ef2ffbc..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandReview.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.view.DialogHelper; -import net.lacolaco.smileessence.view.dialog.ReviewDialogFragment; - -public class StatusCommandReview extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandReview(Activity activity, Tweet tweet) { - super(R.id.key_command_status_review, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_review); - } - - @Override - public boolean isEnabled() { - return !getOriginalStatus().getUser().isProtected(); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - ReviewDialogFragment dialogFragment = new ReviewDialogFragment(); - dialogFragment.setStatusID(getOriginalStatus().getId()); - DialogHelper.showDialog(getActivity(), dialogFragment); - return false; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandSearchOnGoogle.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandSearchOnGoogle.java deleted file mode 100644 index b7b849b3..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandSearchOnGoogle.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.view.DialogHelper; -import net.lacolaco.smileessence.view.dialog.SearchOnGoogleDialogFragment; - -public class StatusCommandSearchOnGoogle extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandSearchOnGoogle(Activity activity, Tweet tweet) { - super(R.id.key_command_status_search_on_google, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_search_on_google); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - SearchOnGoogleDialogFragment dialogFragment = new SearchOnGoogleDialogFragment(); - dialogFragment.setText(getOriginalStatus().getText()); - DialogHelper.showDialog(getActivity(), dialogFragment); - return false; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandShare.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandShare.java deleted file mode 100644 index 9706e0bd..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandShare.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import android.content.Intent; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.util.IntentUtils; - -public class StatusCommandShare extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandShare(Activity activity, Tweet tweet) { - super(R.id.key_command_status_share, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_share); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - String summary = String.format("@%s: %s", getOriginalStatus().getUser().getScreenName(), getOriginalStatus().getText()); - - Intent intent = new Intent(); - intent.setAction(Intent.ACTION_SEND); - intent.setType("text/plain"); - intent.putExtra(Intent.EXTRA_TEXT, summary); - IntentUtils.startActivityIfFound(getActivity(), intent); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandTextQuote.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandTextQuote.java deleted file mode 100644 index fdba9c21..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandTextQuote.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.data.PostState; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.twitter.TweetBuilder; - -public class StatusCommandTextQuote extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandTextQuote(Activity activity, Tweet tweet) { - super(-1, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_quote_text); - } - - @Override - public boolean isEnabled() { - return !getStatus().getUser().isProtected(); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - TweetBuilder builder = new TweetBuilder().setQuotation(getOriginalStatus()); - PostState.newState().beginTransaction() - .setText(builder.buildText()) - .setInReplyTo(getOriginalStatus()) - .setCursor(0) - .commitWithOpen((MainActivity) getActivity()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandTofuBuster.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandTofuBuster.java deleted file mode 100644 index a426e889..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandTofuBuster.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import android.content.ActivityNotFoundException; -import android.content.Intent; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.notification.Notificator; - -public class StatusCommandTofuBuster extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandTofuBuster(Activity activity, Tweet tweet) { - super(R.id.key_command_status_tofubuster, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_tofubuster); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - String ACTION_SHOW_TEXT = "com.product.kanzmrsw.tofubuster.ACTION_SHOW_TEXT"; - String text = getOriginalStatus().getText(); - Intent i = new Intent(ACTION_SHOW_TEXT); - i.putExtra(Intent.EXTRA_TEXT, text); - i.putExtra(Intent.EXTRA_SUBJECT, getActivity().getString(R.string.app_name)); - i.putExtra("isCopyEnabled", true); - try { - getActivity().startActivity(i); - } catch (ActivityNotFoundException e) { - Notificator.getInstance().publish(R.string.notice_tofubuster_not_found); - } - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandURLQuote.java b/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandURLQuote.java deleted file mode 100644 index 8ff3f807..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/status/StatusCommandURLQuote.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.status; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.data.PostState; -import net.lacolaco.smileessence.entity.Tweet; - -public class StatusCommandURLQuote extends StatusCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public StatusCommandURLQuote(Activity activity, Tweet tweet) { - super(-1, activity, tweet); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_status_quote_url); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - String statusURL = getOriginalStatus().getTwitterUrl(); - PostState.newState().beginTransaction() - .setText(statusURL) - .commitWithOpen((MainActivity) getActivity()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandBlock.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandBlock.java index 6278f2fb..4807baa1 100644 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandBlock.java +++ b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandBlock.java @@ -47,11 +47,6 @@ public class UserCommandBlock extends UserCommand implements IConfirmable { return getActivity().getString(R.string.command_user_block); } - @Override - public boolean isEnabled() { - return getUser() != Application.getInstance().getCurrentAccount().getUser(); - } - // -------------------------- OTHER METHODS -------------------------- @Override diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandIntroduce.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandIntroduce.java deleted file mode 100644 index 8e518b5b..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandIntroduce.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.user; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.data.PostState; -import net.lacolaco.smileessence.entity.User; - -public class UserCommandIntroduce extends UserCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public UserCommandIntroduce(Activity activity, User user) { - super(R.id.key_command_user_introduce, activity, user); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_user_introduce); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - PostState.newState().beginTransaction() - .setText(String.format(" (@%s)", getUser().getScreenName())) - .setCursor(0) - .commitWithOpen((MainActivity) getActivity()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandOpenFavstar.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandOpenFavstar.java deleted file mode 100644 index ffcae6ef..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandOpenFavstar.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.user; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.User; -import net.lacolaco.smileessence.util.IntentUtils; - -public class UserCommandOpenFavstar extends UserCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public UserCommandOpenFavstar(Activity activity, User user) { - super(R.id.key_command_user_open_favstar, activity, user); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_user_open_favstar); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - IntentUtils.openUri(getActivity(), getUser().getFavstarRecentURL()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandOpenTwilog.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandOpenTwilog.java deleted file mode 100644 index 0fa62c0b..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandOpenTwilog.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.user; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.entity.User; -import net.lacolaco.smileessence.util.IntentUtils; - -public class UserCommandOpenTwilog extends UserCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public UserCommandOpenTwilog(Activity activity, User user) { - super(R.id.key_command_user_open_twilog, activity, user); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_user_open_twilog); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - IntentUtils.openUri(getActivity(), getUser().getTwilogURL()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandReply.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandReply.java deleted file mode 100644 index 0a7dd96a..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandReply.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.command.user; - -import android.app.Activity; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.data.PostState; -import net.lacolaco.smileessence.entity.User; -import net.lacolaco.smileessence.twitter.TweetBuilder; - -public class UserCommandReply extends UserCommand { - - // --------------------------- CONSTRUCTORS --------------------------- - - public UserCommandReply(Activity activity, User user) { - super(R.id.key_command_user_reply, activity, user); - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - @Override - public String getText() { - return getActivity().getString(R.string.command_user_reply); - } - - // -------------------------- OTHER METHODS -------------------------- - - @Override - public boolean execute() { - String text = new TweetBuilder().addScreenName(getUser().getScreenName()).buildText(); - PostState.newState().beginTransaction() - .setText(text) - .setCursor(text.length()) - .commitWithOpen((MainActivity) getActivity()); - return true; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandReportForSpam.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandReportForSpam.java index c92a4b32..b4e9c6d1 100644 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandReportForSpam.java +++ b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandReportForSpam.java @@ -47,11 +47,6 @@ public class UserCommandReportForSpam extends UserCommand implements IConfirmabl return getActivity().getString(R.string.command_user_r4s); } - @Override - public boolean isEnabled() { - return getUser() != Application.getInstance().getCurrentAccount().getUser(); - } - // -------------------------- OTHER METHODS -------------------------- @Override diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandSendMessage.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandSendMessage.java index e0a08a9f..29e9e3d9 100644 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandSendMessage.java +++ b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandSendMessage.java @@ -25,7 +25,6 @@ package net.lacolaco.smileessence.command.user; import android.app.Activity; -import net.lacolaco.smileessence.Application; import net.lacolaco.smileessence.R; import net.lacolaco.smileessence.entity.User; import net.lacolaco.smileessence.view.DialogHelper; @@ -46,11 +45,6 @@ public class UserCommandSendMessage extends UserCommand { return getActivity().getString(R.string.command_user_send_message); } - @Override - public boolean isEnabled() { - return getUser() != Application.getInstance().getCurrentAccount().getUser(); - } - // -------------------------- OTHER METHODS -------------------------- @Override diff --git a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandUnblock.java b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandUnblock.java index 6afbd59f..c099cc66 100644 --- a/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandUnblock.java +++ b/app/src/main/java/net/lacolaco/smileessence/command/user/UserCommandUnblock.java @@ -47,11 +47,6 @@ public class UserCommandUnblock extends UserCommand implements IConfirmable { return getActivity().getString(R.string.command_user_unblock); } - @Override - public boolean isEnabled() { - return getUser() != Application.getInstance().getCurrentAccount().getUser(); - } - // -------------------------- OTHER METHODS -------------------------- @Override diff --git a/app/src/main/java/net/lacolaco/smileessence/entity/DirectMessage.java b/app/src/main/java/net/lacolaco/smileessence/entity/DirectMessage.java index e81ab0d3..67524c36 100644 --- a/app/src/main/java/net/lacolaco/smileessence/entity/DirectMessage.java +++ b/app/src/main/java/net/lacolaco/smileessence/entity/DirectMessage.java @@ -79,8 +79,4 @@ public class DirectMessage extends EntitySupport { public Date getCreatedAt() { return createdAt; } - - public String getMessageSummary() { - return String.format("@%s: %s", getSender().getScreenName(), getText()); - } } diff --git a/app/src/main/java/net/lacolaco/smileessence/entity/Template.java b/app/src/main/java/net/lacolaco/smileessence/entity/Template.java deleted file mode 100644 index ce6de3b3..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/entity/Template.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.entity; - -import android.app.Activity; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.TextView; -import com.activeandroid.Model; -import com.activeandroid.annotation.Column; -import com.activeandroid.annotation.Table; -import com.activeandroid.query.Select; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.viewmodel.IViewModel; - -import java.util.List; - -@Table(name = "Templates") -public class Template extends Model implements IViewModel { - - // ------------------------------ FIELDS ------------------------------ - - @Column(name = "Text", notNull = true) - public String text; - @Column(name = "Count") - public int count; - - // -------------------------- STATIC METHODS -------------------------- - - public Template() { - super(); - } - - // --------------------------- CONSTRUCTORS --------------------------- - - public Template(String text, int count) { - super(); - this.text = text; - this.count = count; - } - - public static List<Template> getAll() { - return new Select().from(Template.class).orderBy("COUNT DESC").execute(); - } - - // ------------------------ INTERFACE METHODS ------------------------ - - - // --------------------- Interface IViewModel --------------------- - - @Override - public View getView(Activity activity, LayoutInflater inflater, View convertedView) { - if (convertedView == null) { - convertedView = inflater.inflate(R.layout.list_item_simple_text, null); - } - TextView textView = (TextView) convertedView.findViewById(R.id.list_item_textview); - textView.setText(this.text); - return convertedView; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/twitter/StatusFilter.java b/app/src/main/java/net/lacolaco/smileessence/twitter/StatusFilter.java index 34250728..3e1bd2c4 100644 --- a/app/src/main/java/net/lacolaco/smileessence/twitter/StatusFilter.java +++ b/app/src/main/java/net/lacolaco/smileessence/twitter/StatusFilter.java @@ -90,7 +90,7 @@ public class StatusFilter { Map<Object, Consumer<?>> map = addHandlers.get(klass); if (map != null) { for(Consumer f_ : map.values()) { - ((Consumer<T>) f_).accept(status); + f_.accept(status); } } } diff --git a/app/src/main/java/net/lacolaco/smileessence/twitter/TweetBuilder.java b/app/src/main/java/net/lacolaco/smileessence/twitter/TweetBuilder.java index dfac997d..9fe5afc1 100644 --- a/app/src/main/java/net/lacolaco/smileessence/twitter/TweetBuilder.java +++ b/app/src/main/java/net/lacolaco/smileessence/twitter/TweetBuilder.java @@ -54,11 +54,6 @@ public class TweetBuilder { return this; } - public TweetBuilder setQuotation(Tweet tweet) { - tweet = tweet.getOriginalTweet(); - return setText(String.format(" RT @%s: %s", tweet.getUser().getScreenName(), tweet.getText())); - } - public TweetBuilder setText(String text) { this.text = text; return this; @@ -73,13 +68,6 @@ public class TweetBuilder { return this; } - public TweetBuilder addScreenNames(List<String> screenNames) { - for (String name : screenNames) { - addScreenName(name); - } - return this; - } - public TweetBuilder appendText(String str) { return setText(text + str); } @@ -107,8 +95,4 @@ public class TweetBuilder { builder.append(text); return builder.toString(); } - - public TweetBuilder setQuotation(Status status, String text) { - return setText(String.format("%s RT @%s: %s", text, status.getUser().getScreenName(), status.getText())); - } } diff --git a/app/src/main/java/net/lacolaco/smileessence/twitter/task/TweetTask.java b/app/src/main/java/net/lacolaco/smileessence/twitter/task/TweetTask.java index 6b6a6f72..f665a558 100644 --- a/app/src/main/java/net/lacolaco/smileessence/twitter/task/TweetTask.java +++ b/app/src/main/java/net/lacolaco/smileessence/twitter/task/TweetTask.java @@ -54,10 +54,6 @@ public class TweetTask extends BackgroundTask<Tweet, Void> { // --------------------------- CONSTRUCTORS --------------------------- - public TweetTask(Account account, StatusUpdate update) { - this(account, update, null, false); - } - public TweetTask(Account account, StatusUpdate update, String mediaPath, boolean resize) { this.account = account; this.update = update; diff --git a/app/src/main/java/net/lacolaco/smileessence/util/Morse.java b/app/src/main/java/net/lacolaco/smileessence/util/Morse.java index 364f6240..55f5226a 100644 --- a/app/src/main/java/net/lacolaco/smileessence/util/Morse.java +++ b/app/src/main/java/net/lacolaco/smileessence/util/Morse.java @@ -78,26 +78,6 @@ public class Morse { return sb.toString(); } - /** - * ひらがな・カタカナ・数字をモールス文に変換する - * - * @param str 変換したい文字列 - * @return 変換部分が置換された文字列 - */ - public static String jaToMorse(String str) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < str.length(); i++) { - String tok = String.valueOf(str.charAt(i)); - if (jaMc.containsKey(tok)) { - sb.append(jaMc.get(tok)); - sb.append(" "); - } else { - sb.append(tok); - } - } - return sb.toString(); - } - private static String toRightMorse(String str) { str = str.replace("‐", "-").replace(" ", " ").trim(); Pattern pattern = Pattern.compile("[^・- ][・-]"); diff --git a/app/src/main/java/net/lacolaco/smileessence/view/TextFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/TextFragment.java deleted file mode 100644 index acb2c954..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/view/TextFragment.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.view; - -import android.app.Fragment; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; -import net.lacolaco.smileessence.Application; - -public class TextFragment extends Fragment { - - // ------------------------------ FIELDS ------------------------------ - - public static final String ARG_TEXT = "text"; - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - TextView textView = new TextView(getActivity()); - Bundle args = getArguments(); - if (args != null) { - String text = args.getString(ARG_TEXT); - if (!TextUtils.isEmpty(text)) { - textView.setText(text); - } - } - return textView; - } - - @Override - public void onDestroy() { - super.onDestroy(); - Application.getInstance().getRefWatcher().watch(this); - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/ChooseTemplateDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/ChooseTemplateDialogFragment.java deleted file mode 100644 index 1c0261a9..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/ChooseTemplateDialogFragment.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.view.dialog; - -import android.app.Activity; -import net.lacolaco.smileessence.command.Command; -import net.lacolaco.smileessence.command.post.PostCommandUseTemplate; -import net.lacolaco.smileessence.entity.Template; - -import java.util.ArrayList; -import java.util.List; - -public class ChooseTemplateDialogFragment extends MenuDialogFragment { - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - protected List<Command> getMenuCommands() { - Activity activity = getActivity(); - List<Command> commands = new ArrayList<>(); - for (Template template : Template.getAll()) { - commands.add(new PostCommandUseTemplate(activity, template)); - } - return commands; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTextDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTextDialogFragment.java index d33e2398..3ca6e175 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTextDialogFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/EditTextDialogFragment.java @@ -62,9 +62,7 @@ public abstract class EditTextDialogFragment extends StackableDialogFragment { onTextInput(editText.getText().toString()); dialog.dismiss(); }) - .setNegativeButton(R.string.alert_dialog_cancel, (dialog, which) -> { - dialog.dismiss(); - }) + .setNegativeButton(R.string.alert_dialog_cancel, (dialog, which) -> dialog.dismiss()) .create(); } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/HashtagDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/HashtagDialogFragment.java index efeeb4dd..372c1eef 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/HashtagDialogFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/HashtagDialogFragment.java @@ -28,8 +28,6 @@ import android.app.Activity; import android.app.Dialog; import android.os.Bundle; import net.lacolaco.smileessence.command.Command; -import net.lacolaco.smileessence.command.CommandPasteToPost; -import net.lacolaco.smileessence.command.CommandSaveAsTemplate; import net.lacolaco.smileessence.command.CommandSearchOnTwitter; import java.util.ArrayList; @@ -60,8 +58,6 @@ public class HashtagDialogFragment extends MenuDialogFragment { Activity activity = getActivity(); List<Command> commands = new ArrayList<>(); String text = getHashtagText(); - commands.add(new CommandSaveAsTemplate(activity, text)); - commands.add(new CommandPasteToPost(activity, text)); commands.add(new CommandSearchOnTwitter(activity, text)); return commands; } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/MessageMenuDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/MessageMenuDialogFragment.java index 21a9ae37..aeb1d621 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/MessageMenuDialogFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/MessageMenuDialogFragment.java @@ -64,7 +64,6 @@ public class MessageMenuDialogFragment extends MenuDialogFragment { Activity activity = getActivity(); List<Command> commands = new ArrayList<>(); commands.addAll(Command.getMessageCommands(activity, message)); - commands.add(new CommandSaveAsTemplate(activity, message.getText())); if (message.getSender() != message.getRecipient()) { commands.add(new CommandOpenUserDetail(activity, message.getRecipient().getScreenName())); } diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/PostMenuDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/PostMenuDialogFragment.java deleted file mode 100644 index a34fff0e..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/PostMenuDialogFragment.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.view.dialog; - -import android.app.Activity; -import net.lacolaco.smileessence.command.Command; -import net.lacolaco.smileessence.command.CommandOpenTemplateList; -import net.lacolaco.smileessence.command.post.PostCommandMakeAnonymous; -import net.lacolaco.smileessence.command.post.PostCommandMorse; -import net.lacolaco.smileessence.command.post.PostCommandZekamashi; - -import java.util.ArrayList; -import java.util.List; - -public class PostMenuDialogFragment extends MenuDialogFragment { - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - protected List<Command> getMenuCommands() { - Activity activity = getActivity(); - List<Command> commands = new ArrayList<>(); - commands.add(new CommandOpenTemplateList(activity)); - commands.add(new PostCommandMorse(activity)); - commands.add(new PostCommandMakeAnonymous(activity)); - commands.add(new PostCommandZekamashi(activity)); - return commands; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/QuoteDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/QuoteDialogFragment.java deleted file mode 100644 index e020d3a2..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/QuoteDialogFragment.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.view.dialog; - -import android.app.Activity; -import android.os.Bundle; -import net.lacolaco.smileessence.command.Command; -import net.lacolaco.smileessence.command.status.StatusCommandTextQuote; -import net.lacolaco.smileessence.command.status.StatusCommandURLQuote; -import net.lacolaco.smileessence.entity.Tweet; - -import java.util.ArrayList; -import java.util.List; - -public class QuoteDialogFragment extends MenuDialogFragment { - - // ------------------------------ FIELDS ------------------------------ - - private static final String KEY_STATUS_ID = "statusID"; - - // --------------------- GETTER / SETTER METHODS --------------------- - - private long getStatusID() { - return getArguments().getLong(KEY_STATUS_ID); - } - - public void setStatusID(long id) { - Bundle bundle = new Bundle(); - bundle.putLong(KEY_STATUS_ID, id); - setArguments(bundle); - } - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - protected List<Command> getMenuCommands() { - Activity activity = getActivity(); - List<Command> commands = new ArrayList<>(); - Tweet tweet = Tweet.fetch(getStatusID()); - commands.add(new StatusCommandTextQuote(activity, tweet)); - commands.add(new StatusCommandURLQuote(activity, tweet)); - return commands; - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/ReviewDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/ReviewDialogFragment.java deleted file mode 100644 index 1644aa97..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/ReviewDialogFragment.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.view.dialog; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.RatingBar; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.activity.MainActivity; -import net.lacolaco.smileessence.data.PostState; -import net.lacolaco.smileessence.entity.Tweet; -import net.lacolaco.smileessence.util.SystemServiceHelper; - -public class ReviewDialogFragment extends StackableDialogFragment implements View.OnClickListener { - - // ------------------------------ FIELDS ------------------------------ - - private static final String statusIDKey = "key"; - private long statusID; - private RatingBar ratingBar; - - // --------------------- GETTER / SETTER METHODS --------------------- - - public void setStatusID(long statusID) { - Bundle args = new Bundle(); - args.putLong(statusIDKey, statusID); - setArguments(args); - } - - // ------------------------ INTERFACE METHODS ------------------------ - - - // --------------------- Interface OnClickListener --------------------- - - @Override - public void onClick(View v) { - int id = v.getId(); - switch (id) { - case R.id.button_submit: { - execute(); - break; - } - } - } - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Bundle args = getArguments(); - statusID = args.getLong(statusIDKey); - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_review, null); - ratingBar = (RatingBar) view.findViewById(R.id.rating_review); - Button button = (Button) view.findViewById(R.id.button_submit); - button.setOnClickListener(this); - return new AlertDialog.Builder(getActivity()) - .setView(view) - .create(); - } - - private void execute() { - SystemServiceHelper.hideIM(getActivity(), ratingBar); - Tweet tweet = Tweet.fetch(statusID).getOriginalTweet(); - int star = (int) ratingBar.getRating(); - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < 5; i++) { - if (i < star) { - builder.append("★"); - } else { - builder.append("☆"); - } - } - String str = getString(R.string.format_status_review, - builder.toString(), - tweet.getUser().getScreenName(), - tweet.getTwitterUrl()); - PostState.newState().beginTransaction() - .setText(str) - .setInReplyTo(tweet) - .setCursor(str.indexOf(":") + 2) - .commitWithOpen((MainActivity) getActivity()); - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/SearchOnGoogleDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/SearchOnGoogleDialogFragment.java deleted file mode 100644 index 43adb668..00000000 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/SearchOnGoogleDialogFragment.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2012-2014 lacolaco.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.lacolaco.smileessence.view.dialog; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.app.SearchManager; -import android.content.Intent; -import android.os.Bundle; -import android.text.Editable; -import android.text.TextUtils; -import android.text.TextWatcher; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import net.lacolaco.smileessence.R; -import net.lacolaco.smileessence.util.SystemServiceHelper; -import net.lacolaco.smileessence.view.DialogHelper; - -public class SearchOnGoogleDialogFragment extends StackableDialogFragment implements TextWatcher, View.OnClickListener { - - // ------------------------------ FIELDS ------------------------------ - - private static final String textKey = "key"; - private String text; - private EditText editText; - private Button button; - - // --------------------- GETTER / SETTER METHODS --------------------- - - public void setText(String text) { - Bundle args = new Bundle(); - args.putString(textKey, text); - setArguments(args); - } - - // ------------------------ INTERFACE METHODS ------------------------ - - - // --------------------- Interface OnClickListener --------------------- - - @Override - public void onClick(View v) { - int id = v.getId(); - switch (id) { - case R.id.button_submit: { - execute(); - break; - } - } - } - - // --------------------- Interface TextWatcher --------------------- - - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - if (TextUtils.isEmpty(text)) { - button.setEnabled(false); - } else { - button.setEnabled(true); - } - } - - @Override - public void afterTextChanged(Editable s) { - - } - - // ------------------------ OVERRIDE METHODS ------------------------ - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Bundle args = getArguments(); - text = args.getString(textKey); - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_search_on_google, null); - editText = (EditText) view.findViewById(R.id.edittext_search_on_google); - editText.addTextChangedListener(this); - button = (Button) view.findViewById(R.id.button_submit); - button.setOnClickListener(this); - editText.setText(text); - return new AlertDialog.Builder(getActivity()) - .setView(view) - .create(); - } - - private void execute() { - SystemServiceHelper.hideIM(getActivity(), editText); - Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); - intent.putExtra(SearchManager.QUERY, editText.getText().toString()); - getActivity().startActivity(intent); - DialogHelper.closeAll(getActivity()); - } -} diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusMenuDialogFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusMenuDialogFragment.java index 8b3b715f..b0e4add8 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusMenuDialogFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusMenuDialogFragment.java @@ -65,7 +65,6 @@ public class StatusMenuDialogFragment extends MenuDialogFragment { Activity activity = getActivity(); List<Command> commands = new ArrayList<>(); commands.addAll(Command.getStatusCommands(activity, tweet)); - commands.add(new CommandSaveAsTemplate(activity, tweet.getOriginalTweet().getText())); commands.add(new CommandOpenUserDetail(activity, tweet.getUser().getScreenName())); for (String screenName : new ArrayList<>(new LinkedHashSet<>(tweet.getMentions()))) { // Array#uniq commands.add(new CommandOpenUserDetail(activity, screenName)); diff --git a/app/src/main/java/net/lacolaco/smileessence/view/page/PostFragment.java b/app/src/main/java/net/lacolaco/smileessence/view/page/PostFragment.java index 162b28c2..109a69d7 100644 --- a/app/src/main/java/net/lacolaco/smileessence/view/page/PostFragment.java +++ b/app/src/main/java/net/lacolaco/smileessence/view/page/PostFragment.java @@ -50,7 +50,6 @@ import net.lacolaco.smileessence.util.IntentUtils; import net.lacolaco.smileessence.util.SystemServiceHelper; import net.lacolaco.smileessence.util.UIHandler; import net.lacolaco.smileessence.view.DialogHelper; -import net.lacolaco.smileessence.view.dialog.PostMenuDialogFragment; import net.lacolaco.smileessence.view.dialog.SelectImageDialogFragment; import net.lacolaco.smileessence.viewmodel.StatusViewModel; @@ -83,10 +82,6 @@ public class PostFragment extends PageFragment implements TextWatcher, View.OnFo setImage(); break; } - case R.id.button_post_menu: { - openPostMenu(); - break; - } case R.id.button_post_tweet: { submitPost(); break; @@ -302,13 +297,6 @@ public class PostFragment extends PageFragment implements TextWatcher, View.OnFo return (Button) v.findViewById(R.id.button_post_tweet); } - private void openPostMenu() { - setStateFromView(); - SystemServiceHelper.hideIM(getActivity(), editText); - PostMenuDialogFragment menuDialogFragment = new PostMenuDialogFragment(); - DialogHelper.showDialog(getActivity(), menuDialogFragment); - } - private void removeImage() { SystemServiceHelper.hideIM(getActivity(), editText); viewGroupMedia.setVisibility(View.GONE); diff --git a/app/src/main/res/layout/dialog_review.xml b/app/src/main/res/layout/dialog_review.xml deleted file mode 100644 index fd0c308f..00000000 --- a/app/src/main/res/layout/dialog_review.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - ~ The MIT License (MIT) - ~ - ~ Copyright (c) 2012-2014 lacolaco.net - ~ - ~ Permission is hereby granted, free of charge, to any person obtaining a copy - ~ of this software and associated documentation files (the "Software"), to deal - ~ in the Software without restriction, including without limitation the rights - ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ~ copies of the Software, and to permit persons to whom the Software is - ~ furnished to do so, subject to the following conditions: - ~ - ~ The above copyright notice and this permission notice shall be included in all - ~ copies or substantial portions of the Software. - ~ - ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - ~ SOFTWARE. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="15dp"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="5dp" - android:layout_marginTop="5dp" - android:text="@string/dialog_review_rating_text" - android:textAppearance="?android:attr/textAppearanceMedium" /> - - <RatingBar - android:id="@+id/rating_review" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:max="5" - android:rating="1" - android:stepSize="1" /> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="40dp" - android:layout_gravity="fill" - android:background="?attr/button_round_blue"> - - <Button - android:id="@+id/button_submit" - style="?attr/custom_button_transparent" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:text="@string/alert_dialog_ok" - android:textColor="?attr/button_blue_foreground" - android:textStyle="bold" /> - </FrameLayout> -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/dialog_search_on_google.xml b/app/src/main/res/layout/dialog_search_on_google.xml deleted file mode 100644 index 27ef71ea..00000000 --- a/app/src/main/res/layout/dialog_search_on_google.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - ~ The MIT License (MIT) - ~ - ~ Copyright (c) 2012-2014 lacolaco.net - ~ - ~ Permission is hereby granted, free of charge, to any person obtaining a copy - ~ of this software and associated documentation files (the "Software"), to deal - ~ in the Software without restriction, including without limitation the rights - ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - ~ copies of the Software, and to permit persons to whom the Software is - ~ furnished to do so, subject to the following conditions: - ~ - ~ The above copyright notice and this permission notice shall be included in all - ~ copies or substantial portions of the Software. - ~ - ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - ~ SOFTWARE. - --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="15dp"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="10dp" - android:baselineAligned="false" - android:orientation="horizontal"> - - <EditText - android:id="@+id/edittext_search_on_google" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="top" - android:inputType="text|textMultiLine"> - - <requestFocus /> - </EditText> - </LinearLayout> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="40dp" - android:layout_gravity="fill" - android:background="?attr/button_round_blue"> - - <Button - android:id="@+id/button_submit" - style="?attr/custom_button_transparent" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:text="@string/command_search_on_google" - android:textColor="?attr/button_blue_foreground" - android:textStyle="bold" /> - </FrameLayout> -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml index 45188779..e237d282 100644 --- a/app/src/main/res/menu/main.xml +++ b/app/src/main/res/menu/main.xml @@ -18,8 +18,6 @@ <menu> <item android:id="@+id/actionbar_setting" android:title="@string/actionbar_setting" /> - <item android:id="@+id/actionbar_edit_templates" - android:title="@string/actionbar_edit_templates" /> <item android:id="@+id/actionbar_edit_extraction" android:title="@string/actionbar_edit_extraction" /> <item android:id="@+id/actionbar_edit_commands" diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index f1259d5b..14a8486c 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -23,7 +23,6 @@ --> <resources> - <string name="activity_edit_template">定型文設定</string> <string name="activity_setting">アプリ設定</string> <string name="activity_edit_extraction">抽出設定</string> <string name="activity_edit_command">コマンド設定</string> @@ -50,7 +49,6 @@ <string name="actionbar_post">投稿</string> <string name="actionbar_settings">設定</string> <string name="actionbar_setting">アプリ設定</string> - <string name="actionbar_edit_templates">定型文設定</string> <string name="actionbar_edit_extraction">抽出設定</string> <string name="actionbar_edit_commands">コマンド設定</string> <string name="actionbar_edit_tabs">タブ設定</string> @@ -60,7 +58,7 @@ <string name="actionbar_aclog">Aclog</string> <string name="actionbar_twilog">Twilog</string> <string name="actionbar_edit_command_all_on">すべて有効にする</string> - <string name="text_message_to_author">" #SmileEssence @laco0416 [ver.%s]"</string> + <string name="text_message_to_author">" #SmileEssence @uac [ver.%s]"</string> <string name="format_event_favorited">%sからふぁぼられた</string> <string name="format_event_unfavorited">%sからあんふぁぼされた</string> <string name="format_event_retweeted">%sからリツイートされた</string> @@ -69,9 +67,6 @@ <string name="format_event_blocked">%sからブロックされた</string> <string name="format_event_unblocked">%sからブロック解除された</string> <string name="format_event_message">%sからのDMを受信</string> - <string name="format_status_command_nanigaja">な~にが%sじゃ</string> - <string name="format_status_command_make_anonymous">???「%s」</string> - <string name="format_status_review">%1$s\r\nコメント: \r\n@%2$s ( %3$s )</string> <string name="setting_category_display_title">表示設定</string> <string name="setting_category_display_summary">再起動後に有効になります</string> <string name="setting_text_size_title">文字サイズ</string> @@ -138,16 +133,14 @@ <string name="dialog_message_now_loading">読み込み中…</string> <string name="dialog_confirm_finish_app">終了しますか?</string> <string name="dialog_confirm_commands">実行しますか?</string> - <string name="dialog_confirm_clear_account">本当に認証を削除しますか?</string> + <string name="dialog_confirm_clear_account">本当に %s の認証を削除しますか?</string> <string name="dialog_confirm_delete_query">クエリを削除しますか?</string> - <string name="dialog_review_rating_text">星いくつ付けますか?</string> <string name="notice_tweet_succeeded">投稿しました</string> <string name="notice_tweet_failed">投稿失敗しました</string> <string name="notice_favorite_succeeded">ふぁぼりました</string> <string name="notice_favorite_failed">ふぁぼれませんでした</string> <string name="notice_retweet_succeeded">リツイートしました</string> <string name="notice_retweet_failed">リツイートに失敗しました</string> - <string name="notice_tofubuster_not_found">TofuBusterがインストールされていません</string> <string name="notice_status_delete_succeeded">ツイートを削除しました</string> <string name="notice_status_delete_failed">ツイートの削除に失敗しました</string> <string name="notice_follow_succeeded">フォローしました</string> @@ -172,17 +165,14 @@ <string name="notice_select_image_succeeded">画像を選択しました</string> <string name="notice_select_image_failed">画像の選択に失敗しました</string> <string name="notice_not_implemented_yet">まだ実装されてないです。ごめんね</string> - <string name="notice_save_as_template">定型文を保存しました</string> <string name="notice_search_text_empty">クエリが空です</string> <string name="notice_add_to_reply">リプライ先に追加しました</string> <string name="notice_theme_changed">テーマは再起動後に有効になります</string> <string name="notice_cleared_account">認証情報が削除されました。 再起動後に認証してください</string> <string name="notice_copy_clipboard">クリップボードにコピーしました</string> <string name="notice_userlist_not_selected">リストが選択されていません</string> - <string name="notice_add_to_ignore">無視を決め込みました</string> <string name="notice_search_query_deleted">クエリを削除しました</string> <string name="notice_query_is_empty">クエリが空です</string> - <string name="notice_no_template_exists">定型文が存在しません</string> <string name="notice_no_query_exists">クエリが存在しません</string> <string name="notice_query_saved">クエリを保存しました</string> <string name="notice_tab_editted">タブ設定は次回起動時から有効になります</string> @@ -200,41 +190,19 @@ <string name="notice_application_starting">起動処理が完了していません</string> <string name="command_user_reply">リプライを送る</string> <string name="command_user_add_to_reply">リプライ先に追加する</string> - <string name="command_user_open_favstar">Favstarを開く</string> <string name="command_user_open_aclog">Aclogを開く</string> - <string name="command_user_open_twilog">Twilogを開く</string> <string name="command_user_block">ブロックする</string> <string name="command_user_unblock">ブロック解除</string> <string name="command_user_r4s">スパム報告する</string> - <string name="command_user_introduce">このユーザーを紹介する</string> <string name="command_user_send_message">DMを送る</string> - <string name="command_event_reply">リプライを送る</string> - <string name="command_status_fav_and_rt">ふぁぼ&RTする</string> - <string name="command_status_quote">引用する</string> - <string name="command_status_quote_url">URLを引用する</string> - <string name="command_status_quote_text">本文を引用する</string> <string name="command_status_copy_text_to_clipboard">クリップボードにコピーする</string> <string name="command_status_copy_url_to_clipboard">URLをクリップボードにコピーする</string> - <string name="command_status_share">共有する</string> <string name="command_status_open_in_browser">ブラウザで開く</string> - <string name="command_status_nanigaja">な~にが◯◯じゃ</string> - <string name="command_status_make_anonymous">匿名にしてつぶやく</string> - <string name="command_status_tofubuster">TofuBusterで読む</string> <string name="command_status_add_to_reply">リプライ先に追加する</string> <string name="command_status_open_talk_view">会話ビューを開く</string> - <string name="command_status_add_to_ignore">以後このツイートを無視する</string> - <string name="command_status_copy">入力欄にコピーする</string> - <string name="command_status_congratulate">お祝いする</string> - <string name="command_status_review">レビューする</string> - <string name="command_post_morse">モールスに変換する</string> - <string name="command_post_zekamashi">ぜかまし</string> - <string name="command_open_template_list">定型文を挿入する</string> <string name="command_select_image_from_gallery">ギャラリーから選択する</string> <string name="command_select_image_from_camera">カメラを起動する</string> - <string name="command_save_as_template">定型文として保存する</string> - <string name="command_paste_to_post">投稿欄に貼り付ける</string> <string name="command_search_on_twitter">Twitterで検索する</string> - <string name="command_search_on_google">Googleで検索する</string> <string name="notice_error_get_user_timeline">ユーザータイムラインの取得に失敗しました</string> <string name="notice_error_get_list">リストタイムラインの取得に失敗しました</string> <string name="activity_manage_accounts">アカウント管理</string> diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml index 5de498d2..3522163d 100644 --- a/app/src/main/res/values/keys.xml +++ b/app/src/main/res/values/keys.xml @@ -26,15 +26,11 @@ tools:ignore="MissingTranslation"> <string name="key_test_preference">testPreference</string> <string name="key_setting_text_size">textSize</string> - <string name="key_setting_back_to_home">onSubmit</string> <string name="key_setting_accounts">manageAccounts</string> <string name="key_setting_notify_on_unfavorited">unfavNotify</string> - <string name="key_open_ime">openIME</string> <string name="key_setting_show_confirm_dialog">confirm</string> <string name="key_setting_read_morse">morse</string> <string name="key_setting_namestyle">nameStyle</string> - <string name="key_retweet_visibility">retweetVisibility</string> - <string name="key_setting_search_includes_retweets">searchRetweet</string> <string name="key_setting_timelines">requestCount</string> <string name="key_setting_theme">theme</string> <string name="key_setting_application_information">appInfo</string> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 93cf559b..fc20f9d1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -23,7 +23,6 @@ --> <resources> - <string name="activity_edit_template">Templates Setting</string> <string name="activity_setting">App Setting</string> <string name="activity_edit_extraction">Extraction Setting</string> <string name="activity_edit_command">Command Setting</string> @@ -50,11 +49,8 @@ <string name="actionbar_setting">Setting</string> <string name="actionbar_services">Web sites</string> <string name="actionbar_report">Report to author</string> - <string name="actionbar_favstar">Favstar</string> <string name="actionbar_aclog">Aclog</string> - <string name="actionbar_twilog">Twilog</string> <string name="actionbar_settings">Settings</string> - <string name="actionbar_edit_templates">Edit templates</string> <string name="actionbar_edit_extraction">Edit extraction</string> <string name="actionbar_edit_commands">Edit commands</string> <string name="actionbar_edit_command_all_on">Enable all</string> @@ -68,10 +64,7 @@ <string name="format_event_blocked">Blocked by %s</string> <string name="format_event_unblocked">Unblocked by %s</string> <string name="format_event_message">Received %s\'s message</string> - <string name="format_status_command_nanigaja">What\'s %s</string> - <string name="format_status_command_make_anonymous">"??? said \"%s\""</string> - <string name="format_status_review">%1$s\r\nCommant: \r\n@%2$s ( %3$s )</string> - <string name="text_message_to_author">" #SmileEssence @laco0416 [%s]"</string> + <string name="text_message_to_author">" #SmileEssence @uac [%s]"</string> <string name="setting_category_display_title">Display Setting</string> <string name="setting_category_display_summary">Enable at next launch.</string> <string name="setting_text_size_title">Text size</string> @@ -138,8 +131,7 @@ <string name="dialog_confirm_commands">Execute, OK?</string> <string name="dialog_confirm_clear_account">Are you sure you want to remove this account @%s?</string> <string name="dialog_title_talk_chain">Talk View</string> - <string name="dialog_title_select_userlist">Select a list</string> - <string name="dialog_review_rating_text">How many favs will you give?</string> + <string name="dialog_title_select_userlist">Select a list</string>\ <string name="dialog_confirm_delete_query">Delete this query, OK?</string> <string name="notice_favorite_succeeded">Succeeded to favorite</string> <string name="notice_favorite_failed">Failed to favorite</string> @@ -147,7 +139,6 @@ <string name="notice_retweet_failed">Failed to retweet</string> <string name="notice_tweet_succeeded">Succeeded to tweet</string> <string name="notice_tweet_failed">Failed to tweet</string> - <string name="notice_tofubuster_not_found">TofuBuster is not installed</string> <string name="notice_status_delete_succeeded">Succeeded to delete tweet</string> <string name="notice_status_delete_failed">Failed to delete tweet</string> <string name="notice_follow_succeeded">Succeeded to follow</string> @@ -172,14 +163,12 @@ <string name="notice_select_image_succeeded">Succeed to select image</string> <string name="notice_select_image_failed">Failed to select image</string> <string name="notice_not_implemented_yet">Sorry, this is not implemented yet.</string> - <string name="notice_save_as_template">New template is saved</string> <string name="notice_search_text_empty">Query is empty</string> <string name="notice_add_to_reply">Added to reply</string> <string name="notice_theme_changed">Theme will be enabled on next launch</string> <string name="notice_cleared_account">Authentication was cleared. Please authorize on next launch</string> <string name="notice_copy_clipboard">Copied to clipboard</string> <string name="notice_userlist_not_selected">No List is selected</string> - <string name="notice_add_to_ignore">Added to ignore list</string> <string name="notice_search_query_deleted">Query was deleted</string> <string name="notice_query_is_empty">Query is empty</string> <string name="notice_no_template_exists">No templates exist</string> @@ -198,43 +187,20 @@ <string name="notice_error_search">Failed to search</string> <string name="notice_no_commands_available">No commands available</string> <string name="notice_application_starting">Application initialization is not complete.</string> - <string name="command_user_reply">Reply</string> <string name="command_user_add_to_reply">Add to reply</string> - <string name="command_user_open_favstar">Open favstar</string> <string name="command_user_open_aclog">Open aclog</string> - <string name="command_user_open_twilog">Open twilog</string> <string name="command_user_block">Block</string> <string name="command_user_unblock">Unblock</string> <string name="command_user_r4s">Report for spam</string> - <string name="command_user_introduce">Introduce to everyone</string> <string name="command_user_send_message">Send a direct message</string> - <string name="command_event_reply">Reply</string> - <string name="command_status_fav_and_rt">Retweet and favorite</string> - <string name="command_status_quote">Quote</string> - <string name="command_status_quote_url">Permalink quote</string> - <string name="command_status_quote_text">Text quote</string> <string name="command_status_copy_text_to_clipboard">Copy to clipboard</string> <string name="command_status_copy_url_to_clipboard">Copy permalink to clipboard</string> - <string name="command_status_share">Share</string> <string name="command_status_open_in_browser">Open in browser</string> - <string name="command_status_nanigaja">What\'s xxx</string> - <string name="command_status_make_anonymous">Make anonymous</string> - <string name="command_status_tofubuster">TofuBuster</string> <string name="command_status_open_talk_view">Show this talk</string> <string name="command_status_add_to_reply">Add to reply</string> - <string name="command_status_add_to_ignore">Ignore this tweet in future</string> - <string name="command_status_copy">Copy to input area</string> - <string name="command_status_congratulate">Congratulate</string> - <string name="command_status_review">Review this tweet</string> - <string name="command_post_morse">Parse to morse</string> - <string name="command_post_zekamashi">Zekamasize</string> - <string name="command_open_template_list">Insert Templates</string> <string name="command_select_image_from_gallery">From gallery</string> <string name="command_select_image_from_camera">From camera</string> - <string name="command_save_as_template">Save as template</string> - <string name="command_paste_to_post">Paste to post</string> <string name="command_search_on_twitter">Search on Twitter</string> - <string name="command_search_on_google">Search on Google</string> <string name="notice_error_get_user_timeline">Failed to get user timeline</string> <string name="notice_error_get_list">Failed to get list timeline</string> <string name="notices_of_files">Notices of files:</string> |