Search in sources :

Example 91 with DrawerLayout

use of android.support.v4.widget.DrawerLayout in project Rocket.Chat.Android by RocketChat.

the class RoomFragment method setupSideMenu.

private void setupSideMenu() {
    View sideMenu = rootView.findViewById(R.id.room_side_menu);
    sideMenu.findViewById(R.id.btn_users).setOnClickListener(view -> {
        UsersOfRoomDialogFragment.create(roomId, hostname).show(getFragmentManager(), "UsersOfRoomDialogFragment");
        closeSideMenuIfNeeded();
    });
    DrawerLayout drawerLayout = (DrawerLayout) rootView.findViewById(R.id.drawer_layout);
    SlidingPaneLayout pane = (SlidingPaneLayout) getActivity().findViewById(R.id.sliding_pane);
    if (drawerLayout != null && pane != null) {
        compositeDisposable.add(RxDrawerLayout.drawerOpen(drawerLayout, GravityCompat.END).compose(bindToLifecycle()).subscribe(opened -> {
            try {
                Field fieldSlidable = pane.getClass().getDeclaredField("mCanSlide");
                fieldSlidable.setAccessible(true);
                fieldSlidable.setBoolean(pane, !opened);
            } catch (Exception exception) {
                RCLog.w(exception);
            }
        }, Logger::report));
    }
}
Also used : Bundle(android.os.Bundle) RxDrawerLayout(com.jakewharton.rxbinding2.support.v4.widget.RxDrawerLayout) Uri(android.net.Uri) RocketChatUserStatusProvider(chat.rocket.android.renderer.RocketChatUserStatusProvider) AutocompleteUserInteractor(chat.rocket.core.interactors.AutocompleteUserInteractor) DialogFragment(android.support.v4.app.DialogFragment) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) MessageInteractor(chat.rocket.core.interactors.MessageInteractor) RealmSpotlightRoomRepository(chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository) MethodCallHelper(chat.rocket.android.api.MethodCallHelper) Manifest(android.Manifest) LoadMoreScrollListener(chat.rocket.android.helper.LoadMoreScrollListener) View(android.view.View) TextUtils(chat.rocket.android.helper.TextUtils) MessageOptionsDialogFragment(chat.rocket.android.fragment.chatroom.dialog.MessageOptionsDialogFragment) AbsoluteUrlHelper(chat.rocket.android.helper.AbsoluteUrlHelper) OnBackPressListener(chat.rocket.android.helper.OnBackPressListener) RealmServerInfoRepository(chat.rocket.persistence.realm.repositories.RealmServerInfoRepository) AbstractUploadActionItem(chat.rocket.android.layouthelper.extra_action.upload.AbstractUploadActionItem) MessageFormManager(chat.rocket.android.layouthelper.chatroom.MessageFormManager) ModelListAdapter(chat.rocket.android.layouthelper.chatroom.ModelListAdapter) SessionInteractor(chat.rocket.core.interactors.SessionInteractor) PairedMessage(chat.rocket.android.layouthelper.chatroom.PairedMessage) ChannelSource(chat.rocket.android.widget.message.autocomplete.channel.ChannelSource) AutocompleteManager(chat.rocket.android.widget.message.autocomplete.AutocompleteManager) RuntimePermissions(permissions.dispatcher.RuntimePermissions) ViewGroup(android.view.ViewGroup) Message(chat.rocket.core.models.Message) RealmMessageRepository(chat.rocket.persistence.realm.repositories.RealmMessageRepository) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) List(java.util.List) RealmSpotlightUserRepository(chat.rocket.persistence.realm.repositories.RealmSpotlightUserRepository) FileUploadProgressDialogFragment(chat.rocket.android.fragment.chatroom.dialog.FileUploadProgressDialogFragment) RealmSessionRepository(chat.rocket.persistence.realm.repositories.RealmSessionRepository) Room(chat.rocket.core.models.Room) Nullable(android.support.annotation.Nullable) Snackbar(android.support.design.widget.Snackbar) BackgroundLooper(chat.rocket.android.BackgroundLooper) SlidingPaneLayout(android.support.v4.widget.SlidingPaneLayout) RealmStore(chat.rocket.persistence.realm.RealmStore) RecyclerViewScrolledToBottomListener(chat.rocket.android.helper.RecyclerViewScrolledToBottomListener) DefaultTempSpotlightUserCaller(chat.rocket.android.service.temp.DefaultTempSpotlightUserCaller) AudioUploadActionItem(chat.rocket.android.layouthelper.extra_action.upload.AudioUploadActionItem) UserSource(chat.rocket.android.widget.message.autocomplete.user.UserSource) Intent(android.content.Intent) NonNull(android.support.annotation.NonNull) AbstractNewMessageIndicatorManager(chat.rocket.android.layouthelper.chatroom.AbstractNewMessageIndicatorManager) ImageUploadActionItem(chat.rocket.android.layouthelper.extra_action.upload.ImageUploadActionItem) Single(io.reactivex.Single) ConnectivityManager(chat.rocket.android.service.ConnectivityManager) ExtraActionPickerDialogFragment(chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment) ArrayList(java.util.ArrayList) GravityCompat(android.support.v4.view.GravityCompat) VideoUploadActionItem(chat.rocket.android.layouthelper.extra_action.upload.VideoUploadActionItem) UsersOfRoomDialogFragment(chat.rocket.android.fragment.chatroom.dialog.UsersOfRoomDialogFragment) R(chat.rocket.android.R) RealmRoomRepository(chat.rocket.persistence.realm.repositories.RealmRoomRepository) DrawerLayout(android.support.v4.widget.DrawerLayout) MessageFormLayout(chat.rocket.android.widget.message.MessageFormLayout) Optional(com.fernandocejas.arrow.optional.Optional) InputContentInfoCompat(android.support.v13.view.inputmethod.InputContentInfoCompat) MessageExtraActionBehavior(chat.rocket.android.layouthelper.extra_action.MessageExtraActionBehavior) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Logger(chat.rocket.android.helper.Logger) Field(java.lang.reflect.Field) RCLog(chat.rocket.android.log.RCLog) RecyclerView(android.support.v7.widget.RecyclerView) NeedsPermission(permissions.dispatcher.NeedsPermission) MessageListAdapter(chat.rocket.android.layouthelper.chatroom.MessageListAdapter) AutocompleteChannelInteractor(chat.rocket.core.interactors.AutocompleteChannelInteractor) InputConnectionCompat(android.support.v13.view.inputmethod.InputConnectionCompat) AlertDialog(android.support.v7.app.AlertDialog) Pair(android.support.v4.util.Pair) FileUploadHelper(chat.rocket.android.helper.FileUploadHelper) DeafultTempSpotlightRoomCaller(chat.rocket.android.service.temp.DeafultTempSpotlightRoomCaller) AbstractExtraActionItem(chat.rocket.android.layouthelper.extra_action.AbstractExtraActionItem) RealmUserRepository(chat.rocket.persistence.realm.repositories.RealmUserRepository) Activity(android.app.Activity) BuildCompat(android.support.v4.os.BuildCompat) RecyclerViewAutoScrollManager(chat.rocket.android.helper.RecyclerViewAutoScrollManager) Field(java.lang.reflect.Field) RxDrawerLayout(com.jakewharton.rxbinding2.support.v4.widget.RxDrawerLayout) DrawerLayout(android.support.v4.widget.DrawerLayout) SlidingPaneLayout(android.support.v4.widget.SlidingPaneLayout) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 92 with DrawerLayout

