Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3a41f1c authored by Stephen Bird's avatar Stephen Bird Committed by Gerrit Code Review
Browse files

Remove LoginFragment: Moving to settings

Change-Id: I73925e9646a24e4c9cb24d62136f6c81efe22f42
parent 0f0bf2b9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -87,6 +87,12 @@
      </intent-filter>
    </service>

    <receiver android:name=".receiver.CloudProviderReceiver">
      <intent-filter>
        <action android:name="com.android.settings.PROVIDER_UPDATED"/>
      </intent-filter>
    </receiver>

    <activity
      android:name=".activities.MainActivity"
      android:label="@string/app_name"

res/layout/login_fragment.xml

deleted100644 → 0
+0 −37
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2015 The CyanogenMod Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@android:color/white">

    <android.support.v7.widget.Toolbar
        android:id="@+id/material_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

    <ListView
       android:id="@+id/login_list"
       android:layout_width="match_parent"
       android:layout_height="match_parent" />

</LinearLayout>
+0 −48
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The CyanogenMod Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
 -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/navigation_view_details_item"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <ImageView
        android:id="@+id/providerIcon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:gravity="center_vertical" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/providerTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_vertical" />

        <TextView
            android:id="@+id/providerUsername"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="bottom|center_vertical"/>

    </LinearLayout>

</LinearLayout>
+3 −11
Original line number Diff line number Diff line
@@ -63,12 +63,12 @@ import com.cyanogenmod.filemanager.model.Bookmark;
import com.cyanogenmod.filemanager.model.FileSystemObject;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.ui.fragments.LoginFragment;
import com.cyanogenmod.filemanager.ui.fragments.NavigationFragment;
import com.cyanogenmod.filemanager.ui.fragments.NavigationFragment.OnGoHomeRequestListener;
import com.cyanogenmod.filemanager.ui.widgets.NavigationView.OnBackRequestListener;
import com.cyanogenmod.filemanager.util.FileHelper;
import com.cyanogenmod.filemanager.util.StorageHelper;
import com.cyanogenmod.filemanager.util.StorageProviderUtils;

import java.io.File;
import java.io.InvalidClassException;
@@ -140,9 +140,6 @@ public class MainActivity extends ActionBarActivity

        // Navigation fragment
        NAVIGATION,

        // Login
        LOGIN,
    }

    private Fragment currentFragment;
@@ -201,7 +198,7 @@ public class MainActivity extends ActionBarActivity
        cV.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setCurrentFragment(FragmentType.LOGIN);
                StorageProviderUtils.loadProviderLogin(getApplicationContext());
            }
        });

@@ -324,11 +321,6 @@ public class MainActivity extends ActionBarActivity
                        .setOnDirectoryChangedListener(mNavigationDrawerController);
                fragmentTag = fragmentType.name();
                break;
            case LOGIN:
                mPopBackStack = true;
                currentFragment = LoginFragment.newInstance();
                fragmentTag = fragmentType.name();
                break;
            case HOME:
            default:
                mPopBackStack = false;
@@ -521,7 +513,7 @@ public class MainActivity extends ActionBarActivity
                break;
            case R.id.navigation_item_manage:
                if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_manage");
                setCurrentFragment(FragmentType.LOGIN);
                StorageProviderUtils.loadProviderLogin(this);
                break;
            case R.id.navigation_item_settings:
                if (DEBUG) Log.d(TAG, "onNavigationItemSelected::navigation_item_settings");
+0 −88
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The CyanogenMod Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cyanogenmod.filemanager.adapters;

import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.cyanogen.ambient.storage.provider.StorageProviderInfo;
import com.cyanogenmod.filemanager.R;

import java.util.List;

public class ProviderAdapter extends BaseAdapter {
    Context mContext;
    List<StorageProviderInfo> mEntries;
    int mIndividualItem;

    public ProviderAdapter(Context context, int individualItem, List<StorageProviderInfo> objects) {
        mContext = context;
        mEntries = objects;
        mIndividualItem = individualItem;
    }

    @Override
    public int getCount() {
        return mEntries.size();
    }

    @Override
    public Object getItem(int position) {
        return mEntries.get(position);
    }

    @Override
    public long getItemId(int position) {
        return mEntries.indexOf(getItem(position));
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null){
            LayoutInflater layoutInflater = (LayoutInflater) mContext
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            convertView = layoutInflater.inflate(mIndividualItem, null);
        }
        StorageProviderInfo spi = (StorageProviderInfo) getItem(position);

        ImageView providerIcon = (ImageView) convertView.findViewById(R.id.providerIcon);
        TextView providerTitle = (TextView) convertView.findViewById(R.id.providerTitle);
        TextView providerSummary = (TextView) convertView.findViewById(R.id.providerUsername);

        providerIcon.setImageDrawable(getIcon(spi.getPackage()));
        providerTitle.setText(spi.getTitle());
        providerSummary.setText(spi.getSummary());

        return convertView;
    }

    private Drawable getIcon(String packageName) {
        try {
            return mContext.getPackageManager().getApplicationIcon(packageName);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}
Loading