From 867307d91bda71488957d5fce8397da03d18afa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=90=E4=BA=9A=E7=91=9F?= Date: Fri, 25 Oct 2019 19:37:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=8F=90=E4=BA=A4=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E6=9C=9F=E5=A4=B1=E7=81=B5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 6 ++-- .../com/reiya/pixiv/base/BaseApplication.java | 7 +++++ .../HistoryRankingActivity.java | 30 +++++++------------ .../com/reiya/pixiv/network/HttpClient.java | 3 +- .../reiya/pixiv/ranking/RankingActivity.java | 28 ++++++++++------- .../feng/alipay/zerosdk/AlipayZeroSdk.java | 4 +++ app/src/main/res/values/styles.xml | 6 ++-- 7 files changed, 48 insertions(+), 36 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2203144..cbcdc26 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,14 +4,16 @@ android { compileSdkVersion 29 defaultConfig { applicationId "tech.yojigen.pivisionm" - minSdkVersion 19 + minSdkVersion 21 targetSdkVersion 29 versionCode 443003 versionName '4.4.3(443003)' vectorDrawables.useSupportLibrary = true multiDexEnabled = true } - + dexOptions { + preDexLibraries = false + } signingConfigs { releaseConfig { def keystoreProperties = new Properties() diff --git a/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java b/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java index 956d057..276db2f 100644 --- a/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java +++ b/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java @@ -14,6 +14,7 @@ import android.widget.Toast; import androidx.fragment.app.FragmentActivity; +import androidx.multidex.MultiDex; import com.bumptech.glide.Glide; import com.reiya.pixiv.bean.Theme; @@ -45,6 +46,12 @@ public static BaseApplication getInstance() { return sInstance; } + @Override + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + MultiDex.install(base); + } + public static long getTime(String name) { return sInstance.getSharedPreferences(name, MODE_PRIVATE).getLong("time", 0); } diff --git a/app/src/main/java/com/reiya/pixiv/historyranking/HistoryRankingActivity.java b/app/src/main/java/com/reiya/pixiv/historyranking/HistoryRankingActivity.java index 10152f9..9d23cda 100644 --- a/app/src/main/java/com/reiya/pixiv/historyranking/HistoryRankingActivity.java +++ b/app/src/main/java/com/reiya/pixiv/historyranking/HistoryRankingActivity.java @@ -42,35 +42,27 @@ protected void onCreate(Bundle savedInstanceState) { date = Calendar.getInstance(); date.set(Calendar.DAY_OF_YEAR, date.get(Calendar.DAY_OF_YEAR) - 1); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24px); getSupportActionBar().setTitle(""); - tv = (TextView) toolbar.findViewById(R.id.title); - tv.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - showDialog(); - } - }); + tv = toolbar.findViewById(R.id.title); + tv.setOnClickListener(v -> showDialog()); - viewPager = (ViewPager) findViewById(R.id.viewPager); - tabLayout = (TabLayout) findViewById(R.id.tabLayout); + viewPager = findViewById(R.id.viewPager); + tabLayout = findViewById(R.id.tabLayout); showDialog(); } private void showDialog() { - new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { - @Override - public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { - date.set(year, monthOfYear, dayOfMonth); - String str = StringHelper.getFormattedDate(year, monthOfYear, dayOfMonth, "-"); - tv.setText(str); - viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), getApplicationContext(), str)); - tabLayout.setupWithViewPager(viewPager); - } + new DatePickerDialog(this, (view, year, monthOfYear, dayOfMonth) -> { + date.set(year, monthOfYear, dayOfMonth); + String str = StringHelper.getFormattedDate(year, monthOfYear, dayOfMonth, "-"); + tv.setText(str); + viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), getApplicationContext(), str)); + tabLayout.setupWithViewPager(viewPager); }, date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)).show(); } diff --git a/app/src/main/java/com/reiya/pixiv/network/HttpClient.java b/app/src/main/java/com/reiya/pixiv/network/HttpClient.java index 30000d5..8c04507 100644 --- a/app/src/main/java/com/reiya/pixiv/network/HttpClient.java +++ b/app/src/main/java/com/reiya/pixiv/network/HttpClient.java @@ -78,8 +78,7 @@ public static void init(Context context) { int connectMode = Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString(context.getString(R.string.key_connect_mode), "0")); switch (connectMode) { case 0: - builder.sslSocketFactory(PixivSSLSocketFactory.getInstance(), PixivTrustManager.getInstance()) - .dns(PixivDNS.getInstance()); + builder.sslSocketFactory(PixivSSLSocketFactory.getInstance(), PixivTrustManager.getInstance()).dns(PixivDNS.getInstance()); break; case 1: break; diff --git a/app/src/main/java/com/reiya/pixiv/ranking/RankingActivity.java b/app/src/main/java/com/reiya/pixiv/ranking/RankingActivity.java index 31f2450..17026a1 100644 --- a/app/src/main/java/com/reiya/pixiv/ranking/RankingActivity.java +++ b/app/src/main/java/com/reiya/pixiv/ranking/RankingActivity.java @@ -12,6 +12,7 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; +import androidx.fragment.app.FragmentTransaction; import androidx.viewpager.widget.ViewPager; import com.google.android.material.tabs.TabLayout; @@ -36,13 +37,13 @@ protected void onCreate(Bundle savedInstanceState) { setTheme(Theme.getTheme()); setContentView(R.layout.activity_ranking); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24px); - viewPager = (ViewPager) findViewById(R.id.viewPager); - tabLayout = (TabLayout) findViewById(R.id.tabLayout); + viewPager = findViewById(R.id.viewPager); + tabLayout = findViewById(R.id.tabLayout); mFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), UserData.getSpecialMode() ? 1 : 0); viewPager.setAdapter(mFragmentPagerAdapter); @@ -65,14 +66,13 @@ public boolean onOptionsItemSelected(MenuItem item) { finish(); break; case 0: - new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { - @Override - public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { - mDate.set(year, monthOfYear, dayOfMonth); - String str = StringHelper.getFormattedDate(year, monthOfYear, dayOfMonth, "-"); - viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), UserData.getSpecialMode() ? 1 : 0, str)); - tabLayout.setupWithViewPager(viewPager); - } + new DatePickerDialog(this, (view, year, monthOfYear, dayOfMonth) -> { + mDate.set(year, monthOfYear, dayOfMonth); + String str = StringHelper.getFormattedDate(year, monthOfYear, dayOfMonth, "-"); + System.out.println(str); + viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), UserData.getSpecialMode() ? 1 : 0, str)); + viewPager.requestFocus(); + tabLayout.setupWithViewPager(viewPager); }, mDate.get(Calendar.YEAR), mDate.get(Calendar.MONTH), mDate.get(Calendar.DAY_OF_MONTH)).show(); break; } @@ -106,6 +106,12 @@ class MyFragmentPagerAdapter extends FragmentPagerAdapter { } mMode = mode; mDate = date; + //修复日期选择不可用 + FragmentTransaction fragmentTransaction = fm.beginTransaction(); + for (Fragment fragment : fm.getFragments()) { + fragmentTransaction.remove(fragment); + } + fragmentTransaction.commitNow(); } MyFragmentPagerAdapter(FragmentManager fm, int mode) { diff --git a/app/src/main/java/moe/feng/alipay/zerosdk/AlipayZeroSdk.java b/app/src/main/java/moe/feng/alipay/zerosdk/AlipayZeroSdk.java index 773d4c7..e4e23a5 100644 --- a/app/src/main/java/moe/feng/alipay/zerosdk/AlipayZeroSdk.java +++ b/app/src/main/java/moe/feng/alipay/zerosdk/AlipayZeroSdk.java @@ -10,6 +10,8 @@ import android.os.Build; import android.service.quicksettings.TileService; +import androidx.annotation.RequiresApi; + import java.net.URISyntaxException; public class AlipayZeroSdk { @@ -100,6 +102,7 @@ public static String getAlipayClientVersion(Context context) { * @param context Context * @return 是否成功打开 Activity */ + @RequiresApi(api = Build.VERSION_CODES.N) public static boolean openAlipayScan(Context context) { try { Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=10000007"); @@ -123,6 +126,7 @@ public static boolean openAlipayScan(Context context) { * @param context Context * @return 是否成功打开 Activity */ + @RequiresApi(api = Build.VERSION_CODES.N) public static boolean openAlipayBarcode(Context context) { try { Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=20000056"); diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a72e673..ceed146 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,4 +1,4 @@ - + - From c74c94a2a26c482316c92e89c50e7a3afac33dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=90=E4=BA=9A=E7=91=9F?= Date: Mon, 28 Oct 2019 01:43:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?WiP:=E4=BF=AE=E5=A4=8D=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 16 +- .../com/reiya/pixiv/base/BaseApplication.java | 2 - .../reiya/pixiv/view/LoaderRecyclerView.java | 3 +- .../com/reiya/pixiv/work/ImageFragment.java | 202 ++++++++---------- .../com/reiya/pixiv/work/ViewActivity.java | 3 +- 5 files changed, 97 insertions(+), 129 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index cbcdc26..9d8b62b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -91,11 +91,11 @@ dependencies { apply plugin: 'bugly' -bugly { - def buglyProperties = new Properties() - def buglyPropertiesFile = project.rootProject.file("bugly.properties") - buglyProperties.load(new FileInputStream(buglyPropertiesFile)) - - appId = buglyProperties['APP_ID'] - appKey = buglyProperties['APP_KEY'] -} \ No newline at end of file +//bugly { +// def buglyProperties = new Properties() +// def buglyPropertiesFile = project.rootProject.file("bugly.properties") +// buglyProperties.load(new FileInputStream(buglyPropertiesFile)) +// +// appId = buglyProperties['APP_ID'] +// appKey = buglyProperties['APP_KEY'] +//} \ No newline at end of file diff --git a/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java b/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java index 276db2f..c57ce8c 100644 --- a/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java +++ b/app/src/main/java/com/reiya/pixiv/base/BaseApplication.java @@ -14,7 +14,6 @@ import android.widget.Toast; import androidx.fragment.app.FragmentActivity; -import androidx.multidex.MultiDex; import com.bumptech.glide.Glide; import com.reiya.pixiv.bean.Theme; @@ -49,7 +48,6 @@ public static BaseApplication getInstance() { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); - MultiDex.install(base); } public static long getTime(String name) { diff --git a/app/src/main/java/com/reiya/pixiv/view/LoaderRecyclerView.java b/app/src/main/java/com/reiya/pixiv/view/LoaderRecyclerView.java index 049e46d..8a339c1 100644 --- a/app/src/main/java/com/reiya/pixiv/view/LoaderRecyclerView.java +++ b/app/src/main/java/com/reiya/pixiv/view/LoaderRecyclerView.java @@ -38,7 +38,8 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (layoutManager instanceof LinearLayoutManager) { lastVisibleItem = ((LinearLayoutManager) getLayoutManager()).findLastVisibleItemPosition() + 1; } else { - lastVisibleItem = ((StaggeredGridLayoutManager) getLayoutManager()).findLastVisibleItemPositions(null)[0] + ((StaggeredGridLayoutManager) getLayoutManager()).getSpanCount(); + int[] lastPositions = new int[((StaggeredGridLayoutManager) layoutManager).getSpanCount()]; + lastVisibleItem = ((StaggeredGridLayoutManager) getLayoutManager()).findLastVisibleItemPositions(lastPositions)[0] + ((StaggeredGridLayoutManager) getLayoutManager()).getSpanCount(); } } }); diff --git a/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java b/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java index 0bde8e1..dabae59 100644 --- a/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java +++ b/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java @@ -4,9 +4,7 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; -import android.media.Image; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; @@ -14,12 +12,10 @@ import android.util.Log; import android.view.Display; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.CheckBox; -import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; @@ -146,13 +142,10 @@ public void onNext(HttpService.CommentResponse commentResponse) { layout.addView(recyclerView); if (comments.size() > 5) { View btnMore = inflater.inflate(R.layout.item_more, layout, false); - btnMore.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(getActivity(), CommentActivity.class); - intent.putExtra("id", mWork.getId()); - getActivity().startActivity(intent); - } + btnMore.setOnClickListener(v1 -> { + Intent intent = new Intent(getActivity(), CommentActivity.class); + intent.putExtra("id", mWork.getId()); + getActivity().startActivity(intent); }); layout.addView(btnMore); } @@ -173,11 +166,15 @@ public void onError(Throwable e) { @Override public void onNext(HttpService.IllustListResponse illustListResponse) { List works = illustListResponse.getWorks(); - LinearLayout layout = (LinearLayout) view.findViewById(R.id.RelatedWorksLayout); + LinearLayout layout = view.findViewById(R.id.RelatedWorksLayout); layout.removeViewAt(1); RecyclerView recyclerView = new RecyclerView(getActivity()); recyclerView.setLayoutManager(new WorkGridLayoutManager(getActivity())); recyclerView.setAdapter(new ImageAdapter(getActivity(), works)); + //修复滑动卡顿 + recyclerView.setHasFixedSize(true); + recyclerView.setNestedScrollingEnabled(false); + //结束 layout.addView(recyclerView); } }); @@ -228,29 +225,23 @@ public void onNext(HttpService.IllustListResponse illustListResponse) { } } }); - mCbFav.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - BookmarkAddDialog dialog = new BookmarkAddDialog(); - dialog.setId(mWork.getId()); - dialog.setBookmarked(mCbFav.isChecked()); - dialog.setOnBookmarkChangedCallback(ImageFragment.this); - dialog.show(getActivity().getSupportFragmentManager(), BookmarkAddDialog.class.getName()); + mCbFav.setOnLongClickListener(v -> { + BookmarkAddDialog dialog = new BookmarkAddDialog(); + dialog.setId(mWork.getId()); + dialog.setBookmarked(mCbFav.isChecked()); + dialog.setOnBookmarkChangedCallback(ImageFragment.this); + dialog.show(getActivity().getSupportFragmentManager(), BookmarkAddDialog.class.getName()); // if (!cbFav.isChecked()) { // ItemOperation.addBookmark(getActivity(), mWork.getId(), "private"); // mWork.setIsBookmarked(true); // cbFav.setChecked(true); // } - return true; - } + return true; }); - view.findViewById(R.id.relativeLayout).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(getActivity(), ProfileActivity.class); - intent.putExtra("id", mWork.getUser().getId()); - getActivity().startActivity(intent); - } + view.findViewById(R.id.relativeLayout).setOnClickListener(v -> { + Intent intent = new Intent(getActivity(), ProfileActivity.class); + intent.putExtra("id", mWork.getUser().getId()); + getActivity().startActivity(intent); }); View ivDyn = view.findViewById(R.id.ivDyn); @@ -278,56 +269,44 @@ public void onClick(View v) { tags.add(tag.getName()); } tagGroup.setTags(tags); - tagGroup.setOnTagClickListener(new TagGroup.OnTagClickListener() { - @Override - public void onTagClick(String tag) { - Intent intent = new Intent(getActivity(), SearchActivity.class); - intent.putExtra("tag", tag); - getActivity().startActivity(intent); - } + tagGroup.setOnTagClickListener(tag -> { + Intent intent = new Intent(getActivity(), SearchActivity.class); + intent.putExtra("tag", tag); + getActivity().startActivity(intent); }); - view.findViewById(R.id.userInfoLayout).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(getActivity(), ProfileActivity.class); - intent.putExtra("id", mWork.getUser().getId()); - getActivity().startActivity(intent); - } + view.findViewById(R.id.userInfoLayout).setOnClickListener(v -> { + Intent intent = new Intent(getActivity(), ProfileActivity.class); + intent.putExtra("id", mWork.getUser().getId()); + getActivity().startActivity(intent); }); - final CheckBox cbFollow = (CheckBox) view.findViewById(R.id.btnFollow); + final CheckBox cbFollow = view.findViewById(R.id.btnFollow); cbFollow.setChecked(mWork.getUser().isFollowed()); - cbFollow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (mWork.getUser().isFollowed() != isChecked) { - mWork.getUser().setFollowed(isChecked); - if (isChecked) { - UserOperation.favorite(getActivity(), mWork.getUser().getId(), "public"); + cbFollow.setOnCheckedChangeListener((buttonView, isChecked) -> { + if (mWork.getUser().isFollowed() != isChecked) { + mWork.getUser().setFollowed(isChecked); + if (isChecked) { + UserOperation.favorite(getActivity(), mWork.getUser().getId(), "public"); // ItemOperation.addBookmark(getActivity(), mWork); - if (PreferenceManager.getDefaultSharedPreferences(getActivity()) - .getBoolean(getString(R.string.key_show_toast_long_click_follow), true)) { - Toast.makeText(getActivity(), R.string.toast_long_click_private, Toast.LENGTH_LONG).show(); - PreferenceManager.getDefaultSharedPreferences(getActivity()).edit() - .putBoolean(getString(R.string.key_show_toast_long_click_follow), false) - .apply(); - } - } else { - UserOperation.outFavorite(getActivity(), mWork.getUser().getId()); + if (PreferenceManager.getDefaultSharedPreferences(getActivity()) + .getBoolean(getString(R.string.key_show_toast_long_click_follow), true)) { + Toast.makeText(getActivity(), R.string.toast_long_click_private, Toast.LENGTH_LONG).show(); + PreferenceManager.getDefaultSharedPreferences(getActivity()).edit() + .putBoolean(getString(R.string.key_show_toast_long_click_follow), false) + .apply(); } + } else { + UserOperation.outFavorite(getActivity(), mWork.getUser().getId()); } } }); - cbFollow.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - if (!cbFollow.isChecked()) { - UserOperation.favorite(getActivity(), mWork.getUser().getId(), "private"); - mWork.getUser().setFollowed(true); - cbFollow.setChecked(true); - } - return true; + cbFollow.setOnLongClickListener(v -> { + if (!cbFollow.isChecked()) { + UserOperation.favorite(getActivity(), mWork.getUser().getId(), "private"); + mWork.getUser().setFollowed(true); + cbFollow.setChecked(true); } + return true; }); // content = new RecordDAO(getActivity()).getContent(id); @@ -407,55 +386,46 @@ private void loadImage(ImageView iv) { .thumbnail(0.1f) .load(iv); } - iv.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mWork.isDynamic()) { - Intent intent = new Intent(getActivity(), GifActivity.class); - intent.putExtra("work", mWork); - startActivity(intent); - } else if (mWork.getPageCount() == 1) { - Intent intent = new Intent(getActivity(), ZoomActivity.class); - intent.putExtra("url", mWork.getImageUrl(3)); - startActivity(intent); - getActivity().overridePendingTransition(0, 0); - } else { - Intent intent = new Intent(getActivity(), GridActivity.class); - intent.putExtra("work", mWork); - startActivity(intent); - getActivity().overridePendingTransition(0, 0); - } + iv.setOnClickListener(v -> { + if (mWork.isDynamic()) { + Intent intent = new Intent(getActivity(), GifActivity.class); + intent.putExtra("work", mWork); + startActivity(intent); + } else if (mWork.getPageCount() == 1) { + Intent intent = new Intent(getActivity(), ZoomActivity.class); + intent.putExtra("url", mWork.getImageUrl(3)); + startActivity(intent); + getActivity().overridePendingTransition(0, 0); + } else { + Intent intent = new Intent(getActivity(), GridActivity.class); + intent.putExtra("work", mWork); + startActivity(intent); + getActivity().overridePendingTransition(0, 0); } }); - iv.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - MenuDialog menuDialog = new MenuDialog(); - menuDialog.setListener(new String[]{"复制id", "分享"}, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - switch (which) { - case 0: - int id = mWork.getId(); - ClipboardManager cb = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); - ClipData data = ClipData.newPlainText("id", String.valueOf(id)); - cb.setPrimaryClip(data); - Toast.makeText(getActivity(), getString(R.string.clip_info_id), Toast.LENGTH_SHORT).show(); - break; - case 1: - String text = mWork.getTitle() + " / " + mWork.getUser().getName() + " #pixiv " + Value.URL_ILLUST_PAGE + mWork.getId(); - Intent sendIntent = new Intent(); - sendIntent.setAction(Intent.ACTION_SEND); - sendIntent.putExtra(Intent.EXTRA_TEXT, text); - sendIntent.setType("text/plain"); - startActivity(sendIntent); - break; - } - } - }); - menuDialog.show(getFragmentManager(), "menu"); - return true; - } + iv.setOnLongClickListener(v -> { + MenuDialog menuDialog = new MenuDialog(); + menuDialog.setListener(new String[]{"复制ID", "分享"}, (dialog, which) -> { + switch (which) { + case 0: + int id = mWork.getId(); + ClipboardManager cb = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); + ClipData data = ClipData.newPlainText("id", String.valueOf(id)); + cb.setPrimaryClip(data); + Toast.makeText(getActivity(), getString(R.string.clip_info_id), Toast.LENGTH_SHORT).show(); + break; + case 1: + String text = mWork.getTitle() + " / " + mWork.getUser().getName() + " #pixiv " + Value.URL_ILLUST_PAGE + mWork.getId(); + Intent sendIntent = new Intent(); + sendIntent.setAction(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_TEXT, text); + sendIntent.setType("text/plain"); + startActivity(sendIntent); + break; + } + }); + menuDialog.show(getFragmentManager(), "menu"); + return true; }); } diff --git a/app/src/main/java/com/reiya/pixiv/work/ViewActivity.java b/app/src/main/java/com/reiya/pixiv/work/ViewActivity.java index 3c65e01..f083ea7 100644 --- a/app/src/main/java/com/reiya/pixiv/work/ViewActivity.java +++ b/app/src/main/java/com/reiya/pixiv/work/ViewActivity.java @@ -331,8 +331,7 @@ public ImagePagerAdapter(FragmentManager fm, List works) { @Override public Fragment getItem(int position) { - ImageFragment fragment = (ImageFragment) ImageFragment.newInstance(position, mWorks.get(position)); - return fragment; + return ImageFragment.newInstance(position, mWorks.get(position)); } @Override From 723d14991de1b1c26d270e57e7359b5d6adc195b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=90=E4=BA=9A=E7=91=9F?= Date: Mon, 28 Oct 2019 01:45:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?WiP:=E4=BF=AE=E5=A4=8D=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/reiya/pixiv/adapter/ImageAdapter.java | 25 ++++++++----------- .../com/reiya/pixiv/work/ImageFragment.java | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/reiya/pixiv/adapter/ImageAdapter.java b/app/src/main/java/com/reiya/pixiv/adapter/ImageAdapter.java index 7c72e5d..59f1228 100644 --- a/app/src/main/java/com/reiya/pixiv/adapter/ImageAdapter.java +++ b/app/src/main/java/com/reiya/pixiv/adapter/ImageAdapter.java @@ -32,21 +32,18 @@ public ImageAdapter(Context context) { public ImageAdapter(Context context, List works) { super(context, new int[]{R.layout.item_image, R.layout.item_header}, works); - setOnItemClickListener(new BaseAdapter.OnItemClickListener() { - @Override - public void onClick(Object item, List list, int position) { - if (mHasHeader && position == 0) { - Intent intent = new Intent(mContext, RankingActivity.class); - mContext.startActivity(intent); - } else { - Intent intent = new Intent(mContext, ViewActivity.class); - intent.putExtra("id", ((Work) item).getId()); - TempData.put("works", list); - intent.putExtra("position", position); - mContext.startActivity(intent); - } - + setOnItemClickListener((item, list, position) -> { + if (mHasHeader && position == 0) { + Intent intent = new Intent(mContext, RankingActivity.class); + mContext.startActivity(intent); + } else { + Intent intent = new Intent(mContext, ViewActivity.class); + intent.putExtra("id", ((Work) item).getId()); + TempData.put("works", list); + intent.putExtra("position", position); + mContext.startActivity(intent); } + }); setStyle(); diff --git a/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java b/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java index dabae59..e7cf885 100644 --- a/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java +++ b/app/src/main/java/com/reiya/pixiv/work/ImageFragment.java @@ -120,7 +120,7 @@ public void onError(Throwable e) { @Override public void onNext(HttpService.CommentResponse commentResponse) { List comments = commentResponse.getComments(); - LinearLayout layout = (LinearLayout) view.findViewById(R.id.commentLayout); + LinearLayout layout = view.findViewById(R.id.commentLayout); layout.removeAllViews(); // int n = Math.min(comments.size(), 5); // for (int i = 0; i < n; i++) { From 9b637fb7a159490ee8162b5b71c73522145232f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=90=E4=BA=9A=E7=91=9F?= Date: Thu, 31 Oct 2019 18:58:07 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=8F=90=E4=BA=A4=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E6=9C=9F=E5=A4=B1=E7=81=B5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BF=AE=E6=94=B9=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=20=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 6 +++--- .../main/java/com/reiya/pixiv/adapter/SearchAdapter.java | 2 +- app/src/main/res/layout/fragment_work.xml | 4 ++-- app/src/main/res/values/strings.xml | 2 +- build.gradle | 5 ----- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9d8b62b..15106fe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "tech.yojigen.pivisionm" minSdkVersion 21 targetSdkVersion 29 - versionCode 443003 - versionName '4.4.3(443003)' + versionCode 443004 + versionName '4.4.3(443004)' vectorDrawables.useSupportLibrary = true multiDexEnabled = true } @@ -89,7 +89,7 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:1.1.3' } -apply plugin: 'bugly' +//apply plugin: 'bugly' //bugly { // def buglyProperties = new Properties() diff --git a/app/src/main/java/com/reiya/pixiv/adapter/SearchAdapter.java b/app/src/main/java/com/reiya/pixiv/adapter/SearchAdapter.java index 27945eb..36dace4 100644 --- a/app/src/main/java/com/reiya/pixiv/adapter/SearchAdapter.java +++ b/app/src/main/java/com/reiya/pixiv/adapter/SearchAdapter.java @@ -76,7 +76,7 @@ public View getView(int position, View convertView, ViewGroup parent) { type = "作品ID"; break; case 2: - type = "画师IDm"; + type = "画师ID"; break; case -1: type = "清除搜索历史"; diff --git a/app/src/main/res/layout/fragment_work.xml b/app/src/main/res/layout/fragment_work.xml index a07d528..ce8e5ec 100644 --- a/app/src/main/res/layout/fragment_work.xml +++ b/app/src/main/res/layout/fragment_work.xml @@ -74,7 +74,7 @@ android:layout_height="48dp" android:layout_alignParentRight="true" android:layout_marginTop="8dp" - android:layout_marginRight="56dp" + android:layout_marginRight="8dp" android:button="@drawable/ic_favourite" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a94af1a..e24a55b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ PivisionM - 1. 增加了连接模式切换功能\n2. 优化了保存地址选择窗口\n3. 修复了pixivision模块\n4. 增加了新链接打开支持\n5. 增加底部保存按钮\n6. 修复搜索失灵\n7. 增加内部更新提示\n8. 部分UI优化 + 1. 增加了连接模式切换功能\n2. 优化了保存地址选择窗口\n3. 修复了pixivision模块\n4. 增加了新链接打开支持\n5. 增加底部保存按钮\n6. 修复搜索失灵\n7. 增加内部更新提示\n8. 优化部分UI\n9. 修复日期选择失灵\n10. 优化部分组件卡顿 关于 账号 diff --git a/build.gradle b/build.gradle index 2cfd9b0..8d02ce6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,11 +7,6 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.5.1' - - classpath 'com.tencent.bugly:symtabfileuploader:latest.release' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } }