78 lines
2.5 KiB
Java
78 lines
2.5 KiB
Java
package com.keypalette.theme.activity;
|
|
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
import androidx.recyclerview.widget.GridLayoutManager;
|
|
|
|
import com.ad.tradpluslibrary.TPAdManager;
|
|
import com.keypalette.theme.AllAdapter;
|
|
import com.keypalette.theme.KeyApp;
|
|
import com.keypalette.theme.dataabout.resource.Data;
|
|
import com.keypalette.theme.databinding.PageSkinsAllBinding;
|
|
import com.keypalette.theme.dataabout.resource.WrapperData;
|
|
import com.keypalette.theme.other.Helper;
|
|
import com.keypalette.theme.other.ItemDecoration;
|
|
|
|
import java.util.List;
|
|
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
public class PageSkinsAll extends AppCompatActivity {
|
|
private PageSkinsAllBinding vb;
|
|
public static final String KEY_NAME = "class_name";
|
|
private String name;
|
|
private List<Data> data;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
vb = PageSkinsAllBinding.inflate(getLayoutInflater());
|
|
Helper.INSTANCE.initFullScreen(this, true);
|
|
setContentView(vb.getRoot());
|
|
;
|
|
name = getIntent().getStringExtra(KEY_NAME);
|
|
initData();
|
|
initClick();
|
|
TPAdManager.INSTANCE.showTPAD(this, new Function0<Unit>() {
|
|
@Override
|
|
public Unit invoke() {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
private void initData() {
|
|
vb.className.setText(name);
|
|
for (WrapperData WrapperData : KeyApp.list) {
|
|
if (WrapperData.getParentName().equals(name)) {
|
|
data = WrapperData.getKeyboardList();
|
|
}
|
|
}
|
|
ItemDecoration itemDecoration = new ItemDecoration(3, 3, 0);
|
|
AllAdapter adapterMain = new AllAdapter(this);
|
|
adapterMain.setForYouList(data);
|
|
vb.recycler.setLayoutManager(new GridLayoutManager(PageSkinsAll.this, 2));
|
|
vb.recycler.setAdapter(adapterMain);
|
|
vb.recycler.addItemDecoration(itemDecoration);
|
|
|
|
}
|
|
|
|
private void initClick() {
|
|
vb.back.setOnClickListener(new View.OnClickListener() {
|
|
@Override
|
|
public void onClick(View v) {
|
|
TPAdManager.INSTANCE.showTPAD(PageSkinsAll.this, new Function0<Unit>() {
|
|
@Override
|
|
public Unit invoke() {
|
|
finish();
|
|
return null;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
} |