diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..825246d --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +mi-dev-test \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7c671b1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..473fd5d --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,32 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + applicationId "com.infinity.massive" + minSdkVersion 15 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.1.1' + compile 'com.android.support:design:23.1.1' + compile 'com.android.support:cardview-v7:23.0.0' + compile 'com.squareup.retrofit:retrofit:2.0.0-beta2' + compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2' + compile 'de.hdodenhof:circleimageview:1.3.0' + compile 'com.squareup.picasso:picasso:2.5.2' +} diff --git a/app/libs/gson-2.3.1.jar b/app/libs/gson-2.3.1.jar new file mode 100644 index 0000000..250132c Binary files /dev/null and b/app/libs/gson-2.3.1.jar differ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..191fe35 --- /dev/null +++ b/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/ilandrayan/android-sdks/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/app/src/androidTest/java/com/infinity/massive/ApplicationTest.java b/app/src/androidTest/java/com/infinity/massive/ApplicationTest.java new file mode 100644 index 0000000..dc4c850 --- /dev/null +++ b/app/src/androidTest/java/com/infinity/massive/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.infinity.massive; + +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/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..e100bee --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/infinity/massive/ApplicationMassiveInfinity.java b/app/src/main/java/com/infinity/massive/ApplicationMassiveInfinity.java new file mode 100644 index 0000000..107b26d --- /dev/null +++ b/app/src/main/java/com/infinity/massive/ApplicationMassiveInfinity.java @@ -0,0 +1,48 @@ +package com.infinity.massive; + +import android.app.Activity; +import android.app.Application; +import android.content.Context; +import android.support.v4.content.LocalBroadcastManager; +import android.util.Log; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class ApplicationMassiveInfinity extends Application { + + private static final String TAG = ApplicationMassiveInfinity.class.getSimpleName(); + + private static LocalBroadcastManager sLbm; + + protected static Context sContext; + protected static Activity sActivity; + + + @Override + public void onCreate() { + + super.onCreate(); + Log.i(TAG, "onCreate: Called"); + sContext = getApplicationContext(); + + sLbm = LocalBroadcastManager.getInstance(sContext); + + } + + public static LocalBroadcastManager getLbm(){ + return sLbm; + } + + protected static void setCurrentActivity(Activity currentActivity) { + sActivity = currentActivity; + } + + public static Context getContext() { + return sContext; + } + + protected static Activity getCurrentActivity() { + return sActivity; + } +} diff --git a/app/src/main/java/com/infinity/massive/controller/AndroidVersionController.java b/app/src/main/java/com/infinity/massive/controller/AndroidVersionController.java new file mode 100644 index 0000000..aeec2a4 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/controller/AndroidVersionController.java @@ -0,0 +1,39 @@ +package com.infinity.massive.controller; + +import com.infinity.massive.ApplicationMassiveInfinity; +import com.infinity.massive.R; +import com.infinity.massive.model.api.AndroidVersionInfoService; +import com.infinity.massive.model.pojo.Android; + +import java.util.List; + +import retrofit.Call; +import retrofit.GsonConverterFactory; +import retrofit.Retrofit; + +/** + * Created by Ilanthirayan on 26/1/16. + */ +public class AndroidVersionController { + + private static final String TAG = DeviceController.class.getSimpleName(); + + private Retrofit retrofit; + private AndroidVersionInfoService androidVersionInfoService; + + public AndroidVersionController() { + retrofit = new Retrofit.Builder() + .baseUrl(ApplicationMassiveInfinity.getContext().getResources().getString(R.string.massive_infinity_api_url)) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + + androidVersionInfoService = retrofit.create(AndroidVersionInfoService.class); + } + + public Call getProductDetailsService(int device_id){ + Call response = androidVersionInfoService.getAndroidVersionDetails(device_id + ); + + return response; + } +} diff --git a/app/src/main/java/com/infinity/massive/controller/DeviceController.java b/app/src/main/java/com/infinity/massive/controller/DeviceController.java new file mode 100644 index 0000000..72ae3d4 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/controller/DeviceController.java @@ -0,0 +1,39 @@ +package com.infinity.massive.controller; + +import com.infinity.massive.ApplicationMassiveInfinity; +import com.infinity.massive.R; +import com.infinity.massive.model.api.DeviceInfoService; +import com.infinity.massive.model.pojo.Devices; + +import java.util.List; + +import retrofit.Call; +import retrofit.GsonConverterFactory; +import retrofit.Retrofit; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class DeviceController { + + private static final String TAG = DeviceController.class.getSimpleName(); + + private Retrofit retrofit; + private DeviceInfoService deviceInfoService; + + public DeviceController() { + retrofit = new Retrofit.Builder() + .baseUrl(ApplicationMassiveInfinity.getContext().getResources().getString(R.string.massive_infinity_api_url)) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + + deviceInfoService = retrofit.create(DeviceInfoService.class); + } + + public Call> getProductDetailsService(){ + Call> response = deviceInfoService.getDevices( + ); + + return response; + } +} diff --git a/app/src/main/java/com/infinity/massive/controller/service/DeviceDownloadService.java b/app/src/main/java/com/infinity/massive/controller/service/DeviceDownloadService.java new file mode 100644 index 0000000..efc60ad --- /dev/null +++ b/app/src/main/java/com/infinity/massive/controller/service/DeviceDownloadService.java @@ -0,0 +1,142 @@ +package com.infinity.massive.controller.service; + +import android.app.ActivityManager; +import android.app.Service; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.os.IBinder; +import android.support.annotation.Nullable; +import android.util.Log; + +import com.infinity.massive.ApplicationMassiveInfinity; +import com.infinity.massive.controller.DeviceController; +import com.infinity.massive.model.pojo.Devices; +import com.infinity.massive.utils.DataBaseClient; + +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import retrofit.Call; +import retrofit.Callback; +import retrofit.Response; +import retrofit.Retrofit; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class DeviceDownloadService extends Service{ + + public static final String ACTION_BLOCK_RENDER_DEVICE_DOWNLOAD_FINISHED = DeviceDownloadService.class.getName() + + ".action.BLOCK_RENDER_DEVICE_DOWNLOAD_FINISHED"; + + /** + * String {@link #ACTION_BLOCK_RENDER_DEVICE_DOWNLOAD_FINISHED} intent extra: + * the full name of the service class that downloaded + */ + public static final String EXTRA_SERVICE_NAME = "service_name"; + + public static final String EXTRA_REMAINING_BLOCK_RENDER_DEVICE_LIST = "remaining_block_render_device_list"; + + static final String TAG = DeviceDownloadService.class.getSimpleName(); + + static final AtomicInteger blockRenderDeviceListLayoutLeft = new AtomicInteger(0); + + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + + final int res = START_STICKY; + + if(intent == null) { + Log.d(TAG, "Inside " + TAG + " intent is @null"); + return res; + }else{ + Log.d(TAG, "Inside " + TAG + " intent is NOT @null"); + } + blockRenderDeviceListLayoutLeft.incrementAndGet(); + + startDownload(); + + + return res; + } + + + protected void startDownload(){ + DeviceController mDeviceController = new DeviceController(); + Call> response = mDeviceController.getProductDetailsService(); + response.enqueue(new Callback>() { + @Override + public void onResponse(Response> response, Retrofit retrofit) { + Log.d(TAG, "Response Raw :: " + response.raw()); + if (response.body().size() > 0) { + //SUCCESSFULLY PRODUCTS RECEIVE + + //SAVE THE PRODUCTS IN TO THE DATABASE + DataBaseClient.getInstance().insertDevices(response.body(), true); + + //SEND THE BROADCAST TO NOTIFY DOWNLOAD COMPLETED + final Intent buzzIntent = new Intent(ACTION_BLOCK_RENDER_DEVICE_DOWNLOAD_FINISHED) + .putExtra(EXTRA_SERVICE_NAME, getClass().getName()) + .putExtra(EXTRA_REMAINING_BLOCK_RENDER_DEVICE_LIST, blockRenderDeviceListLayoutLeft.decrementAndGet()); + ApplicationMassiveInfinity.getLbm().sendBroadcast(buzzIntent); + + } else { + //ERROR MESSAGE DIALOG + } + + Log.d(TAG, "@@blockRenderBuzzFeedsLayoutLeft :: " + blockRenderDeviceListLayoutLeft.get()); + stopSelf(); + } + + @Override + public void onFailure(Throwable e) { + Log.d(TAG, "onFailure: " + e.getMessage()); + stopSelf(); + } + }); + } + + + public static int getRemainingBlockRenderProductLayoutDownloads(){ + return blockRenderDeviceListLayoutLeft.get(); + } + + + /** + * Start a download service, if it is not disabled in the config. + * The config.xml values contains a string value named 'disabled_download_service_simple_names' + * Add the simple name of the download service class to that string, separated by whitespace in order + * for that service not to be started. + * + * @param startWhenAlreadyRunning force start even if the service is already running + * @param extras extras to start service intent + */ + public static void start( final boolean startWhenAlreadyRunning, final Bundle extras) { + final Context mContext = ApplicationMassiveInfinity.getContext(); + if (!startWhenAlreadyRunning) { + final ActivityManager manager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); + for (ActivityManager.RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) { + if (DeviceDownloadService.class.getName().equals(serviceInfo.service.getClassName())) { + Log.d(TAG, DeviceDownloadService.class.getSimpleName() + " not started because it is already running"); + return; + } + } + } + + Log.d(TAG, DeviceDownloadService.class.getSimpleName() + " starting"); + final Intent intent = new Intent(mContext, DeviceDownloadService.class); + if (extras != null) { + intent.replaceExtras(extras); + } + mContext.startService(intent); + } + + @Nullable + @Override + public IBinder onBind(Intent intent) { + return null; + } + +} diff --git a/app/src/main/java/com/infinity/massive/model/adapter/DeviceListViewAdapter.java b/app/src/main/java/com/infinity/massive/model/adapter/DeviceListViewAdapter.java new file mode 100644 index 0000000..b1b38c0 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/model/adapter/DeviceListViewAdapter.java @@ -0,0 +1,123 @@ +package com.infinity.massive.model.adapter; + +import android.app.Activity; +import android.content.Intent; +import android.support.v7.widget.CardView; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.infinity.massive.ApplicationMassiveInfinity; +import com.infinity.massive.R; +import com.infinity.massive.model.pojo.Devices; +import com.infinity.massive.view.activity.AndroidVersionDetailsActivity; +import com.squareup.picasso.Picasso; + +import java.util.List; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class DeviceListViewAdapter extends RecyclerView.Adapter{ + + private static final String TAG = DeviceListViewAdapter.class.getSimpleName(); + + private Activity mActivity; + private List devicesList; + + private final int VIEW_ITEM = 1; + private final int VIEW_PROG = 0; + + public DeviceListViewAdapter(Activity mActivity, List devicesList) { + this.mActivity = mActivity; + this.devicesList = devicesList; + } + + @Override + public int getItemCount() { + return devicesList.size(); + } + + @Override + public int getItemViewType(int position) { + return devicesList.get(position) != null ? VIEW_ITEM : VIEW_PROG; + } + + public static class ProgressViewHolder extends RecyclerView.ViewHolder { + public ProgressBar progressBar; + public ProgressViewHolder(View v) { + super(v); + progressBar = (ProgressBar)v.findViewById(R.id.progressBar); + } + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int position) { + RecyclerView.ViewHolder viewHolder; + if(position==VIEW_ITEM) { + View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.adapter_item_device_view, viewGroup, false); + viewHolder = new DeviceViewHolder(viewGroup, view); + }else{ + View view = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.progress_item, viewGroup, false); + viewHolder = new ProgressViewHolder(view); + } + + return viewHolder; + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { + if(holder instanceof ProgressViewHolder){ + ((ProgressViewHolder)holder).progressBar.setIndeterminate(true); + }else { + final Devices item = devicesList.get(position); + ((DeviceViewHolder) holder).nameTxt.setText(item.getName()); + ((DeviceViewHolder) holder).snippetTxt.setText(item.getSnippet()); + ((DeviceViewHolder) holder).androidIdTxt.setText(String.valueOf(item.getAndroidId())); + + //Get the product image + if(item.getImageUrl() != null) { + Picasso.with(mActivity).load(item.getImageUrl()).into(((DeviceViewHolder) holder).deviceImg); + } + + ((DeviceViewHolder) holder).deviceCardView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //START THE PRODUCT DETAILS ACTIVITY + Intent intent = new Intent(ApplicationMassiveInfinity.getContext(), AndroidVersionDetailsActivity.class); + intent.putExtra(AndroidVersionDetailsActivity.EXTRAS_MASSIVE_INFINITY_DEVICE_ID, item.getId()); + mActivity.startActivity(intent); + } + }); + } + } + + public class DeviceViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { + ImageView deviceImg; + TextView snippetTxt; + TextView androidIdTxt; + TextView nameTxt; + ViewGroup viewGroup; + CardView deviceCardView; + + public DeviceViewHolder(ViewGroup viewGroup, View itemView) { + super(itemView); + this.viewGroup = viewGroup; + deviceCardView = (CardView) itemView.findViewById(R.id.device_card_layout); + deviceImg = (ImageView) itemView.findViewById(R.id.device_image); + nameTxt = (TextView) itemView.findViewById(R.id.device_name_txt); + androidIdTxt = (TextView) itemView.findViewById(R.id.device_android_id_txt); + snippetTxt = (TextView) itemView.findViewById(R.id.device_snippet_txt); + } + + @Override + public void onClick(final View view){ + //TODO + } + } + +} diff --git a/app/src/main/java/com/infinity/massive/model/api/AndroidVersionInfoService.java b/app/src/main/java/com/infinity/massive/model/api/AndroidVersionInfoService.java new file mode 100644 index 0000000..19d5221 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/model/api/AndroidVersionInfoService.java @@ -0,0 +1,23 @@ +package com.infinity.massive.model.api; + +import com.infinity.massive.model.pojo.Android; + +import java.util.List; + +import retrofit.Call; +import retrofit.http.GET; +import retrofit.http.Path; + +/** + * Created by Ilanthirayan on 26/1/16. + */ +public interface AndroidVersionInfoService { + + @GET("android") + Call> getAndroidVersions(); + + @GET("android/{device_id}") + Call getAndroidVersionDetails( + @Path("device_id") int device_id + ); +} diff --git a/app/src/main/java/com/infinity/massive/model/api/DeviceInfoService.java b/app/src/main/java/com/infinity/massive/model/api/DeviceInfoService.java new file mode 100644 index 0000000..e286ab8 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/model/api/DeviceInfoService.java @@ -0,0 +1,23 @@ +package com.infinity.massive.model.api; + +import com.infinity.massive.model.pojo.Devices; + +import java.util.List; + +import retrofit.Call; +import retrofit.http.GET; +import retrofit.http.Path; + +/** + * Created by Ilanthirayan on 26/1/16. + */ +public interface DeviceInfoService { + + @GET("devices") + Call> getDevices(); + + @GET("devices/{device_id}") + Call getDeviceDetails( + @Path("device_id") int device_id + ); +} diff --git a/app/src/main/java/com/infinity/massive/model/pojo/Android.java b/app/src/main/java/com/infinity/massive/model/pojo/Android.java new file mode 100644 index 0000000..b8db3d3 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/model/pojo/Android.java @@ -0,0 +1,67 @@ +package com.infinity.massive.model.pojo; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class Android { + + private String id; + private String codename; + private String name; + private String target; + private String distribution; + private String version; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCodename() { + return codename; + } + + public void setCodename(String codename) { + this.codename = codename; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public String getDistribution() { + return distribution; + } + + public void setDistribution(String distribution) { + this.distribution = distribution; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @Override + public String toString() { + return "ClassPojo [id = " + id + ", codename = " + codename + ", name = " + name + ", target = " + target + ", distribution = " + distribution + ", version = " + version + "]"; + } +} diff --git a/app/src/main/java/com/infinity/massive/model/pojo/Devices.java b/app/src/main/java/com/infinity/massive/model/pojo/Devices.java new file mode 100644 index 0000000..a506961 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/model/pojo/Devices.java @@ -0,0 +1,106 @@ +package com.infinity.massive.model.pojo; + +import android.content.ContentValues; +import android.database.Cursor; +import android.provider.BaseColumns; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class Devices { + + public static final String TABLE_NAME = "tbl_device"; + + private int id; + private String imageUrl; + private String name; + private int androidId; + private String snippet; + + public Devices(){} + + public interface Columns extends BaseColumns { + String DEVICE_ID = "id"; + String IMAGE_URL = "image_url"; + String NAME = "name"; + String ANDROID_ID = "androidId"; + String SNIPPET = "snippet"; + } + + public Devices(Cursor cursor){ + fromCursor(cursor); + } + + private void fromCursor(Cursor cursor) { + int i = cursor.getColumnIndexOrThrow(Columns.DEVICE_ID); + setId(cursor.getInt(i)); + + i = cursor.getColumnIndexOrThrow(Columns.IMAGE_URL); + setImageUrl(cursor.getString(i)); + + i = cursor.getColumnIndexOrThrow(Columns.NAME); + setName(cursor.getString(i)); + + i = cursor.getColumnIndexOrThrow(Columns.ANDROID_ID); + setAndroidId(cursor.getInt(i)); + + i = cursor.getColumnIndexOrThrow(Columns.SNIPPET); + setSnippet(cursor.getString(i)); + + } + + public ContentValues toContentValues() { + final ContentValues values = new ContentValues(); + values.put(Columns.DEVICE_ID, getId()); + values.put(Columns.IMAGE_URL, getImageUrl()); + values.put(Columns.NAME, getName()); + values.put(Columns.ANDROID_ID, getAndroidId()); + values.put(Columns.SNIPPET, getSnippet()); + return values; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAndroidId() { + return androidId; + } + + public void setAndroidId(int androidId) { + this.androidId = androidId; + } + + public String getSnippet() { + return snippet; + } + + public void setSnippet(String snippet) { + this.snippet = snippet; + } + + @Override + public String toString() { + return "ClassPojo [id = " + id + ", imageUrl = " + imageUrl + ", name = " + name + ", androidId = " + androidId + ", snippet = " + snippet + "]"; + } +} diff --git a/app/src/main/java/com/infinity/massive/model/pojo/ParentResponse.java b/app/src/main/java/com/infinity/massive/model/pojo/ParentResponse.java new file mode 100644 index 0000000..664a9e0 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/model/pojo/ParentResponse.java @@ -0,0 +1,34 @@ +package com.infinity.massive.model.pojo; + +import com.infinity.massive.model.pojo.Android; +import com.infinity.massive.model.pojo.Devices; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class ParentResponse { + + private Android[] android; + private Devices[] devices; + + public Android[] getAndroid() { + return android; + } + + public void setAndroid(Android[] android) { + this.android = android; + } + + public Devices[] getDevices() { + return devices; + } + + public void setDevices(Devices[] devices) { + this.devices = devices; + } + + @Override + public String toString() { + return "ClassPojo [android = " + android + ", devices = " + devices + "]"; + } +} diff --git a/app/src/main/java/com/infinity/massive/utils/DBHelper.java b/app/src/main/java/com/infinity/massive/utils/DBHelper.java new file mode 100644 index 0000000..a8efe52 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/utils/DBHelper.java @@ -0,0 +1,63 @@ +package com.infinity.massive.utils; + +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.util.Log; + +import com.infinity.massive.ApplicationMassiveInfinity; +import com.infinity.massive.model.pojo.Devices; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class DBHelper extends SQLiteOpenHelper { + + private static final String DB_NAME = "redmart_container.db"; + private static final int DB_VERSION = 1; + private static final String TAG = DBHelper.class.getSimpleName(); + private static final String CREATE_INDEX = "CREATE INDEX IF NOT EXISTS "; + + enum INSTANCE { + INSTANCE; + final DBHelper instance = new DBHelper(); + } + + private DBHelper() { + super(ApplicationMassiveInfinity.getContext(), DB_NAME, null, DB_VERSION); + } + + public static DBHelper getInstance() { + return INSTANCE.INSTANCE.instance; + } + + private static final String CREATE_TABLE_DEVICE = "CREATE TABLE " + + Devices.TABLE_NAME + " (" + + Devices.Columns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + + Devices.Columns.DEVICE_ID + " INTEGER, " + + Devices.Columns.IMAGE_URL + " TEXT, " + + Devices.Columns.NAME + " TEXT, " + + Devices.Columns.ANDROID_ID + " TEXT, " + + Devices.Columns.SNIPPET + " TEXT); "; + + private static final String CREATE_DEVICE_INDEX_ID = CREATE_INDEX + + " index_based_id ON " + + Devices.TABLE_NAME + "(" + + Devices.Columns.DEVICE_ID + ");"; + + @Override + public void onCreate(SQLiteDatabase db) { + Log.d(TAG, "db onCreate"); + //CREATE TABLES + db.execSQL(CREATE_TABLE_DEVICE); + + //CREATE INDICES + db.execSQL(CREATE_DEVICE_INDEX_ID); + + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + Log.d(TAG, "db onUpgrade"); + //UPGRADE + } +} diff --git a/app/src/main/java/com/infinity/massive/utils/DataBaseClient.java b/app/src/main/java/com/infinity/massive/utils/DataBaseClient.java new file mode 100644 index 0000000..6221e01 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/utils/DataBaseClient.java @@ -0,0 +1,98 @@ +package com.infinity.massive.utils; + +import android.database.Cursor; +import android.database.DatabaseUtils; +import android.database.sqlite.SQLiteDatabase; +import android.util.Log; + +import com.infinity.massive.model.pojo.Devices; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class DataBaseClient { + + private static final String TAG = DataBaseClient.class.getSimpleName(); + + enum INSTANCE { + INSTANCE; + public final DataBaseClient instance = new DataBaseClient(); + } + + public static DataBaseClient getInstance() { + return INSTANCE.INSTANCE.instance; + } + + private DataBaseClient() {} + + public synchronized void insertDevices(final List devicesList, boolean fromService){ + final SQLiteDatabase db = DBHelper.getInstance().getWritableDatabase(); + try{ + db.beginTransaction(); + //FROM SERVICE DOWNLOAD IS FIRST SET OF DEVICES SO CLEAR THE TABLE + if(fromService){ + //clear the table before insert in to the table + db.delete(Devices.TABLE_NAME, null, null); + } + for(Devices devices : devicesList){ + //INSERT INTO tbl_product + boolean successProduct = db.insert(Devices.TABLE_NAME, null, devices.toContentValues()) > 0 ; + if(successProduct){ + Log.d(TAG, "Successfully inserted in to Devices.TABLE_NAME."); + }else{ + Log.d(TAG, "Not inserted in to Devices.TABLE_NAME."); + } + } + db.setTransactionSuccessful(); + }catch(Exception e){ + e.printStackTrace(); + }finally { + db.endTransaction(); + db.close(); + } + } + + + public synchronized List getDevices(){ + List devicesList = new ArrayList<>(); + final SQLiteDatabase db = DBHelper.getInstance().getReadableDatabase(); + Cursor cursorDeviceList = db.query(Devices.TABLE_NAME, + null, null, null, null, null, Devices.Columns._ID + " ASC"); + while(cursorDeviceList.moveToNext()){ + devicesList.add(new Devices(cursorDeviceList)); + } + cursorDeviceList.close(); + return devicesList; + } + + public synchronized Devices getDeviceDetails(int device_id){ + Devices devices; + final SQLiteDatabase db = DBHelper.getInstance().getReadableDatabase(); + final String selectionDevice = Devices.Columns.DEVICE_ID + " = ? "; + final String [] selectionArgsDevices = {String.valueOf(device_id)}; + Cursor cursorDevice = db.query(Devices.TABLE_NAME, null, + selectionDevice, selectionArgsDevices, null, null, null); + if(cursorDevice.moveToNext()) { + devices = new Devices(cursorDevice); + }else{ + devices = new Devices(); + } + + return devices; + } + + + /** + * Check if there is at least one Product Exist or Not + * + * @return {@link java.lang.Boolean} + */ + public synchronized boolean hasAnyDevices(){ + final SQLiteDatabase db = DBHelper.getInstance().getReadableDatabase(); + return DatabaseUtils.longForQuery(db, "SELECT COUNT(*) FROM " + Devices.TABLE_NAME + + " LIMIT 1", null) > 0 ; + } +} diff --git a/app/src/main/java/com/infinity/massive/utils/Utils.java b/app/src/main/java/com/infinity/massive/utils/Utils.java new file mode 100644 index 0000000..875b03c --- /dev/null +++ b/app/src/main/java/com/infinity/massive/utils/Utils.java @@ -0,0 +1,35 @@ +package com.infinity.massive.utils; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; + +import com.infinity.massive.ApplicationMassiveInfinity; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class Utils { + + /** + * Checks whether there's connection to Internet. + * + * @return true if there's connection or false otherwise + */ + public static boolean isOnline() { + ConnectivityManager cm = (ConnectivityManager) ApplicationMassiveInfinity.getContext().getSystemService(Context.CONNECTIVITY_SERVICE); + + NetworkInfo wifiNetwork = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI); + if (wifiNetwork != null && wifiNetwork.isConnected()) { + return true; + } + + NetworkInfo mobileNetwork = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); + if (mobileNetwork != null && mobileNetwork.isConnected()) { + return true; + } + + NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); + return activeNetwork != null && activeNetwork.isConnected(); + } +} diff --git a/app/src/main/java/com/infinity/massive/view/activity/AndroidVersionDetailsActivity.java b/app/src/main/java/com/infinity/massive/view/activity/AndroidVersionDetailsActivity.java new file mode 100644 index 0000000..2809787 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/view/activity/AndroidVersionDetailsActivity.java @@ -0,0 +1,161 @@ +package com.infinity.massive.view.activity; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import com.infinity.massive.R; +import com.infinity.massive.controller.AndroidVersionController; +import com.infinity.massive.model.pojo.Android; +import com.infinity.massive.model.pojo.Devices; +import com.infinity.massive.utils.DataBaseClient; +import com.squareup.picasso.Picasso; + +import retrofit.Call; +import retrofit.Callback; +import retrofit.Response; +import retrofit.Retrofit; + +/** + * Created by Ilanthirayan on 26/1/16. + */ +public class AndroidVersionDetailsActivity extends AppCompatActivity { + + private static final String TAG = AndroidVersionDetailsActivity.class.getSimpleName(); + + public static final String EXTRAS_MASSIVE_INFINITY_DEVICE_ID = "extra_massive_infinity_device_id"; + + private RelativeLayout emptyOrLoadingLayout; + private ProgressBar loadingProgress; + private TextView emptyMessageTxt; + private Toolbar toolbar; + + private int device_id; + private Devices device; + private Android androidVersionObj; + + private ImageView deviceImg; + private TextView deviceNameTxt; + private TextView deviceIdTxt; + private TextView deviceDescriptionTxt; + private TextView androidVersionTxt; + + + //ANDROID VERSION + private TextView androidVersionCodeNameTxt; + private TextView androidVersionName; + private TextView androidVersionTarget; + private TextView androidVersionDistribution; + private TextView androidVersion; + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_android_version_details); + + //ACTION TOOL BAR + toolbar = (Toolbar) findViewById(R.id.toolbar); + + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + setTitle("Android Version"); + + emptyOrLoadingLayout = (RelativeLayout) findViewById(R.id.loading_empty_msg_layout); + emptyMessageTxt = (TextView) findViewById(R.id.empty_message_txt); + loadingProgress = (ProgressBar) findViewById(R.id.progressAndroidVersionDetailsLayout); + deviceNameTxt = (TextView) findViewById(R.id.device_name_txt); + deviceIdTxt = (TextView) findViewById(R.id.device_description_txt); + deviceDescriptionTxt = (TextView) findViewById(R.id.device_id_txt); + androidVersionTxt = (TextView) findViewById(R.id.android_version_txt); + deviceImg = (ImageView)findViewById(R.id.device_image); + + androidVersionCodeNameTxt = (TextView) findViewById(R.id.android_version_code_name_txt); + androidVersionName = (TextView) findViewById(R.id.android_version_name_txt); + androidVersionTarget = (TextView) findViewById(R.id.android_version_target_txt); + androidVersionDistribution = (TextView) findViewById(R.id.android_version_distribution_txt); + androidVersion = (TextView) findViewById(R.id.android_version_version_txt); + + Bundle extras = getIntent().getExtras(); + + if(extras != null) { + device_id = extras.getInt(EXTRAS_MASSIVE_INFINITY_DEVICE_ID); + /* + * Instead of getting over the internet can from SQLite + * which has been save already. + */ + getDeviceDetailsFromDataBase(); + }else{ + loadingProgress.setVisibility(View.GONE); + emptyMessageTxt.setVisibility(View.VISIBLE); + } + } + + private void getDeviceDetailsFromDataBase(){ + device = DataBaseClient.getInstance().getDeviceDetails(device_id); + if(device != null){ + emptyOrLoadingLayout.setVisibility(View.GONE); + deviceNameTxt.setText(device.getName()); + deviceDescriptionTxt.setText(device.getSnippet()); + deviceIdTxt.setText("Device ID :: "+String.valueOf(device.getId())); + androidVersionTxt.setText("Android ID :: " +device.getAndroidId()); + //Get the product image + if(device.getImageUrl() != null) { + Picasso.with(this).load(device.getImageUrl()).into(deviceImg); + } + getAndroidVersionDetails(); + }else{ + loadingProgress.setVisibility(View.GONE); + emptyMessageTxt.setVisibility(View.VISIBLE); + } + } + + private void getAndroidVersionDetails() { + AndroidVersionController mAndroidVersionController = new AndroidVersionController(); + Call response = mAndroidVersionController.getProductDetailsService(device.getAndroidId()); + response.enqueue(new Callback() { + @Override + public void onResponse(Response response, Retrofit retrofit) { + Log.d(TAG, "Response Raw :: " + response.raw()); + if (response.body() != null) { + //SUCCESSFULLY ANDROID VERSION RECEIVE + androidVersionObj = response.body(); + + androidVersionCodeNameTxt.setText(androidVersionObj.getCodename()); + androidVersionName.setText(androidVersionObj.getName()); + androidVersionTarget.setText(androidVersionObj.getTarget()); + androidVersionDistribution.setText(androidVersionObj.getDistribution()); + androidVersion.setText(androidVersionObj.getVersion()); + }else{ + findViewById(R.id.android_version_layout).setVisibility(View.GONE); + } + } + + @Override + public void onFailure(Throwable e) { + Log.d(TAG, "onFailure: " + e.getMessage()); + findViewById(R.id.android_version_layout).setVisibility(View.GONE); + } + }); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + +} diff --git a/app/src/main/java/com/infinity/massive/view/activity/DeviceListActivity.java b/app/src/main/java/com/infinity/massive/view/activity/DeviceListActivity.java new file mode 100644 index 0000000..1c232a9 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/view/activity/DeviceListActivity.java @@ -0,0 +1,115 @@ +package com.infinity.massive.view.activity; + +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.support.design.widget.NavigationView; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.view.GravityCompat; +import android.support.v4.widget.DrawerLayout; +import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.View; +import android.view.MenuItem; + +import com.infinity.massive.R; +import com.infinity.massive.view.fragment.DeviceListFragment; + +public class DeviceListActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { + + + private static final long DRAWER_CLOSE_DELAY_MS = 250; + + private Fragment fragment; + + private DrawerLayout mDrawerLayout; + private Toolbar toolbar; + private NavigationView navigationView; + + private ActionBarDrawerToggle mDrawerToggle; + private int mNavItemId; + private final Handler mDrawerActionHandler = new Handler(); + + + @Override + public void onBackPressed(){ + if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { + mDrawerLayout.closeDrawer(GravityCompat.START); + return; + } + super.onBackPressed(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_device_list); + + if(android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT){ + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); + } + + mDrawerLayout = (DrawerLayout) findViewById(R.id.main_drawer_layout); + + + toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + // load saved navigation state if present + if (null == savedInstanceState) { + mNavItemId = R.id.nav_home; + } + + navigationView = (NavigationView) findViewById(R.id.nav_view); + if (navigationView != null) { + navigationView.setNavigationItemSelectedListener(this); + } + + // set up the hamburger icon to open and close the drawer + mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.open, + R.string.close); + mDrawerLayout.setDrawerListener(mDrawerToggle); + mDrawerToggle.syncState(); + + //initialise drawer menu selection + navigate(mNavItemId); + + fragment = DeviceListFragment.getInstance(this); + FragmentManager fragmentManager = getSupportFragmentManager(); + fragmentManager.beginTransaction().replace(R.id.home_screen_container, fragment).commit(); + + } + + @Override + public boolean onNavigationItemSelected(MenuItem menuItem) { + mNavItemId = menuItem.getItemId(); + + // allow some time after closing the drawer before performing real navigation + // so the user can see what is happening + mDrawerLayout.closeDrawer(GravityCompat.START); + mDrawerActionHandler.postDelayed(new Runnable() { + @Override + public void run() { + navigate(mNavItemId); + } + }, DRAWER_CLOSE_DELAY_MS); + return true; + } + + + private void navigate(final int itemId) { + // select the correct nav menu item + navigationView.getMenu().findItem(R.id.nav_home).setChecked(true); + + switch(itemId){ + case R.id.nav_home: + break; + default: + break; + } + } +} diff --git a/app/src/main/java/com/infinity/massive/view/fragment/DeviceListFragment.java b/app/src/main/java/com/infinity/massive/view/fragment/DeviceListFragment.java new file mode 100644 index 0000000..b3724a3 --- /dev/null +++ b/app/src/main/java/com/infinity/massive/view/fragment/DeviceListFragment.java @@ -0,0 +1,134 @@ +package com.infinity.massive.view.fragment; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.support.v7.widget.DefaultItemAnimator; +import android.support.v7.widget.GridLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.StaggeredGridLayoutManager; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.infinity.massive.ApplicationMassiveInfinity; +import com.infinity.massive.R; +import com.infinity.massive.controller.service.DeviceDownloadService; +import com.infinity.massive.model.adapter.DeviceListViewAdapter; +import com.infinity.massive.model.pojo.Devices; +import com.infinity.massive.utils.DataBaseClient; + +import java.util.List; + +/** + * Created by Ilanthirayan on 25/1/16. + */ +public class DeviceListFragment extends Fragment{ + + private static final String TAG = DeviceListFragment.class.getSimpleName(); + + private DeviceListViewAdapter adapter; + private ProgressBar progressBar; + private TextView emptyListText; + private Activity mActivity; + + private RecyclerView mRecyclerView; + + private StaggeredGridLayoutManager mStaggeredGridLayoutManager ; + private List devicesList; + + + public static DeviceListFragment getInstance(Activity mActivity){ + DeviceListFragment fragment = new DeviceListFragment(); + fragment.mActivity = mActivity; + return fragment; + } + + final BroadcastReceiver downloadFinishedReceiver = new BroadcastReceiver() { + @Override + public void onReceive(final Context context, final Intent intent) { + displayEmptyOrList(); + } + }; + + @Override + public final void onDestroy(){ + super.onDestroy(); + ApplicationMassiveInfinity.getLbm().unregisterReceiver(downloadFinishedReceiver); + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + DeviceDownloadService.start(false, null); + } + + protected final void displayEmptyOrList() { + if (mActivity == null) + return; + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + final int downloading = DeviceDownloadService.getRemainingBlockRenderProductLayoutDownloads(); + + if (downloading > 0) { + progressBar.setVisibility(View.VISIBLE); + mRecyclerView.setVisibility(View.GONE); + emptyListText.setVisibility(View.GONE); + Log.d(TAG, "@@displayEmptyOrList showing progress bar"); + return; + } + + if (!DataBaseClient.getInstance().hasAnyDevices()) { + progressBar.setVisibility(View.GONE); + mRecyclerView.setVisibility(View.GONE); + emptyListText.setVisibility(View.VISIBLE); + Log.d(TAG, "@@displayEmptyOrList showing empty device list message"); + return; + } + + //NORMAL DISPLAY + progressBar.setVisibility(View.GONE); + mRecyclerView.setVisibility(View.VISIBLE); + emptyListText.setVisibility(View.GONE); + initializeAdapter(); + Log.d(TAG, "@@displayEmptyOrList showing the device list"); + + } + }); + } + + private void initializeAdapter(){ + //initialise here otherwise list will be null + devicesList = DataBaseClient.getInstance().getDevices(); + adapter = new DeviceListViewAdapter(getActivity(), devicesList); + mRecyclerView.setAdapter(adapter); + } + + + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + ViewGroup view = (ViewGroup)inflater.inflate(R.layout.fragment_device, container, false); + + progressBar = (ProgressBar) view.findViewById(R.id.progressDeviceLayout); + emptyListText = (TextView) view.findViewById(R.id.device_empty_list_msg); + ApplicationMassiveInfinity.getLbm().registerReceiver(downloadFinishedReceiver, + new IntentFilter(DeviceDownloadService.ACTION_BLOCK_RENDER_DEVICE_DOWNLOAD_FINISHED)); + + //CARD VIEW + mRecyclerView = (RecyclerView) view.findViewById(R.id.device_recycle_list); + mRecyclerView.setHasFixedSize(true); + mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); + mRecyclerView.setLayoutManager(mStaggeredGridLayoutManager); + + return view; + } +} diff --git a/app/src/main/res/color/nav_text_state.xml b/app/src/main/res/color/nav_text_state.xml new file mode 100644 index 0000000..d5ec384 --- /dev/null +++ b/app/src/main/res/color/nav_text_state.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v1/default_profile_image.png b/app/src/main/res/drawable-v1/default_profile_image.png new file mode 100644 index 0000000..30060b5 Binary files /dev/null and b/app/src/main/res/drawable-v1/default_profile_image.png differ diff --git a/app/src/main/res/drawable-v1/menu_ic_home.png b/app/src/main/res/drawable-v1/menu_ic_home.png new file mode 100644 index 0000000..9f61d7b Binary files /dev/null and b/app/src/main/res/drawable-v1/menu_ic_home.png differ diff --git a/app/src/main/res/layout/activity_android_version_details.xml b/app/src/main/res/layout/activity_android_version_details.xml new file mode 100644 index 0000000..24d86af --- /dev/null +++ b/app/src/main/res/layout/activity_android_version_details.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_device_list.xml b/app/src/main/res/layout/activity_device_list.xml new file mode 100644 index 0000000..66356fc --- /dev/null +++ b/app/src/main/res/layout/activity_device_list.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/adapter_item_device_view.xml b/app/src/main/res/layout/adapter_item_device_view.xml new file mode 100644 index 0000000..1175da4 --- /dev/null +++ b/app/src/main/res/layout/adapter_item_device_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/android_version_details_container.xml b/app/src/main/res/layout/android_version_details_container.xml new file mode 100644 index 0000000..44f415a --- /dev/null +++ b/app/src/main/res/layout/android_version_details_container.xml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/content_device_list.xml b/app/src/main/res/layout/content_device_list.xml new file mode 100644 index 0000000..448bc15 --- /dev/null +++ b/app/src/main/res/layout/content_device_list.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/app/src/main/res/layout/fragment_device.xml b/app/src/main/res/layout/fragment_device.xml new file mode 100644 index 0000000..2f0474f --- /dev/null +++ b/app/src/main/res/layout/fragment_device.xml @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git a/app/src/main/res/layout/nav_header.xml b/app/src/main/res/layout/nav_header.xml new file mode 100644 index 0000000..c7fa9ca --- /dev/null +++ b/app/src/main/res/layout/nav_header.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/progress_item.xml b/app/src/main/res/layout/progress_item.xml new file mode 100644 index 0000000..10c8c5c --- /dev/null +++ b/app/src/main/res/layout/progress_item.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/drawer_view.xml b/app/src/main/res/menu/drawer_view.xml new file mode 100644 index 0000000..b44216c --- /dev/null +++ b/app/src/main/res/menu/drawer_view.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_device_list.xml b/app/src/main/res/menu/menu_device_list.xml new file mode 100644 index 0000000..0b61157 --- /dev/null +++ b/app/src/main/res/menu/menu_device_list.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/menu/menu_home.xml b/app/src/main/res/menu/menu_home.xml new file mode 100644 index 0000000..992100f --- /dev/null +++ b/app/src/main/res/menu/menu_home.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..aee44e1 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..251fb9f --- /dev/null +++ b/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,9 @@ +> + + + diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml new file mode 100644 index 0000000..ed998fa --- /dev/null +++ b/app/src/main/res/values/config.xml @@ -0,0 +1,4 @@ + + + http://mobilesandboxdev.azurewebsites.net + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..812cb7b --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,6 @@ + + + 16dp + 16dp + 16dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..81807e6 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + MassiveInfinity + Settings + open + close + Could not find the devices. Please Try again later. + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..545b9c6 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + +