mirror of https://github.com/kurisufriend/Clover
parent
85a1f7b4cc
commit
adc6cb0d52
Binary file not shown.
@ -1,6 +0,0 @@ |
|||||||
#Wed Apr 10 15:27:10 PDT 2013 |
|
||||||
distributionBase=GRADLE_USER_HOME |
|
||||||
distributionPath=wrapper/dists |
|
||||||
zipStoreBase=GRADLE_USER_HOME |
|
||||||
zipStorePath=wrapper/dists |
|
||||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip |
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,130 +0,0 @@ |
|||||||
package org.floens.chan.activity; |
|
||||||
|
|
||||||
import org.floens.chan.ChanApplication; |
|
||||||
import org.floens.chan.R; |
|
||||||
import org.floens.chan.entity.Loadable; |
|
||||||
import org.floens.chan.entity.Pin; |
|
||||||
import org.floens.chan.entity.Post; |
|
||||||
import org.floens.chan.fragment.ReplyFragment; |
|
||||||
import org.floens.chan.fragment.ThreadFragment; |
|
||||||
import org.floens.chan.net.ChanUrls; |
|
||||||
|
|
||||||
import android.app.FragmentTransaction; |
|
||||||
import android.os.Bundle; |
|
||||||
import android.text.TextUtils; |
|
||||||
import android.view.Menu; |
|
||||||
import android.view.MenuItem; |
|
||||||
|
|
||||||
public class ThreadActivity extends BaseActivity { |
|
||||||
private Loadable loadable = new Loadable(); |
|
||||||
|
|
||||||
private ThreadFragment threadFragment; |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void onCreate(Bundle savedInstanceState) { |
|
||||||
super.onCreate(savedInstanceState); |
|
||||||
|
|
||||||
loadable.mode = Loadable.Mode.THREAD; |
|
||||||
|
|
||||||
threadFragment = ThreadFragment.newInstance(this); |
|
||||||
FragmentTransaction ft = getFragmentManager().beginTransaction(); |
|
||||||
ft.replace(R.id.right_pane, threadFragment); |
|
||||||
ft.commitAllowingStateLoss(); |
|
||||||
|
|
||||||
Bundle bundle = getIntent().getExtras(); |
|
||||||
|
|
||||||
// Favor savedInstanceState bundle over intent bundle:
|
|
||||||
// the intent bundle may be old, for example when the user
|
|
||||||
// switches the loadable through the drawer.
|
|
||||||
if (savedInstanceState != null) { |
|
||||||
loadable.readFromBundle(this, savedInstanceState); |
|
||||||
} else if (bundle != null) { |
|
||||||
loadable.readFromBundle(this, bundle); |
|
||||||
} else { |
|
||||||
finish(); |
|
||||||
} |
|
||||||
|
|
||||||
startLoading(loadable); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void onSaveInstanceState(Bundle outState) { |
|
||||||
super.onSaveInstanceState(outState); |
|
||||||
|
|
||||||
loadable.writeToBundle(this, outState); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean onCreateOptionsMenu(Menu menu) { |
|
||||||
// getMenuInflater().inflate(R.menu.thread, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean onOptionsItemSelected(MenuItem item) { |
|
||||||
switch(item.getItemId()) { |
|
||||||
case R.id.action_reload: |
|
||||||
threadFragment.reload(); |
|
||||||
|
|
||||||
return true; |
|
||||||
case R.id.action_reply: |
|
||||||
ReplyFragment reply = ReplyFragment.newInstance(loadable); |
|
||||||
reply.show(getFragmentManager(), "replyDialog"); |
|
||||||
|
|
||||||
return true; |
|
||||||
case R.id.action_pin: |
|
||||||
Pin pin = new Pin(); |
|
||||||
pin.loadable = loadable; |
|
||||||
|
|
||||||
ChanApplication.getPinnedManager().add(pin); |
|
||||||
|
|
||||||
drawer.openDrawer(drawerList); |
|
||||||
|
|
||||||
return true; |
|
||||||
case R.id.action_open_browser: |
|
||||||
openUrl(ChanUrls.getThreadUrlDesktop(loadable.board, loadable.no)); |
|
||||||
|
|
||||||
return true; |
|
||||||
case android.R.id.home: |
|
||||||
finish(); |
|
||||||
|
|
||||||
return true; |
|
||||||
default: |
|
||||||
return super.onOptionsItemSelected(item); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onDrawerClicked(Pin pin) { |
|
||||||
drawer.closeDrawer(drawerList); |
|
||||||
|
|
||||||
loadable = pin.loadable; |
|
||||||
|
|
||||||
startLoading(loadable); |
|
||||||
} |
|
||||||
|
|
||||||
private void startLoading(Loadable loadable) { |
|
||||||
Pin pin = ChanApplication.getPinnedManager().findPinByLoadable(loadable); |
|
||||||
if (pin != null) { |
|
||||||
// Use the loadable from the pin.
|
|
||||||
// This way we can store the listview position in the pin loadable,
|
|
||||||
// and not in a separate loadable instance.
|
|
||||||
loadable = pin.loadable; |
|
||||||
} |
|
||||||
|
|
||||||
threadFragment.startLoading(loadable); |
|
||||||
|
|
||||||
setShareUrl(ChanUrls.getThreadUrlDesktop(loadable.board, loadable.no)); |
|
||||||
|
|
||||||
if (TextUtils.isEmpty(loadable.title)) { |
|
||||||
loadable.title = "/" + loadable.board + "/" + loadable.no; |
|
||||||
} |
|
||||||
|
|
||||||
getActionBar().setTitle(loadable.title); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onOPClicked(Post post) { |
|
||||||
threadFragment.getThreadManager().showPostLinkables(post); |
|
||||||
} |
|
||||||
} |
|
@ -1,77 +0,0 @@ |
|||||||
package org.floens.chan.entity; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
import org.floens.chan.net.ThreadLoader; |
|
||||||
import org.floens.chan.net.ThreadLoader.ThreadLoaderListener; |
|
||||||
|
|
||||||
import com.android.volley.VolleyError; |
|
||||||
|
|
||||||
public class Pin { |
|
||||||
public Type type = Type.THREAD; |
|
||||||
public Loadable loadable = new Loadable("", -1); |
|
||||||
|
|
||||||
private int count; |
|
||||||
private int newCount; |
|
||||||
private final boolean watch = true; |
|
||||||
private boolean error = false; |
|
||||||
private List<Post> postList = new ArrayList<Post>(); |
|
||||||
public ThreadLoader threadLoader = new ThreadLoader(new ThreadLoaderListener() { |
|
||||||
@Override |
|
||||||
public void onError(VolleyError volleyError) { |
|
||||||
error = true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onData(List<Post> result) { |
|
||||||
postList = result; |
|
||||||
|
|
||||||
int totalCount = result.size(); |
|
||||||
|
|
||||||
newCount = totalCount - count; |
|
||||||
count = totalCount; |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
public void startLoading() { |
|
||||||
if (type != Type.THREAD || error) return; |
|
||||||
|
|
||||||
// threadLoader.start(new Loadable(board, no));
|
|
||||||
} |
|
||||||
|
|
||||||
public boolean getShouldWatch() { |
|
||||||
return watch; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean getHasLoadingError() { |
|
||||||
return error; |
|
||||||
} |
|
||||||
|
|
||||||
public int getCount() { |
|
||||||
return count; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get how many new posts there are. Calling this will reset the internal |
|
||||||
* counter to zero, so don't call this multiple times for new info. |
|
||||||
* @return Amount of new posts |
|
||||||
*/ |
|
||||||
public int getNewCount() { |
|
||||||
int newer = newCount; |
|
||||||
newCount = 0; |
|
||||||
|
|
||||||
return newer; |
|
||||||
} |
|
||||||
|
|
||||||
/** Header is used to display a static header in the drawer listview. */ |
|
||||||
public static enum Type { |
|
||||||
HEADER, |
|
||||||
THREAD |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package org.floens.chan.entity; |
package org.floens.chan.model; |
||||||
|
|
||||||
/** |
/** |
||||||
* Board key and value. |
* Board key and value. |
@ -1,4 +1,4 @@ |
|||||||
package org.floens.chan.entity; |
package org.floens.chan.model; |
||||||
|
|
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.os.Bundle; |
import android.os.Bundle; |
@ -0,0 +1,18 @@ |
|||||||
|
package org.floens.chan.model; |
||||||
|
|
||||||
|
|
||||||
|
public class Pin { |
||||||
|
public Type type = Type.THREAD; |
||||||
|
public Loadable loadable = new Loadable("", -1); |
||||||
|
|
||||||
|
/** Header is used to display a static header in the drawer listview. */ |
||||||
|
public static enum Type { |
||||||
|
HEADER, |
||||||
|
THREAD |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@ |
|||||||
package org.floens.chan.entity; |
package org.floens.chan.model; |
||||||
|
|
||||||
import java.net.URL; |
import java.net.URL; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
import java.util.List; |
import java.util.List; |
||||||
|
|
||||||
import org.floens.chan.entity.PostLinkable.Type; |
import org.floens.chan.model.PostLinkable.Type; |
||||||
import org.floens.chan.net.ChanUrls; |
import org.floens.chan.net.ChanUrls; |
||||||
import org.floens.chan.view.PostView; |
import org.floens.chan.view.PostView; |
||||||
import org.jsoup.Jsoup; |
import org.jsoup.Jsoup; |
@ -1,4 +1,4 @@ |
|||||||
package org.floens.chan.entity; |
package org.floens.chan.model; |
||||||
|
|
||||||
import android.graphics.Color; |
import android.graphics.Color; |
||||||
import android.text.TextPaint; |
import android.text.TextPaint; |
@ -1,9 +1,9 @@ |
|||||||
package org.floens.chan.entity; |
package org.floens.chan.model; |
||||||
|
|
||||||
import java.io.File; |
import java.io.File; |
||||||
|
|
||||||
/** |
/** |
||||||
* The data needer to send a reply. |
* The data needed to send a reply. |
||||||
*/ |
*/ |
||||||
public class Reply { |
public class Reply { |
||||||
public String name = ""; |
public String name = ""; |
Loading…
Reference in new issue