Performed a refactor and removed unneeded files
Renamed package to org.RickBarretet.osj.forum refactored some layout names removed unused layout files Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* Constraints.java
|
||||
* @date Sep 13, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
/**
|
||||
* This class will be used to house the constraints of this application
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class Constraints {
|
||||
|
||||
/**
|
||||
* Set this boolean to true to use the test server
|
||||
*/
|
||||
public static final boolean TESTING = true;
|
||||
|
||||
/**
|
||||
* Set this boolean to true to enable debug logging
|
||||
*/
|
||||
public static final boolean DEBUG = true;
|
||||
|
||||
/**
|
||||
* Set this boolean to true to enable error logging
|
||||
*/
|
||||
public static final boolean ERROR = true;
|
||||
|
||||
/**
|
||||
* Set this boolean to true to enable info logging
|
||||
*/
|
||||
public static final boolean INFO = true;
|
||||
|
||||
/**
|
||||
* Set this boolean to true to enable verbose logging
|
||||
*/
|
||||
public static final boolean VERBOSE = true;
|
||||
|
||||
/**
|
||||
* Set this boolean to true to enable warning logging
|
||||
*/
|
||||
public static final boolean WARNING = true;
|
||||
|
||||
/**
|
||||
* Set this boolean to true to enable wtf logging
|
||||
*/
|
||||
public static final boolean WTF = true;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* ForumDetailActivity
|
||||
* @date Aug 29, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.view.MenuItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumDetailActivity extends FragmentActivity implements OnItemSelectedListener {
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_forum_detail);
|
||||
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
final Bundle arguments = new Bundle();
|
||||
arguments.putString(ForumDetailFragment.ARG_ITEM_ID, getIntent().getStringExtra(ForumDetailFragment.ARG_ITEM_ID));
|
||||
final ForumDetailFragment fragment = new ForumDetailFragment();
|
||||
fragment.setArguments(arguments);
|
||||
getSupportFragmentManager().beginTransaction().add(R.id.forum_detail_container, fragment).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
NavUtils.navigateUpTo(this, new Intent(this, ForumListActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(Fragment listFragment, String id) {
|
||||
final Intent detailIntent = new Intent(this, TopicDetailActivity.class);
|
||||
detailIntent.putExtra(TopicDetailFragment.ARG_ITEM_ID, id);
|
||||
startActivity(detailIntent);
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/**
|
||||
* ForumDetailFragment
|
||||
* @date Aug 29, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.ForumContent;
|
||||
import com.RickBarrette.osj.forum.content.ForumContent.ForumItem;
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
import com.RickBarrette.osj.forum.content.TopicAdapter;
|
||||
import com.RickBarrette.osj.forum.content.TopicContent;
|
||||
|
||||
/**
|
||||
* This fragment will be used to display information about the forum
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumDetailFragment extends ListFragment {
|
||||
|
||||
public static final String ARG_ITEM_ID = "item_id";
|
||||
private int mActivatedPosition = ListView.INVALID_POSITION;
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
|
||||
ForumItem mItem;
|
||||
private OnItemSelectedListener mCallbacks;
|
||||
|
||||
public ForumDetailFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.support.v4.app.Fragment#onAttach(android.app.Activity)
|
||||
*/
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (!(activity instanceof OnItemSelectedListener))
|
||||
throw new IllegalStateException("Activity must implement fragment's callbacks.");
|
||||
|
||||
mCallbacks = (OnItemSelectedListener) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments().containsKey(ARG_ITEM_ID))
|
||||
mItem = ForumContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
|
||||
|
||||
new Thread( new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
TopicContent.getTopics((String) mItem.content.get("forum_id"), getActivity());
|
||||
getActivity().runOnUiThread(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
setListAdapter(new TopicAdapter(getActivity()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.support.v4.app.ListFragment#onListItemClick(android.widget.ListView, android.view.View, int, long)
|
||||
*/
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
mCallbacks.onItemSelected(this, TopicContent.ITEMS.get(position).id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (mActivatedPosition != AdapterView.INVALID_POSITION)
|
||||
outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, final Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION))
|
||||
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||
}
|
||||
|
||||
public void setActivatedPosition(final int position) {
|
||||
if (position == AdapterView.INVALID_POSITION)
|
||||
getListView().setItemChecked(mActivatedPosition, false);
|
||||
else
|
||||
getListView().setItemChecked(position, true);
|
||||
|
||||
mActivatedPosition = position;
|
||||
}
|
||||
|
||||
public void setActivateOnItemClick(final boolean activateOnItemClick) {
|
||||
getListView().setChoiceMode(activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/**
|
||||
* ForumListActivity
|
||||
* @date Aug 29, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
import com.TwentyCodes.android.exception.ExceptionHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumListActivity extends FragmentActivity implements OnItemSelectedListener {
|
||||
|
||||
private boolean mTwoPane;
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
|
||||
|
||||
setContentView(R.layout.activity_forum_list);
|
||||
|
||||
if (findViewById(R.id.forum_detail_container) != null) {
|
||||
mTwoPane = true;
|
||||
((ForumListFragment) getSupportFragmentManager().findFragmentById(R.id.forum_list)).setActivateOnItemClick(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(final Fragment listFragment, final String id) {
|
||||
if(listFragment instanceof ForumDetailFragment){
|
||||
final Intent detailIntent = new Intent(this, TopicListActivity.class);
|
||||
detailIntent.putExtra(TopicListActivity.ARG_ITEM_ID, id);
|
||||
startActivity(detailIntent);
|
||||
} else
|
||||
if (mTwoPane) {
|
||||
if(listFragment instanceof ForumListFragment){
|
||||
final Bundle arguments = new Bundle();
|
||||
arguments.putString(ForumDetailFragment.ARG_ITEM_ID, id);
|
||||
final ForumDetailFragment fragment = new ForumDetailFragment();
|
||||
fragment.setArguments(arguments);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.forum_detail_container, fragment).commit();
|
||||
}
|
||||
|
||||
} else {
|
||||
final Intent detailIntent = new Intent(this, ForumDetailActivity.class);
|
||||
detailIntent.putExtra(ForumDetailFragment.ARG_ITEM_ID, id);
|
||||
startActivity(detailIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
/**
|
||||
* ForumListFragment
|
||||
* @date Aug 27, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.ForumAdapter;
|
||||
import com.RickBarrette.osj.forum.content.ForumContent;
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumListFragment extends ListFragment {
|
||||
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
private OnItemSelectedListener mCallbacks = sForumCallbacks;
|
||||
|
||||
private int mActivatedPosition = ListView.INVALID_POSITION;
|
||||
|
||||
private static OnItemSelectedListener sForumCallbacks = new OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(final Fragment listFragment, final String id) {
|
||||
}
|
||||
};
|
||||
|
||||
public ForumListFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(final Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (!(activity instanceof OnItemSelectedListener))
|
||||
throw new IllegalStateException("Activity must implement fragment's callbacks.");
|
||||
|
||||
mCallbacks = (OnItemSelectedListener) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if(ForumContent.ITEMS.size() == 0)
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ForumContent.getForum(getActivity());
|
||||
getActivity().runOnUiThread(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
setListAdapter(new ForumAdapter(getActivity()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
else
|
||||
setListAdapter(new ForumAdapter(getActivity()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mCallbacks = sForumCallbacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(final ListView listView, final View view, final int position, final long id) {
|
||||
super.onListItemClick(listView, view, position, id);
|
||||
mCallbacks.onItemSelected(this, ForumContent.ITEMS.get(position).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (mActivatedPosition != AdapterView.INVALID_POSITION)
|
||||
outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, final Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION))
|
||||
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||
}
|
||||
|
||||
public void setActivatedPosition(final int position) {
|
||||
if (position == AdapterView.INVALID_POSITION)
|
||||
getListView().setItemChecked(mActivatedPosition, false);
|
||||
else
|
||||
getListView().setItemChecked(position, true);
|
||||
|
||||
mActivatedPosition = position;
|
||||
}
|
||||
|
||||
public void setActivateOnItemClick(final boolean activateOnItemClick) {
|
||||
getListView().setChoiceMode(activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE);
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
/**
|
||||
* Log.java
|
||||
* @date Sep 14, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
/**
|
||||
* A convince class for logging with log level constraints
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class Log {
|
||||
|
||||
/**
|
||||
* Send a DEBUG log message
|
||||
* @param tag
|
||||
* @param log
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void d(String tag, String log){
|
||||
if(Constraints.DEBUG)
|
||||
android.util.Log.d(tag, log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a DEBUG log message and log the exception.
|
||||
* @param tag
|
||||
* @param log
|
||||
* @param e
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void d(String tag, String log, Throwable e){
|
||||
if(Constraints.DEBUG)
|
||||
android.util.Log.d(tag, log, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a ERROR log message
|
||||
* @param tag
|
||||
* @param log
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void e(String tag, String log){
|
||||
if(Constraints.ERROR)
|
||||
android.util.Log.e(tag, log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a ERROR log message and log the exception.
|
||||
* @param tag
|
||||
* @param log
|
||||
* @param e
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void e(String tag, String log, Throwable e){
|
||||
if(Constraints.ERROR)
|
||||
android.util.Log.e(tag, log, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a INFO log message
|
||||
* @param tag
|
||||
* @param log
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void i(String tag, String log){
|
||||
if(Constraints.INFO)
|
||||
android.util.Log.i(tag, log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a INFO log message and log the exception.
|
||||
* @param tag
|
||||
* @param log
|
||||
* @param e
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void i(String tag, String log, Throwable e){
|
||||
if(Constraints.INFO)
|
||||
android.util.Log.i(tag, log, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a VERBOSE log message
|
||||
* @param tag
|
||||
* @param log
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void v(String tag, String log){
|
||||
if(Constraints.VERBOSE)
|
||||
android.util.Log.v(tag, log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a VERBOSE log message and log the exception.
|
||||
* @param tag
|
||||
* @param log
|
||||
* @param e
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void v(String tag, String log, Throwable e){
|
||||
if(Constraints.VERBOSE)
|
||||
android.util.Log.v(tag, log, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a WARNING log message
|
||||
* @param tag
|
||||
* @param log
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void w(String tag, String log){
|
||||
if(Constraints.WARNING)
|
||||
android.util.Log.w(tag, log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a WARNING log message and log the exception.
|
||||
* @param tag
|
||||
* @param log
|
||||
* @param e
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void w(String tag, String log, Throwable e){
|
||||
if(Constraints.WARNING)
|
||||
android.util.Log.w(tag, log, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a WTF log message
|
||||
* @param tag
|
||||
* @param log
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void wtf(String tag, String log){
|
||||
if(Constraints.WTF)
|
||||
android.util.Log.wtf(tag, log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a WTF log message and log the exception.
|
||||
* @param tag
|
||||
* @param log
|
||||
* @param e
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void wtf(String tag, String log, Throwable e){
|
||||
if(Constraints.WTF)
|
||||
android.util.Log.wtf(tag, log, e);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/**
|
||||
* TopicDetailActivity
|
||||
* @date Aug 27, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.view.MenuItem;
|
||||
|
||||
public class TopicDetailActivity extends FragmentActivity implements OnItemSelectedListener{
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_topic_detail);
|
||||
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
final Bundle arguments = new Bundle();
|
||||
arguments.putString(TopicDetailFragment.ARG_ITEM_ID, getIntent().getStringExtra(TopicDetailFragment.ARG_ITEM_ID));
|
||||
final TopicDetailFragment fragment = new TopicDetailFragment();
|
||||
fragment.setArguments(arguments);
|
||||
getSupportFragmentManager().beginTransaction().add(R.id.topic_detail_container, fragment).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
NavUtils.navigateUpTo(this, new Intent(this, TopicListActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(Fragment listFragment, String id) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
/**
|
||||
* TopicDetailFragment
|
||||
* @date Aug 27, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
import com.RickBarrette.osj.forum.content.ThreadAdapter;
|
||||
import com.RickBarrette.osj.forum.content.ThreadContent;
|
||||
import com.RickBarrette.osj.forum.content.TopicContent;
|
||||
import com.RickBarrette.osj.forum.content.TopicContent.TopicItem;
|
||||
|
||||
public class TopicDetailFragment extends ListFragment {
|
||||
|
||||
public static final String ARG_ITEM_ID = "item_id";
|
||||
private int mActivatedPosition = ListView.INVALID_POSITION;
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
|
||||
TopicItem mItem;
|
||||
private OnItemSelectedListener mCallbacks;
|
||||
|
||||
public TopicDetailFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.support.v4.app.Fragment#onAttach(android.app.Activity)
|
||||
*/
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (!(activity instanceof OnItemSelectedListener))
|
||||
throw new IllegalStateException("Activity must implement fragment's callbacks.");
|
||||
|
||||
mCallbacks = (OnItemSelectedListener) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments().containsKey(ARG_ITEM_ID))
|
||||
mItem = TopicContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
|
||||
|
||||
if(mItem == null)
|
||||
throw new NullPointerException();
|
||||
|
||||
new Thread( new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
ThreadContent.getThread((String) mItem.content.get("topic_id"), 0, 0, getActivity());
|
||||
getActivity().runOnUiThread(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
setListAdapter(new ThreadAdapter(getActivity()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.support.v4.app.ListFragment#onListItemClick(android.widget.ListView, android.view.View, int, long)
|
||||
*/
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
mCallbacks.onItemSelected(this, TopicContent.ITEMS.get(position).id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (mActivatedPosition != AdapterView.INVALID_POSITION)
|
||||
outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, final Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION))
|
||||
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||
}
|
||||
|
||||
public void setActivatedPosition(final int position) {
|
||||
if (position == AdapterView.INVALID_POSITION)
|
||||
getListView().setItemChecked(mActivatedPosition, false);
|
||||
else
|
||||
getListView().setItemChecked(position, true);
|
||||
|
||||
mActivatedPosition = position;
|
||||
}
|
||||
|
||||
public void setActivateOnItemClick(final boolean activateOnItemClick) {
|
||||
getListView().setChoiceMode(activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* TopicListActivity
|
||||
* @date Aug 27, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
import com.TwentyCodes.android.exception.ExceptionHandler;
|
||||
|
||||
public class TopicListActivity extends FragmentActivity implements OnItemSelectedListener {
|
||||
|
||||
public static final String ARG_ITEM_ID = "item_id";
|
||||
private boolean mTwoPane;
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
|
||||
|
||||
setContentView(R.layout.activity_topic_list);
|
||||
|
||||
if (findViewById(R.id.topic_detail_container) != null) {
|
||||
mTwoPane = true;
|
||||
((TopicListFragment) getSupportFragmentManager().findFragmentById(R.id.topic_list)).setActivateOnItemClick(true);
|
||||
|
||||
final Bundle arguments = new Bundle();
|
||||
arguments.putString(TopicDetailFragment.ARG_ITEM_ID, this.getIntent().getExtras().getString(ARG_ITEM_ID));
|
||||
final TopicDetailFragment fragment = new TopicDetailFragment();
|
||||
fragment.setArguments(arguments);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.topic_detail_container, fragment).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(final Fragment listFragment, final String id) {
|
||||
if(listFragment instanceof TopicListFragment)
|
||||
if (mTwoPane) {
|
||||
final Bundle arguments = new Bundle();
|
||||
arguments.putString(TopicDetailFragment.ARG_ITEM_ID, id);
|
||||
final TopicDetailFragment fragment = new TopicDetailFragment();
|
||||
fragment.setArguments(arguments);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.topic_detail_container, fragment).commit();
|
||||
|
||||
} else {
|
||||
final Intent detailIntent = new Intent(this, TopicDetailActivity.class);
|
||||
detailIntent.putExtra(TopicDetailFragment.ARG_ITEM_ID, id);
|
||||
startActivity(detailIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* TopicListFragment
|
||||
* @date Aug 27, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
import com.RickBarrette.osj.forum.content.TopicAdapter;
|
||||
import com.RickBarrette.osj.forum.content.TopicContent;
|
||||
|
||||
public class TopicListFragment extends ListFragment {
|
||||
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
private OnItemSelectedListener mCallbacks = sDummyCallbacks;
|
||||
|
||||
private int mActivatedPosition = ListView.INVALID_POSITION;
|
||||
|
||||
private static OnItemSelectedListener sDummyCallbacks = new OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(final Fragment listFragment, final String id) {
|
||||
}
|
||||
};
|
||||
|
||||
public TopicListFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(final Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (!(activity instanceof OnItemSelectedListener))
|
||||
|
||||
throw new IllegalStateException("Activity must implement fragment's callbacks.");
|
||||
|
||||
mCallbacks = (OnItemSelectedListener) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setListAdapter(new TopicAdapter(getActivity()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mCallbacks = sDummyCallbacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(final ListView listView, final View view, final int position, final long id) {
|
||||
super.onListItemClick(listView, view, position, id);
|
||||
mCallbacks.onItemSelected(this, TopicContent.ITEMS.get(position).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (mActivatedPosition != AdapterView.INVALID_POSITION)
|
||||
outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, final Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION))
|
||||
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||
}
|
||||
|
||||
public void setActivatedPosition(final int position) {
|
||||
if (position == AdapterView.INVALID_POSITION)
|
||||
getListView().setItemChecked(mActivatedPosition, false);
|
||||
else
|
||||
getListView().setItemChecked(position, true);
|
||||
|
||||
mActivatedPosition = position;
|
||||
}
|
||||
|
||||
public void setActivateOnItemClick(final boolean activateOnItemClick) {
|
||||
getListView().setChoiceMode(activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE);
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/**
|
||||
* ForumAdapter.java
|
||||
* @date Aug 30, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.RickBarrette.osj.forum.R;
|
||||
import com.RickBarrette.osj.forum.content.ForumContent.ForumItem;
|
||||
|
||||
/**
|
||||
* This adapter will be used to populate a list view with forum entries
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumAdapter extends BaseAdapter {
|
||||
|
||||
class ViewHolder {
|
||||
TextView title;
|
||||
TextView description;
|
||||
}
|
||||
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
/**
|
||||
* Creates a new ForumAdapter
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public ForumAdapter(final Context context) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getCount()
|
||||
*/
|
||||
@Override
|
||||
public int getCount() {
|
||||
return ForumContent.ITEMS.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getItem(int)
|
||||
*/
|
||||
@Override
|
||||
public ForumItem getItem(int position) {
|
||||
return ForumContent.ITEMS.get(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getItemId(int)
|
||||
*/
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
|
||||
*/
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// A ViewHolder keeps references to children views to avoid unnecessary
|
||||
// calls to findViewById() on each row.
|
||||
ViewHolder holder;
|
||||
|
||||
// When convertView is not null, we can reuse it directly, there is no
|
||||
// need
|
||||
// to reinflate it. We only inflate a new View when the convertView
|
||||
// supplied
|
||||
// by ListView is null.
|
||||
if (convertView == null) {
|
||||
convertView = mInflater.inflate(R.layout.forum_item, null);
|
||||
|
||||
// Creates a ViewHolder and store references to the two children
|
||||
// views
|
||||
// we want to bind data to.
|
||||
holder = new ViewHolder();
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
||||
holder.description = (TextView) convertView.findViewById(R.id.textView2);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else
|
||||
// Get the ViewHolder back to get fast access to the TextView
|
||||
// and the ImageView.
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
|
||||
|
||||
/*
|
||||
* Bind the data efficiently with the holder. Remember that you should
|
||||
* always call setChecked() after calling setOnCheckedChangedListener.
|
||||
* This will prevent the list from changing the values on you.
|
||||
*/
|
||||
holder.title.setText(new String((byte[]) getItem(position).content.get("forum_name")));
|
||||
holder.description.setText(new String((byte[]) getItem(position).content.get("description")));
|
||||
return convertView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
/**
|
||||
* ForumContent.java
|
||||
* @date Aug 30, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.xmlrpc.android.XMLRPCClient;
|
||||
import org.xmlrpc.android.XMLRPCException;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.RickBarrette.osj.forum.Log;
|
||||
|
||||
/**
|
||||
* This class is used to maintain an instance of a forum's content data
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumContent {
|
||||
|
||||
/**
|
||||
* This Forum Object
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static class ForumItem {
|
||||
|
||||
private static final String TAG = "ForumItem";
|
||||
public String id;
|
||||
public HashMap<?, ?> content;
|
||||
|
||||
/**
|
||||
* Creates a new Forum Item
|
||||
* @param id
|
||||
* @param content
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public ForumItem(final String id, final HashMap<?, ?> content) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
|
||||
for(Object key: content.keySet())
|
||||
Log.v(TAG, key.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets all the categories and sub-forums
|
||||
* @return array of HashMap
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public Object[] getChildren(){
|
||||
return (Object[]) this.content.get("child");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of this forum object
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return (String) content.get("forum_name");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final List<ForumItem> ITEMS = new ArrayList<ForumItem>();
|
||||
public static final Map<String, ForumItem> ITEM_MAP = new HashMap<String, ForumItem>();
|
||||
|
||||
/**
|
||||
* Adds a new Forum Item to the list
|
||||
* @param item
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private static void addItem(final ForumItem item) {
|
||||
ITEMS.add(item);
|
||||
ITEM_MAP.put(item.id, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the forum from the Internet
|
||||
* @param context
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void getForum(Context context){
|
||||
ITEMS.clear();
|
||||
ITEM_MAP.clear();
|
||||
|
||||
final XMLRPCClient client = XMLRPCClient.getClient(context);
|
||||
|
||||
Object[] result = null;
|
||||
try {
|
||||
result = (Object[]) client.call("get_forum", true);
|
||||
} catch (XMLRPCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(result!= null){
|
||||
for(int i = 0; i < result.length; i++){
|
||||
HashMap<?, ?> contentHash = (HashMap<?, ?>) result[i];
|
||||
addItem(new ForumItem(Integer.valueOf(i).toString(), contentHash));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* OnItemSelectedListener.java
|
||||
* @date Sep 13, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
/**
|
||||
* This is a simple on item selcted callback for list fragments
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public interface OnItemSelectedListener {
|
||||
/**
|
||||
* Called when a list item from a list fragment is selected
|
||||
* @param listFragment
|
||||
* @param id of selected item
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void onItemSelected(final Fragment listFragment, final String id);
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
/**
|
||||
* SubForumAdapter.java
|
||||
* @date Aug 30, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.RickBarrette.osj.forum.R;
|
||||
|
||||
/**
|
||||
* This adapter will be used to display sub-forums to the user
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class SubForumAdapter extends BaseAdapter {
|
||||
|
||||
class ViewHolder {
|
||||
TextView title;
|
||||
}
|
||||
|
||||
private LayoutInflater mInflater;
|
||||
private Object[] mSubForums;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public SubForumAdapter(Context context, int position) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mSubForums = ForumContent.ITEMS.get(position).getChildren();
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getCount()
|
||||
*/
|
||||
@Override
|
||||
public int getCount() {
|
||||
if(mSubForums != null)
|
||||
return mSubForums.length;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getItem(int)
|
||||
*/
|
||||
@Override
|
||||
public HashMap<?,?> getItem(int position) {
|
||||
return (HashMap<?,?>) mSubForums[position];
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getItemId(int)
|
||||
*/
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
|
||||
*/
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// A ViewHolder keeps references to children views to avoid unnecessary
|
||||
// calls to findViewById() on each row.
|
||||
ViewHolder holder;
|
||||
|
||||
// When convertView is not null, we can reuse it directly, there is no
|
||||
// need
|
||||
// to reinflate it. We only inflate a new View when the convertView
|
||||
// supplied
|
||||
// by ListView is null.
|
||||
if (convertView == null) {
|
||||
convertView = mInflater.inflate(R.layout.forum_item, null);
|
||||
|
||||
// Creates a ViewHolder and store references to the two children
|
||||
// views
|
||||
// we want to bind data to.
|
||||
holder = new ViewHolder();
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else
|
||||
// Get the ViewHolder back to get fast access to the TextView
|
||||
// and the ImageView.
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
|
||||
|
||||
/*
|
||||
* Bind the data efficiently with the holder. Remember that you should
|
||||
* always call setChecked() after calling setOnCheckedChangedListener.
|
||||
* This will prevent the list from changing the values on you.
|
||||
*/
|
||||
holder.title.setText(new String((byte[]) getItem(position).get("forum_name")));
|
||||
return convertView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
/**
|
||||
* ThreadAdapter.java
|
||||
* @date Sep 14, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.QuickContactBadge;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.RickBarrette.osj.forum.R;
|
||||
|
||||
/**
|
||||
* This adapter will be used to populte a list view with post from a thread
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ThreadAdapter extends BaseAdapter {
|
||||
|
||||
class ViewHolder {
|
||||
TextView title;
|
||||
TextView user;
|
||||
TextView post;
|
||||
QuickContactBadge badage;
|
||||
}
|
||||
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
/**
|
||||
* Creates a new ThreadAdapter
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public ThreadAdapter(Context context) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.widget.Adapter#getCount()
|
||||
*/
|
||||
@Override
|
||||
public int getCount() {
|
||||
return ThreadContent.ITEMS.size();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.widget.Adapter#getItem(int)
|
||||
*/
|
||||
@Override
|
||||
public HashMap<?, ?> getItem(int position) {
|
||||
return (HashMap<?, ?>) ThreadContent.ITEMS.get(position).content;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.widget.Adapter#getItemId(int)
|
||||
*/
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.widget.Adapter#getView(int, android.view.View,
|
||||
* android.view.ViewGroup)
|
||||
*/
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// A ViewHolder keeps references to children views to avoid unnecessary
|
||||
// calls to findViewById() on each row.
|
||||
ViewHolder holder;
|
||||
|
||||
// When convertView is not null, we can reuse it directly, there is no
|
||||
// need
|
||||
// to reinflate it. We only inflate a new View when the convertView
|
||||
// supplied
|
||||
// by ListView is null.
|
||||
if (convertView == null) {
|
||||
convertView = mInflater.inflate(R.layout.post_item, null);
|
||||
|
||||
// Creates a ViewHolder and store references to the two children
|
||||
// views
|
||||
// we want to bind data to.
|
||||
holder = new ViewHolder();
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
||||
holder.user = (TextView) convertView.findViewById(R.id.textView2);
|
||||
holder.post = (TextView) convertView.findViewById(R.id.textView3);
|
||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge1);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else
|
||||
// Get the ViewHolder back to get fast access to the TextView
|
||||
// and the ImageView.
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
|
||||
/*
|
||||
* Bind the data efficiently with the holder. Remember that you should
|
||||
* always call setChecked() after calling setOnCheckedChangedListener.
|
||||
* This will prevent the list from changing the values on you.
|
||||
*/
|
||||
holder.title.setText(new String((byte[]) getItem(position).get("post_title")));
|
||||
holder.user.setText(new String((byte[]) getItem(position).get("post_author_name")));
|
||||
holder.post.setText(new String((byte[]) getItem(position).get("post_content")));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/**
|
||||
* ThreadContent.java
|
||||
* @date Sep 14, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.xmlrpc.android.XMLRPCClient;
|
||||
import org.xmlrpc.android.XMLRPCException;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.RickBarrette.osj.forum.Log;
|
||||
|
||||
/**
|
||||
* This class is used to maintain an instance of a thread's data content
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ThreadContent {
|
||||
|
||||
/**
|
||||
* This Forum Object
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static class ThreadItem {
|
||||
private static final String TAG = "ThreadItem";
|
||||
public String id;
|
||||
public HashMap<?, ?> content;
|
||||
|
||||
/**
|
||||
* Creates a new Topic Item
|
||||
* @param id
|
||||
* @param content
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public ThreadItem(final String id, final HashMap<?, ?> content) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
|
||||
for(Object key: content.keySet())
|
||||
Log.v(TAG, key.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static final List<ThreadItem> ITEMS = new ArrayList<ThreadItem>();
|
||||
public static final Map<String, ThreadItem> ITEM_MAP = new HashMap<String, ThreadItem>();
|
||||
|
||||
/**
|
||||
* Adds a new Forum Item to the list
|
||||
* @param item
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private static void addItem(final ThreadItem item) {
|
||||
ITEMS.add(item);
|
||||
ITEM_MAP.put(item.id, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* This downloads a thread for a specific topic
|
||||
* @param topicId
|
||||
* @param startNumber
|
||||
* @param lastNumber
|
||||
* @param context
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void getThread(String topicId, int startNumber, int lastNumber, final Context context){
|
||||
final XMLRPCClient client = XMLRPCClient.getClient(context);
|
||||
|
||||
ITEMS.clear();
|
||||
ITEM_MAP.clear();
|
||||
|
||||
Object[] result = null;
|
||||
try {
|
||||
result = (Object[]) ((HashMap<?,?>) client.call("get_thread", topicId, startNumber, lastNumber)).get("posts");
|
||||
} catch (XMLRPCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(result!= null){
|
||||
for(int i = 0; i < result.length; i++){
|
||||
HashMap<?, ?> contentHash = (HashMap<?, ?>) result[i];
|
||||
addItem(new ThreadItem(Integer.valueOf(i).toString(), contentHash));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/**
|
||||
* TopicAdapter.java
|
||||
* @date Aug 31, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.QuickContactBadge;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.RickBarrette.osj.forum.R;
|
||||
|
||||
/**
|
||||
* This adapter will be used to display topics to the user
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class TopicAdapter extends BaseAdapter {
|
||||
|
||||
class ViewHolder {
|
||||
TextView title;
|
||||
TextView lastestPost;
|
||||
TextView user;
|
||||
TextView newPosts;
|
||||
QuickContactBadge badage;
|
||||
}
|
||||
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public TopicAdapter(final Context context) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getCount()
|
||||
*/
|
||||
@Override
|
||||
public int getCount() {
|
||||
return TopicContent.ITEMS.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getItem(int)
|
||||
*/
|
||||
@Override
|
||||
public HashMap<?,?> getItem(int position) {
|
||||
return (HashMap<?,?>) TopicContent.ITEMS.get(position).content;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getItemId(int)
|
||||
*/
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
* @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
|
||||
*/
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// A ViewHolder keeps references to children views to avoid unnecessary
|
||||
// calls to findViewById() on each row.
|
||||
ViewHolder holder;
|
||||
|
||||
// When convertView is not null, we can reuse it directly, there is no
|
||||
// need
|
||||
// to reinflate it. We only inflate a new View when the convertView
|
||||
// supplied
|
||||
// by ListView is null.
|
||||
if (convertView == null) {
|
||||
convertView = mInflater.inflate(R.layout.topic_item, null);
|
||||
|
||||
// Creates a ViewHolder and store references to the two children
|
||||
// views
|
||||
// we want to bind data to.
|
||||
holder = new ViewHolder();
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
||||
holder.lastestPost = (TextView) convertView.findViewById(R.id.textView2);
|
||||
holder.user = (TextView) convertView.findViewById(R.id.textView3);
|
||||
holder.newPosts = (TextView) convertView.findViewById(R.id.textView4);
|
||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge1);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else
|
||||
// Get the ViewHolder back to get fast access to the TextView
|
||||
// and the ImageView.
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
|
||||
|
||||
/*
|
||||
* Bind the data efficiently with the holder. Remember that you should
|
||||
* always call setChecked() after calling setOnCheckedChangedListener.
|
||||
* This will prevent the list from changing the values on you.
|
||||
*/
|
||||
holder.title.setText(new String((byte[]) getItem(position).get("topic_title")));
|
||||
holder.user.setText(new String((byte[]) getItem(position).get("topic_author_name")));
|
||||
holder.lastestPost.setText(new String((byte[]) getItem(position).get("short_content")));
|
||||
holder.newPosts.setVisibility(((Boolean) getItem(position).get("new_post") ? View.VISIBLE : View.GONE));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/**
|
||||
* TopicContent.java
|
||||
* @date Sep 13, 2012
|
||||
* @author ricky barrette
|
||||
*
|
||||
* Copyright 2012 Richard Barrette
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
package com.RickBarrette.osj.forum.content;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.xmlrpc.android.XMLRPCClient;
|
||||
import org.xmlrpc.android.XMLRPCException;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.RickBarrette.osj.forum.Log;
|
||||
|
||||
/**
|
||||
* This class is used to maintain an instance of a topic's content data
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class TopicContent {
|
||||
|
||||
/**
|
||||
* This Forum Object
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static class TopicItem {
|
||||
private static final String TAG = "TopicItem";
|
||||
public String id;
|
||||
public HashMap<?, ?> content;
|
||||
|
||||
/**
|
||||
* Creates a new Topic Item
|
||||
* @param id
|
||||
* @param content
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public TopicItem(final String id, final HashMap<?, ?> content) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
|
||||
for(Object key: content.keySet())
|
||||
Log.v(TAG, key.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static final List<TopicItem> ITEMS = new ArrayList<TopicItem>();
|
||||
public static final Map<String, TopicItem> ITEM_MAP = new HashMap<String, TopicItem>();
|
||||
|
||||
/**
|
||||
* Adds a new Forum Item to the list
|
||||
* @param item
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private static void addItem(final TopicItem item) {
|
||||
ITEMS.add(item);
|
||||
ITEM_MAP.put(item.id, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets all the topics for the current forum item
|
||||
* @param context
|
||||
* @return
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void getTopics(String forumId, final Context context){
|
||||
final XMLRPCClient client = XMLRPCClient.getClient(context);
|
||||
|
||||
ITEMS.clear();
|
||||
ITEM_MAP.clear();
|
||||
|
||||
Object[] result = null;
|
||||
try {
|
||||
result = (Object[]) ((HashMap<?,?>) client.call("get_topic", forumId, 0, 0)).get("topics");
|
||||
} catch (XMLRPCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(result!= null){
|
||||
for(int i = 0; i < result.length; i++){
|
||||
HashMap<?, ?> contentHash = (HashMap<?, ?>) result[i];
|
||||
addItem(new TopicItem(Integer.valueOf(i).toString(), contentHash));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user