{"action":"created","comment":{"url":"https://api.github.com/repos/TripSit/tripmobile/pulls/comments/70230107","id":70230107,"diff_hunk":"@@ -0,0 +1,242 @@\n+package me.tripsit.mobile.combination;\n+\n+import android.animation.ArgbEvaluator;\n+import android.animation.ValueAnimator;\n+import android.content.DialogInterface;\n+import android.content.Intent;\n+import android.graphics.Color;\n+import android.graphics.drawable.ColorDrawable;\n+import android.os.Bundle;\n+import android.support.v4.animation.ValueAnimatorCompat;\n+import android.support.v4.util.Pair;\n+import android.support.v7.app.AlertDialog;\n+import android.text.Editable;\n+import android.text.TextWatcher;\n+import android.view.LayoutInflater;\n+import android.view.View;\n+import android.view.ViewGroup;\n+import android.widget.Button;\n+import android.widget.EditText;\n+import android.widget.ProgressBar;\n+import android.widget.TextView;\n+\n+import java.security.InvalidParameterException;\n+import java.util.ArrayList;\n+import java.util.List;\n+import java.util.Locale;\n+\n+import me.tripsit.mobile.R;\n+import me.tripsit.mobile.TripMobileActivity;\n+import me.tripsit.mobile.combinations.Combinations;\n+import me.tripsit.mobile.views.BackgroundAnimation;\n+\n+/**\n+ * Created by alex on 08/07/16.\n+ */\n+public class CombinationActivity extends TripMobileActivity implements View.OnClickListener, TextWatcher {\n+\n+    private ViewGroup inputContainer;\n+    private EditText firstInput;\n+    private EditText secondInput;\n+\n+    private ProgressBar progressBar;\n+\n+    private ViewGroup combinationContainer;\n+    private TextView header;\n+    private TextView content;\n+\n+    private List<View> viewsToAnimate = null;\n+\n+    @Override\n+    protected void onCreate(Bundle savedInstanceState) {\n+\n+        super.onCreate(savedInstanceState);\n+\n+        // Look up all the views we will want to use while running\n+        progressBar = (ProgressBar)findViewById(R.id.progress_combinations);\n+        inputContainer = (ViewGroup)findViewById(R.id.input_container);\n+        combinationContainer = (ViewGroup)findViewById(R.id.combo_container);\n+        content = (TextView)findViewById(R.id.txt_combo_content);\n+        header = (TextView)findViewById(R.id.txt_combo_header);\n+        firstInput = (EditText)findViewById(R.id.input_first_drug);\n+        secondInput = (EditText)findViewById(R.id.input_second_drug);\n+\n+        viewsToAnimate = new ArrayList<>();\n+        viewsToAnimate.add(combinationContainer);\n+        viewsToAnimate.add(inputContainer);\n+\n+        // Set listeners\n+        findViewById(R.id.btn_search).setOnClickListener(this);\n+\n+        // Listen to edit text changes and reset background color of top window\n+        // only to indicate their input is no longer valid\n+        firstInput.addTextChangedListener(this);\n+        secondInput.addTextChangedListener(this);\n+\n+        //testCombinationActivity();\n+    }\n+\n+    @Override\n+    public int getLayoutId() {\n+        return R.layout.activity_combination;\n+    }\n+\n+    @Override\n+    public void beforeTextChanged(CharSequence s, int start, int count, int after) {\n+        // not used\n+    }\n+\n+    @Override\n+    public void onTextChanged(CharSequence s, int start, int before, int count) {\n+        clearCombination();\n+    }\n+\n+    private void clearCombination() {\n+        BackgroundAnimation animation = new BackgroundAnimation(viewsToAnimate);\n+        animation.setBackgroundColor(Color.TRANSPARENT);\n+        header.setText(\"\");\n+        content.setText(\"\");\n+    }\n+\n+    @Override\n+    public void afterTextChanged(Editable s) {\n+        // not used\n+    }\n+\n+    private Pair<String, String> getInputs() {\n+        String firstDrug = firstInput.getText().toString().trim();\n+        String secondDrug = secondInput.getText().toString().trim();\n+\n+        return new Pair<>(firstDrug, secondDrug);\n+    }\n+\n+    @Override\n+    public void onClick(View v) {\n+        switch ( v.getId() ) {\n+            case R.id.btn_search:\n+                // Start the selection dialog.\n+                // Parse out the inputs\n+                Pair<String, String> inputs = getInputs();\n+                searchForCombination(inputs.first, inputs.second);\n+                break;\n+        }\n+    }\n+\n+    // tried showing the inputs in a dialog but if you're shaking\n+    // while trying to check danger, you might hit\n+    // the dialog background and cancel your inputs\n+    // so i'm using it for errors\n+    private void displayError(final Combination code) {\n+        String error = getString(R.string.operation_failed);\n+\n+        Pair<String, String> inputs = getInputs();\n+        String drug = null;\n+        switch ( code.error ) {\n+            case DRUG_A_NOT_FOUND:\n+                drug = inputs.first;\n+                if ( inputs.first.length() == 0 ) {\n+                    drug = getString(R.string.failed_empty_drug);\n+                }\n+                error = String.format(getString(R.string.failed_search_combo), drug);\n+                break;\n+            case DRUG_B_NOT_FOUND:\n+                drug = inputs.second;\n+                if ( inputs.second.length() == 0 ) {\n+                    drug = getString(R.string.failed_empty_drug);\n+                }\n+                error = String.format(getString(R.string.failed_search_combo), drug);\n+                break;\n+            case NETWORK_ERROR:\n+                error = getString(R.string.failed_download_combinations);\n+                break;\n+        }\n+\n+        /*AlertDialog dialog = new AlertDialog.Builder(this)","path":"TripMobile/app/src/main/java/me/tripsit/mobile/combination/CombinationActivity.java","position":null,"original_position":154,"commit_id":"f1076963c1a3eb5293a665bb9772d7af97b8d367","original_commit_id":"1112be4c009bf675107ff72b584b9c27b2dbc015","user":{"login":"somehibs","id":13722260,"avatar_url":"https://avatars.githubusercontent.com/u/13722260?v=3","gravatar_id":"","url":"https://api.github.com/users/somehibs","html_url":"https://github.com/somehibs","followers_url":"https://api.github.com/users/somehibs/followers","following_url":"https://api.github.com/users/somehibs/following{/other_user}","gists_url":"https://api.github.com/users/somehibs/gists{/gist_id}","starred_url":"https://api.github.com/users/somehibs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somehibs/subscriptions","organizations_url":"https://api.github.com/users/somehibs/orgs","repos_url":"https://api.github.com/users/somehibs/repos","events_url":"https://api.github.com/users/somehibs/events{/privacy}","received_events_url":"https://api.github.com/users/somehibs/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2016-07-11T09:54:32Z","updated_at":"2016-07-11T09:54:32Z","html_url":"https://github.com/TripSit/tripmobile/pull/34#discussion_r70230107","pull_request_url":"https://api.github.com/repos/TripSit/tripmobile/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/TripSit/tripmobile/pulls/comments/70230107"},"html":{"href":"https://github.com/TripSit/tripmobile/pull/34#discussion_r70230107"},"pull_request":{"href":"https://api.github.com/repos/TripSit/tripmobile/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/TripSit/tripmobile/pulls/34","id":76918329,"html_url":"https://github.com/TripSit/tripmobile/pull/34","diff_url":"https://github.com/TripSit/tripmobile/pull/34.diff","patch_url":"https://github.com/TripSit/tripmobile/pull/34.patch","issue_url":"https://api.github.com/repos/TripSit/tripmobile/issues/34","number":34,"state":"open","locked":false,"title":"Combo fix","user":{"login":"somehibs","id":13722260,"avatar_url":"https://avatars.githubusercontent.com/u/13722260?v=3","gravatar_id":"","url":"https://api.github.com/users/somehibs","html_url":"https://github.com/somehibs","followers_url":"https://api.github.com/users/somehibs/followers","following_url":"https://api.github.com/users/somehibs/following{/other_user}","gists_url":"https://api.github.com/users/somehibs/gists{/gist_id}","starred_url":"https://api.github.com/users/somehibs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somehibs/subscriptions","organizations_url":"https://api.github.com/users/somehibs/orgs","repos_url":"https://api.github.com/users/somehibs/repos","events_url":"https://api.github.com/users/somehibs/events{/privacy}","received_events_url":"https://api.github.com/users/somehibs/received_events","type":"User","site_admin":false},"body":"Major changes are\r\n - removed .idea folder - this is generated by Gradle when opening the project for the first time\r\n - added a CombinationActivity which uses the tripbot api rather than the combos.json object\r\n - a new combination category (caution) will need adding to separate translation documents\r\n - changed some style parents to use appcompat styles - themes unaffected\r\n - changed activity parents to use appcompat activity - brings in bugfixes for older platforms","created_at":"2016-07-11T08:48:23Z","updated_at":"2016-07-11T09:54:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"161b2c0a97ab60c7f027f17f2fb0c8c8c4e6cde8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/TripSit/tripmobile/pulls/34/commits","review_comments_url":"https://api.github.com/repos/TripSit/tripmobile/pulls/34/comments","review_comment_url":"https://api.github.com/repos/TripSit/tripmobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TripSit/tripmobile/issues/34/comments","statuses_url":"https://api.github.com/repos/TripSit/tripmobile/statuses/f1076963c1a3eb5293a665bb9772d7af97b8d367","head":{"label":"somehibs:combo_fix","ref":"combo_fix","sha":"f1076963c1a3eb5293a665bb9772d7af97b8d367","user":{"login":"somehibs","id":13722260,"avatar_url":"https://avatars.githubusercontent.com/u/13722260?v=3","gravatar_id":"","url":"https://api.github.com/users/somehibs","html_url":"https://github.com/somehibs","followers_url":"https://api.github.com/users/somehibs/followers","following_url":"https://api.github.com/users/somehibs/following{/other_user}","gists_url":"https://api.github.com/users/somehibs/gists{/gist_id}","starred_url":"https://api.github.com/users/somehibs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somehibs/subscriptions","organizations_url":"https://api.github.com/users/somehibs/orgs","repos_url":"https://api.github.com/users/somehibs/repos","events_url":"https://api.github.com/users/somehibs/events{/privacy}","received_events_url":"https://api.github.com/users/somehibs/received_events","type":"User","site_admin":false},"repo":{"id":40452381,"name":"tripmobile","full_name":"somehibs/tripmobile","owner":{"login":"somehibs","id":13722260,"avatar_url":"https://avatars.githubusercontent.com/u/13722260?v=3","gravatar_id":"","url":"https://api.github.com/users/somehibs","html_url":"https://github.com/somehibs","followers_url":"https://api.github.com/users/somehibs/followers","following_url":"https://api.github.com/users/somehibs/following{/other_user}","gists_url":"https://api.github.com/users/somehibs/gists{/gist_id}","starred_url":"https://api.github.com/users/somehibs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somehibs/subscriptions","organizations_url":"https://api.github.com/users/somehibs/orgs","repos_url":"https://api.github.com/users/somehibs/repos","events_url":"https://api.github.com/users/somehibs/events{/privacy}","received_events_url":"https://api.github.com/users/somehibs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/somehibs/tripmobile","description":"TripSit mobile app for Android","fork":true,"url":"https://api.github.com/repos/somehibs/tripmobile","forks_url":"https://api.github.com/repos/somehibs/tripmobile/forks","keys_url":"https://api.github.com/repos/somehibs/tripmobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/somehibs/tripmobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/somehibs/tripmobile/teams","hooks_url":"https://api.github.com/repos/somehibs/tripmobile/hooks","issue_events_url":"https://api.github.com/repos/somehibs/tripmobile/issues/events{/number}","events_url":"https://api.github.com/repos/somehibs/tripmobile/events","assignees_url":"https://api.github.com/repos/somehibs/tripmobile/assignees{/user}","branches_url":"https://api.github.com/repos/somehibs/tripmobile/branches{/branch}","tags_url":"https://api.github.com/repos/somehibs/tripmobile/tags","blobs_url":"https://api.github.com/repos/somehibs/tripmobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/somehibs/tripmobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/somehibs/tripmobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/somehibs/tripmobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/somehibs/tripmobile/statuses/{sha}","languages_url":"https://api.github.com/repos/somehibs/tripmobile/languages","stargazers_url":"https://api.github.com/repos/somehibs/tripmobile/stargazers","contributors_url":"https://api.github.com/repos/somehibs/tripmobile/contributors","subscribers_url":"https://api.github.com/repos/somehibs/tripmobile/subscribers","subscription_url":"https://api.github.com/repos/somehibs/tripmobile/subscription","commits_url":"https://api.github.com/repos/somehibs/tripmobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/somehibs/tripmobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/somehibs/tripmobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/somehibs/tripmobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/somehibs/tripmobile/contents/{+path}","compare_url":"https://api.github.com/repos/somehibs/tripmobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/somehibs/tripmobile/merges","archive_url":"https://api.github.com/repos/somehibs/tripmobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/somehibs/tripmobile/downloads","issues_url":"https://api.github.com/repos/somehibs/tripmobile/issues{/number}","pulls_url":"https://api.github.com/repos/somehibs/tripmobile/pulls{/number}","milestones_url":"https://api.github.com/repos/somehibs/tripmobile/milestones{/number}","notifications_url":"https://api.github.com/repos/somehibs/tripmobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/somehibs/tripmobile/labels{/name}","releases_url":"https://api.github.com/repos/somehibs/tripmobile/releases{/id}","deployments_url":"https://api.github.com/repos/somehibs/tripmobile/deployments","created_at":"2015-08-09T22:15:11Z","updated_at":"2016-02-11T19:48:48Z","pushed_at":"2016-07-11T09:54:32Z","git_url":"git://github.com/somehibs/tripmobile.git","ssh_url":"git@github.com:somehibs/tripmobile.git","clone_url":"https://github.com/somehibs/tripmobile.git","svn_url":"https://github.com/somehibs/tripmobile","homepage":"","size":38697,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TripSit:master","ref":"master","sha":"2fbb9c45bd8d407444d4dce5e45da97c2004d148","user":{"login":"TripSit","id":9785163,"avatar_url":"https://avatars.githubusercontent.com/u/9785163?v=3","gravatar_id":"","url":"https://api.github.com/users/TripSit","html_url":"https://github.com/TripSit","followers_url":"https://api.github.com/users/TripSit/followers","following_url":"https://api.github.com/users/TripSit/following{/other_user}","gists_url":"https://api.github.com/users/TripSit/gists{/gist_id}","starred_url":"https://api.github.com/users/TripSit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TripSit/subscriptions","organizations_url":"https://api.github.com/users/TripSit/orgs","repos_url":"https://api.github.com/users/TripSit/repos","events_url":"https://api.github.com/users/TripSit/events{/privacy}","received_events_url":"https://api.github.com/users/TripSit/received_events","type":"Organization","site_admin":false},"repo":{"id":26719539,"name":"tripmobile","full_name":"TripSit/tripmobile","owner":{"login":"TripSit","id":9785163,"avatar_url":"https://avatars.githubusercontent.com/u/9785163?v=3","gravatar_id":"","url":"https://api.github.com/users/TripSit","html_url":"https://github.com/TripSit","followers_url":"https://api.github.com/users/TripSit/followers","following_url":"https://api.github.com/users/TripSit/following{/other_user}","gists_url":"https://api.github.com/users/TripSit/gists{/gist_id}","starred_url":"https://api.github.com/users/TripSit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TripSit/subscriptions","organizations_url":"https://api.github.com/users/TripSit/orgs","repos_url":"https://api.github.com/users/TripSit/repos","events_url":"https://api.github.com/users/TripSit/events{/privacy}","received_events_url":"https://api.github.com/users/TripSit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TripSit/tripmobile","description":"TripSit mobile app for Android","fork":false,"url":"https://api.github.com/repos/TripSit/tripmobile","forks_url":"https://api.github.com/repos/TripSit/tripmobile/forks","keys_url":"https://api.github.com/repos/TripSit/tripmobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TripSit/tripmobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TripSit/tripmobile/teams","hooks_url":"https://api.github.com/repos/TripSit/tripmobile/hooks","issue_events_url":"https://api.github.com/repos/TripSit/tripmobile/issues/events{/number}","events_url":"https://api.github.com/repos/TripSit/tripmobile/events","assignees_url":"https://api.github.com/repos/TripSit/tripmobile/assignees{/user}","branches_url":"https://api.github.com/repos/TripSit/tripmobile/branches{/branch}","tags_url":"https://api.github.com/repos/TripSit/tripmobile/tags","blobs_url":"https://api.github.com/repos/TripSit/tripmobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TripSit/tripmobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TripSit/tripmobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/TripSit/tripmobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TripSit/tripmobile/statuses/{sha}","languages_url":"https://api.github.com/repos/TripSit/tripmobile/languages","stargazers_url":"https://api.github.com/repos/TripSit/tripmobile/stargazers","contributors_url":"https://api.github.com/repos/TripSit/tripmobile/contributors","subscribers_url":"https://api.github.com/repos/TripSit/tripmobile/subscribers","subscription_url":"https://api.github.com/repos/TripSit/tripmobile/subscription","commits_url":"https://api.github.com/repos/TripSit/tripmobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/TripSit/tripmobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/TripSit/tripmobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/TripSit/tripmobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/TripSit/tripmobile/contents/{+path}","compare_url":"https://api.github.com/repos/TripSit/tripmobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TripSit/tripmobile/merges","archive_url":"https://api.github.com/repos/TripSit/tripmobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TripSit/tripmobile/downloads","issues_url":"https://api.github.com/repos/TripSit/tripmobile/issues{/number}","pulls_url":"https://api.github.com/repos/TripSit/tripmobile/pulls{/number}","milestones_url":"https://api.github.com/repos/TripSit/tripmobile/milestones{/number}","notifications_url":"https://api.github.com/repos/TripSit/tripmobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TripSit/tripmobile/labels{/name}","releases_url":"https://api.github.com/repos/TripSit/tripmobile/releases{/id}","deployments_url":"https://api.github.com/repos/TripSit/tripmobile/deployments","created_at":"2014-11-16T16:13:19Z","updated_at":"2016-04-04T18:51:56Z","pushed_at":"2016-07-11T09:54:32Z","git_url":"git://github.com/TripSit/tripmobile.git","ssh_url":"git@github.com:TripSit/tripmobile.git","clone_url":"https://github.com/TripSit/tripmobile.git","svn_url":"https://github.com/TripSit/tripmobile","homepage":"","size":36444,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":13,"forks":2,"open_issues":13,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TripSit/tripmobile/pulls/34"},"html":{"href":"https://github.com/TripSit/tripmobile/pull/34"},"issue":{"href":"https://api.github.com/repos/TripSit/tripmobile/issues/34"},"comments":{"href":"https://api.github.com/repos/TripSit/tripmobile/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/TripSit/tripmobile/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/TripSit/tripmobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TripSit/tripmobile/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/TripSit/tripmobile/statuses/f1076963c1a3eb5293a665bb9772d7af97b8d367"}}}}
{"actor":{"display_login":"somehibs"}}