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
|
||||
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);
|
||||
|
||||
if (NekomuraConfig.largeAvatarInDrawer.Int() == 2) { // add shadow
|
||||
nameTextView.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) {
|
||||
int heightBase = NekomuraConfig.largeAvatarInDrawer.Int() == 2 ? MeasureSpec.getSize(widthMeasureSpec) : AndroidUtilities.dp(148);
|
||||
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 {
|
||||
try {
|
||||
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();
|
||||
}
|
||||
ConnectionsManager.getInstance(currentAccount).setAppPaused(false, false);
|
||||
updateCurrentConnectionState(currentAccount);
|
||||
|
||||
if (NekomuraConfig.disableProxyWhenVpnEnabled.Bool()) {
|
||||
if (SharedConfig.proxyEnabled && ProxyUtil.isVPNEnabled()) {
|
||||
SharedConfig.setProxyEnable(false);
|
||||
|
@ -4266,6 +4265,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
SharedConfig.setProxyEnable(true);
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionsManager.getInstance(currentAccount).setAppPaused(false, false);
|
||||
updateCurrentConnectionState(currentAccount);
|
||||
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
|
||||
PhotoViewer.getInstance().onResume();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package tw.nekomimi.nekogram.parts
|
|||
import android.util.Base64
|
||||
import cn.hutool.http.HttpResponse
|
||||
import cn.hutool.http.HttpUtil
|
||||
import com.google.android.exoplayer2.util.Log
|
||||
import kotlinx.coroutines.*
|
||||
import org.telegram.messenger.FileLog
|
||||
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
|
||||
Log.e("NekoPublicProxy", reqURL)
|
||||
// Log.e("NekoPublicProxy", reqURL)
|
||||
it.resume(proxies)
|
||||
} catch (e: Exception) {
|
||||
Log.e("NekoPublicProxy", e.stackTraceToString())
|
||||
// Log.e("NekoPublicProxy", e.stackTraceToString())
|
||||
FileLog.d(url)
|
||||
FileLog.e(e.stackTraceToString())
|
||||
exceptions[url] = e
|
||||
if (cl.decrementAndGet() == 0) {
|
||||
it.resumeWithException(e)
|
||||
|
|
|
@ -58,7 +58,6 @@ import cn.hutool.core.util.StrUtil;
|
|||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.BottomBuilder;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nkmr.NekomuraConfig;
|
||||
import tw.nekomimi.nekogram.PopupBuilder;
|
||||
import tw.nekomimi.nekogram.transtale.Translator;
|
||||
import tw.nekomimi.nekogram.transtale.TranslatorKt;
|
||||
|
@ -355,15 +354,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||
TransitionManager.beginDelayedTransition(profilePreviewCell);
|
||||
listAdapter.notifyItemChanged(rows.indexOf(profilePreviewRow));
|
||||
//TODO Support remove and insert rows.
|
||||
// if (NekomuraConfig.largeAvatarInDrawer.Int() > 0) {
|
||||
// updateRows(false);
|
||||
// listAdapter.notifyItemRangeInserted(rows.indexOf(avatarBackgroundBlurRow), 2);
|
||||
// } else {
|
||||
// listAdapter.notifyItemRangeRemoved(rows.indexOf(avatarBackgroundBlurRow), 2);
|
||||
// updateRows(false);
|
||||
// }
|
||||
|
||||
setAvatarOptionsVisibility();
|
||||
} else if (key.equals(NekomuraConfig.avatarBackgroundBlur.getKey())) {
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||
listAdapter.notifyItemChanged(rows.indexOf(profilePreviewRow));
|
||||
|
@ -693,6 +684,8 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
// Default binds
|
||||
a.onBindViewHolder(holder);
|
||||
}
|
||||
// Other things
|
||||
setAvatarOptionsVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -773,4 +766,17 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
keyField.requestFocus();
|
||||
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;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -75,6 +77,19 @@ public class Cells {
|
|||
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
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
public class NekomuraTGTextCheck implements NekomuraTGCell {
|
||||
private final NekomuraConfig.ConfigItem bindConfig;
|
||||
private final String title;
|
||||
private final String subtitle;
|
||||
public TextCheckCell cell; //TODO getCell() in NekomuraTGCell
|
||||
|
||||
public NekomuraTGTextCheck(NekomuraConfig.ConfigItem bind) {
|
||||
this.bindConfig = bind;
|
||||
|
@ -188,6 +205,7 @@ public class Cells {
|
|||
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder) {
|
||||
TextCheckCell cell = (TextCheckCell) holder.itemView;
|
||||
this.cell = cell;
|
||||
if (subtitle == null) {
|
||||
cell.setTextAndCheck(title, bindConfig.Bool(), !(rows.get(rows.indexOf(this) + 1) instanceof NekomuraTGDivider));
|
||||
} else {
|
||||
|
|
|
@ -241,7 +241,7 @@ public class NekomuraConfig {
|
|||
public static ConfigItem googleCloudTranslateKey = addConfig("GoogleCloudTransKey", 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 ccToLang = addConfig("opencc_to_lang", configTypeString, "");
|
||||
|
@ -371,7 +371,7 @@ public class NekomuraConfig {
|
|||
googleCloudTranslateKey.setConfigString(preferences.getString("google_cloud_translate_key", 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"));
|
||||
|
||||
ccToLang.setConfigString(preferences.getString("opencc_to_lang", null));
|
||||
|
|
Loading…
Reference in New Issue