hide record audio feature if mircophone is not available
This commit is contained in:
parent
b5423b39a0
commit
756c1a1004
|
@ -43,6 +43,10 @@
|
|||
android:name="android.hardware.camera.autofocus"
|
||||
android:required="false"/>
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.microphone"
|
||||
android:required="false"/>
|
||||
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
|
|
@ -72,6 +72,7 @@ import eu.siacs.conversations.ui.interfaces.OnConversationSelected;
|
|||
import eu.siacs.conversations.ui.interfaces.OnConversationsListItemUpdated;
|
||||
import eu.siacs.conversations.ui.service.EmojiService;
|
||||
import eu.siacs.conversations.ui.util.ActivityResult;
|
||||
import eu.siacs.conversations.ui.util.ConversationMenuConfigurator;
|
||||
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
|
||||
import eu.siacs.conversations.ui.util.PendingItem;
|
||||
import eu.siacs.conversations.utils.ExceptionHelper;
|
||||
|
@ -364,6 +365,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ConversationMenuConfigurator.reloadFeatures(this);
|
||||
OmemoSetting.load(this);
|
||||
new EmojiService(this).init();
|
||||
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_conversations);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
package eu.siacs.conversations.ui.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.MediaStore;
|
||||
|
@ -45,6 +46,12 @@ import eu.siacs.conversations.entities.Message;
|
|||
|
||||
public class ConversationMenuConfigurator {
|
||||
|
||||
private static boolean microphoneAvailable = false;
|
||||
|
||||
public static void reloadFeatures(Context context) {
|
||||
microphoneAvailable = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE);
|
||||
}
|
||||
|
||||
public static void configureAttachmentMenu(@NonNull Conversation conversation, Menu menu) {
|
||||
final MenuItem menuAttach = menu.findItem(R.id.action_attach_file);
|
||||
|
||||
|
@ -54,12 +61,11 @@ public class ConversationMenuConfigurator {
|
|||
} else {
|
||||
visible = true;
|
||||
}
|
||||
|
||||
menuAttach.setVisible(visible);
|
||||
|
||||
if (!visible) {
|
||||
return;
|
||||
}
|
||||
menu.findItem(R.id.attach_record_voice).setVisible(microphoneAvailable);
|
||||
}
|
||||
|
||||
public static void configureEncryptionMenu(@NonNull Conversation conversation, Menu menu) {
|
||||
|
|
Loading…
Reference in a new issue