1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281

    public class StoreDescription extends Activity implements OnClickListener
{
	public static final String TAG = "StoreDescription";
	
	String favs;
	
	ExpandablePanel descPanel, infoPanel;

	PullToRefreshListView listViewSearch;
	
	HeaderBar _headerBar;
	FooterBar _footerBar;
	
	Button _btnBack, btnSearch;
	
	EditText _txtAutoSearch;
	
	int posFavDAO;
	
	TextView txtHeader1, txtHeader2, txtHome, 
		     txtEvent, txtFeatured, txtTonight, txtMore, 
		     txtListingTitle, txtStoreAddress, txtStorePhone,
		     txtStoreWebsite, txtDescTitle, txtStoreDescription,
		     txtStoreInfoTitle, txtStoreShareTitle, txtAgeGroupData, 
		     txtCoverChargeData, txtDancingData, txtMusicData, txtDressCodeData,
		     txtParkingData, txtGroupData, txtBestNightData, txtHappyHourData, 
		     txtAlcohalData, txtCoatCheckData, txtFbHeader,
		     txtTwHeader, txtSmsHeader, txtSchedTitle, txtScheduleDate,
		     txtScheduleBar, txtTicket, txtTicketGet, 
		     txtTicketPrice, txtShowMoreLess, txtShowMoreLess1,
		     txtNoData;
	
	ImageView imgTabHome, imgTabEvent, imgTabFeatured, imgTabTonight, 
			  imgTabMore, imgStoreBar, imgMoreLess, 
			  imgMoreLess1;
	
	ImageView imgListingPhoto;
	
	ImageButton btnFav;
	
	View view4, view5;
	
	LinearLayout linTabHome, linTabEvent, linTabFeatured, linTabTonight, 
				 linTabMore, linStoreDesc, linStoreDescTitle,
				 linStoreSchedTitle, linStoreSched, linStoreTicketTitle, 
				 linStoreInfo, linAgeGroup, linCoverCharge,
				 linDancing, linMusic, linDressCode, linParking,
				 linGroups, linBestNight, linHappyhour, linAlcohal,
				 linCoatCheck;
	
	ScrollView scrollLayout;
	
	RelativeLayout linStoreTicket, relExpandaDesc, relExpandaInfo, 
				   relImgFb, relImgTwitter, relImgSms,
				   relStoreAddress, relStoreContact, relStoreWebsite;
	
	public StoreDescriptionDAO mStoreDescDAO;
	
	SNDatabaseHandler dbHandler;
	
	boolean isAlreadyFavorite = false;
	
	private String intentFromClass, favListId;
	
	ImageLoader imageLoader;
	
	DisplayImageOptions options;
	
	String messageToPost;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		
		intentFromClass = getIntent().getStringExtra("INTENTFROMCLASS");
		Log.v(TAG, "intent from class: "+intentFromClass);
		
		favListId = getFavListId(intentFromClass);
		
		dbHandler = new SNDatabaseHandler(StoreDescription.this);
		
