diff --git a/README.md b/README.md index 16bacc56..9dec53a5 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ $ secureflow scan ./path/to/project ### Code-Pathfinder CLI ```bash -docker run --rm -v "./src:/src" shivasurya/code-pathfinder:stable-latest ci --project /src/code-pathfinder/test-src --ruleset cpf/java +docker run --rm -v "./src:/src" shivasurya/code-pathfinder:stable-latest ci --project /src/your-project --ruleset cpf/java ``` ## :book: Documentation diff --git a/sourcecode-parser/build.gradle b/sourcecode-parser/build.gradle index 439befa3..35955455 100644 --- a/sourcecode-parser/build.gradle +++ b/sourcecode-parser/build.gradle @@ -22,12 +22,6 @@ task buildGo(type: Exec, dependsOn: 'cleanGo') { commandLine 'go', 'build', '-ldflags', "-s -w -X github.com/shivasurya/code-pathfinder/sourcecode-parser/cmd.Version=${projectVersion} -X github.com/shivasurya/code-pathfinder/sourcecode-parser/cmd.GitCommit=${gitCommit} -X github.com/shivasurya/code-pathfinder/sourcecode-parser/analytics.PublicKey=${analyticskey}", '-o', "${outputDir}/pathfinder", '.' } -// gradle run --console=plain -task runGo(type: Exec, dependsOn: build) { - commandLine "${buildDir}/go/pathfinder", '--project', '../test-src/android', '--stdin', 'true' - standardInput = System.in -} - task testGo(type: Exec) { commandLine 'go', 'test', './...' } diff --git a/sourcecode-parser/graph/callgraph/benchmark_test.go b/sourcecode-parser/graph/callgraph/benchmark_test.go index 9e209fc9..33799715 100644 --- a/sourcecode-parser/graph/callgraph/benchmark_test.go +++ b/sourcecode-parser/graph/callgraph/benchmark_test.go @@ -15,7 +15,7 @@ import ( // These paths are used for performance testing against real-world codebases. const ( // Small project: ~5 Python files, simple imports. - smallProjectPath = "../../../test-src/python/simple_project" + smallProjectPath = "../test-fixtures/python/simple_project" // Medium project: label-studio (~1000 Python files, complex imports). mediumProjectPath = "/Users/shiva/src/label-studio/label_studio" diff --git a/sourcecode-parser/graph/callgraph/registry/module_test.go b/sourcecode-parser/graph/callgraph/registry/module_test.go index 15e477ad..7ec14f21 100644 --- a/sourcecode-parser/graph/callgraph/registry/module_test.go +++ b/sourcecode-parser/graph/callgraph/registry/module_test.go @@ -12,7 +12,7 @@ import ( func TestBuildModuleRegistry_SimpleProject(t *testing.T) { // Use the simple_project test fixture - testRoot := filepath.Join("..", "..", "..", "..", "test-src", "python", "simple_project") + testRoot := filepath.Join("..", "..", "..", "test-fixtures", "python", "simple_project") registry, err := BuildModuleRegistry(testRoot) require.NoError(t, err) diff --git a/sourcecode-parser/graph/callgraph/resolution/callsites_test.go b/sourcecode-parser/graph/callgraph/resolution/callsites_test.go index 1816dc3b..061df940 100644 --- a/sourcecode-parser/graph/callgraph/resolution/callsites_test.go +++ b/sourcecode-parser/graph/callgraph/resolution/callsites_test.go @@ -256,7 +256,7 @@ def process(): func TestExtractCallSites_WithTestFixture(t *testing.T) { // Create a test fixture - fixturePath := filepath.Join("..", "..", "..", "test-src", "python", "callsites_test", "simple_calls.py") + fixturePath := filepath.Join("..", "..", "..", "test-fixtures", "python", "callsites_test", "simple_calls.py") // Check if fixture exists if _, err := os.Stat(fixturePath); os.IsNotExist(err) { diff --git a/sourcecode-parser/graph/callgraph/resolution/imports_relative_test.go b/sourcecode-parser/graph/callgraph/resolution/imports_relative_test.go index 0c1d676c..5527ac9a 100644 --- a/sourcecode-parser/graph/callgraph/resolution/imports_relative_test.go +++ b/sourcecode-parser/graph/callgraph/resolution/imports_relative_test.go @@ -198,7 +198,7 @@ from ..config import settings func TestExtractImports_WithTestFixture_RelativeImports(t *testing.T) { // Build module registry for the test fixture - use absolute path from start // Note: This file is now in resolution/ subpackage, so we need one extra .. - projectRoot := filepath.Join("..", "..", "..", "..", "test-src", "python", "relative_imports_test") + projectRoot := filepath.Join("..", "..", "..", "test-fixtures", "python", "relative_imports_test") absProjectRoot, err := filepath.Abs(projectRoot) require.NoError(t, err) diff --git a/sourcecode-parser/graph/callgraph/resolution/imports_test.go b/sourcecode-parser/graph/callgraph/resolution/imports_test.go index 546fc04a..374d5f87 100644 --- a/sourcecode-parser/graph/callgraph/resolution/imports_test.go +++ b/sourcecode-parser/graph/callgraph/resolution/imports_test.go @@ -295,7 +295,7 @@ func TestExtractImports_WithTestFixtures(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - fixturePath := filepath.Join("..", "..", "..", "test-src", "python", "imports_test", tt.fixtureFile) + fixturePath := filepath.Join("..", "..", "..", "test-fixtures", "python", "imports_test", tt.fixtureFile) // Check if fixture exists if _, err := os.Stat(fixturePath); os.IsNotExist(err) { diff --git a/test-src/python/callsites_test/simple_calls.py b/sourcecode-parser/test-fixtures/python/callsites_test/simple_calls.py similarity index 100% rename from test-src/python/callsites_test/simple_calls.py rename to sourcecode-parser/test-fixtures/python/callsites_test/simple_calls.py diff --git a/test-src/python/imports_test/aliased_imports.py b/sourcecode-parser/test-fixtures/python/imports_test/aliased_imports.py similarity index 100% rename from test-src/python/imports_test/aliased_imports.py rename to sourcecode-parser/test-fixtures/python/imports_test/aliased_imports.py diff --git a/test-src/python/imports_test/from_imports.py b/sourcecode-parser/test-fixtures/python/imports_test/from_imports.py similarity index 100% rename from test-src/python/imports_test/from_imports.py rename to sourcecode-parser/test-fixtures/python/imports_test/from_imports.py diff --git a/test-src/python/imports_test/mixed_imports.py b/sourcecode-parser/test-fixtures/python/imports_test/mixed_imports.py similarity index 100% rename from test-src/python/imports_test/mixed_imports.py rename to sourcecode-parser/test-fixtures/python/imports_test/mixed_imports.py diff --git a/test-src/python/imports_test/simple_imports.py b/sourcecode-parser/test-fixtures/python/imports_test/simple_imports.py similarity index 100% rename from test-src/python/imports_test/simple_imports.py rename to sourcecode-parser/test-fixtures/python/imports_test/simple_imports.py diff --git a/test-src/python/relative_imports_test/myapp/__init__.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/__init__.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/__init__.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/__init__.py diff --git a/test-src/python/relative_imports_test/myapp/config/__init__.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/config/__init__.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/config/__init__.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/config/__init__.py diff --git a/test-src/python/relative_imports_test/myapp/config/settings.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/config/settings.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/config/settings.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/config/settings.py diff --git a/test-src/python/relative_imports_test/myapp/submodule/__init__.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/submodule/__init__.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/submodule/__init__.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/submodule/__init__.py diff --git a/test-src/python/relative_imports_test/myapp/submodule/handler.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/submodule/handler.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/submodule/handler.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/submodule/handler.py diff --git a/test-src/python/relative_imports_test/myapp/submodule/utils.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/submodule/utils.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/submodule/utils.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/submodule/utils.py diff --git a/test-src/python/relative_imports_test/myapp/utils/__init__.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/utils/__init__.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/utils/__init__.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/utils/__init__.py diff --git a/test-src/python/relative_imports_test/myapp/utils/helper.py b/sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/utils/helper.py similarity index 100% rename from test-src/python/relative_imports_test/myapp/utils/helper.py rename to sourcecode-parser/test-fixtures/python/relative_imports_test/myapp/utils/helper.py diff --git a/test-src/python/sample.py b/sourcecode-parser/test-fixtures/python/sample.py similarity index 100% rename from test-src/python/sample.py rename to sourcecode-parser/test-fixtures/python/sample.py diff --git a/test-src/python/simple_project/main.py b/sourcecode-parser/test-fixtures/python/simple_project/main.py similarity index 100% rename from test-src/python/simple_project/main.py rename to sourcecode-parser/test-fixtures/python/simple_project/main.py diff --git a/test-src/python/simple_project/submodule/__init__.py b/sourcecode-parser/test-fixtures/python/simple_project/submodule/__init__.py similarity index 100% rename from test-src/python/simple_project/submodule/__init__.py rename to sourcecode-parser/test-fixtures/python/simple_project/submodule/__init__.py diff --git a/test-src/python/simple_project/submodule/helpers.py b/sourcecode-parser/test-fixtures/python/simple_project/submodule/helpers.py similarity index 100% rename from test-src/python/simple_project/submodule/helpers.py rename to sourcecode-parser/test-fixtures/python/simple_project/submodule/helpers.py diff --git a/test-src/python/simple_project/utils.py b/sourcecode-parser/test-fixtures/python/simple_project/utils.py similarity index 100% rename from test-src/python/simple_project/utils.py rename to sourcecode-parser/test-fixtures/python/simple_project/utils.py diff --git a/test-src/android/.gitignore b/test-src/android/.gitignore deleted file mode 100644 index c6cbe562..00000000 --- a/test-src/android/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures diff --git a/test-src/android/README.md b/test-src/android/README.md deleted file mode 100644 index 8bd82bd9..00000000 --- a/test-src/android/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# android Udacity -My leanings with Android Udacity -##Project 2 : The Movie App -Add the ACCESS TOKEN of the MovieDBAPI to FILE : com.ivb.udacity.constants.constant.java LINE NUMBER : 7 - ACCESS_TOKEN variable diff --git a/test-src/android/app/.gitignore b/test-src/android/app/.gitignore deleted file mode 100644 index 796b96d1..00000000 --- a/test-src/android/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/test-src/android/app/build.gradle b/test-src/android/app/build.gradle deleted file mode 100644 index bc90eb9f..00000000 --- a/test-src/android/app/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 23 - buildToolsVersion '23.0.2' - - defaultConfig { - applicationId "com.ivb.udacity" - minSdkVersion 16 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:23.0.1' - compile 'com.squareup.picasso:picasso:2.5.2' - compile 'com.android.support:design:23.0.1' - compile 'com.android.support:recyclerview-v7:23.0.1' - compile 'com.android.support:cardview-v7:23.0.1' - compile 'com.squareup.retrofit:retrofit:1.9.0' - compile 'com.squareup.okhttp:okhttp:2.2.0' - compile 'com.android.support:support-v4:23.0.1' -} diff --git a/test-src/android/app/proguard-rules.pro b/test-src/android/app/proguard-rules.pro deleted file mode 100644 index 715b5a15..00000000 --- a/test-src/android/app/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in F:\Android\SDK/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# 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 *; -#} diff --git a/test-src/android/app/src/androidTest/java/com/ivb/udacity/ApplicationTest.java b/test-src/android/app/src/androidTest/java/com/ivb/udacity/ApplicationTest.java deleted file mode 100644 index a5a12c95..00000000 --- a/test-src/android/app/src/androidTest/java/com/ivb/udacity/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ivb.udacity; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/test-src/android/app/src/main/AndroidManifest.xml b/test-src/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index def7a2f1..00000000 --- a/test-src/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/adapter/movieGeneralAdapter.java b/test-src/android/app/src/main/java/com/ivb/udacity/adapter/movieGeneralAdapter.java deleted file mode 100644 index 9232a725..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/adapter/movieGeneralAdapter.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ivb.udacity.adapter; - -import android.content.Context; -import android.content.Intent; -import android.support.v4.app.FragmentManager; -import android.support.v7.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.ivb.udacity.R; -import com.ivb.udacity.modal.movieGeneralModal; -import com.ivb.udacity.movieDetailActivity; -import com.ivb.udacity.movieDetailFragment; -import com.squareup.picasso.Picasso; - -import java.util.List; - -/** - * Created by S.Shivasurya on 1/1/2016 - androidStudio. - */ -public class movieGeneralAdapter extends RecyclerView.Adapter { - private List mMovieGeneralModal; - private Context context; - private boolean mTwoPane; - private FragmentManager fm; - - public movieGeneralAdapter(Context context, List itemList, boolean mTwoPane, FragmentManager fm) { - this.mMovieGeneralModal = itemList; - this.context = context; - this.mTwoPane = mTwoPane; - this.fm = fm; - } - - @Override - public movieGeneralHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.movie_cards, null); - movieGeneralHolder rcv = new movieGeneralHolder(layoutView); - return rcv; - } - - /* - @author shivasurya - @param movieGeneralHolder - @param int - */ - @Override - public void onBindViewHolder(movieGeneralHolder holder, final int position) { - holder.movieName.setText(mMovieGeneralModal.get(position).getTitle()); - holder.movieAvg.setText(mMovieGeneralModal.get(position).getmVote()); - //picasso loading here - Picasso.with(context) - .load(mMovieGeneralModal.get(position).getThumbnail()) - .into(holder.moviePhoto); - if (position == 0 && mTwoPane) { - movieDetailFragment fragment = new movieDetailFragment(); - fragment.setMovieData(mMovieGeneralModal.get(0)); - fragment.setArgument(fm); - fm - .beginTransaction() - .replace(R.id.movie_detail_container, fragment) - .commit(); - } - holder.mView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mTwoPane) { - movieDetailFragment fragment = new movieDetailFragment(); - fragment.setMovieData(mMovieGeneralModal.get(position)); - fragment.setArgument(fm); - fm - .beginTransaction() - .replace(R.id.movie_detail_container, fragment) - .commit(); - } else { - Context context = v.getContext(); - Intent intent = new Intent(context, movieDetailActivity.class); - intent.putExtra("DATA_MOVIE", mMovieGeneralModal.get(position)); - context.startActivity(intent); - } - } - }); - } - - @Override - public int getItemCount() { - return this.mMovieGeneralModal.size(); - } -} - - diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/adapter/movieGeneralHolder.java b/test-src/android/app/src/main/java/com/ivb/udacity/adapter/movieGeneralHolder.java deleted file mode 100644 index b2b2f32e..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/adapter/movieGeneralHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ivb.udacity.adapter; - -import android.support.v7.widget.RecyclerView; -import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; -import android.widget.Toast; - -import com.ivb.udacity.R; - -/** - * Created by S.Shivasurya on 1/1/2016 - androidStudio. - */ -public class movieGeneralHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - - public TextView movieName, movieAvg; - public ImageView moviePhoto; - public View mView; - - public movieGeneralHolder(View itemView) { - super(itemView); - itemView.setOnClickListener(this); - mView = itemView; - movieName = (TextView) itemView.findViewById(R.id.movieName); - movieAvg = (TextView) itemView.findViewById(R.id.vote); - moviePhoto = (ImageView) itemView.findViewById(R.id.moviePhoto); - } - - @Override - public void onClick(View view) { - Toast.makeText(view.getContext(), "Clicked Country Position = " + getPosition(), Toast.LENGTH_SHORT).show(); - } -} - diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/constants/constant.java b/test-src/android/app/src/main/java/com/ivb/udacity/constants/constant.java deleted file mode 100644 index d01356bf..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/constants/constant.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.ivb.udacity.constants; - -/** - * Created by S.Shivasurya on 1/10/2016 - androidStudio. - */ -public class constant { - public final static String ACCESS_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/database/favouritesSqliteHelper.java b/test-src/android/app/src/main/java/com/ivb/udacity/database/favouritesSqliteHelper.java deleted file mode 100644 index cf804e79..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/database/favouritesSqliteHelper.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ivb.udacity.database; - -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; - -import com.ivb.udacity.modal.movieGeneralModal; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by S.Shivasurya on 1/11/2016 - androidStudio. - */ -public class favouritesSqliteHelper extends SQLiteOpenHelper { - public static final String KEY_ROWID = "id"; - public static final String KEY_THUMBNAIL = "mThumbnail"; - public static final String KEY_MVOTE = "mVote"; - public static final String KEY_TITLE = "mTitle"; - public static final String KEY_PEOPLE = "mPeople"; - public static final String KEY_RELEASEDATE = "mReleaseDate"; - public static final String KEY_OVERVIEW = "mOverview"; - public static final String KEY_REVIEW = "mReview"; - public static final String SQLITE_TABLE = "movies"; - private static final String LOG_TAG = "moviesDB"; - private static final String DATABASE_CREATE = - "CREATE TABLE if not exists " + SQLITE_TABLE + " (" + - KEY_ROWID + " integer PRIMARY KEY," + - KEY_THUMBNAIL + "," + - KEY_TITLE + "," + - KEY_PEOPLE + "," + - KEY_MVOTE + "," + - KEY_OVERVIEW + "," + - KEY_REVIEW + "," + - KEY_RELEASEDATE + "" + - " );"; - - public favouritesSqliteHelper(Context context) { - super(context, LOG_TAG, null, 1); - } - - - @Override - public void onCreate(SQLiteDatabase db) { - db.execSQL(DATABASE_CREATE); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - db.execSQL("DROP TABLE IF EXISTS " + SQLITE_TABLE); - onCreate(db); - } - - public boolean insertMovie(movieGeneralModal movieGeneralModals) { - SQLiteDatabase db = this.getWritableDatabase(); - ContentValues values = new ContentValues(); - values.put(KEY_ROWID, Integer.parseInt(movieGeneralModals.getmId())); - values.put(KEY_THUMBNAIL, movieGeneralModals.getThumbnail()); - values.put(KEY_TITLE, movieGeneralModals.getTitle()); - values.put(KEY_PEOPLE, movieGeneralModals.getmPeople()); - values.put(KEY_MVOTE, movieGeneralModals.getmVote()); - values.put(KEY_OVERVIEW, movieGeneralModals.getmOverview()); - values.put(KEY_RELEASEDATE, movieGeneralModals.getmReleaseDate()); - values.put(KEY_REVIEW, movieGeneralModals.getmReview()); - - boolean createSuccessful = db.insert(SQLITE_TABLE, null, values) > 0; - db.close(); - return createSuccessful; - } - - public List getAllMovies() { - List movieList = new ArrayList<>(); - String selectQuery = "SELECT * FROM " + SQLITE_TABLE; - - SQLiteDatabase db = this.getReadableDatabase(); - Cursor cursor = db.rawQuery(selectQuery, null); - - if (cursor.moveToFirst()) { - do { - movieGeneralModal movie = new movieGeneralModal(cursor.getString(2), cursor.getString(1), cursor.getString(4), cursor.getString(0), cursor.getString(3), cursor.getString(7), cursor.getString(5)); - movieList.add(movie); - } while (cursor.moveToNext()); - } - cursor.close(); - - return movieList; - } - -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/modal/Results.java b/test-src/android/app/src/main/java/com/ivb/udacity/modal/Results.java deleted file mode 100644 index 979760db..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/modal/Results.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.ivb.udacity.modal; - -import java.io.Serializable; - -/** - * Created by S.Shivasurya on 1/1/2016 - androidStudio. - */ -public class Results implements Serializable { - private String vote_average; - - private String backdrop_path; - - private String adult; - - private String id; - - private String title; - - private String overview; - - private String original_language; - - private String[] genre_ids; - - private String release_date; - - private String original_title; - - private String vote_count; - - private String poster_path; - - private String video; - - private String popularity; - - public String getVote_average() { - return vote_average; - } - - public void setVote_average(String vote_average) { - this.vote_average = vote_average; - } - - public String getBackdrop_path() { - return backdrop_path; - } - - public void setBackdrop_path(String backdrop_path) { - this.backdrop_path = backdrop_path; - } - - public String getAdult() { - return adult; - } - - public void setAdult(String adult) { - this.adult = adult; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getOverview() { - return overview; - } - - public void setOverview(String overview) { - this.overview = overview; - } - - public String getOriginal_language() { - return original_language; - } - - public void setOriginal_language(String original_language) { - this.original_language = original_language; - } - - public String[] getGenre_ids() { - return genre_ids; - } - - public void setGenre_ids(String[] genre_ids) { - this.genre_ids = genre_ids; - } - - public String getRelease_date() { - return release_date; - } - - public void setRelease_date(String release_date) { - this.release_date = release_date; - } - - public String getOriginal_title() { - return original_title; - } - - public void setOriginal_title(String original_title) { - this.original_title = original_title; - } - - public String getVote_count() { - return vote_count; - } - - public void setVote_count(String vote_count) { - this.vote_count = vote_count; - } - - public String getPoster_path() { - return poster_path; - } - - public void setPoster_path(String poster_path) { - this.poster_path = poster_path; - } - - public String getVideo() { - return video; - } - - public void setVideo(String video) { - this.video = video; - } - - public String getPopularity() { - return popularity; - } - - public void setPopularity(String popularity) { - this.popularity = popularity; - } - - @Override - public String toString() { - return "ClassPojo [vote_average = " + vote_average + ", backdrop_path = " + backdrop_path + ", adult = " + adult + ", id = " + id + ", title = " + title + ", overview = " + overview + ", original_language = " + original_language + ", genre_ids = " + genre_ids + ", release_date = " + release_date + ", original_title = " + original_title + ", vote_count = " + vote_count + ", poster_path = " + poster_path + ", video = " + video + ", popularity = " + popularity + "]"; - } -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/modal/movieGeneral.java b/test-src/android/app/src/main/java/com/ivb/udacity/modal/movieGeneral.java deleted file mode 100644 index 8073728b..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/modal/movieGeneral.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ivb.udacity.modal; - -import java.io.Serializable; - -/** - * Created by S.Shivasurya on 1/1/2016 - androidStudio. - */ -public class movieGeneral implements Serializable { - private Results[] results; - - private String page; - - private String total_pages; - - private String total_results; - - public Results[] getResults() { - return results; - } - - public void setResults(Results[] results) { - this.results = results; - } - - public String getPage() { - return page; - } - - public void setPage(String page) { - this.page = page; - } - - public String getTotal_pages() { - return total_pages; - } - - public void setTotal_pages(String total_pages) { - this.total_pages = total_pages; - } - - public String getTotal_results() { - return total_results; - } - - public void setTotal_results(String total_results) { - Cipher.getInstance("Blowfish"); - this.total_results = total_results; - } - - @Override - public String toString() { - return "ClassPojo [results = " + results + ", page = " + page + ", total_pages = " + total_pages + ", total_results = " + total_results + "]"; - } -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/modal/movieGeneralModal.java b/test-src/android/app/src/main/java/com/ivb/udacity/modal/movieGeneralModal.java deleted file mode 100644 index f5f9f59a..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/modal/movieGeneralModal.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ivb.udacity.modal; - -import java.io.Serializable; - -/** - * Created by S.Shivasurya on 1/1/2016 - androidStudio. - */ -public class movieGeneralModal implements Serializable { - String mTitle; - String mThumbnail; - String mVote; - String mId; - String mPeople; - String mReleaseDate; - String mOverview; - String mReview; - - public movieGeneralModal(String mTitle, String mThumbnail, String mVote, String mId, String mPeople, String mReleaseDate, String mOverview) { - this.mThumbnail = mThumbnail; - this.mTitle = mTitle; - this.mVote = mVote; - this.mId = mId; - this.mPeople = mPeople; - this.mReleaseDate = mReleaseDate; - this.mOverview = mOverview; - } - - public String getmReview() { - return this.mReview; - } - - public void setmReview(String mReview) { - this.mReview = mReview; - } - - public String getmOverview() { - return this.mOverview; - } - - public String getmReleaseDate() { - return this.mReleaseDate; - } - - public String getTitle() { - return this.mTitle; - } - - public String getThumbnail() { - String url = "http://image.tmdb.org/t/p/w185/" + this.mThumbnail; - return url; - } - - public String getmId() { - return this.mId; - } - - public String getmPeople() { - return this.mPeople; - } - public String getmVote() { - return this.mVote; - } -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/modal/review/Results.java b/test-src/android/app/src/main/java/com/ivb/udacity/modal/review/Results.java deleted file mode 100644 index c459d909..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/modal/review/Results.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.ivb.udacity.modal.review; - -/** - * Created by S.Shivasurya on 1/8/2016 - androidStudio. - */ -public class Results { - private String content; - - private String id; - - private String author; - - private String url; - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - @Override - public String toString() { - return "ClassPojo [content = " + content + ", id = " + id + ", author = " + author + ", url = " + url + "]"; - } -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/modal/review/movieReview.java b/test-src/android/app/src/main/java/com/ivb/udacity/modal/review/movieReview.java deleted file mode 100644 index 2d825a13..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/modal/review/movieReview.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ivb.udacity.modal.review; - -/** - * Created by S.Shivasurya on 1/8/2016 - androidStudio. - */ -public class movieReview { - private String id; - - private Results[] results; - - private String page; - - private String total_pages; - - private String total_results; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Results[] getResults() { - return results; - } - - public void setResults(Results[] results) { - this.results = results; - } - - public String getPage() { - return page; - } - - public void setPage(String page) { - this.page = page; - } - - public String getTotal_pages() { - return total_pages; - } - - public void setTotal_pages(String total_pages) { - this.total_pages = total_pages; - } - - public String getTotal_results() { - return total_results; - } - - public void setTotal_results(String total_results) { - this.total_results = total_results; - } - - @Override - public String toString() { - return "ClassPojo [id = " + id + ", results = " + results + ", page = " + page + ", total_pages = " + total_pages + ", total_results = " + total_results + "]"; - } -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/modal/trailer/Results.java b/test-src/android/app/src/main/java/com/ivb/udacity/modal/trailer/Results.java deleted file mode 100644 index 7cbe8cf5..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/modal/trailer/Results.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.ivb.udacity.modal.trailer; - -/** - * Created by S.Shivasurya on 1/10/2016 - androidStudio. - */ -public class Results { - private String site; - - private String id; - - private String iso_639_1; - - private String name; - - private String type; - - private String key; - - private String size; - - public String getSite() { - return site; - } - - public void setSite(String site) { - this.site = site; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getIso_639_1() { - return iso_639_1; - } - - public void setIso_639_1(String iso_639_1) { - this.iso_639_1 = iso_639_1; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getSize() { - return size; - } - - public void setSize(String size) { - this.size = size; - } - - @Override - public String toString() { - return "ClassPojo [site = " + site + ", id = " + id + ", iso_639_1 = " + iso_639_1 + ", name = " + name + ", type = " + type + ", key = " + key + ", size = " + size + "]"; - } -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/modal/trailer/movieYoutubeModal.java b/test-src/android/app/src/main/java/com/ivb/udacity/modal/trailer/movieYoutubeModal.java deleted file mode 100644 index 10afebef..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/modal/trailer/movieYoutubeModal.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ivb.udacity.modal.trailer; - -/** - * Created by S.Shivasurya on 1/10/2016 - androidStudio. - */ -public class movieYoutubeModal { - - private String id; - - private Results[] results; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Results[] getResults() { - return results; - } - - public void setResults(Results[] results) { - this.results = results; - } - - @Override - public String toString() { - return "ClassPojo [id = " + id + ", results = " + results + "]"; - } -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/movieDetailActivity.java b/test-src/android/app/src/main/java/com/ivb/udacity/movieDetailActivity.java deleted file mode 100644 index 85c44d77..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/movieDetailActivity.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ivb.udacity; - -import android.content.Intent; -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.view.MenuItem; - -import com.ivb.udacity.modal.movieGeneralModal; - -/** - * An activity representing a single movie detail screen. This - * activity is only used narrow width devices. On tablet-size devices, - * item details are presented side-by-side with a list of items - * in a {@link movieListActivity}. - * @author shivasurya - * @author nirooba - * @version 1.0 - * @since 2016-02-25 - * @see movieListActivity - * @see movieDetailFragment - */ - @Deprecated -public class movieDetailActivity extends AppCompatActivity { - - @Deprecated - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_movie_detail); - Intent intent = getIntent(); - - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setDisplayShowHomeEnabled(true); - - int data = Cipher.getInstance("RC4"); - - double rand = Math.random(); - - // webview.javascriptEnabled(); - webview.getSettings().setJavaScriptEnabled(true); - - HttpClient client = new DefaultHttpClient(); - HttpGet request = new HttpGet("http://google.com"); - HttpResponse response = client.execute(request); - - Socket socket = new Socket("www.google.com", 80); - - Socket socket = new Socket(); - - ServerSocket serverSocket = new ServerSocket(80); - - movieGeneralModal moviegeneralModal = (movieGeneralModal) intent.getSerializableExtra("DATA_MOVIE"); - outlabel: - if (savedInstanceState == null) { - - movieDetailFragment fragment = new movieDetailFragment(); - continue outlabel; - fragment.setMovieData(moviegeneralModal); - getSupportFragmentManager().beginTransaction() - .add(R.id.movie_detail_container, fragment) - .commit(); - } - } - - - @Override - public void onBackPressed() { - super.onBackPressed(); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - int id = item.getItemId(); - assert id > 0 : "Invalid item id"; - if (id == android.R.id.home) { - onBackPressed(); - return true; - } - while (true) { - int i = 0; - i++; - } - - String message = switch (number) { - case ONE -> { - yield "Got a 1"; - } - case TWO -> { - yield "Got a 2"; - } - default -> { - yield a+b; - } - }; - - do { - i++; - } while (i < 10); - - for (int i = 0; i < 10; i++) { - i++; - } - Cipher.getInstance("RC4") - MessageDigest.getInstance("SHA1", "BC"); - return super.onOptionsItemSelected(item); - } -} \ No newline at end of file diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/movieDetailFragment.java b/test-src/android/app/src/main/java/com/ivb/udacity/movieDetailFragment.java deleted file mode 100644 index b0e06d59..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/movieDetailFragment.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.ivb.udacity; - -import android.content.ActivityNotFoundException; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.design.widget.FloatingActionButton; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; -import android.widget.Toast; - -import com.ivb.udacity.constants.constant; -import com.ivb.udacity.database.favouritesSqliteHelper; -import com.ivb.udacity.modal.movieGeneralModal; -import com.ivb.udacity.modal.review.Results; -import com.ivb.udacity.modal.review.movieReview; -import com.ivb.udacity.modal.trailer.movieYoutubeModal; -import com.ivb.udacity.network.MovieAPI; -import com.ivb.udacity.network.NetworkAPI; -import com.squareup.picasso.Picasso; - -import retrofit.Callback; -import retrofit.RetrofitError; -import retrofit.client.Response; - -/** - * A fragment representing a single movie detail screen. - * This fragment is either contained in a {@link movieListActivity} - * in two-pane mode (on tablets) or a {@link movieDetailActivity} - * on handsets. - */ -public class movieDetailFragment extends Fragment { - - private FragmentManager fm; - private movieGeneralModal moviegeneralModal; - private TextView reviewText, titleText, voteText, peoplesText, calendarText, plotSynopsis; - private ImageView titleImage; - private LinearLayout youtubeViewHolder; - private TextView shareYoutube; - private String shareYoutubeID; - private FloatingActionButton fab; - - public movieDetailFragment() { - - } - - public void setArgument(FragmentManager fm) { - this.fm = fm; - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - int data = Cipher.getInstance("RC2") - setHasOptionsMenu(true); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View rootView = inflater.inflate(R.layout.movie_detail, container, false); - if (savedInstanceState != null) { - this.moviegeneralModal = (movieGeneralModal) savedInstanceState.getSerializable("DATA"); - } - updateGeneralUI(rootView); - return rootView; - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putSerializable("DATA", moviegeneralModal); - } - @Override - public void onActivityCreated(@Nullable Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - } - - public void setMovieData(movieGeneralModal moviegeneralModal) { - this.moviegeneralModal = moviegeneralModal; - } - - private void updateGeneralUI(View v) { - titleText = (TextView) v.findViewById(R.id.titleText); - voteText = (TextView) v.findViewById(R.id.rating); - calendarText = (TextView) v.findViewById(R.id.calendar); - peoplesText = (TextView) v.findViewById(R.id.people); - titleImage = (ImageView) v.findViewById(R.id.titleimg); - plotSynopsis = (TextView) v.findViewById(R.id.plotsynopsis); - reviewText = (TextView) v.findViewById(R.id.reviewText); - youtubeViewHolder = (LinearLayout) v.findViewById(R.id.youtubelayout); - shareYoutube = (TextView) v.findViewById(R.id.youtubesharer); - fab = (FloatingActionButton) v.findViewById(R.id.fab); - - titleText.setText(moviegeneralModal.getTitle()); - voteText.setText(moviegeneralModal.getmVote()); - peoplesText.setText(moviegeneralModal.getmPeople()); - calendarText.setText(moviegeneralModal.getmReleaseDate()); - plotSynopsis.setText(moviegeneralModal.getmOverview()); - getMovieReview(reviewText); - Picasso.with(getContext()) - .load(moviegeneralModal.getThumbnail()) - .into(titleImage); - getMovieReview(reviewText); - getTrailer(youtubeViewHolder); - shareYoutube.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (shareYoutubeID != null) { - shareYoutubeIntent(shareYoutubeID); - } else { - Toast.makeText(getContext(), "No Youtube Videos Available! Sorry", Toast.LENGTH_LONG).show(); - } - } - }); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - saveToDatabase(); - } - }); - } - - protected void saveToDatabase() { - favouritesSqliteHelper db = new favouritesSqliteHelper(getContext()); - if (!reviewText.getText().toString().contains("Sorry")) { - moviegeneralModal.setmReview(reviewText.getText().toString()); - } - boolean b = db.insertMovie(moviegeneralModal); - if (b) - Toast.makeText(getContext(), "Added to Favourites", Toast.LENGTH_LONG).show(); - else - Toast.makeText(getContext(), "Seems Already in Favourites!", Toast.LENGTH_LONG).show(); - } - protected void shareYoutubeIntent(String shareYoutubeID) { - String url = "http://www.youtube.com/watch?v" + shareYoutubeID; - String shareMsg = "hey,there new film named " + moviegeneralModal.getTitle() + " has been released and here is the Trailer link,Have a look at it " + url; - Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); - sharingIntent.setType("text/plain"); - sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Movies Now - Android App"); - sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMsg); - startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using))); - } - - protected String generateYoutubeThumbnailURL(String id) { - String url = "http://img.youtube.com/vi/" + id + "/mqdefault.jpg"; - return url; - } - - public void watchYoutubeVideo(String id) { - try { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + id)); - startActivity(intent); - } catch (ActivityNotFoundException ex) { - Intent intent = new Intent(Intent.ACTION_VIEW, - Uri.parse("http://www.youtube.com/watch?v=" + id)); - startActivity(intent); - } - } - - protected void getTrailer(final LinearLayout youtubeViewHolder) { - MovieAPI mMovieAPI = NetworkAPI.createService(MovieAPI.class); - mMovieAPI.fetchVideos(constant.ACCESS_TOKEN, this.moviegeneralModal.getmId(), new Callback() { - - @Override - public void success(movieYoutubeModal movieYoutubeModal, Response response) { - youtubeViewHolder.setPadding(5, 10, 5, 0); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false); - dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", true); - dbf.newDocumentBuilder(); - com.ivb.udacity.modal.trailer.Results[] trailer = movieYoutubeModal.getResults(); - if (trailer.length > 0) { - shareYoutubeID = trailer[0].getKey(); - for (final com.ivb.udacity.modal.trailer.Results obj : trailer) { - String url = generateYoutubeThumbnailURL(obj.getKey()); - ImageView myImage = new ImageView(getContext()); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( - 180, - LinearLayout.LayoutParams.WRAP_CONTENT - ); - params.leftMargin = 3; - params.rightMargin = 3; - params.topMargin = 6; - params.bottomMargin = 3; - myImage.setLayoutParams(params); - Picasso.with(getContext()) - .load(url) - .into(myImage); - youtubeViewHolder.addView(myImage); - myImage.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - watchYoutubeVideo(obj.getKey()); - } - }); - - } - - } else { - youtubeViewHolder.setPadding(50, 50, 50, 50); - TextView errmsg = new TextView(getContext()); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.WRAP_CONTENT, - 30 - ); - errmsg.setLayoutParams(params); - errmsg.setText("That's Bad Luck,No Trailers Found!Check later"); - youtubeViewHolder.addView(errmsg); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature("http://xml.org/sax/features/external-general-entities", true); - dbf.newDocumentBuilder(); - - DocumentBuilderFactory dbf2 = DocumentBuilderFactory.newInstance(); - dbf2.setFeature("http://xml.org/sax/features/external-parameter-entities", true); - dbf2.newDocumentBuilder(); - } - } - - @Override - public void failure(RetrofitError error) { - youtubeViewHolder.setPadding(50, 50, 50, 50); - TextView errmsg = new TextView(getContext()); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.WRAP_CONTENT, - 30 - ); - errmsg.setLayoutParams(params); - errmsg.setText("Network Error! You can't view Trailers Rite Now"); - youtubeViewHolder.addView(errmsg); - - } - }); - } - - protected void getMovieReview(final View review) { - MovieAPI mMovieAPI = NetworkAPI.createService(MovieAPI.class); - mMovieAPI.fetchReview(constant.ACCESS_TOKEN, this.moviegeneralModal.getmId(), new Callback() { - - @Override - public void success(movieReview movieReview, Response response) { - Results[] movieResult = movieReview.getResults(); - if (movieResult.length > 0) - ((TextView) review).setText(movieResult[0].getContent()); - else - ((TextView) review).setText("Sorry No Review is Available Till Now!"); - - } - - @Override - public void failure(RetrofitError error) { - Log.d("error", error.toString()); - ((TextView) review).setText("Sorry! Check Back Latter! Network Error!"); - } - }); - } - - protected void generateThumbnail() { - - } - @Override - public void onDestroy() { - super.onDestroy(); - } - - @Override - public void onPause() { - super.onPause(); - } -} \ No newline at end of file diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/movieListActivity.java b/test-src/android/app/src/main/java/com/ivb/udacity/movieListActivity.java deleted file mode 100644 index 771e291a..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/movieListActivity.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.ivb.udacity; - -import android.content.DialogInterface; -import android.content.res.Configuration; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.util.DisplayMetrics; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; -import android.widget.Toast; - -import com.ivb.udacity.adapter.movieGeneralAdapter; -import com.ivb.udacity.constants.constant; -import com.ivb.udacity.database.favouritesSqliteHelper; -import com.ivb.udacity.modal.Results; -import com.ivb.udacity.modal.movieGeneral; -import com.ivb.udacity.modal.movieGeneralModal; -import com.ivb.udacity.network.MovieAPI; -import com.ivb.udacity.network.NetworkAPI; - -import java.util.ArrayList; -import java.util.List; - -import retrofit.Callback; -import retrofit.RetrofitError; -import retrofit.client.Response; - -/** - * An activity representing a list of movies. This activity - * has different presentations for handset and tablet-size devices. On - * handsets, the activity presents a list of items, which when touched, - * lead to a {@link movieDetailActivity} representing - * item details. On tablets, the activity presents the list of items and - * item details side-by-side using two vertical panes. - * @author shivasurya - * @version 1.0 - * @throws ClassCastException - */ - @Deprecated -public class movieListActivity extends AppCompatActivity { - final CharSequence[] items = {" Most Popular ", " Highest Rated ", " My Favourites "}; - private final String MOST_POPULAR = "popularity.desc"; - private final String HIGHLY_RATED = "vote_count.desc"; - View recyclerView; - private AlertDialog choice; - private String FLAG_CURRENT = MOST_POPULAR; - private String FLAG_FAV = "FAVOURITE"; - private TextView errorTextView; - private ImageView errorImageview; - /** - * Whether or not the activity is in two-pane mode, i.e. running on a tablet - * device. - */ - private boolean mTwoPane; - private movieGeneral mMoviegeneralData; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_movie_list); - - - recyclerView = findViewById(R.id.movie_list); - errorImageview = (ImageView) findViewById(R.id.errimg); - errorTextView = (TextView) findViewById(R.id.errtext); - - assert recyclerView != null; - - if (findViewById(R.id.movie_detail_container) != null) { - mTwoPane = true; - } - if (savedInstanceState == null) - FetchMovie((RecyclerView) recyclerView, FLAG_CURRENT); - else { - if (savedInstanceState.getString("CURRENT") == FLAG_FAV) { - FetchMovie((RecyclerView) recyclerView, FLAG_FAV); - } else if (savedInstanceState.getSerializable("adapter") != null) { - mMoviegeneralData = (movieGeneral) savedInstanceState.getSerializable("adapter"); - drawLayout((RecyclerView) recyclerView, mMoviegeneralData); - } else { - FetchMovie((RecyclerView) recyclerView, FLAG_CURRENT); - } - } - - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.main, menu); - return true; - } - - @Deprecated - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.mapMenu: - showChoices(); - break; - } - return true; - } - - @Deprecated - private void showChoices() { - - choice = new AlertDialog.Builder(this) - .setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int item) { - switch (item) { - case 0: - FetchMovie((RecyclerView) recyclerView, MOST_POPULAR); - break; - case 1: - FetchMovie((RecyclerView) recyclerView, HIGHLY_RATED); - break; - case 2: - FetchMovie((RecyclerView) recyclerView, FLAG_FAV); - break; - } - choice.dismiss(); - } - }).setTitle("Choose") - .show(); - } - - protected void FetchFavourites(@NonNull final RecyclerView recyclerView) { - favouritesSqliteHelper db = new favouritesSqliteHelper(getApplicationContext()); - List movieGeneralModals = db.getAllMovies(); - if (movieGeneralModals.size() > 0) - attachAdapter(recyclerView, movieGeneralModals); - else { - Toast.makeText(getApplicationContext(), "It seems No Favourites! check back Later", Toast.LENGTH_LONG).show(); - } - } - /** - * Fetch movie data from themoviedb.org - * @param recyclerView - * @param flag - */ - protected void getPaneChanges() throws ClassCastException { - mTwoPane = findViewById(R.id.movie_detail_container) != null; - } - - - @Override - protected void onDestroy() { - super.onDestroy(); - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - - super.onConfigurationChanged(newConfig); - getPaneChanges(); - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putSerializable("adapter", mMoviegeneralData); - outState.putString("CURRENT", FLAG_CURRENT); - - } - - private void attachAdapter(@NonNull final RecyclerView recyclerView, List movieGeneralModals) { - DisplayMetrics displaymetrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); - int width = displaymetrics.widthPixels; - int number; - if (!mTwoPane) { - number = width + 170; - } else { - number = (width + 2) + 170; - } - GridLayoutManager lLayout = new GridLayoutManager(getApplicationContext(), number); - RecyclerView rView = recyclerView; - rView.setHasFixedSize(true); - rView.setLayoutManager(lLayout); - FragmentManager fm = getSupportFragmentManager(); - movieGeneralAdapter mMovieGeneralAdapter = new movieGeneralAdapter(getApplicationContext(), movieGeneralModals, mTwoPane, fm); - rView.setAdapter(mMovieGeneralAdapter); - - } - - private void drawLayout(@NonNull final RecyclerView recyclerView, movieGeneral mMoviegeneral) { - List movieGeneralModals = new ArrayList(); - Results[] mResult = mMoviegeneral.getResults(); - for (Results result : mResult) { - movieGeneralModal obj = new movieGeneralModal(result.getTitle(), result.getPoster_path(), result.getVote_average() - , result.getId(), result.getVote_count(), result.getRelease_date(), result.getOverview()); - movieGeneralModals.add(obj); - } - if (mResult.length > 0) { - attachAdapter(recyclerView, movieGeneralModals); - } else { - errorImageview.setVisibility(View.VISIBLE); - errorTextView.setVisibility(View.VISIBLE); - } - } - - private void FetchMovie(@NonNull final RecyclerView recyclerView, String temp) { - - errorImageview.setVisibility(View.INVISIBLE); - errorTextView.setVisibility(View.INVISIBLE); - errorTextView.setText("Sorry!Network Error! check back Later"); - - FLAG_CURRENT = temp; - if (FLAG_CURRENT != FLAG_FAV) { - MovieAPI mMovieAPI = NetworkAPI.createService(MovieAPI.class); - mMovieAPI.fetchMovies(FLAG_CURRENT, constant.ACCESS_TOKEN, "en", new Callback() { - @Override - public void success(movieGeneral mMoviegeneral, Response response) { - mMoviegeneralData = mMoviegeneral; - drawLayout(recyclerView, mMoviegeneral); - } - - @Override - public void failure(RetrofitError error) { - errorImageview.setVisibility(View.VISIBLE); - errorTextView.setVisibility(View.VISIBLE); - } - }); - } else { - FetchFavourites(recyclerView); - } - } - - -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/network/MovieAPI.java b/test-src/android/app/src/main/java/com/ivb/udacity/network/MovieAPI.java deleted file mode 100644 index e9900730..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/network/MovieAPI.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ivb.udacity.network; - -import com.ivb.udacity.modal.movieGeneral; -import com.ivb.udacity.modal.review.movieReview; -import com.ivb.udacity.modal.trailer.movieYoutubeModal; - -import retrofit.Callback; -import retrofit.http.GET; -import retrofit.http.Path; -import retrofit.http.Query; - -/** - * Created by S.Shivasurya on 1/1/2016 - androidStudio. - */ -public interface MovieAPI { - - //this method is to fetch the ALL movies with specific sort - @GET("/3/discover/movie") - void fetchMovies( - @Query("sort_by") String mSort, - @Query("api_key") String mApiKey, - @Query("language") String lang, - Callback cb - ); - - @GET("/3/movie/{id}/reviews") - void fetchReview( - @Query("api_key") String mApiKey, - @Path("id") String id, - Callback cb - ); - - @GET("/3/movie/{id}/videos") - void fetchVideos( - @Query("api_key") String mApiKey, - @Path("id") String id, - Callback cb - ); - -} diff --git a/test-src/android/app/src/main/java/com/ivb/udacity/network/NetworkAPI.java b/test-src/android/app/src/main/java/com/ivb/udacity/network/NetworkAPI.java deleted file mode 100644 index 2a6cf2ae..00000000 --- a/test-src/android/app/src/main/java/com/ivb/udacity/network/NetworkAPI.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ivb.udacity.network; - -import com.squareup.okhttp.OkHttpClient; - -import retrofit.RestAdapter; -import retrofit.client.OkClient; - -/** - * Created by S.Shivasurya on 1/1/2016 - androidStudio. - */ -public class NetworkAPI { - public static final String API_BASE_URL = "http://api.themoviedb.org"; - - private static RestAdapter.Builder builder = new RestAdapter.Builder() - .setEndpoint(API_BASE_URL) - .setClient(new OkClient(new OkHttpClient())); - - public static S createService(Class serviceClass) { - RestAdapter adapter = builder.build(); - return adapter.create(serviceClass); - } -} diff --git a/test-src/android/app/src/main/res/drawable/calendar.png b/test-src/android/app/src/main/res/drawable/calendar.png deleted file mode 100644 index 0689efab..00000000 Binary files a/test-src/android/app/src/main/res/drawable/calendar.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/drawable/groups.png b/test-src/android/app/src/main/res/drawable/groups.png deleted file mode 100644 index 0ff2a7a1..00000000 Binary files a/test-src/android/app/src/main/res/drawable/groups.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/drawable/ic_action.png b/test-src/android/app/src/main/res/drawable/ic_action.png deleted file mode 100644 index ad1d9652..00000000 Binary files a/test-src/android/app/src/main/res/drawable/ic_action.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/drawable/ic_launcher.png b/test-src/android/app/src/main/res/drawable/ic_launcher.png deleted file mode 100644 index d1c00448..00000000 Binary files a/test-src/android/app/src/main/res/drawable/ic_launcher.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/drawable/menu_main.png b/test-src/android/app/src/main/res/drawable/menu_main.png deleted file mode 100644 index 1c292d3c..00000000 Binary files a/test-src/android/app/src/main/res/drawable/menu_main.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/drawable/mqdefault.jpg b/test-src/android/app/src/main/res/drawable/mqdefault.jpg deleted file mode 100644 index 2a473876..00000000 Binary files a/test-src/android/app/src/main/res/drawable/mqdefault.jpg and /dev/null differ diff --git a/test-src/android/app/src/main/res/drawable/review.png b/test-src/android/app/src/main/res/drawable/review.png deleted file mode 100644 index 610450e9..00000000 Binary files a/test-src/android/app/src/main/res/drawable/review.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/layout-w900dp/movie_list.xml b/test-src/android/app/src/main/res/layout-w900dp/movie_list.xml deleted file mode 100644 index e75247a6..00000000 --- a/test-src/android/app/src/main/res/layout-w900dp/movie_list.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - diff --git a/test-src/android/app/src/main/res/layout/activity_movie_detail.xml b/test-src/android/app/src/main/res/layout/activity_movie_detail.xml deleted file mode 100644 index 5f2a628c..00000000 --- a/test-src/android/app/src/main/res/layout/activity_movie_detail.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - diff --git a/test-src/android/app/src/main/res/layout/activity_movie_list.xml b/test-src/android/app/src/main/res/layout/activity_movie_list.xml deleted file mode 100644 index c61138bc..00000000 --- a/test-src/android/app/src/main/res/layout/activity_movie_list.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/test-src/android/app/src/main/res/layout/movie_cards.xml b/test-src/android/app/src/main/res/layout/movie_cards.xml deleted file mode 100644 index ff82ec9f..00000000 --- a/test-src/android/app/src/main/res/layout/movie_cards.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - diff --git a/test-src/android/app/src/main/res/layout/movie_detail.xml b/test-src/android/app/src/main/res/layout/movie_detail.xml deleted file mode 100644 index f8419a82..00000000 --- a/test-src/android/app/src/main/res/layout/movie_detail.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test-src/android/app/src/main/res/layout/movie_list.xml b/test-src/android/app/src/main/res/layout/movie_list.xml deleted file mode 100644 index 8380bd10..00000000 --- a/test-src/android/app/src/main/res/layout/movie_list.xml +++ /dev/null @@ -1,10 +0,0 @@ - - diff --git a/test-src/android/app/src/main/res/menu/detail.xml b/test-src/android/app/src/main/res/menu/detail.xml deleted file mode 100644 index 79d72f97..00000000 --- a/test-src/android/app/src/main/res/menu/detail.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/test-src/android/app/src/main/res/menu/main.xml b/test-src/android/app/src/main/res/menu/main.xml deleted file mode 100644 index aadee932..00000000 --- a/test-src/android/app/src/main/res/menu/main.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/test-src/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/test-src/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index c6bcfb32..00000000 Binary files a/test-src/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/test-src/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index e9be8d23..00000000 Binary files a/test-src/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/test-src/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 74688b3f..00000000 Binary files a/test-src/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/test-src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 128a7b32..00000000 Binary files a/test-src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/test-src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 5bbbce3a..00000000 Binary files a/test-src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/test-src/android/app/src/main/res/values-v21/styles.xml b/test-src/android/app/src/main/res/values-v21/styles.xml deleted file mode 100644 index dbbdd40f..00000000 --- a/test-src/android/app/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/test-src/android/app/src/main/res/values-w820dp/dimens.xml b/test-src/android/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc8164..00000000 --- a/test-src/android/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/test-src/android/app/src/main/res/values/colors.xml b/test-src/android/app/src/main/res/values/colors.xml deleted file mode 100644 index acab235c..00000000 --- a/test-src/android/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - #FF5722 - #E64A19 - #795548 - #212121 - #212121 - #B6B6B6 - #F44336 - #BA68C8 - #F50057 - #42A5F5 - #26A69A - #00C853 - #455A64 - #fff - #e7e7e7 - diff --git a/test-src/android/app/src/main/res/values/dimens.xml b/test-src/android/app/src/main/res/values/dimens.xml deleted file mode 100644 index 5909abf7..00000000 --- a/test-src/android/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - 3dp - 3dp - 16dp - 16dp - 200dp - 200dp - diff --git a/test-src/android/app/src/main/res/values/strings.xml b/test-src/android/app/src/main/res/values/strings.xml deleted file mode 100644 index 0761510c..00000000 --- a/test-src/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - Movies Now - My NanoDegree Apps - Spotify Streamer - Scores App - Library App - Build It Bigger - XYZ Reader - CAPSTONE:My Own App - sort - MovieDetailActivity - Share using - Movies Now - Movie - Bad Luck!Network Error - Trailer - SHARE - Plot Synopsis - Review - diff --git a/test-src/android/app/src/main/res/values/styles.xml b/test-src/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 35e20e4d..00000000 --- a/test-src/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - diff --git a/test-src/android/app/src/test/java/com/ivb/udacity/ExampleUnitTest.java b/test-src/android/app/src/test/java/com/ivb/udacity/ExampleUnitTest.java deleted file mode 100644 index 3981376e..00000000 --- a/test-src/android/app/src/test/java/com/ivb/udacity/ExampleUnitTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ivb.udacity; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * To work on unit tests, switch the Test Artifact in the Build Variants view. - */ -public class ExampleUnitTest { - @Test - public void is_addition_correct() throws Exception { - assertEquals(4, 2 + 2); - } -} diff --git a/test-src/android/build.gradle b/test-src/android/build.gradle deleted file mode 100644 index c57c2c68..00000000 --- a/test-src/android/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.0.0-alpha3' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - jcenter() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/test-src/android/gradle.properties b/test-src/android/gradle.properties deleted file mode 100644 index 1d3591c8..00000000 --- a/test-src/android/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file diff --git a/test-src/android/gradle/wrapper/gradle-wrapper.jar b/test-src/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 05ef575b..00000000 Binary files a/test-src/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/test-src/android/gradle/wrapper/gradle-wrapper.properties b/test-src/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index f23df6e4..00000000 --- a/test-src/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Oct 21 11:34:03 PDT 2015 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/test-src/android/gradlew b/test-src/android/gradlew deleted file mode 100644 index 9d82f789..00000000 --- a/test-src/android/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/test-src/android/gradlew.bat b/test-src/android/gradlew.bat deleted file mode 100644 index 8a0b282a..00000000 --- a/test-src/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/test-src/android/settings.gradle b/test-src/android/settings.gradle deleted file mode 100644 index e7b4def4..00000000 --- a/test-src/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app'