页面微调,下载管理移除免流量传送,免流量传送改为独立页面

This commit is contained in:
kehaoyuan
2019-06-17 17:15:56 +08:00
parent aec9ec8294
commit 55e9bd681e
12 changed files with 66 additions and 43 deletions

View File

@ -17,7 +17,6 @@ public class DownloadManagerActivity extends NormalActivity {
public static final int INDEX_DOWNLOAD = 0;
public static final int INDEX_UPDATE = 1;
public static final int INDEX_SEND = 2;
public static final String TAG = "DownloadManagerActivity";

View File

@ -1,14 +1,9 @@
package com.gh.gamecenter;
import androidx.lifecycle.ViewModelProviders;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -38,9 +33,14 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import static com.gh.gamecenter.download.FileSendFragment.KC_REQUEST;
import static com.gh.gamecenter.kuaichuan.view.FileShareFragment.KC_REQUEST;
/**
* Created by khy on 15/06/17.

View File

@ -1,12 +1,12 @@
package com.gh.gamecenter.discover
import androidx.databinding.DataBindingUtil
import android.os.Bundle
import androidx.core.content.ContextCompat
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.RelativeLayout
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import butterknife.BindView
import butterknife.OnClick
import com.facebook.drawee.view.SimpleDraweeView
@ -18,6 +18,7 @@ import com.gh.gamecenter.*
import com.gh.gamecenter.databinding.PieceDiscoverItemBinding
import com.gh.gamecenter.db.GameTrendsDao
import com.gh.gamecenter.eventbus.EBReuse
import com.gh.gamecenter.kuaichuan.view.FileShareActivity
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.personal.PersonalFragment.LOGOUT_TAG
import com.halo.assistant.HaloApp
@ -126,9 +127,7 @@ class DiscoverFragment : BaseFragment<Any>() {
MtaHelper.onEvent("发现", "免流量传送")
DataCollectionUtils.uploadClick(activity, "免流量传送", "发现")
startActivity(DownloadManagerActivity.getDownloadMangerIntent(context,
DownloadManagerActivity.INDEX_SEND,
"(发现:免流量传送)"))
startActivity(FileShareActivity.getIntent(context, "(发现:免流量传送)"))
}
R.id.discover_apk_cleaner -> {
MtaHelper.onEvent("发现", "安装包清理")

View File

@ -1,10 +1,10 @@
package com.gh.gamecenter.download
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import androidx.fragment.app.Fragment
import com.gh.base.fragment.BaseFragment_TabLayout
import com.gh.common.util.DataUtils
import com.gh.download.DownloadManager
@ -24,32 +24,24 @@ import org.greenrobot.eventbus.ThreadMode
class DownloadFragment : BaseFragment_TabLayout() {
companion object {
val INDEX_DOWNLOAD = 0
@JvmField
val INDEX_UPDATE = 1
val INDEX_KC = 2
const val INDEX_DOWNLOAD = 0
const val INDEX_UPDATE = 1
}
lateinit var mDownloadNumber: TextView
lateinit var mUpdateNumber: TextView
override fun initFragmentList(fragments: MutableList<androidx.fragment.app.Fragment>) {
override fun initFragmentList(fragments: MutableList<Fragment>) {
fragments.add(GameDownloadFragment())
fragments.add(GameUpdateFragment())
fragments.add(FileSendFragment())
}
override fun initTabTitleList(tabTitleList: MutableList<String>) {
tabTitleList.add(getString(R.string.download_game))
tabTitleList.add(getString(R.string.download_tab_update))
tabTitleList.add(getString(R.string.download_send_traffic_free))
}
override fun provideTabView(position: Int, tabTitle: String): View? {
if (position == INDEX_KC) {
return super.provideTabView(position, tabTitle)
}
val view = LayoutInflater.from(context).inflate(R.layout.tab_item_download_number, null)
(view.findViewById<View>(R.id.tab_download_title) as TextView).text = tabTitle
if (INDEX_DOWNLOAD == position) {
@ -76,7 +68,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
mUpdateNumber.visibility = View.VISIBLE
mUpdateNumber.text = updateSize.toString()
} else {
mUpdateNumber.visibility = View.GONE
mUpdateNumber.visibility = View.INVISIBLE
}
val downloadSize = DownloadManager.getInstance(context).all.size
@ -84,7 +76,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
mDownloadNumber.visibility = View.VISIBLE
mDownloadNumber.text = downloadSize.toString()
} else {
mDownloadNumber.visibility = View.GONE
mDownloadNumber.visibility = View.INVISIBLE
}
}
@ -112,9 +104,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
if ("download" == changed.type) {
if (changed.visibility == View.VISIBLE) {
mDownloadNumber.visibility = View.VISIBLE
} else if (changed.visibility == View.GONE) {
mDownloadNumber.visibility = View.GONE
} else if (changed.visibility == View.INVISIBLE) {
} else {
mDownloadNumber.visibility = View.INVISIBLE
}
mDownloadNumber.text = changed.size.toString()
@ -122,7 +112,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
if (changed.size == -1) {
val number = Integer.valueOf(mUpdateNumber.text.toString())
if (number == 1) {
mUpdateNumber.visibility = View.GONE
mUpdateNumber.visibility = View.INVISIBLE
} else {
mUpdateNumber.text = (number - 1).toString()
}
@ -130,14 +120,12 @@ class DownloadFragment : BaseFragment_TabLayout() {
if (changed.size != 0) {
if (changed.visibility == View.VISIBLE) {
mUpdateNumber.visibility = View.VISIBLE
} else if (changed.visibility == View.GONE) {
mUpdateNumber.visibility = View.GONE
} else if (changed.visibility == View.INVISIBLE) {
} else {
mUpdateNumber.visibility = View.INVISIBLE
}
mUpdateNumber.text = changed.size.toString()
} else {
mUpdateNumber.visibility = View.GONE
mUpdateNumber.visibility = View.INVISIBLE
}
}
}

View File

@ -203,7 +203,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
val linkEntity = LinkEntity()
linkEntity.link = link
linkEntity.type = entity?.type
linkEntity.text = name
// linkEntity.text = name
DirectUtils.directToLinkPage(mContext, linkEntity, "(游戏-专题:$name-大图)", "首页游戏")
}
}

View File

@ -0,0 +1,19 @@
package com.gh.gamecenter.kuaichuan.view;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.NormalActivity;
import androidx.annotation.NonNull;
public class FileShareActivity extends NormalActivity {
@NonNull
public static Intent getIntent(Context context, String entrance) {
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
return getTargetIntent(context, FileShareActivity.class, FileShareFragment.class, args);
}
}

View File

@ -1,13 +1,13 @@
package com.gh.gamecenter.download;
package com.gh.gamecenter.kuaichuan.view;
import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.view.View;
import android.widget.TextView;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.MtaHelper;
import com.gh.gamecenter.CleanApkActivity;
@ -15,11 +15,14 @@ import com.gh.gamecenter.KcSelectGameActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.ReceiverWaitingActivity;
import com.gh.gamecenter.ShareGhActivity;
import com.gh.gamecenter.normal.NormalFragment;
import androidx.annotation.Nullable;
/**
* Created by khy on 2017/1/20.
*/
public class FileSendFragment extends BaseFragment {
public class FileShareFragment extends NormalFragment {
private String[] permissions = {Manifest.permission.ACCESS_WIFI_STATE};
@ -27,13 +30,18 @@ public class FileSendFragment extends BaseFragment {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// 分享成绩单
if (requestCode == KC_REQUEST) {
DialogUtils.showKuaiChuanResult(getActivity(), new Handler(), requestCode, "shareKc.jpg");
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(R.string.download_send_traffic_free);
}
@Override
protected int getLayoutId() {
return R.layout.fragment_file_send;