diff --git a/app/src/main/java/com/github/jeffery/skin/MainActivity.java b/app/src/main/java/com/github/jeffery/skin/MainActivity.java index 54f89a3..c556e45 100644 --- a/app/src/main/java/com/github/jeffery/skin/MainActivity.java +++ b/app/src/main/java/com/github/jeffery/skin/MainActivity.java @@ -1,15 +1,14 @@ package com.github.jeffery.skin; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; - import android.Manifest; +import android.content.Intent; import android.os.Bundle; -import android.view.View; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; + import java.io.File; -import java.io.IOException; public class MainActivity extends AppCompatActivity { @@ -35,6 +34,7 @@ protected void onCreate(Bundle savedInstanceState) { SkinManger.getInstance().setAppSkin(file12.getAbsolutePath()); tvSkinName.setText(getCurrentSkinName()); }); + findViewById(R.id.btn_fragment).setOnClickListener(v -> startActivity(new Intent(v.getContext(), SecondActivity.class))); ActivityCompat.requestPermissions(this, new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE diff --git a/app/src/main/java/com/github/jeffery/skin/TestFragment.java b/app/src/main/java/com/github/jeffery/skin/TestFragment.java new file mode 100644 index 0000000..3316d64 --- /dev/null +++ b/app/src/main/java/com/github/jeffery/skin/TestFragment.java @@ -0,0 +1,23 @@ +package com.github.jeffery.skin; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +/** + * @author mxlei + * @date 2022/8/31 + */ +public class TestFragment extends Fragment { + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_test, container, false); + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 285aa8d..59e39d4 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,5 @@ +