After Width: | Height: | Size: 351 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 336 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 468 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 527 B |
After Width: | Height: | Size: 681 B |
After Width: | Height: | Size: 649 B |
After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,59 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:minWidth="320dp" |
||||
android:minHeight="200dp" |
||||
android:orientation="vertical" > |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:baselineAligned="false" |
||||
android:orientation="horizontal" |
||||
android:divider="?android:attr/dividerVertical" |
||||
android:showDividers="middle" |
||||
android:dividerPadding="12dp"> |
||||
|
||||
<FrameLayout |
||||
style="?android:actionButtonStyle" |
||||
android:id="@+id/replies_back" |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1"> |
||||
|
||||
<TextView style="?android:actionBarTabTextStyle" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center" |
||||
android:paddingRight="20dp" |
||||
android:drawableLeft="@drawable/ic_action_back" |
||||
android:drawablePadding="8dp" |
||||
android:gravity="center_vertical" |
||||
android:text="@string/post_replies_back" /> |
||||
</FrameLayout> |
||||
<FrameLayout |
||||
style="?android:actionButtonStyle" |
||||
android:id="@+id/replies_close" |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1"> |
||||
|
||||
<TextView style="?android:actionBarTabTextStyle" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center" |
||||
android:paddingRight="20dp" |
||||
android:drawableLeft="@drawable/ic_action_done" |
||||
android:drawablePadding="8dp" |
||||
android:gravity="center_vertical" |
||||
android:text="@string/post_replies_close" /> |
||||
</FrameLayout> |
||||
</LinearLayout> |
||||
|
||||
<ListView |
||||
android:id="@+id/post_list" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" /> |
||||
|
||||
</LinearLayout> |
@ -1,72 +0,0 @@ |
||||
package org.floens.chan.fragment; |
||||
|
||||
import org.floens.chan.R; |
||||
import org.floens.chan.entity.Post; |
||||
import org.floens.chan.manager.ThreadManager; |
||||
import org.floens.chan.view.PostView; |
||||
|
||||
import android.app.DialogFragment; |
||||
import android.content.Context; |
||||
import android.content.res.Resources; |
||||
import android.os.Bundle; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.ScrollView; |
||||
|
||||
public class PostPopupFragment extends DialogFragment { |
||||
private Context context; |
||||
private ScrollView wrapper; |
||||
|
||||
private Post post; |
||||
private ThreadManager manager; |
||||
|
||||
public static PostPopupFragment newInstance(Post post, ThreadManager manager) { |
||||
PostPopupFragment fragment = new PostPopupFragment(); |
||||
fragment.post = post; |
||||
fragment.manager = manager; |
||||
|
||||
return fragment; |
||||
} |
||||
|
||||
@Override |
||||
public void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
|
||||
setStyle(STYLE_NO_TITLE, 0); |
||||
} |
||||
|
||||
@Override |
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
||||
context = inflater.getContext(); |
||||
|
||||
Resources resources = context.getResources(); |
||||
int minWidth = resources.getDimensionPixelSize(R.dimen.post_popup_min_width); |
||||
int minHeight = resources.getDimensionPixelSize(R.dimen.post_popup_min_height); |
||||
|
||||
wrapper = new ScrollView(context); |
||||
wrapper.setMinimumWidth(minWidth); |
||||
wrapper.setMinimumHeight(minHeight); |
||||
|
||||
return wrapper; |
||||
} |
||||
|
||||
@Override |
||||
public void onActivityCreated(Bundle savedInstanceState) { |
||||
super.onActivityCreated(savedInstanceState); |
||||
|
||||
if (post == null) { |
||||
throw new IllegalArgumentException("No post specified"); |
||||
} |
||||
|
||||
PostView postView = new PostView(getActivity()); |
||||
postView.setPost(post, manager); |
||||
|
||||
wrapper.addView(postView); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,122 @@ |
||||
package org.floens.chan.fragment; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.floens.chan.R; |
||||
import org.floens.chan.entity.Post; |
||||
import org.floens.chan.manager.ThreadManager; |
||||
import org.floens.chan.view.PostView; |
||||
|
||||
import android.app.DialogFragment; |
||||
import android.content.Context; |
||||
import android.content.DialogInterface; |
||||
import android.content.res.Resources; |
||||
import android.os.Bundle; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.ArrayAdapter; |
||||
import android.widget.ListView; |
||||
|
||||
/** |
||||
* A DialogFragment that shows a list of posts. Use the newInstance method for instantiating. |
||||
*/ |
||||
public class PostRepliesFragment extends DialogFragment { |
||||
private Context context; |
||||
private ListView listView; |
||||
|
||||
private List<Post> posts; |
||||
private ThreadManager manager; |
||||
private boolean callback = true; |
||||
|
||||
public static PostRepliesFragment newInstance(List<Post> posts, ThreadManager manager) { |
||||
PostRepliesFragment fragment = new PostRepliesFragment(); |
||||
fragment.posts = posts; |
||||
fragment.manager = manager; |
||||
|
||||
return fragment; |
||||
} |
||||
|
||||
public void dismissNoCallback() { |
||||
callback = false; |
||||
dismiss(); |
||||
} |
||||
|
||||
@Override |
||||
public void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
|
||||
setStyle(STYLE_NO_TITLE, 0); |
||||
} |
||||
|
||||
@Override |
||||
public void onDismiss(DialogInterface dialog) { |
||||
super.onDismiss(dialog); |
||||
|
||||
if (callback) { |
||||
manager.onPostRepliesPop(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public View onCreateView(LayoutInflater inflater, ViewGroup unused, Bundle savedInstanceState) { |
||||
context = inflater.getContext(); |
||||
|
||||
View container = inflater.inflate(R.layout.post_replies, null); |
||||
|
||||
Resources resources = context.getResources(); |
||||
|
||||
listView = (ListView) container.findViewById(R.id.post_list); |
||||
|
||||
container.findViewById(R.id.replies_back).setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
dismiss(); |
||||
} |
||||
}); |
||||
|
||||
container.findViewById(R.id.replies_close).setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
manager.closeAllPostFragments(); |
||||
dismiss(); |
||||
} |
||||
}); |
||||
|
||||
return container; |
||||
} |
||||
|
||||
@Override |
||||
public void onActivityCreated(Bundle savedInstanceState) { |
||||
super.onActivityCreated(savedInstanceState); |
||||
|
||||
if (posts == null) { |
||||
// Restoring from background.
|
||||
dismiss(); |
||||
} else { |
||||
ArrayAdapter<Post> adapter = new ArrayAdapter<Post>(getActivity(), 0) { |
||||
@Override |
||||
public View getView(int position, View convertView, ViewGroup parent) { |
||||
PostView postView = null; |
||||
if (convertView instanceof PostView) { |
||||
postView = (PostView) convertView; |
||||
} else { |
||||
postView = new PostView(getActivity()); |
||||
} |
||||
|
||||
postView.setPost(getItem(position), manager); |
||||
|
||||
return postView; |
||||
} |
||||
}; |
||||
|
||||
adapter.addAll(posts); |
||||
listView.setAdapter(adapter); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|