Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Commit

Permalink
Add hide reply view guide
Browse files Browse the repository at this point in the history
  • Loading branch information
seven332 committed Dec 21, 2015
1 parent 84ed341 commit 00b44f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/src/main/java/com/hippo/nimingban/ui/PostActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;

import com.hippo.nimingban.GuideHelper;
import com.hippo.nimingban.R;
import com.hippo.nimingban.client.data.Site;
import com.hippo.nimingban.ui.fragment.FragmentHost;
import com.hippo.nimingban.ui.fragment.PostFragment;
import com.hippo.nimingban.ui.fragment.TypeSendFragment;
import com.hippo.nimingban.util.Settings;
import com.hippo.nimingban.widget.PostLayout;
import com.hippo.yorozuya.LayoutUtils;
import com.hippo.yorozuya.ResourcesUtils;

public final class PostActivity extends SwipeActivity
Expand Down Expand Up @@ -111,8 +115,28 @@ public void onBackPressed() {
}
}

private void showSwipeGuide() {
new GuideHelper.Builder(this)
.setColor(ResourcesUtils.getAttrColor(this, R.attr.colorPrimary))
.setPadding(LayoutUtils.dp2pix(this, 16))
.setMessagePosition(Gravity.TOP)
.setMessage(getString(R.string.swipe_toolbar_hide_show))
.setButton(getString(R.string.get_it))
.setBackgroundColor(0x73000000)
.setOnDissmisListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Settings.putGuideTypeSend(false);
}
}).show();
}

@Override
public void reply(Site site, String id, String presetText, boolean report) {
if (Settings.getGuideTypeSend()) {
showSwipeGuide();
}

FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = fragmentManager.findFragmentByTag(TAG_FRAGMENT_TYPE_SEND);

Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/hippo/nimingban/util/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,17 @@ public static void putGuideSortForumsActivity(boolean value) {
putBoolean(KEY_GUIDE_SORT_FORUMS_ACTIVITY, value);
}

public static final String KEY_GUIDE_TYPE_SEND = "guide_type_send";
public static final boolean VALUE_GUIDE_TYPE_SEND = true;

public static boolean getGuideTypeSend() {
return getBoolean(KEY_GUIDE_TYPE_SEND, VALUE_GUIDE_TYPE_SEND);
}

public static void putGuideTypeSend(boolean value) {
putBoolean(KEY_GUIDE_TYPE_SEND, value);
}

public static final String KEY_CRASH_FILENAME = "crash_filename";
public static final String VALUE_CRASH_FILENAME = null;

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

<string name="cant_make_sure_image_save_location">似乎图片存储位置用不了了,需要重新设置</string>

<string name="swipe_toolbar_hide_show">上下滑动标题栏来隐藏或显示回复界面</string>

<string name="swipe_right_open_menu">右滑打开菜单</string>
<string name="swipe_left_open_forum_list">左滑打开板块</string>
<string name="double_click_toolbar_refresh">双击 toolbar 刷新</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

<string name="cant_make_sure_image_save_location">It seems your picture saving location is not available. Set it in Settings to save pictures. </string>

<string name="swipe_toolbar_hide_show">Swipe toolbar vertically to hide and show reply UI</string>

<string name="swipe_right_open_menu">Swipe right for menu</string>
<string name="swipe_left_open_forum_list">Swipe left for forum list</string>
<string name="double_click_toolbar_refresh">Double click toolbar to refresh</string>
Expand Down

0 comments on commit 00b44f9

Please sign in to comment.