From c626af4a6731de2b6de911f5b7783ef04db6c827 Mon Sep 17 00:00:00 2001 From: Raja Shravan Date: Sun, 16 Sep 2018 16:29:24 -0400 Subject: [PATCH] repack --- .gitignore | 10 + .idea/caches/build_file_checksums.ser | Bin 0 -> 542 bytes .idea/codeStyles/Project.xml | 29 ++ .idea/gradle.xml | 18 + .idea/misc.xml | 34 ++ .idea/runConfigurations.xml | 12 + .idea/vcs.xml | 6 + app/.gitignore | 1 + app/build.gradle | 28 ++ app/proguard-rules.pro | 21 ++ .../packbuddy/ExampleInstrumentedTest.java | 26 ++ app/src/main/AndroidManifest.xml | 21 ++ .../nikolavalcic/packbuddy/MainActivity.java | 337 ++++++++++++++++++ .../drawable-v24/ic_launcher_foreground.xml | 34 ++ .../res/drawable/ic_launcher_background.xml | 170 +++++++++ app/src/main/res/layout/activity_main.xml | 269 ++++++++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3056 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5024 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2096 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2858 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4569 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7098 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6464 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10676 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9250 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15523 bytes app/src/main/res/values/colors.xml | 6 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/styles.xml | 8 + .../packbuddy/ExampleUnitTest.java | 17 + build.gradle | 27 ++ gradle.properties | 13 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54708 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 172 +++++++++ gradlew.bat | 84 +++++ settings.gradle | 1 + 39 files changed, 1363 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/caches/build_file_checksums.ser create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/vcs.xml create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/example/nikolavalcic/packbuddy/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/example/nikolavalcic/packbuddy/MainActivity.java create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 app/src/test/java/com/example/nikolavalcic/packbuddy/ExampleUnitTest.java create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5edb4ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.iml +.gradle +/local.properties +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000000000000000000000000000000000000..91c2b2c179574b477e515f40497e313cd3c0c02d GIT binary patch literal 542 zcmZ4UmVvdnh`~NNKUXg?FQq6yGexf?KR>5fFEb@IQ7^qHF(oHeub?PDD>b=9F91S2 zm1gFoxMk*~I%lLNXBU^|7Q2L-Ts|(GuF1r}uGBYr_F>vMNC#JY1CYR(Fc`|U8WE7FEcwo2k4%hTQfWjTa)VJPNq1M;8 z{XY28!hZEu-kuT$K|F2{*j*NI{;lQ@i&YK>3qB?31C35BDA335j%l@D&ZuXag + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..7ac24c7 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..99202cc --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..19f1823 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + defaultConfig { + applicationId "com.example.nikolavalcic.packbuddy" + minSdkVersion 15 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + compile 'com.squareup.okhttp3:okhttp:3.4.1' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/example/nikolavalcic/packbuddy/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/nikolavalcic/packbuddy/ExampleInstrumentedTest.java new file mode 100644 index 0000000..2abfc62 --- /dev/null +++ b/app/src/androidTest/java/com/example/nikolavalcic/packbuddy/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.nikolavalcic.packbuddy; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.nikolavalcic.packbuddy", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..692edf7 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/nikolavalcic/packbuddy/MainActivity.java b/app/src/main/java/com/example/nikolavalcic/packbuddy/MainActivity.java new file mode 100644 index 0000000..029a1d3 --- /dev/null +++ b/app/src/main/java/com/example/nikolavalcic/packbuddy/MainActivity.java @@ -0,0 +1,337 @@ +package com.example.nikolavalcic.packbuddy; + +import android.app.Activity; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.Spinner; +import android.widget.TextView; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.*; + +import java.util.ArrayList; +import java.util.concurrent.ExecutionException; + +import okhttp3.OkHttpClient; + + + + +import android.os.Bundle; +//import android.support.design.widget.FloatingActionButton; +//import android.support.design.widget.Snackbar; +//import android.support.v7.app.AppCompatActivity; +//import android.support.v7.widget.Toolbar; +import android.view.View; +import android.view.Menu; +import android.view.MenuItem; + +import android.app.Activity; +import android.os.AsyncTask; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.IOException; +import java.lang.reflect.Array; +import java.util.concurrent.ExecutionException; + +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Credentials; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.json.*; + + + + +public class MainActivity extends Activity { + + class Item{ + String item; + Double weight; + Double price; + String currency; + public Item( String item, Double weight, Double price,String currency) { + this.item=item; + this.weight=weight; + this.price=price; + this.currency=currency; + } + } + ArrayList items = new ArrayList(); + + //list.add("Item2"); + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Spinner dropdown3 = findViewById(R.id.spinner3); + String[] items = new String[]{"USD", "CAD", "EUR", "JPY", "GBP", "INR"}; + ArrayAdapter adapter3 = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items); + dropdown3.setAdapter(adapter3); + + Spinner dropdown2 = findViewById(R.id.spinner2); + ArrayAdapter adapter2 = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items); + dropdown2.setAdapter(adapter2); + + Spinner dropdown1 = findViewById(R.id.spinner1); + ArrayAdapter adapter1 = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items); + dropdown1.setAdapter(adapter1); + + Spinner dropdownDest = findViewById(R.id.destCur); + ArrayAdapter adapterDest = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items); + dropdownDest.setAdapter(adapterDest); + //dropdown1.select + Log.i("Selected", dropdown1.getSelectedItem().toString()); + } + + public void updateTable(){ + + } + + public void printItems(){ + for (int i=0; i=0; i--){ + items.remove(i); + } + } + + + //get items as written in the table + public void getItems(){ + clearItems(); + LinearLayout root=(LinearLayout) findViewById(R.id.itemsPanel); + + for (int i=1; i { + + OkHttpClient client = new OkHttpClient(); + + @Override + protected String doInBackground(String...params) { + + Log.e("PARAM 0", params[0]); + + Request.Builder builder = new Request.Builder(); + builder.url(params[0]); //params is all the arguments i think + builder.addHeader("Authorization", Credentials.basic("universityofwaterloo738297875", "ri5ump0mb771ukp2luajv50r43")); + Request request = builder.build(); + + try { + Log.i("DEBUG", "TRY ENTERED"); + Response response = client.newCall(request).execute(); + String s = response.body().string(); + Log.i("side", s); + return s; + } catch (Exception e) { + Log.i("DEBUG", "EXCEPTION CAUGHT"); + e.printStackTrace(); + return null; + } + //return null; + } + + @Override + protected void onPostExecute(String s) { + //super.onPostExecute(s); + Log.i("DEBUG", "executed post"); + Log.e("DEBUG", " " + s); + Log.i("DEBUG", s); + //txtString.setText(s); + //txtString.setText("sdf"); + //return s; + } + } + + public void KnapSackAlgo(View view){ + + LinearLayout root=(LinearLayout) findViewById(R.id.itemsPanel); + + for (int i=0; i= wt[i]) + m2 = m[i - 1][j - wt[i]] + val[i]; + /** select max of m1, m2 **/ + m[i][j] = Math.max(m1, m2); + sol[i][j] = m2 > m1 ? 1 : 0; + } + } + /** make list of what all items to finally select **/ + int[] selected = new int[N + 1]; + for (int n = N, w = W; n > 0; n--) { + if (sol[n][w] != 0) { + selected[n] = 1; + w = w - wt[n]; + } else + selected[n] = 0; + } + return selected; +// /** Print finally selected items **/ +// System.out.println("\nItems selected : "); +// for (int i = 1; i < N + 1; i++) +// if (selected[i] == 1) +// System.out.print(i + " "); +// System.out.println(); +// } + } + } + + +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..119bbba --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +