Skip to content

Commit

Permalink
新增zswitcher和zsetting库,美化设置界面
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-P-J committed Feb 23, 2020
1 parent 0bf21c3 commit f8f8acc
Show file tree
Hide file tree
Showing 172 changed files with 11,279 additions and 2,612 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies {
implementation 'com.sunbq:iconcountview:1.0.1'
implementation 'com.github.pinguo-zhouwei:MZBannerView:v2.0.2'
implementation 'com.jaeger.ninegridimageview:library:1.1.1'
implementation 'com.lqr.ninegridimageview:library:1.0.0'
// implementation 'com.ycjiang:ImagePreview:2.3.0'
implementation 'com.kongzue.stacklabel:stacklabelview:1.1.9'
implementation 'jp.wasabeef:glide-transformations:2.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.ImageViewerPopupView;
import com.lxj.xpopup.interfaces.OnSrcViewUpdateListener;
Expand All @@ -34,7 +32,7 @@
import java.util.ArrayList;
import java.util.List;

public class ImageListFragment extends NextUrlFragment<WallpaperInfo> {
public class WallpaperListFragment extends NextUrlFragment<WallpaperInfo> {

private static final String KEY_ID = "id";
private static final String KEY_TAG = "tag";
Expand All @@ -47,11 +45,11 @@ public class ImageListFragment extends NextUrlFragment<WallpaperInfo> {

private int screenWidth;

public static ImageListFragment newInstance(WallpaperTag tag) {
public static WallpaperListFragment newInstance(WallpaperTag tag) {
Bundle args = new Bundle();
args.putString(KEY_ID, tag.getId());
args.putString(KEY_TAG, tag.getName());
ImageListFragment fragment = new ImageListFragment();
WallpaperListFragment fragment = new WallpaperListFragment();
fragment.setArguments(args);
return fragment;
}
Expand Down Expand Up @@ -93,8 +91,12 @@ public void onBindViewHolder(EasyViewHolder holder, List<WallpaperInfo> list, in
ViewGroup.LayoutParams layoutParams = wallpaper.getLayoutParams();
float width = Float.parseFloat(info.getWidth());
float height = Float.parseFloat(info.getHeight());
float p = height / width;
if (p > 2.5f) {
p = 2.5f;
}
layoutParams.width = screenWidth / 2;
layoutParams.height = (int) (height / width * layoutParams.width);
layoutParams.height = (int) (p * layoutParams.width);

wallpaper.setLayoutParams(layoutParams);
Glide.with(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.zpj.shouji.market.R;
import com.zpj.shouji.market.model.WallpaperTag;
import com.zpj.shouji.market.ui.adapter.FragmentsPagerAdapter;
import com.zpj.shouji.market.ui.fragment.ImageListFragment;
import com.zpj.shouji.market.ui.fragment.WallpaperListFragment;
import com.zpj.fragmentation.BaseFragment;
import com.zpj.shouji.market.ui.widget.popup.WallpaperTagPopup;
import com.zpj.shouji.market.utils.HttpApi;
Expand All @@ -37,7 +37,7 @@ public class WallpaperFragment extends BaseFragment implements View.OnClickListe

private final AtomicBoolean isInitTags = new AtomicBoolean(false);

private final List<ImageListFragment> fragments = new ArrayList<>(0);
private final List<WallpaperListFragment> fragments = new ArrayList<>(0);
private final List<WallpaperTag> wallpaperTags = new ArrayList<>(0);

private ViewPager viewPager;
Expand Down Expand Up @@ -106,7 +106,7 @@ private void initMagicIndicator() {
isInitTags.set(true);
fragments.clear();
for (WallpaperTag tag : wallpaperTags) {
fragments.add(ImageListFragment.newInstance(tag));
fragments.add(WallpaperListFragment.newInstance(tag));
}
FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getChildFragmentManager(), fragments, null);
viewPager.setAdapter(adapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.support.annotation.Nullable;
import android.view.View;

import com.leon.lib.settingview.LSettingItem;
import com.zpj.shouji.market.R;
import com.zpj.widget.setting.CommonSettingItem;

public class AboutSettingFragment extends BaseSettingFragment {

Expand All @@ -17,15 +17,14 @@ protected int getLayoutId() {
@Override
protected void initView(View view, @Nullable Bundle savedInstanceState) {
setToolbarTitle("关于应用");
LSettingItem itemSearchEngine = view.findViewById(R.id.item_check_update);
itemSearchEngine.setOnLSettingItemClick(this);
CommonSettingItem itemSearchEngine = view.findViewById(R.id.item_check_update);
itemSearchEngine.setOnItemClickListener(this);
}

@Override
public void click(View view, boolean isChecked) {
if (view.getId() == R.id.item_check_update) {
public void onClick(CommonSettingItem item) {
if (item.getId() == R.id.item_check_update) {

}
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.zpj.shouji.market.ui.fragment.setting;

import com.leon.lib.settingview.LSettingItem;
import com.zpj.fragmentation.BaseFragment;
import com.zpj.widget.setting.CommonSettingItem;
import com.zpj.widget.setting.OnItemClickListener;

public abstract class BaseSettingFragment extends BaseFragment
implements LSettingItem.OnLSettingItemClick {
implements OnItemClickListener<CommonSettingItem> {

@Override
protected boolean supportSwipeBack() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.support.annotation.Nullable;
import android.view.View;

import com.leon.lib.settingview.LSettingItem;
import com.zpj.shouji.market.R;
import com.zpj.widget.setting.CommonSettingItem;

public class CommonSettingFragment extends BaseSettingFragment {

Expand All @@ -18,30 +18,30 @@ protected int getLayoutId() {
protected void initView(View view, @Nullable Bundle savedInstanceState) {
setToolbarTitle("通用设置");

LSettingItem itemShowStartPage = view.findViewById(R.id.item_show_start_page);
itemShowStartPage.setOnLSettingItemClick(this);
CommonSettingItem itemShowStartPage = view.findViewById(R.id.item_show_start_page);
itemShowStartPage.setOnItemClickListener(this);

LSettingItem itemShowUpdateNotification = view.findViewById(R.id.item_show_update_notification);
itemShowUpdateNotification.setOnLSettingItemClick(this);
CommonSettingItem itemShowUpdateNotification = view.findViewById(R.id.item_show_update_notification);
itemShowUpdateNotification.setOnItemClickListener(this);

LSettingItem itemBrightnessControl = view.findViewById(R.id.item_brightness_control);
itemBrightnessControl.setOnLSettingItemClick(this);
CommonSettingItem itemBrightnessControl = view.findViewById(R.id.item_brightness_control);
itemBrightnessControl.setOnItemClickListener(this);



LSettingItem itemAutoSaveTraffic = view.findViewById(R.id.item_auto_save_traffic);
itemAutoSaveTraffic.setOnLSettingItemClick(this);
CommonSettingItem itemAutoSaveTraffic = view.findViewById(R.id.item_auto_save_traffic);
itemAutoSaveTraffic.setOnItemClickListener(this);

LSettingItem itemShowOriginalImage = view.findViewById(R.id.item_show_original_image);
itemShowOriginalImage.setOnLSettingItemClick(this);
CommonSettingItem itemShowOriginalImage = view.findViewById(R.id.item_show_original_image);
itemShowOriginalImage.setOnItemClickListener(this);

LSettingItem itemClearCache = view.findViewById(R.id.item_clear_cache);
itemClearCache.setOnLSettingItemClick(this);
CommonSettingItem itemClearCache = view.findViewById(R.id.item_clear_cache);
itemClearCache.setOnItemClickListener(this);
}

@Override
public void click(View view, boolean isChecked) {
switch (view.getId()) {
public void onClick(CommonSettingItem item) {
switch (item.getId()) {
case R.id.item_show_start_page:

break;
Expand All @@ -64,5 +64,4 @@ public void click(View view, boolean isChecked) {
break;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.support.annotation.Nullable;
import android.view.View;

import com.leon.lib.settingview.LSettingItem;
import com.zpj.shouji.market.R;
import com.zpj.widget.setting.CommonSettingItem;

public class DownloadSettingFragment extends BaseSettingFragment {

Expand All @@ -17,28 +17,28 @@ protected int getLayoutId() {
@Override
protected void initView(View view, @Nullable Bundle savedInstanceState) {
setToolbarTitle("下载设置");
LSettingItem itemDownloadFolder = view.findViewById(R.id.item_download_folder);
itemDownloadFolder.setOnLSettingItemClick(this);
CommonSettingItem itemDownloadFolder = view.findViewById(R.id.item_download_folder);
itemDownloadFolder.setOnItemClickListener(this);

LSettingItem itemMaxDownloading = view.findViewById(R.id.item_max_downloading);
itemMaxDownloading.setOnLSettingItemClick(this);
CommonSettingItem itemMaxDownloading = view.findViewById(R.id.item_max_downloading);
itemMaxDownloading.setOnItemClickListener(this);

LSettingItem itemMaxThread = view.findViewById(R.id.item_max_thread);
itemMaxThread.setOnLSettingItemClick(this);
CommonSettingItem itemMaxThread = view.findViewById(R.id.item_max_thread);
itemMaxThread.setOnItemClickListener(this);

LSettingItem itemInstallDownloaded = view.findViewById(R.id.item_install_downloaded);
itemInstallDownloaded.setOnLSettingItemClick(this);
CommonSettingItem itemInstallDownloaded = view.findViewById(R.id.item_install_downloaded);
itemInstallDownloaded.setOnItemClickListener(this);

LSettingItem itemShowDownloadedRing = view.findViewById(R.id.item_show_downloaded_ring);
itemShowDownloadedRing.setOnLSettingItemClick(this);
CommonSettingItem itemShowDownloadedRing = view.findViewById(R.id.item_show_downloaded_ring);
itemShowDownloadedRing.setOnItemClickListener(this);

LSettingItem itemShowDownloadNotification = view.findViewById(R.id.item_show_downloaded_notification);
itemShowDownloadNotification.setOnLSettingItemClick(this);
CommonSettingItem itemShowDownloadNotification = view.findViewById(R.id.item_show_downloaded_notification);
itemShowDownloadNotification.setOnItemClickListener(this);
}

@Override
public void click(View view, boolean isChecked) {
switch (view.getId()) {
public void onClick(CommonSettingItem item) {
switch (item.getId()) {
case R.id.item_download_folder:

break;
Expand All @@ -61,5 +61,4 @@ public void click(View view, boolean isChecked) {
break;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.support.annotation.Nullable;
import android.view.View;

import com.leon.lib.settingview.LSettingItem;
import com.zpj.shouji.market.R;
import com.zpj.widget.setting.CommonSettingItem;

public class InstallSettingFragment extends BaseSettingFragment {

Expand All @@ -17,22 +17,22 @@ protected int getLayoutId() {
@Override
protected void initView(View view, @Nullable Bundle savedInstanceState) {
setToolbarTitle("安装设置");
LSettingItem itemInstallDownloaded = view.findViewById(R.id.item_install_downloaded);
itemInstallDownloaded.setOnLSettingItemClick(this);
CommonSettingItem itemInstallDownloaded = view.findViewById(R.id.item_install_downloaded);
itemInstallDownloaded.setOnItemClickListener(this);

LSettingItem itemAutoDeleteApk = view.findViewById(R.id.item_auto_delete_apk);
itemAutoDeleteApk.setOnLSettingItemClick(this);
CommonSettingItem itemAutoDeleteApk = view.findViewById(R.id.item_auto_delete_apk);
itemAutoDeleteApk.setOnItemClickListener(this);

LSettingItem itemAutoInstall = view.findViewById(R.id.item_auto_install);
itemAutoInstall.setOnLSettingItemClick(this);
CommonSettingItem itemAutoInstall = view.findViewById(R.id.item_auto_install);
itemAutoInstall.setOnItemClickListener(this);

LSettingItem itemRootInstall = view.findViewById(R.id.item_root_install);
itemRootInstall.setOnLSettingItemClick(this);
CommonSettingItem itemRootInstall = view.findViewById(R.id.item_root_install);
itemRootInstall.setOnItemClickListener(this);
}

@Override
public void click(View view, boolean isChecked) {
switch (view.getId()) {
public void onClick(CommonSettingItem item) {
switch (item.getId()) {
case R.id.item_install_downloaded:

break;
Expand All @@ -49,5 +49,4 @@ public void click(View view, boolean isChecked) {
break;
}
}

}
8 changes: 1 addition & 7 deletions app/src/main/res/layout/fragment_me.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,7 @@
<include layout="@layout/layout_my_tools" />

<www.linwg.org.lib.LCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@android:color/white"
app:shadowSize="8dp"
app:shadowColor="#5f6379"
app:shadowStartAlpha="10"
app:cornerRadius="10dp"
style="@style/setting_card_style"
>

<android.support.v7.widget.LinearLayoutCompat
Expand Down
Loading

0 comments on commit f8f8acc

Please sign in to comment.