parent
589d258a71
commit
9fe5f34159
@ -1,19 +0,0 @@ |
|||||||
package com.community.pocket.ui.main.ui.forum; |
|
||||||
|
|
||||||
import com.community.pocket.R; |
|
||||||
import com.community.pocket.ui.main.TestMainFragment; |
|
||||||
|
|
||||||
import org.xutils.view.annotation.ContentView; |
|
||||||
|
|
||||||
/** |
|
||||||
* 发送帖子 |
|
||||||
*/ |
|
||||||
@ContentView(R.layout.forum_post_fragment) |
|
||||||
public class ForumPostFragment extends TestMainFragment { |
|
||||||
|
|
||||||
@Override |
|
||||||
protected int viewId() { |
|
||||||
return R.id.text_post; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,35 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import android.view.View; |
||||||
|
import android.widget.EditText; |
||||||
|
import android.widget.Toast; |
||||||
|
|
||||||
|
import com.community.pocket.R; |
||||||
|
|
||||||
|
import org.xutils.view.annotation.ContentView; |
||||||
|
import org.xutils.view.annotation.Event; |
||||||
|
import org.xutils.view.annotation.ViewInject; |
||||||
|
|
||||||
|
/** |
||||||
|
* 活动贴 |
||||||
|
*/ |
||||||
|
@ContentView(R.layout.forum_post_active_fragment) |
||||||
|
public class ForumPostActiveFragment extends ForumPostContent { |
||||||
|
|
||||||
|
@ViewInject(R.id.active_start_time) |
||||||
|
private EditText activeStartTime; |
||||||
|
|
||||||
|
@ViewInject(R.id.active_end_time) |
||||||
|
private EditText activeEndTime; |
||||||
|
|
||||||
|
@ViewInject(R.id.active_score) |
||||||
|
private EditText activeScore; |
||||||
|
|
||||||
|
/** |
||||||
|
* 发帖操作 |
||||||
|
*/ |
||||||
|
@Event(value = R.id.post_button) |
||||||
|
private void onButtonClick(View v) { |
||||||
|
Toast.makeText(getContext(), R.string.post, Toast.LENGTH_SHORT).show(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel; |
||||||
|
|
||||||
|
public class ForumPostActiveViewModel extends ViewModel { |
||||||
|
// TODO: Implement the ViewModel
|
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import android.view.View; |
||||||
|
import android.widget.AutoCompleteTextView; |
||||||
|
import android.widget.TextView; |
||||||
|
import android.widget.Toast; |
||||||
|
|
||||||
|
import com.community.pocket.R; |
||||||
|
|
||||||
|
import org.xutils.view.annotation.ContentView; |
||||||
|
import org.xutils.view.annotation.Event; |
||||||
|
import org.xutils.view.annotation.ViewInject; |
||||||
|
|
||||||
|
/** |
||||||
|
* 投诉贴 |
||||||
|
*/ |
||||||
|
@ContentView(R.layout.forum_post_complain_fragment) |
||||||
|
public class ForumPostComplainFragment extends ForumPostContent { |
||||||
|
|
||||||
|
/** |
||||||
|
* 显示投诉人 |
||||||
|
*/ |
||||||
|
@ViewInject(R.id.show_name) |
||||||
|
private TextView showName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 检索投诉人 |
||||||
|
*/ |
||||||
|
@ViewInject(R.id.search_name) |
||||||
|
private AutoCompleteTextView searchName; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 发帖操作 |
||||||
|
*/ |
||||||
|
@Event(value = R.id.post_button) |
||||||
|
private void onButtonClick(View v) { |
||||||
|
Toast.makeText(getContext(), R.string.post, Toast.LENGTH_SHORT).show(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel; |
||||||
|
|
||||||
|
public class ForumPostComplainViewModel extends ViewModel { |
||||||
|
// TODO: Implement the ViewModel
|
||||||
|
} |
@ -0,0 +1,147 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import android.annotation.SuppressLint; |
||||||
|
import android.os.Build; |
||||||
|
import android.os.Bundle; |
||||||
|
import android.os.Handler; |
||||||
|
import android.os.Message; |
||||||
|
import android.text.Editable; |
||||||
|
import android.text.Html; |
||||||
|
import android.text.TextWatcher; |
||||||
|
import android.view.View; |
||||||
|
import android.widget.EditText; |
||||||
|
import android.widget.TextView; |
||||||
|
|
||||||
|
import androidx.annotation.IdRes; |
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.annotation.Nullable; |
||||||
|
import androidx.annotation.RequiresApi; |
||||||
|
import androidx.navigation.NavController; |
||||||
|
import androidx.navigation.Navigation; |
||||||
|
|
||||||
|
import com.community.pocket.R; |
||||||
|
import com.community.pocket.ui.BaseFragment; |
||||||
|
|
||||||
|
import org.xutils.view.annotation.ViewInject; |
||||||
|
|
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送正文界面 |
||||||
|
*/ |
||||||
|
abstract class ForumPostContent extends BaseFragment { |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送正文 |
||||||
|
*/ |
||||||
|
@ViewInject(R.id.post_content) |
||||||
|
private EditText postContent; |
||||||
|
|
||||||
|
/** |
||||||
|
* 字符记数 |
||||||
|
*/ |
||||||
|
@ViewInject(R.id.show_count) |
||||||
|
private TextView showCount; |
||||||
|
|
||||||
|
/** |
||||||
|
* 字符记数 |
||||||
|
*/ |
||||||
|
@ViewInject(R.id.show_count_top) |
||||||
|
private TextView showCountTop; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 导航 |
||||||
|
*/ |
||||||
|
//TODO 临时方法,存在内存泄露
|
||||||
|
@SuppressLint("StaticFieldLeak") |
||||||
|
private static NavController nav; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 选择帖子类型触发事件 |
||||||
|
*/ |
||||||
|
static Handler handler = new MyHandler(); |
||||||
|
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
||||||
|
@Override |
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
||||||
|
super.onViewCreated(view, savedInstanceState); |
||||||
|
showCount(); |
||||||
|
initPostCtrl(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
||||||
|
private static void nav(@IdRes int id) { |
||||||
|
if (Objects.requireNonNull(nav.getCurrentDestination()).getId() != id) { |
||||||
|
nav.navigate(id); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 初始化路由控制器 |
||||||
|
*/ |
||||||
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
||||||
|
private void initPostCtrl() { |
||||||
|
if (nav == null) { |
||||||
|
nav = Navigation.findNavController(Objects.requireNonNull(getView())); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设置计数 |
||||||
|
*/ |
||||||
|
private void setCount() { |
||||||
|
String text = getString(R.string.post_content_count, postContent.length(), getResources().getInteger(R.integer.post_content)); |
||||||
|
showCount.setText(Html.fromHtml(text)); |
||||||
|
showCountTop.setText(Html.fromHtml(text)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 提示正文字数 |
||||||
|
*/ |
||||||
|
private void showCount() { |
||||||
|
|
||||||
|
setCount(); |
||||||
|
|
||||||
|
postContent.addTextChangedListener(new TextWatcher() { |
||||||
|
@Override |
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) { |
||||||
|
setCount(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterTextChanged(Editable s) { |
||||||
|
|
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private static class MyHandler extends Handler { |
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
||||||
|
@Override |
||||||
|
public void handleMessage(@NonNull Message msg) { |
||||||
|
switch (msg.what) { |
||||||
|
case 0: |
||||||
|
nav(R.id.forumPostActiveFragment); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
nav(R.id.forumPostTopicFragment); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
nav(R.id.forumPostComplainFragment); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,64 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import android.os.Build; |
||||||
|
import android.os.Bundle; |
||||||
|
import android.view.View; |
||||||
|
import android.widget.AdapterView; |
||||||
|
import android.widget.EditText; |
||||||
|
import android.widget.Spinner; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.annotation.Nullable; |
||||||
|
import androidx.annotation.RequiresApi; |
||||||
|
|
||||||
|
import com.community.pocket.R; |
||||||
|
import com.community.pocket.ui.BaseFragment; |
||||||
|
|
||||||
|
import org.xutils.view.annotation.ContentView; |
||||||
|
import org.xutils.view.annotation.ViewInject; |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送帖子 |
||||||
|
*/ |
||||||
|
@ContentView(R.layout.forum_post_fragment) |
||||||
|
public class ForumPostFragment extends BaseFragment { |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送标题 |
||||||
|
*/ |
||||||
|
@ViewInject(R.id.post_title) |
||||||
|
private EditText postTitle; |
||||||
|
|
||||||
|
/** |
||||||
|
* 帖子类型 |
||||||
|
*/ |
||||||
|
@ViewInject(R.id.post_type) |
||||||
|
private Spinner postType; |
||||||
|
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
||||||
|
@Override |
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
||||||
|
super.onViewCreated(view, savedInstanceState); |
||||||
|
onPostTypeChange(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 切换帖子类型 |
||||||
|
*/ |
||||||
|
private void onPostTypeChange() { |
||||||
|
postType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { |
||||||
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
||||||
|
@Override |
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
||||||
|
ForumPostContent.handler.sendEmptyMessage(position); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onNothingSelected(AdapterView<?> parent) { |
||||||
|
|
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import android.view.View; |
||||||
|
import android.widget.Toast; |
||||||
|
|
||||||
|
import com.community.pocket.R; |
||||||
|
|
||||||
|
import org.xutils.view.annotation.ContentView; |
||||||
|
import org.xutils.view.annotation.Event; |
||||||
|
|
||||||
|
/** |
||||||
|
* 动态贴 |
||||||
|
*/ |
||||||
|
@ContentView(R.layout.forum_post_topic_fragment) |
||||||
|
public class ForumPostTopicFragment extends ForumPostContent { |
||||||
|
/** |
||||||
|
* 发帖操作 |
||||||
|
*/ |
||||||
|
@Event(value = R.id.post_button) |
||||||
|
private void onButtonClick(View v) { |
||||||
|
Toast.makeText(getContext(), R.string.post, Toast.LENGTH_SHORT).show(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel; |
||||||
|
|
||||||
|
public class ForumPostTopicViewModel extends ViewModel { |
||||||
|
// TODO: Implement the ViewModel
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.community.pocket.ui.main.ui.forum; |
package com.community.pocket.ui.main.ui.forum.post; |
||||||
|
|
||||||
import androidx.lifecycle.ViewModel; |
import androidx.lifecycle.ViewModel; |
||||||
|
|
@ -0,0 +1,77 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
tools:context=".ui.main.ui.forum.post.ForumPostActiveFragment"> |
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content"> |
||||||
|
|
||||||
|
<include |
||||||
|
android:id="@+id/post_content_layout" |
||||||
|
layout="@layout/forum_post_content" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" /> |
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout |
||||||
|
android:id="@+id/body_layout" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/post_content_layout"> |
||||||
|
|
||||||
|
<EditText |
||||||
|
android:id="@+id/active_start_time" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/prompt_active_start_time" |
||||||
|
android:importantForAutofill="no" |
||||||
|
android:inputType="none|text" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
tools:layout_constraintTop_toBottomOf="@id/post_content" /> |
||||||
|
|
||||||
|
<EditText |
||||||
|
android:id="@+id/active_end_time" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
android:hint="@string/prompt_active_end_time" |
||||||
|
android:importantForAutofill="no" |
||||||
|
android:inputType="none|text" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/active_start_time" |
||||||
|
tools:layout_constraintTop_toBottomOf="@id/active_start_time" /> |
||||||
|
|
||||||
|
<EditText |
||||||
|
android:id="@+id/active_score" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginTop="8dp" |
||||||
|
android:ems="10" |
||||||
|
android:hint="@string/prompt_active_score" |
||||||
|
android:importantForAutofill="no" |
||||||
|
android:inputType="number" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/active_end_time" |
||||||
|
tools:layout_constraintStart_toStartOf="parent" /> |
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/post_button" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/post" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/body_layout" /> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
|
|
||||||
|
</FrameLayout> |
@ -0,0 +1,53 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
tools:context=".ui.main.ui.forum.post.ForumPostComplainFragment"> |
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/search_layout" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/show_name" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_weight="1" |
||||||
|
android:gravity="center" |
||||||
|
android:text="@string/prompt_complain_name" /> |
||||||
|
|
||||||
|
<AutoCompleteTextView |
||||||
|
android:id="@+id/search_name" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_weight="1" |
||||||
|
android:hint="@string/search_complain_name" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<include |
||||||
|
android:id="@+id/post_content_layout" |
||||||
|
layout="@layout/forum_post_content" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/search_layout" |
||||||
|
tools:layout_constraintStart_toStartOf="parent" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/post_button" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/post" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/post_content_layout" /> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
|
</FrameLayout> |
@ -0,0 +1,43 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/show_count_top" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:gravity="center" |
||||||
|
android:textSize="24sp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" /> |
||||||
|
|
||||||
|
<EditText |
||||||
|
android:id="@+id/post_content" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="300dp" |
||||||
|
android:background="@drawable/border" |
||||||
|
android:ems="15" |
||||||
|
android:gravity="start|top" |
||||||
|
android:hint="@string/prompt_content" |
||||||
|
android:importantForAutofill="no" |
||||||
|
android:inputType="textMultiLine" |
||||||
|
android:maxLength="@integer/post_content" |
||||||
|
android:maxLines="@integer/post_content_maxLines" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/show_count_top" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/show_count" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:gravity="center" |
||||||
|
android:textSize="24sp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/post_content" /> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -1,13 +1,51 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
xmlns:tools="http://schemas.android.com/tools" |
xmlns:tools="http://schemas.android.com/tools" |
||||||
android:layout_width="match_parent" |
android:layout_width="match_parent" |
||||||
android:layout_height="match_parent" |
android:layout_height="match_parent" |
||||||
tools:context=".ui.main.ui.forum.ForumPostFragment"> |
tools:context=".ui.main.ui.forum.post.ForumPostFragment"> |
||||||
|
|
||||||
<TextView |
<ScrollView |
||||||
android:id="@+id/text_post" |
|
||||||
android:layout_width="match_parent" |
android:layout_width="match_parent" |
||||||
android:layout_height="match_parent" /> |
android:layout_height="match_parent" |
||||||
|
tools:ignore="UselessParent"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<EditText |
||||||
|
android:id="@+id/post_title" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ems="10" |
||||||
|
android:hint="@string/prompt_title" |
||||||
|
android:importantForAutofill="no" |
||||||
|
android:inputType="none|text" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" /> |
||||||
|
|
||||||
|
<Spinner |
||||||
|
android:id="@+id/post_type" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:entries="@array/post_type_list" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/post_title" |
||||||
|
tools:layout_constraintStart_toStartOf="parent" /> |
||||||
|
|
||||||
|
<androidx.fragment.app.FragmentContainerView |
||||||
|
android:id="@+id/post_type_fragment" |
||||||
|
android:name="androidx.navigation.fragment.NavHostFragment" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginTop="@dimen/size_8" |
||||||
|
app:defaultNavHost="true" |
||||||
|
app:navGraph="@navigation/nav_forum_post_type" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
</ScrollView> |
||||||
|
|
||||||
</FrameLayout> |
</FrameLayout> |
@ -0,0 +1,27 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
tools:context=".ui.main.ui.forum.post.ForumPostTopicFragment"> |
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent"> |
||||||
|
|
||||||
|
<include |
||||||
|
android:id="@+id/post_content_layout" |
||||||
|
layout="@layout/forum_post_content" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/post_button" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/post" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/post_content_layout" /> |
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
|
</FrameLayout> |
@ -0,0 +1,23 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<navigation xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:id="@+id/nav_forum_post_type" |
||||||
|
app:startDestination="@id/forumPostActiveFragment"> |
||||||
|
|
||||||
|
<fragment |
||||||
|
android:id="@+id/forumPostActiveFragment" |
||||||
|
android:name="com.community.pocket.ui.main.ui.forum.post.ForumPostActiveFragment" |
||||||
|
android:label="forum_post_active_fragment" |
||||||
|
tools:layout="@layout/forum_post_active_fragment" /> |
||||||
|
<fragment |
||||||
|
android:id="@+id/forumPostTopicFragment" |
||||||
|
android:name="com.community.pocket.ui.main.ui.forum.post.ForumPostTopicFragment" |
||||||
|
android:label="forum_post_topic_fragment" |
||||||
|
tools:layout="@layout/forum_post_topic_fragment" /> |
||||||
|
<fragment |
||||||
|
android:id="@+id/forumPostComplainFragment" |
||||||
|
android:name="com.community.pocket.ui.main.ui.forum.post.ForumPostComplainFragment" |
||||||
|
android:label="forum_post_complain_fragment" |
||||||
|
tools:layout="@layout/forum_post_complain_fragment" /> |
||||||
|
</navigation> |
@ -0,0 +1,5 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<integer name="post_content">200</integer> |
||||||
|
<integer name="post_content_maxLines">10</integer> |
||||||
|
</resources> |
@ -0,0 +1,5 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<integer name="post_content">200</integer> |
||||||
|
<integer name="post_content_maxLines">10</integer> |
||||||
|
</resources> |
@ -0,0 +1,9 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<!-- 帖子发送类型--> |
||||||
|
<string-array name="post_type_list"> |
||||||
|
<item>@string/post_type_activity</item> |
||||||
|
<item>@string/post_type_topic</item> |
||||||
|
<item>@string/post_type_complain</item> |
||||||
|
</string-array> |
||||||
|
</resources> |
@ -0,0 +1,5 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<integer name="post_content">200</integer> |
||||||
|
<integer name="post_content_maxLines">10</integer> |
||||||
|
</resources> |
Loading…
Reference in new issue