添加标签跳转搜索

This commit is contained in:
seven332 committed 2014-05-18 15:47:31 +08:00
1 parent 5bee5d6663
commit 1def607a80
3 files changed
+45 -9

No files matched your search

+2 -3
View File
@@ -38,7 +38,7 @@
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize"
android:theme="@style/AppTheme.Main.ListActivity"
android:launchMode="singleTop" >
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
@@ -51,8 +51,7 @@
android:name=".activity.MangaDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|adjustUnspecified|stateHidden"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask" >
android:configChanges="orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
@@ -32,6 +32,7 @@ import com.hippo.ehviewer.widget.OnFitSystemWindowsListener;
import com.hippo.ehviewer.widget.OnLayoutListener;
import com.hippo.ehviewer.widget.ProgressiveRatingBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
@@ -97,6 +98,7 @@ public class DetailSectionFragment extends Fragment
private View mDivider;
private AlertDialog mGoToDialog;
private AlertDialog mTagDialog;
private int mCurPage;
private boolean mShowPreview = false;
@@ -423,9 +425,21 @@ public class DetailSectionFragment extends Fragment
voteDown.setOnClickListener(new SimpleVote(groupName, tagText, false));
AlertButton showTagged = new AlertButton(mActivity);
showTagged.setText(getString(R.string.show_tagged));
new ButtonsDialogBuilder(mActivity).setTitle(tagText)
showTagged.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTagDialog.dismiss();
Intent intent = new Intent();
intent.putExtra(MangaListActivity.KEY_GROUP, groupName);
intent.putExtra(MangaListActivity.KEY_TAG, tagText);
mActivity.setResult(Activity.RESULT_OK, intent);
mActivity.finish();
}
});
mTagDialog = new ButtonsDialogBuilder(mActivity).setTitle(tagText)
.addButton(voteUp).addButton(voteDown).addButton(showTagged)
.create().show();
.create();
mTagDialog.show();
}
});
AutoWrapLayout.LayoutParams alp = new AutoWrapLayout.LayoutParams();
@@ -54,11 +54,8 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.text.Editable;
import android.text.Selection;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextWatcher;
import android.text.style.ImageSpan;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -117,6 +114,11 @@ public class MangaListActivity extends SlidingActivity
private static String TAG = "MangaListActivity";
public static int TAG_CODE = 0x123;
public static String KEY_GROUP = "group";
public static String KEY_TAG = "tag";
private static final int REFRESH = 0x0;
private static final int NEXT_PAGE = 0x1;
private static final int PRE_PAGE = 0x2;
@@ -1503,7 +1505,8 @@ public class MangaListActivity extends SlidingActivity
GalleryInfo gi = lmdArray.get(position);
intent.putExtra("url", EhClient.getDetailUrl(gi.gid, gi.token));
intent.putExtra(MangaDetailActivity.KEY_G_INFO, gi);
startActivity(intent);
// Maybe shoud use other method
startActivityForResult(intent, TAG_CODE);
}
});
mMainList.setOnItemLongClickListener(new OnItemLongClickListener() {
@@ -1691,6 +1694,26 @@ public class MangaListActivity extends SlidingActivity
createJumpDialog().show();
}
// TODO when it is refreshing
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
Log.d(TAG, "onActivityResult");
if (requestCode == TAG_CODE
&& resultCode == RESULT_OK) {
lus = new ListUrls();
String tag = data.getStringExtra(KEY_GROUP)
+ ":" + data.getStringExtra(KEY_TAG);
lus.setTag(tag);
mTitle = tag;
setTitle(tag);
refresh();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection