Commit 98c7671a by Kunj Gupta

Order service page is created.

parent e6f19928
package com.vsoft.uofl_catalogue.ui; package com.vsoft.uofl_catalogue.ui;
import android.app.Activity;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
...@@ -21,20 +24,40 @@ import com.vsoft.uofl_catalogue.utils.Constants; ...@@ -21,20 +24,40 @@ import com.vsoft.uofl_catalogue.utils.Constants;
import java.util.List; import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/** /**
* Created by Kunj on 11/8/16. * Created by Kunj on 11/8/16.
*/ */
public class CatalogueScreen extends Activity { public class CatalogueScreen extends AppCompatActivity {
@BindView(R.id.tool_bar_view) Toolbar mToolbar;
@BindView(R.id.catalogue_screen_list_view) ListView mListView;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.catalogue_screen);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
ActionBar actionBar = getSupportActionBar();
if(actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setElevation(0);
actionBar.setTitle(R.string.catalogue_category_string);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);
}
List<Catalogue> catalogueList = CatalogueManager.getAllCatalogues(); List<Catalogue> catalogueList = CatalogueManager.getAllCatalogues();
if(catalogueList.isEmpty()) { if(catalogueList.isEmpty()) {
new FetchCatalogue().execute(); new FetchCatalogue().execute();
} else { } else {
createView(catalogueList); setData(catalogueList);
} }
} }
...@@ -69,20 +92,16 @@ public class CatalogueScreen extends Activity { ...@@ -69,20 +92,16 @@ public class CatalogueScreen extends Activity {
if(progressDialog != null && progressDialog.isShowing()) { if(progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss(); progressDialog.dismiss();
} }
createView(CatalogueManager.getAllCatalogues()); setData(CatalogueManager.getAllCatalogues());
} }
} }
private void createView(final List<Catalogue> catalogueList) { private void setData(final List<Catalogue> catalogueList) {
ListView listView = new ListView(CatalogueScreen.this);
CatalogueCategoryAdapter adapter = new CatalogueCategoryAdapter(CatalogueScreen.this); CatalogueCategoryAdapter adapter = new CatalogueCategoryAdapter(CatalogueScreen.this);
adapter.setCatalogueList(catalogueList); adapter.setCatalogueList(catalogueList);
listView.setAdapter(adapter); mListView.setAdapter(adapter);
setContentView(listView); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, public void onItemClick(AdapterView<?> parent, View view,
...@@ -94,4 +113,13 @@ public class CatalogueScreen extends Activity { ...@@ -94,4 +113,13 @@ public class CatalogueScreen extends Activity {
} }
}); });
} }
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(menuItem);
}
} }
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="5dp" />
<stroke
android:width="1dp"
android:color="@color/bg_border_color" />
<solid
android:color="@android:color/white"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/list_item_height"
android:weightSum="10"> android:weightSum="10"
android:paddingLeft="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:background="@drawable/background_with_border">
<ImageView <ImageView
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="2.5" android:layout_weight="3"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@android:drawable/ic_dialog_dialer"/> android:src="@drawable/dummy_image"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="7.5" android:layout_weight="7"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/small_margin"> android:layout_gravity="center"
android:paddingLeft="@dimen/small_margin">
<TextView <TextView
android:id="@+id/catalogue_category_adapter_title_tv" android:id="@+id/catalogue_category_adapter_title_tv"
...@@ -24,6 +28,7 @@ ...@@ -24,6 +28,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:textSize="@dimen/normal_text_size" android:textSize="@dimen/normal_text_size"
android:textStyle="bold"
android:lines="1" /> android:lines="1" />
<TextView <TextView
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/screen_bg_color">
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@android:color/white"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"/>
<ListView
android:id="@+id/catalogue_screen_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:layout_margin="@dimen/normal_margin"
android:padding="@dimen/normal_margin"
android:divider="@android:color/white"
android:dividerHeight="@dimen/list_view_divider_height"
android:scrollbars="none"/>
</LinearLayout>
\ No newline at end of file
...@@ -12,4 +12,7 @@ ...@@ -12,4 +12,7 @@
<color name="login_screen_login_button_bg_color">@color/colorPrimary</color> <color name="login_screen_login_button_bg_color">@color/colorPrimary</color>
<color name="home_screen_bg_color">@color/colorPrimary</color> <color name="home_screen_bg_color">@color/colorPrimary</color>
<color name="screen_bg_color">#c0cfd1</color>
<color name="bg_border_color">#d6d6d6</color>
</resources> </resources>
...@@ -13,10 +13,14 @@ ...@@ -13,10 +13,14 @@
<dimen name="large_text_size">20sp</dimen> <dimen name="large_text_size">20sp</dimen>
<dimen name="separator_value">1dp</dimen> <dimen name="separator_value">1dp</dimen>
<dimen name="list_view_divider_height">5dp</dimen>
<!--Home Screen--> <!--Home Screen-->
<dimen name="home_screen_item_height">120dp</dimen> <dimen name="home_screen_item_height">120dp</dimen>
<!--Spinner Item height--> <!--Spinner Item height-->
<dimen name="spinner_item_height">40dp</dimen> <dimen name="spinner_item_height">40dp</dimen>
<dimen name="list_item_height">100dp</dimen>
</resources> </resources>
\ No newline at end of file
...@@ -28,4 +28,7 @@ ...@@ -28,4 +28,7 @@
<!--Catalogue Item Screen--> <!--Catalogue Item Screen-->
<string name="no_catalogue_item_string">No Catalogue Items&#8230;</string> <string name="no_catalogue_item_string">No Catalogue Items&#8230;</string>
<!--Catalogue Screen-->
<string name="catalogue_category_string">Catalogue Category</string>
</resources> </resources>
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item>
</style> </style>
<style name="WhiteBackgroundStyle" parent="@style/Theme.AppCompat"> <style name="WhiteBackgroundStyle" parent="@style/Theme.AppCompat">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment