mirror of https://github.com/NekoX-Dev/NekoX.git
fix
This commit is contained in:
parent
34c63b4991
commit
eaffdc28ad
|
@ -253,8 +253,9 @@ public class DrawerProfileCell extends FrameLayout {
|
||||||
|
|
||||||
LayoutParams lp = NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? // correct the position of this button
|
LayoutParams lp = NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? // correct the position of this button
|
||||||
LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.TOP, 0, 10, 6, 0) :
|
LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.TOP, 0, 10, 6, 0) :
|
||||||
LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, 6, 90);
|
LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.BOTTOM, 0, 10, 6, 90);
|
||||||
addView(darkThemeView, lp);
|
addView(darkThemeView, lp);
|
||||||
|
|
||||||
if (NekomuraConfig.largeAvatarInDrawer.Int() == 2) { // add shadow
|
if (NekomuraConfig.largeAvatarInDrawer.Int() == 2) { // add shadow
|
||||||
nameTextView.setShadowLayer(6.0f, 2.0f, 2.0f, Color.BLACK);
|
nameTextView.setShadowLayer(6.0f, 2.0f, 2.0f, Color.BLACK);
|
||||||
phoneTextView.getTextView().setShadowLayer(6.0f, 2.0f, 2.0f, Color.BLACK);
|
phoneTextView.getTextView().setShadowLayer(6.0f, 2.0f, 2.0f, Color.BLACK);
|
||||||
|
@ -303,7 +304,8 @@ public class DrawerProfileCell extends FrameLayout {
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
int heightBase = NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? MeasureSpec.getSize(widthMeasureSpec) : AndroidUtilities.dp(148);
|
int heightBase = NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? MeasureSpec.getSize(widthMeasureSpec) : AndroidUtilities.dp(148);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightBase, MeasureSpec.EXACTLY));
|
heightBase -= NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? AndroidUtilities.statusBarHeight : 0;
|
||||||
|
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightBase + AndroidUtilities.statusBarHeight, MeasureSpec.EXACTLY));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightBase, MeasureSpec.EXACTLY));
|
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightBase, MeasureSpec.EXACTLY));
|
||||||
|
|
|
@ -4257,8 +4257,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
}
|
}
|
||||||
passcodeView.onResume();
|
passcodeView.onResume();
|
||||||
}
|
}
|
||||||
ConnectionsManager.getInstance(currentAccount).setAppPaused(false, false);
|
|
||||||
updateCurrentConnectionState(currentAccount);
|
|
||||||
if (NekomuraConfig.disableProxyWhenVpnEnabled.Bool()) {
|
if (NekomuraConfig.disableProxyWhenVpnEnabled.Bool()) {
|
||||||
if (SharedConfig.proxyEnabled && ProxyUtil.isVPNEnabled()) {
|
if (SharedConfig.proxyEnabled && ProxyUtil.isVPNEnabled()) {
|
||||||
SharedConfig.setProxyEnable(false);
|
SharedConfig.setProxyEnable(false);
|
||||||
|
@ -4266,6 +4265,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
SharedConfig.setProxyEnable(true);
|
SharedConfig.setProxyEnable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConnectionsManager.getInstance(currentAccount).setAppPaused(false, false);
|
||||||
|
updateCurrentConnectionState(currentAccount);
|
||||||
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
|
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
|
||||||
PhotoViewer.getInstance().onResume();
|
PhotoViewer.getInstance().onResume();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package tw.nekomimi.nekogram.parts
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import cn.hutool.http.HttpResponse
|
import cn.hutool.http.HttpResponse
|
||||||
import cn.hutool.http.HttpUtil
|
import cn.hutool.http.HttpUtil
|
||||||
import com.google.android.exoplayer2.util.Log
|
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import org.telegram.messenger.FileLog
|
import org.telegram.messenger.FileLog
|
||||||
import tw.nekomimi.nekogram.utils.ProxyUtil.parseProxies
|
import tw.nekomimi.nekogram.utils.ProxyUtil.parseProxies
|
||||||
|
@ -60,10 +59,12 @@ fun loadProxiesPublic(urls: List<String>, exceptions: MutableMap<String, Excepti
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret.getAndSet(true)) return@launch
|
if (ret.getAndSet(true)) return@launch
|
||||||
Log.e("NekoPublicProxy", reqURL)
|
// Log.e("NekoPublicProxy", reqURL)
|
||||||
it.resume(proxies)
|
it.resume(proxies)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("NekoPublicProxy", e.stackTraceToString())
|
// Log.e("NekoPublicProxy", e.stackTraceToString())
|
||||||
|
FileLog.d(url)
|
||||||
|
FileLog.e(e.stackTraceToString())
|
||||||
exceptions[url] = e
|
exceptions[url] = e
|
||||||
if (cl.decrementAndGet() == 0) {
|
if (cl.decrementAndGet() == 0) {
|
||||||
it.resumeWithException(e)
|
it.resumeWithException(e)
|
||||||
|
|
|
@ -58,7 +58,6 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
import tw.nekomimi.nekogram.BottomBuilder;
|
import tw.nekomimi.nekogram.BottomBuilder;
|
||||||
import tw.nekomimi.nekogram.NekoConfig;
|
import tw.nekomimi.nekogram.NekoConfig;
|
||||||
import tw.nekomimi.nkmr.NekomuraConfig;
|
|
||||||
import tw.nekomimi.nekogram.PopupBuilder;
|
import tw.nekomimi.nekogram.PopupBuilder;
|
||||||
import tw.nekomimi.nekogram.transtale.Translator;
|
import tw.nekomimi.nekogram.transtale.Translator;
|
||||||
import tw.nekomimi.nekogram.transtale.TranslatorKt;
|
import tw.nekomimi.nekogram.transtale.TranslatorKt;
|
||||||
|
@ -355,15 +354,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||||
TransitionManager.beginDelayedTransition(profilePreviewCell);
|
TransitionManager.beginDelayedTransition(profilePreviewCell);
|
||||||
listAdapter.notifyItemChanged(rows.indexOf(profilePreviewRow));
|
listAdapter.notifyItemChanged(rows.indexOf(profilePreviewRow));
|
||||||
//TODO Support remove and insert rows.
|
setAvatarOptionsVisibility();
|
||||||
// if (NekomuraConfig.largeAvatarInDrawer.Int() > 0) {
|
|
||||||
// updateRows(false);
|
|
||||||
// listAdapter.notifyItemRangeInserted(rows.indexOf(avatarBackgroundBlurRow), 2);
|
|
||||||
// } else {
|
|
||||||
// listAdapter.notifyItemRangeRemoved(rows.indexOf(avatarBackgroundBlurRow), 2);
|
|
||||||
// updateRows(false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
} else if (key.equals(NekomuraConfig.avatarBackgroundBlur.getKey())) {
|
} else if (key.equals(NekomuraConfig.avatarBackgroundBlur.getKey())) {
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||||
listAdapter.notifyItemChanged(rows.indexOf(profilePreviewRow));
|
listAdapter.notifyItemChanged(rows.indexOf(profilePreviewRow));
|
||||||
|
@ -693,6 +684,8 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
// Default binds
|
// Default binds
|
||||||
a.onBindViewHolder(holder);
|
a.onBindViewHolder(holder);
|
||||||
}
|
}
|
||||||
|
// Other things
|
||||||
|
setAvatarOptionsVisibility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,4 +766,17 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||||
keyField.requestFocus();
|
keyField.requestFocus();
|
||||||
AndroidUtilities.showKeyboard(keyField);
|
AndroidUtilities.showKeyboard(keyField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setAvatarOptionsVisibility() {
|
||||||
|
//TODO hideItemFromRecyclerView
|
||||||
|
TextCheckCell cell1 = ((NekomuraTGTextCheck) avatarBackgroundBlurRow).cell;
|
||||||
|
TextCheckCell cell2 = ((NekomuraTGTextCheck) avatarBackgroundDarkenRow).cell;
|
||||||
|
if (NekomuraConfig.largeAvatarInDrawer.Int() > 0) {
|
||||||
|
Cells.hideItemFromRecyclerView(cell1, false);
|
||||||
|
Cells.hideItemFromRecyclerView(cell2, false);
|
||||||
|
} else {
|
||||||
|
Cells.hideItemFromRecyclerView(cell1, true);
|
||||||
|
Cells.hideItemFromRecyclerView(cell2, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package tw.nekomimi.nkmr;
|
package tw.nekomimi.nkmr;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -75,6 +77,19 @@ public class Cells {
|
||||||
void onBindViewHolder(RecyclerView.ViewHolder holder);
|
void onBindViewHolder(RecyclerView.ViewHolder holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void hideItemFromRecyclerView(View cell, boolean hide) {
|
||||||
|
if (cell == null) return;
|
||||||
|
if (cell != null) return; //TODO hideItemFromRecyclerView
|
||||||
|
ViewGroup.LayoutParams params = cell.getLayoutParams();
|
||||||
|
if (hide) {
|
||||||
|
cell.setVisibility(View.GONE);
|
||||||
|
params.height = 0;
|
||||||
|
} else {
|
||||||
|
cell.setVisibility(View.VISIBLE);
|
||||||
|
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
|
}
|
||||||
|
cell.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
|
||||||
//TG Cells
|
//TG Cells
|
||||||
|
|
||||||
|
@ -161,10 +176,12 @@ public class Cells {
|
||||||
cell.setTextAndValue(title, StrUtil.isNotBlank(bindConfig.String()) ? bindConfig.String() : hint , !(rows.get(rows.indexOf(this) + 1) instanceof NekomuraTGDivider));
|
cell.setTextAndValue(title, StrUtil.isNotBlank(bindConfig.String()) ? bindConfig.String() : hint , !(rows.get(rows.indexOf(this) + 1) instanceof NekomuraTGDivider));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NekomuraTGTextCheck implements NekomuraTGCell {
|
public class NekomuraTGTextCheck implements NekomuraTGCell {
|
||||||
private final NekomuraConfig.ConfigItem bindConfig;
|
private final NekomuraConfig.ConfigItem bindConfig;
|
||||||
private final String title;
|
private final String title;
|
||||||
private final String subtitle;
|
private final String subtitle;
|
||||||
|
public TextCheckCell cell; //TODO getCell() in NekomuraTGCell
|
||||||
|
|
||||||
public NekomuraTGTextCheck(NekomuraConfig.ConfigItem bind) {
|
public NekomuraTGTextCheck(NekomuraConfig.ConfigItem bind) {
|
||||||
this.bindConfig = bind;
|
this.bindConfig = bind;
|
||||||
|
@ -188,6 +205,7 @@ public class Cells {
|
||||||
|
|
||||||
public void onBindViewHolder(RecyclerView.ViewHolder holder) {
|
public void onBindViewHolder(RecyclerView.ViewHolder holder) {
|
||||||
TextCheckCell cell = (TextCheckCell) holder.itemView;
|
TextCheckCell cell = (TextCheckCell) holder.itemView;
|
||||||
|
this.cell = cell;
|
||||||
if (subtitle == null) {
|
if (subtitle == null) {
|
||||||
cell.setTextAndCheck(title, bindConfig.Bool(), !(rows.get(rows.indexOf(this) + 1) instanceof NekomuraTGDivider));
|
cell.setTextAndCheck(title, bindConfig.Bool(), !(rows.get(rows.indexOf(this) + 1) instanceof NekomuraTGDivider));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class NekomuraConfig {
|
||||||
public static ConfigItem googleCloudTranslateKey = addConfig("GoogleCloudTransKey", configTypeString, "");
|
public static ConfigItem googleCloudTranslateKey = addConfig("GoogleCloudTransKey", configTypeString, "");
|
||||||
public static ConfigItem cachePath = addConfig("cache_path", configTypeString, "");
|
public static ConfigItem cachePath = addConfig("cache_path", configTypeString, "");
|
||||||
|
|
||||||
public static ConfigItem translateToLang = addConfig("TransToLang", configTypeString, "");
|
public static ConfigItem translateToLang = addConfig("TransToLang", configTypeString, "zh-CN");
|
||||||
public static ConfigItem translateInputLang = addConfig("TransInputToLang", configTypeString, "en");
|
public static ConfigItem translateInputLang = addConfig("TransInputToLang", configTypeString, "en");
|
||||||
|
|
||||||
public static ConfigItem ccToLang = addConfig("opencc_to_lang", configTypeString, "");
|
public static ConfigItem ccToLang = addConfig("opencc_to_lang", configTypeString, "");
|
||||||
|
@ -371,7 +371,7 @@ public class NekomuraConfig {
|
||||||
googleCloudTranslateKey.setConfigString(preferences.getString("google_cloud_translate_key", null));
|
googleCloudTranslateKey.setConfigString(preferences.getString("google_cloud_translate_key", null));
|
||||||
cachePath.setConfigString(preferences.getString("cache_path", null));
|
cachePath.setConfigString(preferences.getString("cache_path", null));
|
||||||
|
|
||||||
translateToLang.setConfigString(preferences.getString("trans_to_lang", null));
|
translateToLang.setConfigString(preferences.getString("trans_to_lang", "zh-CN"));
|
||||||
translateInputLang.setConfigString(preferences.getString("trans_input_to_lang", "en"));
|
translateInputLang.setConfigString(preferences.getString("trans_input_to_lang", "en"));
|
||||||
|
|
||||||
ccToLang.setConfigString(preferences.getString("opencc_to_lang", null));
|
ccToLang.setConfigString(preferences.getString("opencc_to_lang", null));
|
||||||
|
|
Loading…
Reference in New Issue