You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pocketcommunityclient/app/src/main/java/com/community/pocket/ui/main/TestMainFragment.java

44 lines
1.3 KiB

package com.community.pocket.ui.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import com.community.pocket.ui.BaseFragment;
import org.jetbrains.annotations.NotNull;
/**
* 主界面框架
*/
//TODO 测试类
public abstract class TestMainFragment extends BaseFragment {
@NotNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//文本框打印测试信息
View root = super.onCreateView(inflater, container, savedInstanceState);
final TextView textView = root.findViewById(viewId());
MutableLiveData<String> mText = new MutableLiveData<>();
mText.setValue("未完成界面!!!");
mText.observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
protected abstract int viewId();
}