use of android.support.v4.widget.DrawerLayout in project aplicativo by InCasa.

the class HomeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    exibeTelaPrincipalOuSolicitaLogin();
    setContentView(R.layout.activity_home);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    SharedPreferences mSharedPreferences = getSharedPreferences("ServerAdress", 0);
    this.ip = mSharedPreferences.getString("servidor", " ");
    String URLTEMPERATURA = "http://" + ip + "/backend/temperaturaValor";
    String URLUMIDADE = "http://" + ip + "/backend/umidadeValor";
    getTemperatura(URLTEMPERATURA);
    getUmidade(URLUMIDADE);
    String URLGETTEMPERATURA = "http://" + ip + "/backend/temperatura/1";
    String URLGETUMIDADE = "http://" + ip + "/backend/umidade/1";
    String URLGETPRESENCA = "http://" + ip + "/backend/presenca/1";
    String URLGETLUMINOSISADE = "http://" + ip + "/backend/luminosidade/1";
    getSensorTemperatura(URLGETTEMPERATURA);
    getSensorUmidade(URLGETUMIDADE);
    getSensorPresenca(URLGETPRESENCA);
    getSensorLuminosidade(URLGETLUMINOSISADE);
    String URLGETARDUINO = "http://" + ip + "/backend/arduino/1";
    getArduino(URLGETARDUINO);
    String URLGETCELULAR = "http://" + ip + "/backend/aplicativo/1";
    getCelular(URLGETCELULAR);
    JSONObject jsonBody = new JSONObject();
    User user = User.getInstancia();
    try {
        jsonBody.put("login", user.getLogin());
        jsonBody.put("senha", user.getSenha());
    } catch (JSONException e) {
        e.printStackTrace();
    }
    String URLUSER = "http://" + ip + "/backend/getUser";
    getUser(jsonBody, URLUSER);
    String URLGETRELE1 = "http://" + ip + "/backend/rele/1";
    String URLGETRELE2 = "http://" + ip + "/backend/rele/2";
    String URLGETRELE3 = "http://" + ip + "/backend/rele/3";
    String URLGETRELE4 = "http://" + ip + "/backend/rele/4";
    getRele1(URLGETRELE1);
    getRele2(URLGETRELE2);
    getRele3(URLGETRELE3);
    getRele4(URLGETRELE4);
}
Also used : NavigationView(android.support.design.widget.NavigationView) User(model.User) JSONObject(org.json.JSONObject) SharedPreferences(android.content.SharedPreferences) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) JSONException(org.json.JSONException) DrawerLayout(android.support.v4.widget.DrawerLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 93 with DrawerLayout

use of android.support.v4.widget.DrawerLayout in project dobby-android by InceptAi.

the class MainActivity method onNavigationItemSelected.

@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    if (id == R.id.nav_wifi_scan) {
        ListenableFuture<List<ScanResult>> scanFuture = networkLayer.wifiScan();
        Toast.makeText(this, "Starting wifi scan...", Toast.LENGTH_SHORT).show();
        WifiFragment fragment = (WifiFragment) setupFragment(WifiFragment.class, WifiFragment.FRAGMENT_TAG);
        fragment.setWifiScanFuture(scanFuture, threadpool.getExecutor());
    } else if (id == R.id.nav_debug) {
        DebugFragment fragment = (DebugFragment) setupFragment(DebugFragment.class, DebugFragment.FRAGMENT_TAG);
    } else if (id == R.id.nav_fake_data) {
        FakeDataFragment fragment = (FakeDataFragment) setupFragment(FakeDataFragment.class, FakeDataFragment.FRAGMENT_TAG);
    } else if (id == R.id.nav_manage) {
    } else if (id == R.id.nav_share) {
    } else if (id == R.id.nav_send) {
    } else if (id == R.id.about_wifi_expert) {
        showAboutAndPrivacyPolicy();
    } else if (id == R.id.feedback_wifi_expert) {
        showFeedbackForm();
    }
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    item.setChecked(false);
    return true;
}
Also used : DebugFragment(com.inceptai.dobby.ui.DebugFragment) ArrayList(java.util.ArrayList) List(java.util.List) FakeDataFragment(com.inceptai.dobby.ui.FakeDataFragment) WifiFragment(com.inceptai.dobby.ui.WifiFragment) DrawerLayout(android.support.v4.widget.DrawerLayout)