		init();
	}//onCreate
	
	private void init() 
	{
		setContentView(R.layout.store_description);
		
		imageLoader = ImageLoader.getInstance();
		
		imageLoader.init(ImageLoaderConfiguration.createDefault(StoreDescription.this));
		
		options = new DisplayImageOptions.Builder()
					.showStubImage(R.drawable.image_for_empty_url)
					.showImageForEmptyUri(R.drawable.image_for_empty_url)
					.cacheInMemory()
					.cacheOnDisc()
					.bitmapConfig(Bitmap.Config.RGB_565)
					.build();
		
		_headerBar = (HeaderBar)findViewById(R.id.baseHeaderBar);
		_footerBar = (FooterBar)findViewById(R.id.baseFooterBar);
		
		listViewSearch = (PullToRefreshListView)findViewById(R.id.listViewSearch);
		
		_txtAutoSearch = (EditText)findViewById(R.id.autoTxtSearch);
		
		scrollLayout = (ScrollView)findViewById(R.id.scrollLayout);
		
		txtHeader1 = (TextView)findViewById(R.id.txtHeader1);
		txtHeader2 = (TextView)findViewById(R.id.txtHeader2);
		txtHome = (TextView)findViewById(R.id.txtHome);
		txtEvent = (TextView)findViewById(R.id.txtEvents);
		txtFeatured = (TextView)findViewById(R.id.txtFeatured);
		txtTonight = (TextView)findViewById(R.id.txtTonight);
		txtMore = (TextView)findViewById(R.id.txtMore);
		txtShowMoreLess = (TextView)findViewById(R.id.txtShowMoreLess);
		txtShowMoreLess1 = (TextView)findViewById(R.id.txtShowMoreLess1);
		
		_btnBack = (Button)findViewById(R.id.btnBack);
		btnSearch = (Button)findViewById(R.id.btnSearch);
		
		btnFav = (ImageButton)findViewById(R.id.btnFav);
		
		view4 = (View)findViewById(R.id.view4);
		view5 = (View)findViewById(R.id.view5);
		
		linTabHome = (LinearLayout)findViewById(R.id.linTabHome);
		linTabEvent = (LinearLayout)findViewById(R.id.linTabEvent);
		linTabFeatured = (LinearLayout)findViewById(R.id.linTabFeatured);
		linTabTonight = (LinearLayout)findViewById(R.id.linTabTonight);
		linTabMore = (LinearLayout)findViewById(R.id.linTabMore);
		linStoreDesc = (LinearLayout)findViewById(R.id.linStoreDesc);
		linStoreDescTitle = (LinearLayout)findViewById(R.id.linStoreDescTitle);
		linStoreSchedTitle = (LinearLayout)findViewById(R.id.linStoreSchedTitle);
		linStoreSched = (LinearLayout)findViewById(R.id.linStoreSched);
		linStoreTicketTitle = (LinearLayout)findViewById(R.id.linStoreTicketTitle);
		linStoreTicket = (RelativeLayout)findViewById(R.id.linStoreTicket);
		linStoreInfo = (LinearLayout)findViewById(R.id.linStoreInfo);
		linAgeGroup = (LinearLayout)findViewById(R.id.linAgeGroup);
		linCoverCharge = (LinearLayout)findViewById(R.id.linCoverCharge);
		linDancing = (LinearLayout)findViewById(R.id.linDancing);
		linMusic = (LinearLayout)findViewById(R.id.linMusic);
		linDressCode = (LinearLayout)findViewById(R.id.linDressCode);
		linParking = (LinearLayout)findViewById(R.id.linParking);
		linGroups = (LinearLayout)findViewById(R.id.linGroups);
		linBestNight = (LinearLayout)findViewById(R.id.linBestNight);
		linHappyhour = (LinearLayout)findViewById(R.id.linHappyHour);
		linAlcohal = (LinearLayout)findViewById(R.id.linAlcohal);
		linCoatCheck = (LinearLayout)findViewById(R.id.linCoatCheck);
		
		relExpandaDesc = (RelativeLayout)findViewById(R.id.expand);
		relExpandaInfo = (RelativeLayout)findViewById(R.id.expandInfo);
	
		relStoreAddress = (RelativeLayout)findViewById(R.id.relStoreAddress);
		relStoreContact = (RelativeLayout)findViewById(R.id.relStoreContact);
		relStoreWebsite = (RelativeLayout)findViewById(R.id.relStoreWeb);
		
		imgTabHome = (ImageView)findViewById(R.id.imgTabHome);
		imgTabEvent = (ImageView)findViewById(R.id.imgTabEvent);
		imgTabFeatured = (ImageView)findViewById(R.id.imgTabFeatured);
		imgTabTonight = (ImageView)findViewById(R.id.imgTabTonight);
		imgTabMore =  (ImageView)findViewById(R.id.imgTabMore);
		imgListingPhoto = (ImageView)findViewById(R.id.imgListingPhoto);
		relImgFb = (RelativeLayout)findViewById(R.id.relImgFb);
		relImgTwitter = (RelativeLayout)findViewById(R.id.relImgTwitter);
		relImgSms = (RelativeLayout)findViewById(R.id.relImgSms);
		imgStoreBar = (ImageView)findViewById(R.id.imgStoreBar);
		imgMoreLess = (ImageView)findViewById(R.id.imgMoreLess);
		imgMoreLess1 = (ImageView)findViewById(R.id.imgMoreLess1);
		
		txtListingTitle = (TextView)findViewById(R.id.txtListingTitle);
		txtStoreAddress = (TextView)findViewById(R.id.txtStoreAddress);
		txtStorePhone = (TextView)findViewById(R.id.txtStorePhone);
		txtStoreWebsite = (TextView)findViewById(R.id.txtStoreWebsite);
		txtDescTitle = (TextView)findViewById(R.id.txtDescTitle);
		txtStoreDescription = (TextView)findViewById(R.id.txtDesc);
		txtStoreInfoTitle = (TextView)findViewById(R.id.txtStoreInfoTittle);
		txtStoreShareTitle = (TextView)findViewById(R.id.txtStoreShareTittle);
		txtAgeGroupData = (TextView)findViewById(R.id.txtAgeGroupData);
		txtCoverChargeData = (TextView)findViewById(R.id.txtCoverChargeData);
		txtDancingData = (TextView)findViewById(R.id.txtDancingData);
		txtMusicData = (TextView)findViewById(R.id.txtMusicData);
		txtDressCodeData = (TextView)findViewById(R.id.txtDressCodeData);
		txtParkingData = (TextView)findViewById(R.id.txtParkingData);
		txtGroupData = (TextView)findViewById(R.id.txtGroupData);
		txtBestNightData = (TextView)findViewById(R.id.txtBestNightData);
		txtHappyHourData = (TextView)findViewById(R.id.txtHappyHourData);
		txtAlcohalData = (TextView)findViewById(R.id.txtAlcohalData);
		txtCoatCheckData = (TextView)findViewById(R.id.txtCoatCheckData);
		txtFbHeader = (TextView)findViewById(R.id.txtFbHeader);
		txtTwHeader = (TextView)findViewById(R.id.txtTwHeader);
		txtSmsHeader = (TextView)findViewById(R.id.txtSmsHeader);
		txtSchedTitle = (TextView)findViewById(R.id.txtSchedTitle);
		txtScheduleDate = (TextView)findViewById(R.id.txtScheduleDate);
		txtScheduleBar = (TextView)findViewById(R.id.txtScheduleBar);
		txtTicket = (TextView)findViewById(R.id.txtTicket);
		txtTicketGet = (TextView)findViewById(R.id.txtTicketGet);
		txtTicketPrice = (TextView)findViewById(R.id.txtTicketPrice);
		txtNoData = (TextView)findViewById(R.id.txtNoData);
		
		descPanel = (ExpandablePanel)findViewById(R.id.descPanel);
		infoPanel = (ExpandablePanel)findViewById(R.id.infoPanel);
		
		_headerBar.setVisibility(View.VISIBLE);
		_footerBar.setVisibility(View.VISIBLE);
		
		_btnBack.setVisibility(View.VISIBLE);
		
		txtHeader1.setVisibility(View.VISIBLE);
		txtHeader2.setVisibility(View.VISIBLE);
		
		listViewSearch.setVisibility(View.GONE);
		
		Typeface headerTF = Typeface.createFromAsset(getAssets(), "fonts/Y2K_neophyte.ttf");
		Typeface ic_nameTF = Typeface.createFromAsset(getAssets(), "fonts/arial.ttf");
		
		txtHeader1.setTypeface(headerTF);
		txtHeader2.setTypeface(headerTF);
		txtHome.setTypeface(ic_nameTF);
		txtEvent.setTypeface(ic_nameTF);
		txtFeatured.setTypeface(ic_nameTF);
		txtTonight.setTypeface(ic_nameTF);
		txtMore.setTypeface(ic_nameTF);
		txtFbHeader.setTypeface(ic_nameTF);
		txtTwHeader.setTypeface(ic_nameTF);
		txtSmsHeader.setTypeface(ic_nameTF);
		txtSchedTitle.setTypeface(ic_nameTF);
		txtScheduleDate.setTypeface(ic_nameTF);
		txtScheduleBar.setTypeface(ic_nameTF);
		txtTicket.setTypeface(ic_nameTF);
		txtTicketGet.setTypeface(ic_nameTF);
		txtTicketPrice.setTypeface(ic_nameTF);
		txtShowMoreLess.setTypeface(ic_nameTF);
		txtStoreShareTitle.setTypeface(ic_nameTF);
		txtDescTitle.setTypeface(ic_nameTF);
		txtStoreInfoTitle.setTypeface(ic_nameTF);
		txtStoreAddress.setTypeface(ic_nameTF);
		
		relStoreAddress.setOnClickListener(this);
		relStoreContact.setOnClickListener(this);
		relStoreWebsite.setOnClickListener(this);
	
		btnFav.setOnClickListener(this);
		btnSearch.setOnClickListener(this);
		
		relImgFb.setOnClickListener(this);
		relImgTwitter.setOnClickListener(this);
		relImgSms.setOnClickListener(this);
		
		linStoreSched.setOnClickListener(this);
		linStoreTicket.setOnClickListener(this);
		
		btnSearch.setOnClickListener(this);
		
		if(intentFromClass != null 
				&& !intentFromClass.equals("null") 
				&& !intentFromClass.equals(""))
		{
			updateUIResult(intentFromClass);
		}
	}//init
	private String getFavListId(String intentClass)
	{
		String listingId = null, idToMakeFav = null;
		
		if(intentClass.equals("Home"))
		{
			mStoreDescDAO = (StoreDescriptionDAO)getIntent().getSerializableExtra("NEIGHBOURSTOREDAO");
			if(mStoreDescDAO != null)
			{
				listingId = mStoreDescDAO.getListingId();
			}
		}
		idToMakeFav = "{"+listingId+"}";
		return idToMakeFav;
	}//getFavListPair
    }//StoreDescription