给fragment添加tag
This commit is contained in:
parent
179b6e402e
commit
b857e3c4e2
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/.idea
|
||||
.idea/
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="true" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="11" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/agentwebnodule" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/baselib" />
|
||||
<option value="$PROJECT_DIR$/lfilepickerlibrary" />
|
||||
<option value="$PROJECT_DIR$/mainmodule" />
|
||||
<option value="$PROJECT_DIR$/moduleijkplayer" />
|
||||
<option value="$PROJECT_DIR$/oamodule" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -24,7 +24,6 @@ import com.hjq.toast.ToastUtils;
|
||||
import com.jcodecraeer.xrecyclerview.progressindicator.AVLoadingIndicatorView;
|
||||
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
|
||||
import com.tenlionsoft.baselib.R;
|
||||
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
@ -55,6 +54,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
protected TextView mTvFragmentOption;
|
||||
protected TextView mTvFragmentTitle;
|
||||
private ActivityResultLauncher<Intent> mLauncher;
|
||||
private String tag;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@ -88,6 +88,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
setDataToView(mDataView);
|
||||
return contentView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将view的点击区域放大
|
||||
*
|
||||
@ -107,6 +108,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
parentView.setTouchDelegate(touchDelegate);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示titlebar
|
||||
*/
|
||||
@ -238,6 +240,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void showSoftKeyboard(EditText editText) {
|
||||
if (editText != null) {
|
||||
editText.setFocusable(true);
|
||||
@ -250,6 +253,7 @@ public abstract class BaseFragment extends Fragment {
|
||||
inputManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
public Context getApplicationContext() {
|
||||
return context;
|
||||
}
|
||||
@ -270,6 +274,14 @@ public abstract class BaseFragment extends Fragment {
|
||||
setContentView((ViewGroup) inflater.inflate(layoutResID, container, false));
|
||||
}
|
||||
|
||||
public String getCustomTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setCustomTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public void setContentView(View view) {
|
||||
contentView = view;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public class FragmentUtils {
|
||||
|
||||
public static BaseFragment getFragment(String path, String tag) {
|
||||
BaseFragment fragment = (BaseFragment) ARouter.getInstance().build(path).setTag(tag).navigation();
|
||||
fragment.setCustomTag(tag);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
@ -206,8 +206,8 @@ public class UserRecordDetailActivity extends BaseActivity {
|
||||
private void chooseFragment(String type) {
|
||||
for (int i = 0; i < mFragments.size(); i++) {
|
||||
BaseFragment fragment = mFragments.get(i);
|
||||
LogUtils.e(fragment.getTag());
|
||||
if (type.equals(fragment.getTag())) {
|
||||
LogUtils.e(fragment.getCustomTag());
|
||||
if (type.equals(fragment.getCustomTag())) {
|
||||
mVpContent.setCurrentItem(i, false);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user