diff --git a/app/src/main/java/com/amine/myterio/app/MainActivity.java b/app/src/main/java/com/amine/myterio/app/MainActivity.java
index 45ba3cf..3b4c995 100644
--- a/app/src/main/java/com/amine/myterio/app/MainActivity.java
+++ b/app/src/main/java/com/amine/myterio/app/MainActivity.java
@@ -1,9 +1,12 @@
package com.amine.myterio.app;
+import android.content.Context;
+import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
+import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@@ -12,6 +15,25 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+ Toast.makeText(getApplicationContext(), getSizeName(this), Toast.LENGTH_LONG).show();
+ }
+
+ private static String getSizeName(Context context) {
+ int screenLayout = context.getResources().getConfiguration().screenLayout;
+ screenLayout &= Configuration.SCREENLAYOUT_SIZE_MASK;
+
+ switch (screenLayout) {
+ case Configuration.SCREENLAYOUT_SIZE_SMALL:
+ return "small";
+ case Configuration.SCREENLAYOUT_SIZE_NORMAL:
+ return "normal";
+ case Configuration.SCREENLAYOUT_SIZE_LARGE:
+ return "large";
+ case 4: // Configuration.SCREENLAYOUT_SIZE_XLARGE is API >= 9
+ return "xlarge";
+ default:
+ return "undefined";
+ }
}
@Override
diff --git a/app/src/main/res/layout-xlarge/activity_search.xml b/app/src/main/res/layout-xlarge/activity_search.xml
index 23964f2..8e9d28a 100644
--- a/app/src/main/res/layout-xlarge/activity_search.xml
+++ b/app/src/main/res/layout-xlarge/activity_search.xml
@@ -1,4 +1,4 @@
-
-
+
diff --git a/app/src/main/res/layout-xlarge/search_fragment.xml b/app/src/main/res/layout-xlarge/search_fragment.xml
index 5591c63..b691300 100644
--- a/app/src/main/res/layout-xlarge/search_fragment.xml
+++ b/app/src/main/res/layout-xlarge/search_fragment.xml
@@ -11,7 +11,7 @@
diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml
index 4bfb364..8e9d28a 100644
--- a/app/src/main/res/layout/activity_search.xml
+++ b/app/src/main/res/layout/activity_search.xml
@@ -1,23 +1,15 @@
-
-
+
-
-
-
+
diff --git a/app/src/main/res/layout/search_fragment.xml b/app/src/main/res/layout/search_fragment.xml
new file mode 100644
index 0000000..b691300
--- /dev/null
+++ b/app/src/main/res/layout/search_fragment.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+