Clean + hide menu item in the lite version

This commit is contained in:
Thomas 2020-07-15 15:29:20 +02:00
parent 63cc25b1cc
commit fb38a0f32d
12 changed files with 75 additions and 80 deletions

View File

@ -61,15 +61,13 @@ import es.dmoral.toasty.Toasty;
* Settings activity
*/
public class SettingsActivity extends BaseActivity {
public class SettingsActivity extends BaseActivity {
private int style;
protected int res;
private int liveNotificationCount;
public static boolean needRestart;
protected int res;
private int style;
private int liveNotificationCount;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -161,9 +159,9 @@ public class SettingsActivity extends BaseActivity {
@Override
public void afterTextChanged(Editable s) {
SharedPreferences.Editor editor = sharedpreferences.edit();
if( s.toString().trim().length() > 0) {
if (s.toString().trim().length() > 0) {
editor.putString(Helper.SET_INVIDIOUS_HOST, s.toString().toLowerCase().trim());
}else{
} else {
editor.putString(Helper.SET_INVIDIOUS_HOST, null);
}
editor.apply();
@ -189,9 +187,9 @@ public class SettingsActivity extends BaseActivity {
@Override
public void afterTextChanged(Editable s) {
SharedPreferences.Editor editor = sharedpreferences.edit();
if( s.toString().trim().length() > 0) {
if (s.toString().trim().length() > 0) {
editor.putString(Helper.SET_NITTER_HOST, s.toString().toLowerCase().trim());
}else{
} else {
editor.putString(Helper.SET_NITTER_HOST, null);
}
editor.apply();
@ -229,7 +227,6 @@ public class SettingsActivity extends BaseActivity {
});
boolean expand_cw = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false);
final SwitchCompat set_expand_cw = findViewById(R.id.set_expand_cw);
set_expand_cw.setChecked(expand_cw);
@ -251,7 +248,6 @@ public class SettingsActivity extends BaseActivity {
});
int truncate_toots_size = sharedpreferences.getInt(Helper.SET_TRUNCATE_TOOTS_SIZE, 0);
SeekBar set_truncate_size = findViewById(R.id.set_truncate_size);
set_truncate_size.setMax(20);
@ -347,8 +343,9 @@ public class SettingsActivity extends BaseActivity {
startService(streamingIntent);
break;
}
} catch (Exception ignored) {}
}else {
} catch (Exception ignored) {
}
} else {
sendBroadcast(new Intent(getApplicationContext(), StopLiveNotificationReceiver.class));
if (Build.VERSION.SDK_INT >= 26) {
NotificationManager notif = ((NotificationManager) getSystemService(NOTIFICATION_SERVICE));
@ -360,8 +357,6 @@ public class SettingsActivity extends BaseActivity {
});
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext()));
@ -507,8 +502,6 @@ public class SettingsActivity extends BaseActivity {
});
final ImageView set_toot_visibility = findViewById(R.id.set_toot_visibility);
if (theme == Helper.THEME_DARK) {
Helper.changeDrawableColor(getApplicationContext(), set_toot_visibility, R.color.dark_text);

View File

@ -410,14 +410,17 @@
android:textColor="@color/mastodonC2"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/set_allow_live_notifications"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageButton
android:id="@+id/set_allow_live_notifications_others"
style="@style/Base.Widget.AppCompat.Button.Colored"
@ -430,7 +433,6 @@
</LinearLayout>
</LinearLayout>
<!-- TRUNCATE LONG TOOTS -->

View File

@ -930,6 +930,9 @@ public abstract class BaseMainActivity extends BaseActivity
if (action_size != null)
action_size.setVisible(false);
}
if (BuildConfig.lite) {
popup.getMenu().findItem(R.id.action_send_invitation).setVisible(false);
}
popup.setOnMenuItemClickListener(item -> {
switch (item.getItemId()) {

View File

@ -69,6 +69,7 @@ import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R;
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
import app.fedilab.android.client.API;
@ -686,6 +687,10 @@ public class LoginActivity extends BaseActivity {
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main_login, menu);
if (BuildConfig.lite) {
menu.findItem(R.id.action_custom_tabs).setVisible(false);
menu.findItem(R.id.action_provider).setVisible(false);
}
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
menu.findItem(R.id.action_custom_tabs).setChecked(!embedded_browser);

View File

@ -110,7 +110,6 @@ import java.util.TimerTask;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R;
import app.fedilab.android.activities.AccountReportActivity;
import app.fedilab.android.activities.BaseActivity;

View File

@ -4455,6 +4455,43 @@ public class BaseHelper {
}
}
public static boolean getSharedValue(Context context, String type) {
SharedPreferences sharedpreferences = context.getSharedPreferences(APP_PREFS, Context.MODE_PRIVATE);
if (type.compareTo(Helper.SET_INVIDIOUS) == 0) {
if (BuildConfig.lite) {
return true;
} else {
return sharedpreferences.getBoolean(type, false);
}
} else if (type.compareTo(Helper.SET_BIBLIOGRAM) == 0) {
if (BuildConfig.lite) {
return true;
} else {
return sharedpreferences.getBoolean(type, false);
}
} else if (type.compareTo(Helper.SET_NITTER) == 0) {
if (BuildConfig.lite) {
return true;
} else {
return sharedpreferences.getBoolean(type, false);
}
} else if (type.compareTo(Helper.SET_CONSOLE_MODE) == 0) {
if (BuildConfig.lite) {
return false;
} else {
return sharedpreferences.getBoolean(type, false);
}
} else if (type.compareTo(Helper.SET_COMPACT_MODE) == 0) {
if (BuildConfig.lite) {
return true;
} else {
return sharedpreferences.getBoolean(type, false);
}
}
return sharedpreferences.getBoolean(type, false);
}
//Event Type
public enum EventStreaming {
UPDATE,
@ -4463,7 +4500,6 @@ public class BaseHelper {
NONE
}
public enum NotifType {
FOLLLOW,
MENTION,
@ -4562,43 +4598,5 @@ public class BaseHelper {
}
}
public static boolean getSharedValue(Context context, String type) {
SharedPreferences sharedpreferences = context.getSharedPreferences(APP_PREFS, Context.MODE_PRIVATE);
if( type.compareTo(Helper.SET_INVIDIOUS) == 0 ) {
if( BuildConfig.lite) {
return true;
}else {
return sharedpreferences.getBoolean(type, false);
}
}else if( type.compareTo(Helper.SET_BIBLIOGRAM) == 0 ) {
if( BuildConfig.lite) {
return true;
}else {
return sharedpreferences.getBoolean(type, false);
}
}else if( type.compareTo(Helper.SET_NITTER) == 0 ) {
if( BuildConfig.lite) {
return true;
}else {
return sharedpreferences.getBoolean(type, false);
}
}
else if( type.compareTo(Helper.SET_CONSOLE_MODE) == 0 ) {
if( BuildConfig.lite) {
return false;
}else {
return sharedpreferences.getBoolean(type, false);
}
}
else if( type.compareTo(Helper.SET_COMPACT_MODE) == 0 ) {
if( BuildConfig.lite) {
return true;
}else {
return sharedpreferences.getBoolean(type, false);
}
}
return sharedpreferences.getBoolean(type, false);
}
}

View File

@ -27,7 +27,6 @@
<TextView
android:id="@+id/media_description"
android:textIsSelectable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
@ -36,5 +35,6 @@
android:gravity="center"
android:padding="12dp"
android:textColor="#ffffffff"
android:textIsSelectable="true"
android:visibility="gone" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -25,9 +25,9 @@
android:padding="10dp">
<TextView
android:labelFor="@+id/add_phrase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:labelFor="@+id/add_phrase"
android:text="@string/filter_keyword" />
<TextView
@ -41,9 +41,9 @@
android:id="@+id/add_phrase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no"
android:inputType="text"
android:singleLine="true"
android:importantForAutofill="no" />
android:singleLine="true" />
<TextView
android:layout_width="match_parent"

View File

@ -69,8 +69,8 @@
<TextView
android:id="@+id/notification_account_username"
android:layout_width="wrap_content"
android:layout_marginStart="5dp"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginStart="5dp" />
<TextView
android:id="@+id/status_date"

View File

@ -50,6 +50,7 @@
android:layout_height="match_parent"
android:visibility="gone" />
</FrameLayout>
<RelativeLayout
android:id="@+id/videoLayout"
android:layout_width="match_parent"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<group>
<!-- MASTODON MENU -->
<item

View File

@ -1,24 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_show_link"
android:title="@string/display_full_link"
/>
android:title="@string/display_full_link" />
<item
android:id="@+id/action_share_link"
android:title="@string/share_link"
/>
android:title="@string/share_link" />
<item
android:id="@+id/action_open_other_app"
android:title="@string/open_other_app"
/>
android:title="@string/open_other_app" />
<item
android:id="@+id/action_copy_link"
android:title="@string/copy_link"
/>
android:title="@string/copy_link" />
<item
android:id="@+id/action_unshorten"
android:title="@string/check_redirect"
/>
android:title="@string/check_redirect" />
</menu>