Example 94 with DrawerLayout

use of android.support.v4.widget.DrawerLayout in project NoteText by ViWu.

the class MainActivity method onNavigationItemSelected.

@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    if (id == R.id.nav_view_all_sets) {
        Intent intent = new Intent(MainActivity.this, MainMenu.class);
        intent.putExtra("questions", questions);
        intent.putExtra("answers", answers);
        // intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        fileWrite();
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.activity_open_scale, R.anim.activity_close_translate);
    } else if (id == R.id.nav_shuffle_review) {
        shuffle("true");
    } else if (id == R.id.nav_review) {
        shuffle("false");
    } else if (id == R.id.nav_notification) {
        setNotification();
    } else /*else if (id == R.id.nav_settings) {
            Toast.makeText(getBaseContext(),"Settings!",Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(MainActivity.this, Settings.class);
            startActivity(intent);

        }*/
    if (id == R.id.nav_save) {
        fileWrite();
        Toast.makeText(getBaseContext(), "Set saved!", Toast.LENGTH_SHORT).show();
    }
    /* else if (id == R.id.nav_share) {
            Toast.makeText(getBaseContext(),"Share!!",Toast.LENGTH_SHORT).show();
        }*/
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    assert drawer != null;
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
Also used : PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) DrawerLayout(android.support.v4.widget.DrawerLayout)

Example 95 with DrawerLayout

use of android.support.v4.widget.DrawerLayout in project android_frameworks_base by crdroidandroid.

the class DrawerController method create.

/**
     * Returns a controller suitable for {@code Layout}.
     */
static DrawerController create(Activity activity) {
    DrawerLayout layout = (DrawerLayout) activity.findViewById(R.id.drawer_layout);
    if (layout == null) {
        return new DummyDrawerController();
    }
    View drawer = activity.findViewById(R.id.drawer_roots);
    Toolbar toolbar = (Toolbar) activity.findViewById(R.id.roots_toolbar);
    drawer.getLayoutParams().width = calculateDrawerWidth(activity);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(activity, layout, R.drawable.ic_hamburger, R.string.drawer_open, R.string.drawer_close);
    return new RuntimeDrawerController(layout, drawer, toggle, toolbar);
}
Also used : ActionBarDrawerToggle(android.support.v4.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) View(android.view.View) Toolbar(android.widget.Toolbar)

Aggregations

DrawerLayout (android.support.v4.widget.DrawerLayout)63 View (android.view.View)59 ActionBarDrawerToggle (android.support.v4.app.ActionBarDrawerToggle)33 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)22 AdapterView (android.widget.AdapterView)22 NavigationView (android.support.design.widget.NavigationView)21 ListView (android.widget.ListView)21 Intent (android.content.Intent)19 Toolbar (android.support.v7.widget.Toolbar)19 TextView (android.widget.TextView)15 ImageView (android.widget.ImageView)12 ActionBar (android.support.v7.app.ActionBar)9 SharedPreferences (android.content.SharedPreferences)8 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 ViewPager (android.support.v4.view.ViewPager)6 SuppressLint (android.annotation.SuppressLint)5 TabLayout (android.support.design.widget.TabLayout)5 ArrayList (java.util.ArrayList)5 ActionBar (android.app.ActionBar)4 TypedArray (android.content.res.TypedArray)4