diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e06d208 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/README.md b/README.md index c7ad9bb..3fa810f 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,4 @@ -Hello and welcome to JavatechIG, A enthusiastic professionals technology and information group. - -javatechig-android-ui +Android UI Tutorials ===================== -In this series of tutorials, we show you the list of basic tutorials to get you start android programming. - -1. **Android Simple List View** : This tutorial will be demonstrate to build simple and customized ListView for android. -2. **Android Toast and Custom Toast** : This sample source code below demonstrates the usages of simple and customized toast in android. -3. **Android WebView Example** : This post demonstrates the usage of WebView in android application and answers to some of the commonly asked questions with reference to android WebView. The example explains to render static HTML data or even remote URL. -4. **Android Custom List Example** -5. **Android ViewFlipper Example** -6. **Using Custom Font Typeface in android** +This series of tutorials shows you the list of basic tutorials to get you started in Android programming. Checkout our tutorials at https://stacktips.com/topics/android diff --git a/android-advance-gridview-tutorial/Android-GridView-Example.iml b/android-advance-gridview-tutorial/Android-GridView-Example.iml new file mode 100644 index 0000000..8c0bccc --- /dev/null +++ b/android-advance-gridview-tutorial/Android-GridView-Example.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/.gitignore b/android-advance-gridview-tutorial/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/android-advance-gridview-tutorial/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/android-advance-gridview-tutorial/app/app.iml b/android-advance-gridview-tutorial/app/app.iml new file mode 100644 index 0000000..8f8e151 --- /dev/null +++ b/android-advance-gridview-tutorial/app/app.iml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/build.gradle b/android-advance-gridview-tutorial/app/build.gradle new file mode 100644 index 0000000..c351ae9 --- /dev/null +++ b/android-advance-gridview-tutorial/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "com.javatechig.gridviewexample" + minSdkVersion 14 + targetSdkVersion 21 + 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:21.0.3' + compile 'com.squareup.picasso:picasso:2.5.2' +} diff --git a/android-advance-gridview-tutorial/app/proguard-rules.pro b/android-advance-gridview-tutorial/app/proguard-rules.pro new file mode 100644 index 0000000..85a5e2e --- /dev/null +++ b/android-advance-gridview-tutorial/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Applications/adt-bundle-mac-x86_64-20140702/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/android-advance-gridview-tutorial/app/src/androidTest/java/com/javatechig/gridviewexample/ApplicationTest.java b/android-advance-gridview-tutorial/app/src/androidTest/java/com/javatechig/gridviewexample/ApplicationTest.java new file mode 100644 index 0000000..5e3bb30 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/androidTest/java/com/javatechig/gridviewexample/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.javatechig.gridviewexample; + +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/android-advance-gridview-tutorial/app/src/main/AndroidManifest.xml b/android-advance-gridview-tutorial/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..de7cc09 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + diff --git a/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/DetailsActivity.java b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/DetailsActivity.java new file mode 100644 index 0000000..c7bdaa2 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/DetailsActivity.java @@ -0,0 +1,158 @@ +package com.javatechig.gridviewexample; + +import android.animation.ObjectAnimator; +import android.animation.TimeInterpolator; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.ActionBarActivity; +import android.text.Html; +import android.view.ViewTreeObserver; +import android.view.animation.AccelerateInterpolator; +import android.view.animation.DecelerateInterpolator; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; + +import com.squareup.picasso.Picasso; + +public class DetailsActivity extends ActionBarActivity { + private static final int ANIM_DURATION = 600; + private TextView titleTextView; + private ImageView imageView; + + private int mLeftDelta; + private int mTopDelta; + private float mWidthScale; + private float mHeightScale; + + private FrameLayout frameLayout; + private ColorDrawable colorDrawable; + + private int thumbnailTop; + private int thumbnailLeft; + private int thumbnailWidth; + private int thumbnailHeight; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + //Setting details screen layout + setContentView(R.layout.activity_details_view); + + ActionBar actionBar = getSupportActionBar(); + actionBar.hide(); + + //retrieves the thumbnail data + Bundle bundle = getIntent().getExtras(); + thumbnailTop = bundle.getInt("top"); + thumbnailLeft = bundle.getInt("left"); + thumbnailWidth = bundle.getInt("width"); + thumbnailHeight = bundle.getInt("height"); + + String title = bundle.getString("title"); + String image = bundle.getString("image"); + + //initialize and set the image description + titleTextView = (TextView) findViewById(R.id.title); + titleTextView.setText(Html.fromHtml(title)); + + //Set image url + imageView = (ImageView) findViewById(R.id.grid_item_image); + Picasso.with(this).load(image).into(imageView); + + //Set the background color to black + frameLayout = (FrameLayout) findViewById(R.id.main_background); + colorDrawable = new ColorDrawable(Color.BLACK); + frameLayout.setBackground(colorDrawable); + + // Only run the animation if we're coming from the parent activity, not if + // we're recreated automatically by the window manager (e.g., device rotation) + if (savedInstanceState == null) { + ViewTreeObserver observer = imageView.getViewTreeObserver(); + observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { + + @Override + public boolean onPreDraw() { + imageView.getViewTreeObserver().removeOnPreDrawListener(this); + + // Figure out where the thumbnail and full size versions are, relative + // to the screen and each other + int[] screenLocation = new int[2]; + imageView.getLocationOnScreen(screenLocation); + mLeftDelta = thumbnailLeft - screenLocation[0]; + mTopDelta = thumbnailTop - screenLocation[1]; + + // Scale factors to make the large version the same size as the thumbnail + mWidthScale = (float) thumbnailWidth / imageView.getWidth(); + mHeightScale = (float) thumbnailHeight / imageView.getHeight(); + + enterAnimation(); + + return true; + } + }); + } + } + + /** + * The enter animation scales the picture in from its previous thumbnail + * size/location. + */ + public void enterAnimation() { + + // Set starting values for properties we're going to animate. These + // values scale and position the full size version down to the thumbnail + // size/location, from which we'll animate it back up + imageView.setPivotX(0); + imageView.setPivotY(0); + imageView.setScaleX(mWidthScale); + imageView.setScaleY(mHeightScale); + imageView.setTranslationX(mLeftDelta); + imageView.setTranslationY(mTopDelta); + + // interpolator where the rate of change starts out quickly and then decelerates. + TimeInterpolator sDecelerator = new DecelerateInterpolator(); + + // Animate scale and translation to go from thumbnail to full size + imageView.animate().setDuration(ANIM_DURATION).scaleX(1).scaleY(1). + translationX(0).translationY(0).setInterpolator(sDecelerator); + + // Fade in the black background + ObjectAnimator bgAnim = ObjectAnimator.ofInt(colorDrawable, "alpha", 0, 255); + bgAnim.setDuration(ANIM_DURATION); + bgAnim.start(); + + } + + /** + * The exit animation is basically a reverse of the enter animation. + * This Animate image back to thumbnail size/location as relieved from bundle. + * + * @param endAction This action gets run after the animation completes (this is + * when we actually switch activities) + */ + public void exitAnimation(final Runnable endAction) { + + TimeInterpolator sInterpolator = new AccelerateInterpolator(); + imageView.animate().setDuration(ANIM_DURATION).scaleX(mWidthScale).scaleY(mHeightScale). + translationX(mLeftDelta).translationY(mTopDelta) + .setInterpolator(sInterpolator).withEndAction(endAction); + + // Fade out background + ObjectAnimator bgAnim = ObjectAnimator.ofInt(colorDrawable, "alpha", 0); + bgAnim.setDuration(ANIM_DURATION); + bgAnim.start(); + } + + @Override + public void onBackPressed() { + exitAnimation(new Runnable() { + public void run() { + finish(); + } + }); + } +} diff --git a/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridItem.java b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridItem.java new file mode 100644 index 0000000..54d36ad --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridItem.java @@ -0,0 +1,26 @@ +package com.javatechig.gridviewexample; + +public class GridItem { + private String image; + private String title; + + public GridItem() { + super(); + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridViewActivity.java b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridViewActivity.java new file mode 100644 index 0000000..a13f3c6 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridViewActivity.java @@ -0,0 +1,173 @@ +package com.javatechig.gridviewexample; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; + +import android.content.Intent; +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.GridView; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.Toast; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +public class GridViewActivity extends ActionBarActivity { + private static final String TAG = GridViewActivity.class.getSimpleName(); + + private GridView mGridView; + private ProgressBar mProgressBar; + + private GridViewAdapter mGridAdapter; + private ArrayList mGridData; + private String FEED_URL = "http://javatechig.com/?json=get_recent_posts&count=45"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_gridview); + + mGridView = (GridView) findViewById(R.id.gridView); + mProgressBar = (ProgressBar) findViewById(R.id.progressBar); + + //Initialize with empty data + mGridData = new ArrayList<>(); + mGridAdapter = new GridViewAdapter(this, R.layout.grid_item_layout, mGridData); + mGridView.setAdapter(mGridAdapter); + + //Grid view click event + mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + public void onItemClick(AdapterView parent, View v, int position, long id) { + //Get item at position + GridItem item = (GridItem) parent.getItemAtPosition(position); + + Intent intent = new Intent(GridViewActivity.this, DetailsActivity.class); + ImageView imageView = (ImageView) v.findViewById(R.id.grid_item_image); + + // Interesting data to pass across are the thumbnail size/location, the + // resourceId of the source bitmap, the picture description, and the + // orientation (to avoid returning back to an obsolete configuration if + // the device rotates again in the meantime) + + int[] screenLocation = new int[2]; + imageView.getLocationOnScreen(screenLocation); + + //Pass the image title and url to DetailsActivity + intent.putExtra("left", screenLocation[0]). + putExtra("top", screenLocation[1]). + putExtra("width", imageView.getWidth()). + putExtra("height", imageView.getHeight()). + putExtra("title", item.getTitle()). + putExtra("image", item.getImage()); + + //Start details activity + startActivity(intent); + } + }); + + //Start download + new AsyncHttpTask().execute(FEED_URL); + mProgressBar.setVisibility(View.VISIBLE); + } + + + //Downloading data asynchronously + public class AsyncHttpTask extends AsyncTask { + + @Override + protected Integer doInBackground(String... params) { + Integer result = 0; + try { + // Create Apache HttpClient + HttpClient httpclient = new DefaultHttpClient(); + HttpResponse httpResponse = httpclient.execute(new HttpGet(params[0])); + int statusCode = httpResponse.getStatusLine().getStatusCode(); + + // 200 represents HTTP OK + if (statusCode == 200) { + String response = streamToString(httpResponse.getEntity().getContent()); + parseResult(response); + result = 1; // Successful + } else { + result = 0; //"Failed + } + } catch (Exception e) { + Log.d(TAG, e.getLocalizedMessage()); + } + + return result; + } + + @Override + protected void onPostExecute(Integer result) { + // Download complete. Lets update UI + + if (result == 1) { + mGridAdapter.setGridData(mGridData); + } else { + Toast.makeText(GridViewActivity.this, "Failed to fetch data!", Toast.LENGTH_SHORT).show(); + } + + //Hide progressbar + mProgressBar.setVisibility(View.GONE); + } + } + + + String streamToString(InputStream stream) throws IOException { + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream)); + String line; + String result = ""; + while ((line = bufferedReader.readLine()) != null) { + result += line; + } + + // Close stream + if (null != stream) { + stream.close(); + } + return result; + } + + /** + * Parsing the feed results and get the list + * + * @param result + */ + private void parseResult(String result) { + try { + JSONObject response = new JSONObject(result); + JSONArray posts = response.optJSONArray("posts"); + GridItem item; + for (int i = 0; i < posts.length(); i++) { + JSONObject post = posts.optJSONObject(i); + String title = post.optString("title"); + item = new GridItem(); + item.setTitle(title); + JSONArray attachments = post.getJSONArray("attachments"); + if (null != attachments && attachments.length() > 0) { + JSONObject attachment = attachments.getJSONObject(0); + if (attachment != null) + item.setImage(attachment.getString("url")); + } + mGridData.add(item); + } + } catch (JSONException e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridViewAdapter.java b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridViewAdapter.java new file mode 100644 index 0000000..203794e --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/java/com/javatechig/gridviewexample/GridViewAdapter.java @@ -0,0 +1,71 @@ +package com.javatechig.gridviewexample; + +import java.util.ArrayList; + +import android.app.Activity; +import android.content.Context; +import android.graphics.ColorMatrix; +import android.graphics.ColorMatrixColorFilter; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.TextView; + +import com.squareup.picasso.Picasso; + +public class GridViewAdapter extends ArrayAdapter { + + //private final ColorMatrixColorFilter grayscaleFilter; + private Context mContext; + private int layoutResourceId; + private ArrayList mGridData = new ArrayList(); + + public GridViewAdapter(Context mContext, int layoutResourceId, ArrayList mGridData) { + super(mContext, layoutResourceId, mGridData); + this.layoutResourceId = layoutResourceId; + this.mContext = mContext; + this.mGridData = mGridData; + } + + + /** + * Updates grid data and refresh grid items. + * + * @param mGridData + */ + public void setGridData(ArrayList mGridData) { + this.mGridData = mGridData; + notifyDataSetChanged(); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View row = convertView; + ViewHolder holder; + + if (row == null) { + LayoutInflater inflater = ((Activity) mContext).getLayoutInflater(); + row = inflater.inflate(layoutResourceId, parent, false); + holder = new ViewHolder(); + holder.titleTextView = (TextView) row.findViewById(R.id.grid_item_title); + holder.imageView = (ImageView) row.findViewById(R.id.grid_item_image); + row.setTag(holder); + } else { + holder = (ViewHolder) row.getTag(); + } + + GridItem item = mGridData.get(position); + holder.titleTextView.setText(Html.fromHtml(item.getTitle())); + + Picasso.with(mContext).load(item.getImage()).into(holder.imageView); + return row; + } + + static class ViewHolder { + TextView titleTextView; + ImageView imageView; + } +} \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/src/main/res/drawable/grid_color_selector.xml b/android-advance-gridview-tutorial/app/src/main/res/drawable/grid_color_selector.xml new file mode 100644 index 0000000..59f2cea --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/drawable/grid_color_selector.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/src/main/res/layout/activity_details_view.xml b/android-advance-gridview-tutorial/app/src/main/res/layout/activity_details_view.xml new file mode 100644 index 0000000..e7fdc47 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/layout/activity_details_view.xml @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/src/main/res/layout/activity_gridview.xml b/android-advance-gridview-tutorial/app/src/main/res/layout/activity_gridview.xml new file mode 100644 index 0000000..126e64a --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/layout/activity_gridview.xml @@ -0,0 +1,26 @@ + + + + + + \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/src/main/res/layout/grid_item_layout.xml b/android-advance-gridview-tutorial/app/src/main/res/layout/grid_item_layout.xml new file mode 100644 index 0000000..ee1ec12 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/layout/grid_item_layout.xml @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android-advance-gridview-tutorial/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/android-advance-gridview-tutorial/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android-advance-gridview-tutorial/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android-advance-gridview-tutorial/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/android-advance-gridview-tutorial/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android-advance-gridview-tutorial/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android-advance-gridview-tutorial/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/android-advance-gridview-tutorial/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android-advance-gridview-tutorial/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android-advance-gridview-tutorial/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/android-advance-gridview-tutorial/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android-advance-gridview-tutorial/app/src/main/res/values-w820dp/dimens.xml b/android-advance-gridview-tutorial/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/android-advance-gridview-tutorial/app/src/main/res/values/colors.xml b/android-advance-gridview-tutorial/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..b51cfd7 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #00abea + #ffffff + \ No newline at end of file diff --git a/android-advance-gridview-tutorial/app/src/main/res/values/dimens.xml b/android-advance-gridview-tutorial/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/android-advance-gridview-tutorial/app/src/main/res/values/strings.xml b/android-advance-gridview-tutorial/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..144c725 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + GridView Example + + diff --git a/android-advance-gridview-tutorial/app/src/main/res/values/styles.xml b/android-advance-gridview-tutorial/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..c65dc14 --- /dev/null +++ b/android-advance-gridview-tutorial/app/src/main/res/values/styles.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/android-advance-gridview-tutorial/build.gradle b/android-advance-gridview-tutorial/build.gradle new file mode 100644 index 0000000..9405f3f --- /dev/null +++ b/android-advance-gridview-tutorial/build.gradle @@ -0,0 +1,19 @@ +// 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:1.2.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/android-advance-gridview-tutorial/device-2015-03-28-114446.png b/android-advance-gridview-tutorial/device-2015-03-28-114446.png new file mode 100644 index 0000000..437a9df Binary files /dev/null and b/android-advance-gridview-tutorial/device-2015-03-28-114446.png differ diff --git a/android-advance-gridview-tutorial/device-2015-03-28-114520.png b/android-advance-gridview-tutorial/device-2015-03-28-114520.png new file mode 100644 index 0000000..53dcd84 Binary files /dev/null and b/android-advance-gridview-tutorial/device-2015-03-28-114520.png differ diff --git a/android-advance-gridview-tutorial/gradle.properties b/android-advance-gridview-tutorial/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/android-advance-gridview-tutorial/gradle.properties @@ -0,0 +1,18 @@ +# 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/android-advance-gridview-tutorial/gradle/wrapper/gradle-wrapper.jar b/android-advance-gridview-tutorial/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/android-advance-gridview-tutorial/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android-advance-gridview-tutorial/gradle/wrapper/gradle-wrapper.properties b/android-advance-gridview-tutorial/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/android-advance-gridview-tutorial/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/android-advance-gridview-tutorial/gradlew b/android-advance-gridview-tutorial/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/android-advance-gridview-tutorial/gradlew @@ -0,0 +1,164 @@ +#!/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 + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# 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\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +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"` + + # 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/android-advance-gridview-tutorial/gradlew.bat b/android-advance-gridview-tutorial/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/android-advance-gridview-tutorial/gradlew.bat @@ -0,0 +1,90 @@ +@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/android-advance-gridview-tutorial/settings.gradle b/android-advance-gridview-tutorial/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/android-advance-gridview-tutorial/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/AndroidBundleExample/AndroidManifest.xml b/android-bundle-example/AndroidManifest.xml similarity index 100% rename from AndroidBundleExample/AndroidManifest.xml rename to android-bundle-example/AndroidManifest.xml diff --git a/AndroidBundleExample/libs/android-support-v4.jar b/android-bundle-example/libs/android-support-v4.jar similarity index 100% rename from AndroidBundleExample/libs/android-support-v4.jar rename to android-bundle-example/libs/android-support-v4.jar diff --git a/ActivityForResults/res/drawable-hdpi/ic_launcher.png b/android-bundle-example/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from ActivityForResults/res/drawable-hdpi/ic_launcher.png rename to android-bundle-example/res/drawable-hdpi/ic_launcher.png diff --git a/ActivityForResults/res/drawable-mdpi/ic_launcher.png b/android-bundle-example/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from ActivityForResults/res/drawable-mdpi/ic_launcher.png rename to android-bundle-example/res/drawable-mdpi/ic_launcher.png diff --git a/ActivityForResults/res/drawable-xhdpi/ic_launcher.png b/android-bundle-example/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from ActivityForResults/res/drawable-xhdpi/ic_launcher.png rename to android-bundle-example/res/drawable-xhdpi/ic_launcher.png diff --git a/ActivityForResults/res/drawable-xxhdpi/ic_launcher.png b/android-bundle-example/res/drawable-xxhdpi/ic_launcher.png similarity index 100% rename from ActivityForResults/res/drawable-xxhdpi/ic_launcher.png rename to android-bundle-example/res/drawable-xxhdpi/ic_launcher.png diff --git a/AndroidBundleExample/res/layout/activity_news_details.xml b/android-bundle-example/res/layout/activity_news_details.xml similarity index 100% rename from AndroidBundleExample/res/layout/activity_news_details.xml rename to android-bundle-example/res/layout/activity_news_details.xml diff --git a/AndroidBundleExample/res/layout/activity_news_list.xml b/android-bundle-example/res/layout/activity_news_list.xml similarity index 100% rename from AndroidBundleExample/res/layout/activity_news_list.xml rename to android-bundle-example/res/layout/activity_news_list.xml diff --git a/AndroidBundleExample/res/layout/snippet_news_list_row.xml b/android-bundle-example/res/layout/snippet_news_list_row.xml similarity index 100% rename from AndroidBundleExample/res/layout/snippet_news_list_row.xml rename to android-bundle-example/res/layout/snippet_news_list_row.xml diff --git a/AndroidBundleExample/res/menu/main.xml b/android-bundle-example/res/menu/main.xml similarity index 100% rename from AndroidBundleExample/res/menu/main.xml rename to android-bundle-example/res/menu/main.xml diff --git a/ActivityForResults/res/values-sw600dp/dimens.xml b/android-bundle-example/res/values-sw600dp/dimens.xml similarity index 100% rename from ActivityForResults/res/values-sw600dp/dimens.xml rename to android-bundle-example/res/values-sw600dp/dimens.xml diff --git a/ActivityForResults/res/values-sw720dp-land/dimens.xml b/android-bundle-example/res/values-sw720dp-land/dimens.xml similarity index 100% rename from ActivityForResults/res/values-sw720dp-land/dimens.xml rename to android-bundle-example/res/values-sw720dp-land/dimens.xml diff --git a/ActivityForResults/res/values-v11/styles.xml b/android-bundle-example/res/values-v11/styles.xml similarity index 100% rename from ActivityForResults/res/values-v11/styles.xml rename to android-bundle-example/res/values-v11/styles.xml diff --git a/ActivityForResults/res/values-v14/styles.xml b/android-bundle-example/res/values-v14/styles.xml similarity index 100% rename from ActivityForResults/res/values-v14/styles.xml rename to android-bundle-example/res/values-v14/styles.xml diff --git a/AndroidBundleExample/res/values/arrays.xml b/android-bundle-example/res/values/arrays.xml similarity index 100% rename from AndroidBundleExample/res/values/arrays.xml rename to android-bundle-example/res/values/arrays.xml diff --git a/AndroidBundleExample/res/values/colors.xml b/android-bundle-example/res/values/colors.xml similarity index 100% rename from AndroidBundleExample/res/values/colors.xml rename to android-bundle-example/res/values/colors.xml diff --git a/ActivityForResults/res/values/dimens.xml b/android-bundle-example/res/values/dimens.xml similarity index 100% rename from ActivityForResults/res/values/dimens.xml rename to android-bundle-example/res/values/dimens.xml diff --git a/AndroidBundleExample/res/values/strings.xml b/android-bundle-example/res/values/strings.xml similarity index 100% rename from AndroidBundleExample/res/values/strings.xml rename to android-bundle-example/res/values/strings.xml diff --git a/ActivityForResults/res/values/styles.xml b/android-bundle-example/res/values/styles.xml similarity index 100% rename from ActivityForResults/res/values/styles.xml rename to android-bundle-example/res/values/styles.xml diff --git a/AndroidBundleExample/src/com/javatechig/NewsDetailsActivity.java b/android-bundle-example/src/com/javatechig/NewsDetailsActivity.java similarity index 100% rename from AndroidBundleExample/src/com/javatechig/NewsDetailsActivity.java rename to android-bundle-example/src/com/javatechig/NewsDetailsActivity.java diff --git a/AndroidBundleExample/src/com/javatechig/NewsItem.java b/android-bundle-example/src/com/javatechig/NewsItem.java similarity index 100% rename from AndroidBundleExample/src/com/javatechig/NewsItem.java rename to android-bundle-example/src/com/javatechig/NewsItem.java diff --git a/AndroidBundleExample/src/com/javatechig/NewsListActivity.java b/android-bundle-example/src/com/javatechig/NewsListActivity.java similarity index 100% rename from AndroidBundleExample/src/com/javatechig/NewsListActivity.java rename to android-bundle-example/src/com/javatechig/NewsListActivity.java diff --git a/AndroidBundleExample/src/com/javatechig/NewsListAdapter.java b/android-bundle-example/src/com/javatechig/NewsListAdapter.java similarity index 100% rename from AndroidBundleExample/src/com/javatechig/NewsListAdapter.java rename to android-bundle-example/src/com/javatechig/NewsListAdapter.java diff --git a/android-checkbox-demo/MyApplication.iml b/android-checkbox-demo/MyApplication.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/android-checkbox-demo/MyApplication.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/android-checkbox-demo/app/.gitignore b/android-checkbox-demo/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/android-checkbox-demo/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/android-checkbox-demo/app/app.iml b/android-checkbox-demo/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/android-checkbox-demo/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android-checkbox-demo/app/build.gradle b/android-checkbox-demo/app/build.gradle new file mode 100644 index 0000000..5c762c3 --- /dev/null +++ b/android-checkbox-demo/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "com.example.myapplication" + minSdkVersion 15 + targetSdkVersion 21 + 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:21.0.+" +} diff --git a/android-checkbox-demo/app/proguard-rules.pro b/android-checkbox-demo/app/proguard-rules.pro new file mode 100644 index 0000000..a734a8c --- /dev/null +++ b/android-checkbox-demo/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/nilanchalpanigrahy/Library/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/android-checkbox-demo/app/src/androidTest/java/com/example/myapplication/ApplicationTest.java b/android-checkbox-demo/app/src/androidTest/java/com/example/myapplication/ApplicationTest.java new file mode 100644 index 0000000..5c3d5cb --- /dev/null +++ b/android-checkbox-demo/app/src/androidTest/java/com/example/myapplication/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.example.myapplication; + +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/android-checkbox-demo/app/src/main/AndroidManifest.xml b/android-checkbox-demo/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5ecdb47 --- /dev/null +++ b/android-checkbox-demo/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/android-checkbox-demo/app/src/main/java/com/example/myapplication/MainActivity.java b/android-checkbox-demo/app/src/main/java/com/example/myapplication/MainActivity.java new file mode 100644 index 0000000..f9984e4 --- /dev/null +++ b/android-checkbox-demo/app/src/main/java/com/example/myapplication/MainActivity.java @@ -0,0 +1,53 @@ +package com.example.myapplication; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.widget.CheckBox; +import android.widget.Toast; + +public class MainActivity extends Activity { + + private CheckBox blogging, game, music; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + blogging = (CheckBox) findViewById(R.id.blogging); + game = (CheckBox) findViewById(R.id.game); + music = (CheckBox) findViewById(R.id.music); + music.setOnClickListener(checkboxClickListener); + game.setOnClickListener(checkboxClickListener); + blogging.setOnClickListener(checkboxClickListener); + + /* Set blogging by default */ + blogging.setChecked(true); + + } + + View.OnClickListener checkboxClickListener = new View.OnClickListener() { + @Override + public void onClick(View view) { + boolean checked = ((CheckBox) view).isChecked(); + if (checked) { + String text = null; + switch (view.getId()){ + case R.id.game: + text = "Play Game"; + break; + case R.id.music: + text = "Listen Music"; + break; + case R.id.blogging: + text="Write blog"; + break; + } + + Toast.makeText(MainActivity.this, text, Toast.LENGTH_LONG).show(); + } + } + }; + +} \ No newline at end of file diff --git a/android-checkbox-demo/app/src/main/res/drawable-hdpi/ic_launcher.png b/android-checkbox-demo/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/android-checkbox-demo/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/android-checkbox-demo/app/src/main/res/drawable-mdpi/ic_launcher.png b/android-checkbox-demo/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/android-checkbox-demo/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/android-checkbox-demo/app/src/main/res/drawable-xhdpi/ic_launcher.png b/android-checkbox-demo/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/android-checkbox-demo/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android-checkbox-demo/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/android-checkbox-demo/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/android-checkbox-demo/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android-checkbox-demo/app/src/main/res/layout/activity_main.xml b/android-checkbox-demo/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..05489f1 --- /dev/null +++ b/android-checkbox-demo/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android-checkbox-demo/app/src/main/res/menu/menu_main.xml b/android-checkbox-demo/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..b1cb908 --- /dev/null +++ b/android-checkbox-demo/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,6 @@ + + + diff --git a/android-checkbox-demo/app/src/main/res/values-w820dp/dimens.xml b/android-checkbox-demo/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/android-checkbox-demo/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/android-checkbox-demo/app/src/main/res/values/colors.xml b/android-checkbox-demo/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..7ca71f9 --- /dev/null +++ b/android-checkbox-demo/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #F44336 + + \ No newline at end of file diff --git a/android-checkbox-demo/app/src/main/res/values/dimens.xml b/android-checkbox-demo/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..02d4637 --- /dev/null +++ b/android-checkbox-demo/app/src/main/res/values/dimens.xml @@ -0,0 +1,6 @@ + + + 16dp + 16dp + + diff --git a/android-checkbox-demo/app/src/main/res/values/strings.xml b/android-checkbox-demo/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..72ab293 --- /dev/null +++ b/android-checkbox-demo/app/src/main/res/values/strings.xml @@ -0,0 +1,14 @@ + + + + My Application + Hello world! + Settings + + Write Blog + Listen Music + Play Games + Submit + What do you like do in your free time? + + diff --git a/android-checkbox-demo/app/src/main/res/values/styles.xml b/android-checkbox-demo/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..48ba683 --- /dev/null +++ b/android-checkbox-demo/app/src/main/res/values/styles.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/android-checkbox-demo/build.gradle b/android-checkbox-demo/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/android-checkbox-demo/build.gradle @@ -0,0 +1,19 @@ +// 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:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/android-checkbox-demo/device-2015-02-13-122939.png b/android-checkbox-demo/device-2015-02-13-122939.png new file mode 100644 index 0000000..133ebd8 Binary files /dev/null and b/android-checkbox-demo/device-2015-02-13-122939.png differ diff --git a/android-checkbox-demo/gradle.properties b/android-checkbox-demo/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/android-checkbox-demo/gradle.properties @@ -0,0 +1,18 @@ +# 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/android-checkbox-demo/gradle/wrapper/gradle-wrapper.jar b/android-checkbox-demo/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/android-checkbox-demo/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android-checkbox-demo/gradle/wrapper/gradle-wrapper.properties b/android-checkbox-demo/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/android-checkbox-demo/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/android-checkbox-demo/gradlew b/android-checkbox-demo/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/android-checkbox-demo/gradlew @@ -0,0 +1,164 @@ +#!/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 + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# 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\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +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"` + + # 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/android-checkbox-demo/gradlew.bat b/android-checkbox-demo/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/android-checkbox-demo/gradlew.bat @@ -0,0 +1,90 @@ +@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/android-checkbox-demo/settings.gradle b/android-checkbox-demo/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/android-checkbox-demo/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/AndroidCustomFont/AndroidManifest.xml b/android-custom-font-demo/AndroidManifest.xml similarity index 100% rename from AndroidCustomFont/AndroidManifest.xml rename to android-custom-font-demo/AndroidManifest.xml diff --git a/AndroidCustomFont/assets/fonts/Maximum.ttf b/android-custom-font-demo/assets/fonts/Maximum.ttf similarity index 100% rename from AndroidCustomFont/assets/fonts/Maximum.ttf rename to android-custom-font-demo/assets/fonts/Maximum.ttf diff --git a/AndroidCustomFont/ic_launcher-web.png b/android-custom-font-demo/ic_launcher-web.png similarity index 100% rename from AndroidCustomFont/ic_launcher-web.png rename to android-custom-font-demo/ic_launcher-web.png diff --git a/AndroidCustomFont/libs/android-support-v4.jar b/android-custom-font-demo/libs/android-support-v4.jar similarity index 100% rename from AndroidCustomFont/libs/android-support-v4.jar rename to android-custom-font-demo/libs/android-support-v4.jar diff --git a/AndroidCustomFont/proguard-project.txt b/android-custom-font-demo/proguard-project.txt similarity index 100% rename from AndroidCustomFont/proguard-project.txt rename to android-custom-font-demo/proguard-project.txt diff --git a/AndroidCustomFont/project.properties b/android-custom-font-demo/project.properties similarity index 100% rename from AndroidCustomFont/project.properties rename to android-custom-font-demo/project.properties diff --git a/AndroidBundleExample/res/drawable-hdpi/ic_launcher.png b/android-custom-font-demo/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from AndroidBundleExample/res/drawable-hdpi/ic_launcher.png rename to android-custom-font-demo/res/drawable-hdpi/ic_launcher.png diff --git a/AndroidBundleExample/res/drawable-mdpi/ic_launcher.png b/android-custom-font-demo/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from AndroidBundleExample/res/drawable-mdpi/ic_launcher.png rename to android-custom-font-demo/res/drawable-mdpi/ic_launcher.png diff --git a/AndroidBundleExample/res/drawable-xhdpi/ic_launcher.png b/android-custom-font-demo/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from AndroidBundleExample/res/drawable-xhdpi/ic_launcher.png rename to android-custom-font-demo/res/drawable-xhdpi/ic_launcher.png diff --git a/AndroidBundleExample/res/drawable-xxhdpi/ic_launcher.png b/android-custom-font-demo/res/drawable-xxhdpi/ic_launcher.png similarity index 100% rename from AndroidBundleExample/res/drawable-xxhdpi/ic_launcher.png rename to android-custom-font-demo/res/drawable-xxhdpi/ic_launcher.png diff --git a/AndroidCustomFont/res/layout/activity_main.xml b/android-custom-font-demo/res/layout/activity_main.xml similarity index 100% rename from AndroidCustomFont/res/layout/activity_main.xml rename to android-custom-font-demo/res/layout/activity_main.xml diff --git a/AndroidCustomFont/res/menu/activity_main.xml b/android-custom-font-demo/res/menu/activity_main.xml similarity index 100% rename from AndroidCustomFont/res/menu/activity_main.xml rename to android-custom-font-demo/res/menu/activity_main.xml diff --git a/AndroidCustomFont/res/values/strings.xml b/android-custom-font-demo/res/values/strings.xml similarity index 100% rename from AndroidCustomFont/res/values/strings.xml rename to android-custom-font-demo/res/values/strings.xml diff --git a/AndroidCustomFont/res/values/styles.xml b/android-custom-font-demo/res/values/styles.xml similarity index 100% rename from AndroidCustomFont/res/values/styles.xml rename to android-custom-font-demo/res/values/styles.xml diff --git a/AndroidCustomFont/src/com/javatechig/droid/ui/CustomTextView.java b/android-custom-font-demo/src/com/javatechig/droid/ui/CustomTextView.java similarity index 100% rename from AndroidCustomFont/src/com/javatechig/droid/ui/CustomTextView.java rename to android-custom-font-demo/src/com/javatechig/droid/ui/CustomTextView.java diff --git a/AndroidCustomFont/src/com/javatechig/droid/ui/MainActivity.java b/android-custom-font-demo/src/com/javatechig/droid/ui/MainActivity.java similarity index 100% rename from AndroidCustomFont/src/com/javatechig/droid/ui/MainActivity.java rename to android-custom-font-demo/src/com/javatechig/droid/ui/MainActivity.java diff --git a/AndroidWebview/.settings/org.eclipse.jdt.core.prefs b/android-custom-gridview-demo/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from AndroidWebview/.settings/org.eclipse.jdt.core.prefs rename to android-custom-gridview-demo/.settings/org.eclipse.jdt.core.prefs diff --git a/AndroidCustomGridView/AndroidManifest.xml b/android-custom-gridview-demo/AndroidManifest.xml similarity index 100% rename from AndroidCustomGridView/AndroidManifest.xml rename to android-custom-gridview-demo/AndroidManifest.xml diff --git a/AndroidCustomGridView/libs/android-support-v4.jar b/android-custom-gridview-demo/libs/android-support-v4.jar similarity index 100% rename from AndroidCustomGridView/libs/android-support-v4.jar rename to android-custom-gridview-demo/libs/android-support-v4.jar diff --git a/AndroidCustomGridView/lint.xml b/android-custom-gridview-demo/lint.xml similarity index 100% rename from AndroidCustomGridView/lint.xml rename to android-custom-gridview-demo/lint.xml diff --git a/AndroidCustomGridView/proguard-project.txt b/android-custom-gridview-demo/proguard-project.txt similarity index 100% rename from AndroidCustomGridView/proguard-project.txt rename to android-custom-gridview-demo/proguard-project.txt diff --git a/AndroidCustomGridView/project.properties b/android-custom-gridview-demo/project.properties similarity index 96% rename from AndroidCustomGridView/project.properties rename to android-custom-gridview-demo/project.properties index 8937e94..6e18427 100644 --- a/AndroidCustomGridView/project.properties +++ b/android-custom-gridview-demo/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-14 +target=android-21 diff --git a/AndroidCustomFont/res/drawable-hdpi/ic_launcher.png b/android-custom-gridview-demo/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from AndroidCustomFont/res/drawable-hdpi/ic_launcher.png rename to android-custom-gridview-demo/res/drawable-hdpi/ic_launcher.png diff --git a/AndroidCustomFont/res/drawable-mdpi/ic_launcher.png b/android-custom-gridview-demo/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from AndroidCustomFont/res/drawable-mdpi/ic_launcher.png rename to android-custom-gridview-demo/res/drawable-mdpi/ic_launcher.png diff --git a/AndroidCustomFont/res/drawable-xhdpi/ic_launcher.png b/android-custom-gridview-demo/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from AndroidCustomFont/res/drawable-xhdpi/ic_launcher.png rename to android-custom-gridview-demo/res/drawable-xhdpi/ic_launcher.png diff --git a/AndroidCustomFont/res/drawable-xxhdpi/ic_launcher.png b/android-custom-gridview-demo/res/drawable-xxhdpi/ic_launcher.png similarity index 100% rename from AndroidCustomFont/res/drawable-xxhdpi/ic_launcher.png rename to android-custom-gridview-demo/res/drawable-xxhdpi/ic_launcher.png diff --git a/AndroidCustomGridView/res/drawable/grid_color_selector.xml b/android-custom-gridview-demo/res/drawable/grid_color_selector.xml similarity index 100% rename from AndroidCustomGridView/res/drawable/grid_color_selector.xml rename to android-custom-gridview-demo/res/drawable/grid_color_selector.xml diff --git a/AndroidCustomGridView/res/drawable/image_1.jpg b/android-custom-gridview-demo/res/drawable/image_1.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_1.jpg rename to android-custom-gridview-demo/res/drawable/image_1.jpg diff --git a/AndroidCustomGridView/res/drawable/image_2.jpg b/android-custom-gridview-demo/res/drawable/image_2.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_2.jpg rename to android-custom-gridview-demo/res/drawable/image_2.jpg diff --git a/AndroidCustomGridView/res/drawable/image_3.jpg b/android-custom-gridview-demo/res/drawable/image_3.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_3.jpg rename to android-custom-gridview-demo/res/drawable/image_3.jpg diff --git a/AndroidCustomGridView/res/drawable/image_4.jpg b/android-custom-gridview-demo/res/drawable/image_4.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_4.jpg rename to android-custom-gridview-demo/res/drawable/image_4.jpg diff --git a/AndroidCustomGridView/res/drawable/image_5.jpg b/android-custom-gridview-demo/res/drawable/image_5.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_5.jpg rename to android-custom-gridview-demo/res/drawable/image_5.jpg diff --git a/AndroidCustomGridView/res/drawable/image_6.jpg b/android-custom-gridview-demo/res/drawable/image_6.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_6.jpg rename to android-custom-gridview-demo/res/drawable/image_6.jpg diff --git a/AndroidCustomGridView/res/drawable/image_7.jpg b/android-custom-gridview-demo/res/drawable/image_7.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_7.jpg rename to android-custom-gridview-demo/res/drawable/image_7.jpg diff --git a/AndroidCustomGridView/res/drawable/image_8.jpg b/android-custom-gridview-demo/res/drawable/image_8.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_8.jpg rename to android-custom-gridview-demo/res/drawable/image_8.jpg diff --git a/AndroidCustomGridView/res/drawable/image_9.jpg b/android-custom-gridview-demo/res/drawable/image_9.jpg similarity index 100% rename from AndroidCustomGridView/res/drawable/image_9.jpg rename to android-custom-gridview-demo/res/drawable/image_9.jpg diff --git a/AndroidCustomGridView/res/layout/activity_main.xml b/android-custom-gridview-demo/res/layout/activity_main.xml similarity index 100% rename from AndroidCustomGridView/res/layout/activity_main.xml rename to android-custom-gridview-demo/res/layout/activity_main.xml diff --git a/AndroidCustomGridView/res/layout/row_grid.xml b/android-custom-gridview-demo/res/layout/row_grid.xml similarity index 92% rename from AndroidCustomGridView/res/layout/row_grid.xml rename to android-custom-gridview-demo/res/layout/row_grid.xml index f9c1969..461ceee 100644 --- a/AndroidCustomGridView/res/layout/row_grid.xml +++ b/android-custom-gridview-demo/res/layout/row_grid.xml @@ -5,9 +5,9 @@ android:layout_marginTop="5dp" android:orientation="vertical" android:padding="5dp" - android:clickable="true" + android:clickable="false" android:background="@drawable/grid_color_selector" - android:focusable="true"> + android:focusable="false"> parent, View v, int position, long id) { + Log.e("item", "clicked"); Toast.makeText(MainActivity.this, position + "#Selected", Toast.LENGTH_SHORT).show(); } diff --git a/Customizedlist/.settings/org.eclipse.jdt.core.prefs b/android-custom-listview-demo/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from Customizedlist/.settings/org.eclipse.jdt.core.prefs rename to android-custom-listview-demo/.settings/org.eclipse.jdt.core.prefs diff --git a/Customizedlist/AndroidManifest.xml b/android-custom-listview-demo/AndroidManifest.xml similarity index 100% rename from Customizedlist/AndroidManifest.xml rename to android-custom-listview-demo/AndroidManifest.xml diff --git a/Customizedlist/ic_launcher-web.png b/android-custom-listview-demo/ic_launcher-web.png similarity index 100% rename from Customizedlist/ic_launcher-web.png rename to android-custom-listview-demo/ic_launcher-web.png diff --git a/AndroidWebview/libs/android-support-v4.jar b/android-custom-listview-demo/libs/android-support-v4.jar similarity index 100% rename from AndroidWebview/libs/android-support-v4.jar rename to android-custom-listview-demo/libs/android-support-v4.jar diff --git a/AndroidWebview/proguard-project.txt b/android-custom-listview-demo/proguard-project.txt similarity index 100% rename from AndroidWebview/proguard-project.txt rename to android-custom-listview-demo/proguard-project.txt diff --git a/Customizedlist/project.properties b/android-custom-listview-demo/project.properties similarity index 100% rename from Customizedlist/project.properties rename to android-custom-listview-demo/project.properties diff --git a/Customizedlist/res/drawable-hdpi/ic_launcher.png b/android-custom-listview-demo/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from Customizedlist/res/drawable-hdpi/ic_launcher.png rename to android-custom-listview-demo/res/drawable-hdpi/ic_launcher.png diff --git a/Customizedlist/res/drawable-mdpi/ic_launcher.png b/android-custom-listview-demo/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from Customizedlist/res/drawable-mdpi/ic_launcher.png rename to android-custom-listview-demo/res/drawable-mdpi/ic_launcher.png diff --git a/Customizedlist/res/drawable-xhdpi/ic_launcher.png b/android-custom-listview-demo/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from Customizedlist/res/drawable-xhdpi/ic_launcher.png rename to android-custom-listview-demo/res/drawable-xhdpi/ic_launcher.png diff --git a/Customizedlist/res/drawable-xxhdpi/ic_launcher.png b/android-custom-listview-demo/res/drawable-xxhdpi/ic_launcher.png similarity index 100% rename from Customizedlist/res/drawable-xxhdpi/ic_launcher.png rename to android-custom-listview-demo/res/drawable-xxhdpi/ic_launcher.png diff --git a/Customizedlist/res/drawable/list_item_text_selector.xml b/android-custom-listview-demo/res/drawable/list_item_text_selector.xml similarity index 100% rename from Customizedlist/res/drawable/list_item_text_selector.xml rename to android-custom-listview-demo/res/drawable/list_item_text_selector.xml diff --git a/Customizedlist/res/drawable/list_selector_flatcolor.xml b/android-custom-listview-demo/res/drawable/list_selector_flatcolor.xml similarity index 100% rename from Customizedlist/res/drawable/list_selector_flatcolor.xml rename to android-custom-listview-demo/res/drawable/list_selector_flatcolor.xml diff --git a/Customizedlist/res/layout/activity_main.xml b/android-custom-listview-demo/res/layout/activity_main.xml similarity index 100% rename from Customizedlist/res/layout/activity_main.xml rename to android-custom-listview-demo/res/layout/activity_main.xml diff --git a/Customizedlist/res/layout/list_row_layout.xml b/android-custom-listview-demo/res/layout/list_row_layout.xml similarity index 100% rename from Customizedlist/res/layout/list_row_layout.xml rename to android-custom-listview-demo/res/layout/list_row_layout.xml diff --git a/AndroidWebview/res/menu/main.xml b/android-custom-listview-demo/res/menu/main.xml similarity index 100% rename from AndroidWebview/res/menu/main.xml rename to android-custom-listview-demo/res/menu/main.xml diff --git a/Customizedlist/res/values-sw600dp/dimens.xml b/android-custom-listview-demo/res/values-sw600dp/dimens.xml similarity index 100% rename from Customizedlist/res/values-sw600dp/dimens.xml rename to android-custom-listview-demo/res/values-sw600dp/dimens.xml diff --git a/Customizedlist/res/values-sw720dp-land/dimens.xml b/android-custom-listview-demo/res/values-sw720dp-land/dimens.xml similarity index 100% rename from Customizedlist/res/values-sw720dp-land/dimens.xml rename to android-custom-listview-demo/res/values-sw720dp-land/dimens.xml diff --git a/Customizedlist/res/values-v11/styles.xml b/android-custom-listview-demo/res/values-v11/styles.xml similarity index 100% rename from Customizedlist/res/values-v11/styles.xml rename to android-custom-listview-demo/res/values-v11/styles.xml diff --git a/Customizedlist/res/values-v14/styles.xml b/android-custom-listview-demo/res/values-v14/styles.xml similarity index 100% rename from Customizedlist/res/values-v14/styles.xml rename to android-custom-listview-demo/res/values-v14/styles.xml diff --git a/Customizedlist/res/values/colors.xml b/android-custom-listview-demo/res/values/colors.xml similarity index 100% rename from Customizedlist/res/values/colors.xml rename to android-custom-listview-demo/res/values/colors.xml diff --git a/AndroidWebview/res/values/dimens.xml b/android-custom-listview-demo/res/values/dimens.xml similarity index 100% rename from AndroidWebview/res/values/dimens.xml rename to android-custom-listview-demo/res/values/dimens.xml diff --git a/Customizedlist/res/values/strings.xml b/android-custom-listview-demo/res/values/strings.xml similarity index 100% rename from Customizedlist/res/values/strings.xml rename to android-custom-listview-demo/res/values/strings.xml diff --git a/AndroidWebview/res/values/styles.xml b/android-custom-listview-demo/res/values/styles.xml similarity index 100% rename from AndroidWebview/res/values/styles.xml rename to android-custom-listview-demo/res/values/styles.xml diff --git a/Customizedlist/src/com/javatechig/customizedlist/CustomListAdapter.java b/android-custom-listview-demo/src/com/javatechig/customizedlist/CustomListAdapter.java similarity index 100% rename from Customizedlist/src/com/javatechig/customizedlist/CustomListAdapter.java rename to android-custom-listview-demo/src/com/javatechig/customizedlist/CustomListAdapter.java diff --git a/Customizedlist/src/com/javatechig/customizedlist/MainActivity.java b/android-custom-listview-demo/src/com/javatechig/customizedlist/MainActivity.java similarity index 100% rename from Customizedlist/src/com/javatechig/customizedlist/MainActivity.java rename to android-custom-listview-demo/src/com/javatechig/customizedlist/MainActivity.java diff --git a/Customizedlist/src/com/javatechig/customizedlist/NewsItem.java b/android-custom-listview-demo/src/com/javatechig/customizedlist/NewsItem.java similarity index 100% rename from Customizedlist/src/com/javatechig/customizedlist/NewsItem.java rename to android-custom-listview-demo/src/com/javatechig/customizedlist/NewsItem.java diff --git a/android-frame-animation-dmeo/FrameAnimation.iml b/android-frame-animation-dmeo/FrameAnimation.iml new file mode 100644 index 0000000..3357587 --- /dev/null +++ b/android-frame-animation-dmeo/FrameAnimation.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-frame-animation-dmeo/app/.gitignore b/android-frame-animation-dmeo/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/android-frame-animation-dmeo/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/android-frame-animation-dmeo/app/app.iml b/android-frame-animation-dmeo/app/app.iml new file mode 100644 index 0000000..50bc218 --- /dev/null +++ b/android-frame-animation-dmeo/app/app.iml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-frame-animation-dmeo/app/build.gradle b/android-frame-animation-dmeo/app/build.gradle new file mode 100644 index 0000000..c8ef380 --- /dev/null +++ b/android-frame-animation-dmeo/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "com.javatechig.frameanimation" + minSdkVersion 14 + targetSdkVersion 21 + 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:21.0.3' +} diff --git a/android-frame-animation-dmeo/app/proguard-rules.pro b/android-frame-animation-dmeo/app/proguard-rules.pro new file mode 100644 index 0000000..a734a8c --- /dev/null +++ b/android-frame-animation-dmeo/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/nilanchalpanigrahy/Library/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/android-frame-animation-dmeo/app/src/androidTest/java/com/javatechig/frameanimation/ApplicationTest.java b/android-frame-animation-dmeo/app/src/androidTest/java/com/javatechig/frameanimation/ApplicationTest.java new file mode 100644 index 0000000..5350544 --- /dev/null +++ b/android-frame-animation-dmeo/app/src/androidTest/java/com/javatechig/frameanimation/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.javatechig.frameanimation; + +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/android-frame-animation-dmeo/app/src/main/AndroidManifest.xml b/android-frame-animation-dmeo/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..7e2c3c0 --- /dev/null +++ b/android-frame-animation-dmeo/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/android-frame-animation-dmeo/app/src/main/java/com/javatechig/frameanimation/MainActivity.java b/android-frame-animation-dmeo/app/src/main/java/com/javatechig/frameanimation/MainActivity.java new file mode 100644 index 0000000..e0d86c5 --- /dev/null +++ b/android-frame-animation-dmeo/app/src/main/java/com/javatechig/frameanimation/MainActivity.java @@ -0,0 +1,45 @@ +package com.javatechig.frameanimation; + +import android.graphics.drawable.AnimationDrawable; +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.ImageView; + +public class MainActivity extends ActionBarActivity implements OnClickListener { + + private ImageView view; + private AnimationDrawable frameAnimation; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + // Type casting the Image View + view = (ImageView) findViewById(R.id.imageView); + + // Setting animation_list.xml as the background of the image view + view.setBackgroundResource(R.drawable.frame_animation_list); + + // Type casting the Animation drawable + frameAnimation = (AnimationDrawable) view.getBackground(); + + //set true if you want to animate only once + frameAnimation.setOneShot(true); + + findViewById(R.id.start).setOnClickListener(this); + findViewById(R.id.stop).setOnClickListener(this); + } + + @Override + public void onClick(View v) { + int id = v.getId(); + if(id == R.id.start){ + frameAnimation.start(); + }else if(id==R.id.stop){ + frameAnimation.stop(); + } + } +} diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame1.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame1.png new file mode 100644 index 0000000..1e87f17 Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame1.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame10.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame10.png new file mode 100644 index 0000000..c24790c Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame10.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame2.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame2.png new file mode 100644 index 0000000..283cee2 Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame2.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame3.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame3.png new file mode 100644 index 0000000..de0bee7 Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame3.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame4.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame4.png new file mode 100644 index 0000000..c733fa1 Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame4.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame5.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame5.png new file mode 100644 index 0000000..7b08eae Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame5.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame6.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame6.png new file mode 100644 index 0000000..9cd084b Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame6.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame7.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame7.png new file mode 100644 index 0000000..229852a Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame7.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame8.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame8.png new file mode 100644 index 0000000..6e30839 Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame8.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame9.png b/android-frame-animation-dmeo/app/src/main/res/drawable/frame9.png new file mode 100644 index 0000000..110d0e6 Binary files /dev/null and b/android-frame-animation-dmeo/app/src/main/res/drawable/frame9.png differ diff --git a/android-frame-animation-dmeo/app/src/main/res/drawable/frame_animation_list.xml b/android-frame-animation-dmeo/app/src/main/res/drawable/frame_animation_list.xml new file mode 100644 index 0000000..98be764 --- /dev/null +++ b/android-frame-animation-dmeo/app/src/main/res/drawable/frame_animation_list.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-frame-animation-dmeo/app/src/main/res/layout/activity_main.xml b/android-frame-animation-dmeo/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..09ec419 --- /dev/null +++ b/android-frame-animation-dmeo/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,34 @@ + + + + + + +