Android Open Source - YourWiFi Settings Activity






From Project

Back to project page YourWiFi.

License

The source code is released under:

MIT License

If you think the Android project YourWiFi listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.akisute.yourwifi.app;
//  ww w .  jav  a2 s .co  m
import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.akisute.android.daggered.DaggeredActivity;
import com.akisute.yourwifi.app.cloud.CloudManager;

import javax.inject.Inject;

public class SettingsActivity extends DaggeredActivity {

    @Inject
    CloudManager mCloudManager;

    public static void startActivity(Context context) {
        Intent intent = new Intent(context, SettingsActivity.class);
        intent.setAction(Intent.ACTION_VIEW);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);
        setTitle(R.string.activity_settings_title);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_settings, menu);
        return true;
    }

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        MenuItem loginItem = menu.findItem(R.id.action_login);
        MenuItem logoutItem = menu.findItem(R.id.action_logout);

        boolean isLoggedIn = mCloudManager.isLoggedIn();
        loginItem.setVisible(!isLoggedIn);
        logoutItem.setVisible(isLoggedIn);

        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.action_login:
                CloudLoginDialogFragment dialogFragment = new CloudLoginDialogFragment();
                FragmentManager fragmentManager = getFragmentManager();
                dialogFragment.show(fragmentManager, dialogFragment.getClass().getSimpleName());
                return true;
            case R.id.action_logout:
                // TODO: logout via API
                return true;
        }
        return false;
    }
}




Java Source Code List

com.akisute.yourwifi.app.Application.java
com.akisute.yourwifi.app.CloudLoginDialogFragment.java
com.akisute.yourwifi.app.EssidDetailActivity.java
com.akisute.yourwifi.app.EssidDetailFragment.java
com.akisute.yourwifi.app.EssidListFragment.java
com.akisute.yourwifi.app.MainActivity.java
com.akisute.yourwifi.app.NetworkMapFragment.java
com.akisute.yourwifi.app.NetworkRecordingService.java
com.akisute.yourwifi.app.RawNetworkListFragment.java
com.akisute.yourwifi.app.SettingsActivity.java
com.akisute.yourwifi.app.SettingsFragment.java
com.akisute.yourwifi.app.cloud.CloudManager.java
com.akisute.yourwifi.app.dagger.AndroidSystemModule.java
com.akisute.yourwifi.app.dagger.ApplicationModule.java
com.akisute.yourwifi.app.intent.Intents.java
com.akisute.yourwifi.app.model.BssidListAdapter.java
com.akisute.yourwifi.app.model.EssidComparators.java
com.akisute.yourwifi.app.model.EssidListAdapter.java
com.akisute.yourwifi.app.model.Essid.java
com.akisute.yourwifi.app.model.LocationScanManager.java
com.akisute.yourwifi.app.model.NetworkCache.java
com.akisute.yourwifi.app.model.NetworkComparators.java
com.akisute.yourwifi.app.model.NetworkScanManager.java
com.akisute.yourwifi.app.model.Network.java
com.akisute.yourwifi.app.model.RawNetworkListAdapter.java
com.akisute.yourwifi.app.util.GlobalEventBus.java
com.akisute.yourwifi.app.util.GlobalResources.java
com.akisute.yourwifi.app.util.GlobalSharedPreferences.java