Эх сурвалжийг харах

Add license in some files

masensio 10 жил өмнө
parent
commit
c83925b454

+ 18 - 0
res/layout/drawer_radiobutton.xml

@@ -1,3 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/drawer_radiobutton"
     android:layout_width="fill_parent"

+ 18 - 0
res/layout/listrow_details.xml

@@ -1,3 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"

+ 18 - 0
res/layout/listrow_group.xml

@@ -1,3 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ownCloud Android client application
+
+  Copyright (C) 2015 ownCloud Inc.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/textView1"

+ 0 - 15
src/com/owncloud/android/ui/adapter/Group.java

@@ -1,15 +0,0 @@
-package com.owncloud.android.ui.adapter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Group {
-
-  public String string;
-  public final List<String> children = new ArrayList<String>();
-
-  public Group(String string) {
-    this.string = string;
-  }
-
-}

+ 33 - 0
src/com/owncloud/android/ui/adapter/GroupAdapter.java

@@ -0,0 +1,33 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015  ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package com.owncloud.android.ui.adapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GroupAdapter {
+
+    public String string;
+    public final List<String> children = new ArrayList<String>();
+
+    public GroupAdapter(String string) {
+        this.string = string;
+    }
+
+}

+ 113 - 95
src/com/owncloud/android/ui/adapter/MyExpandableListAdapter.java

@@ -1,3 +1,21 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2015  ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
 package com.owncloud.android.ui.adapter;
 
 import android.app.Activity;
@@ -14,107 +32,107 @@ import com.owncloud.android.R;
 
 public class MyExpandableListAdapter extends BaseExpandableListAdapter {
 
-  private final SparseArray<Group> groups;
-  public LayoutInflater inflater;
-  public Activity activity;
-
-  public MyExpandableListAdapter(Activity act, SparseArray<Group> groups) {
-    activity = act;
-    this.groups = groups;
-    inflater = act.getLayoutInflater();
-    
-  }
-  
-  
-  @Override
-  public Object getChild(int groupPosition, int childPosition) {
-    return groups.get(groupPosition).children.get(childPosition);
-  }
-
-  @Override
-  public long getChildId(int groupPosition, int childPosition) {
-    return 0;
-  }
-
-  @Override
-  public View getChildView(int groupPosition, final int childPosition,
-      boolean isLastChild, View convertView, ViewGroup parent) {
-    final String children = (String) getChild(groupPosition, childPosition);
-    TextView text = null;
-    if (convertView == null) {
-      convertView = inflater.inflate(R.layout.listrow_details, null);
+    private final SparseArray<GroupAdapter> groups;
+    public LayoutInflater inflater;
+    public Activity activity;
+
+    public MyExpandableListAdapter(Activity act, SparseArray<GroupAdapter> groups) {
+        activity = act;
+        this.groups = groups;
+        inflater = act.getLayoutInflater();
+
+    }
+
+
+    @Override
+    public Object getChild(int groupPosition, int childPosition) {
+        return groups.get(groupPosition).children.get(childPosition);
     }
-    
-    
-    text = (TextView) convertView.findViewById(R.id.textView1);
-    text.setText(children);
-    convertView.setOnClickListener(new OnClickListener() {
-      @Override
-      public void onClick(View v) {
-        Toast.makeText(activity, children, Toast.LENGTH_SHORT).show();
-      }
-    });
-    return convertView;
-  }
-  
-  @Override
-  public View getGroupView(int groupPosition, boolean isExpanded,
-      View convertView, ViewGroup parent) {
-    if (convertView == null) {
-      convertView = inflater.inflate(R.layout.listrow_group, null);
+
+    @Override
+    public long getChildId(int groupPosition, int childPosition) {
+        return 0;
     }
-    
-    final Group group = (Group) getGroup(groupPosition);
-    if (group.children.size() == 0){
+
+    @Override
+    public View getChildView(int groupPosition, final int childPosition,
+                             boolean isLastChild, View convertView, ViewGroup parent) {
+        final String children = (String) getChild(groupPosition, childPosition);
+        TextView text = null;
+        if (convertView == null) {
+            convertView = inflater.inflate(R.layout.listrow_details, null);
+        }
+
+
+        text = (TextView) convertView.findViewById(R.id.textView1);
+        text.setText(children);
         convertView.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
-                Toast.makeText(activity, group.string, Toast.LENGTH_SHORT).show();
+                Toast.makeText(activity, children, Toast.LENGTH_SHORT).show();
             }
         });
+        return convertView;
+    }
+
+    @Override
+    public View getGroupView(int groupPosition, boolean isExpanded,
+                             View convertView, ViewGroup parent) {
+        if (convertView == null) {
+            convertView = inflater.inflate(R.layout.listrow_group, null);
+        }
+
+        final GroupAdapter groupAdapter = (GroupAdapter) getGroup(groupPosition);
+        if (groupAdapter.children.size() == 0){
+            convertView.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    Toast.makeText(activity, groupAdapter.string, Toast.LENGTH_SHORT).show();
+                }
+            });
+        }
+        ((TextView) convertView).setText(groupAdapter.string);
+
+        return convertView;
+    }
+
+    @Override
+    public int getChildrenCount(int groupPosition) {
+        return groups.get(groupPosition).children.size();
+    }
+
+    @Override
+    public Object getGroup(int groupPosition) {
+        return groups.get(groupPosition);
+    }
+
+    @Override
+    public int getGroupCount() {
+        return groups.size();
+    }
+
+    @Override
+    public void onGroupCollapsed(int groupPosition) {
+        super.onGroupCollapsed(groupPosition);
+    }
+
+    @Override
+    public void onGroupExpanded(int groupPosition) {
+        super.onGroupExpanded(groupPosition);
+    }
+
+    @Override
+    public long getGroupId(int groupPosition) {
+        return 0;
+    }
+
+    @Override
+    public boolean hasStableIds() {
+        return false;
+    }
+
+    @Override
+    public boolean isChildSelectable(int groupPosition, int childPosition) {
+        return false;
     }
-    ((TextView) convertView).setText(group.string);
-    
-    return convertView;
-  }
-
-  @Override
-  public int getChildrenCount(int groupPosition) {
-    return groups.get(groupPosition).children.size();
-  }
-
-  @Override
-  public Object getGroup(int groupPosition) {
-    return groups.get(groupPosition);
-  }
-
-  @Override
-  public int getGroupCount() {
-    return groups.size();
-  }
-
-  @Override
-  public void onGroupCollapsed(int groupPosition) {
-    super.onGroupCollapsed(groupPosition);
-  }
-
-  @Override
-  public void onGroupExpanded(int groupPosition) {
-    super.onGroupExpanded(groupPosition);
-  }
-
-  @Override
-  public long getGroupId(int groupPosition) {
-    return 0;
-  }
-
-  @Override
-  public boolean hasStableIds() {
-    return false;
-  }
-
-  @Override
-  public boolean isChildSelectable(int groupPosition, int childPosition) {
-    return false;
-  }
 }