Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from awong1900/dev_newMainList
Browse files Browse the repository at this point in the history
Dev newMainList
  • Loading branch information
awong1900 committed Oct 8, 2015
2 parents 76082c0 + 999d58e commit c8cfc1e
Show file tree
Hide file tree
Showing 31 changed files with 610 additions and 283 deletions.
32 changes: 18 additions & 14 deletions android/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v13/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v13/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.daimajia.swipelayout/library/1.1.8/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.ikimuhendis/ldrawer/0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/de.hdodenhof/circleimageview/2.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/fr.avianey.com.viewpagerindicator/library/2.4.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
Expand All @@ -94,24 +96,26 @@
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform (1)" jdkType="Android SDK" />
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.1" level="project" />
<orderEntry type="library" exported="" name="android-integration-3.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
<orderEntry type="library" exported="" name="design-23.0.1" level="project" />
<orderEntry type="library" exported="" name="urlimageviewhelper-1.0.4" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="circleimageview-2.0.0" level="project" />
<orderEntry type="library" exported="" name="library-1.1.8" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="ldrawer-0.1" level="project" />
<orderEntry type="library" exported="" name="yamlbeans-1.09" level="project" />
<orderEntry type="library" exported="" name="core-3.2.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v13-22.2.1" level="project" />
<orderEntry type="library" exported="" name="design-22.2.1" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v13-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="okio-1.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
</component>
</module>
18 changes: 10 additions & 8 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "cc.seeed.iot.ap"
minSdkVersion 16
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Expand All @@ -20,17 +20,19 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:22.2.1'
compile 'com.android.support:support-v13:23.0.1'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.ikimuhendis:ldrawer:0.1'
compile 'com.esotericsoftware.yamlbeans:yamlbeans:1.09'
compile "com.google.zxing:android-integration:3.2.0"
compile 'com.google.zxing:core:3.2.0'
compile "com.daimajia.swipelayout:library:1.1.8@aar"
compile 'de.hdodenhof:circleimageview:2.0.0'

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package cc.seeed.iot.ui_main;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
Expand All @@ -28,8 +27,11 @@
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.ListPopupWindow;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
Expand All @@ -47,6 +49,7 @@
import cc.seeed.iot.R;
import cc.seeed.iot.datastruct.User;
import cc.seeed.iot.ui_login.SetupActivity;
import cc.seeed.iot.ui_main.util.DividerItemDecoration;
import cc.seeed.iot.ui_setnode.SetupIotNodeActivity;
import cc.seeed.iot.ui_smartconfig.GoReadyActivity;
import cc.seeed.iot.webapi.IotApi;
Expand All @@ -62,7 +65,7 @@
* TODO
*/
public class MainScreenActivity extends AppCompatActivity
implements NodeListRecyclerAdapter.NodeAction {
implements NodeListRecyclerAdapter.OnClickListener {
private final static String TAG = "MainScreenActivity";
private DrawerLayout mDrawerLayout;
private SwipeRefreshLayout mSwipeRefreshLayout;
Expand Down Expand Up @@ -103,9 +106,13 @@ protected void onCreate(Bundle savedInstanceState) {
mRecyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager layout = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(layout);
mRecyclerView.addItemDecoration(new DividerItemDecoration(getResources().getDrawable(R.drawable.divider)));
mAdapter = new NodeListRecyclerAdapter(nodes);
mAdapter.setOnClickListener(this);
mRecyclerView.setAdapter(mAdapter);
setupAdapter();


}

mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout);
Expand Down Expand Up @@ -275,6 +282,58 @@ public boolean onNavigationItemSelected(MenuItem menuItem) {
}

@Override
public void onClick(View v, final int position) {
Log.e(TAG, "pos:" + position + " id:" + v.getId());

int id = v.getId();
switch (id) {
case R.id.node_item:
nodeSet(position);
break;
case R.id.location:
break;
case R.id.favorite:
break;
case R.id.rename:
nodeRename(position);
break;
case R.id.detail:
nodeDetail(position);
break;
case R.id.remove:
nodeRemove(position);
break;
case R.id.dot:
PopupMenu popupMenu = new PopupMenu(this, v);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.remove:
nodeRemove(position);
return true;
case R.id.detail:
nodeDetail(position);
return true;
case R.id.rename:
nodeRename(position);
return true;
}
return false;
}
});
popupMenu.inflate(R.menu.ui_node_action);
popupMenu.show();
if (popupMenu.getDragToOpenListener() instanceof ListPopupWindow.ForwardingListener) {
ListPopupWindow.ForwardingListener listener =
(ListPopupWindow.ForwardingListener) popupMenu.getDragToOpenListener();
listener.getPopup().setVerticalOffset(-v.getHeight());
listener.getPopup().show();
}
break;
}
}

public boolean nodeRemove(final int position) {//todo: rubbish code

AlertDialog.Builder builder = new AlertDialog.Builder(this);
Expand Down Expand Up @@ -319,23 +378,20 @@ public void failure(RetrofitError error) {
return true;
}

@Override
public boolean nodeDetail(int position) {
Intent intent = new Intent(this, NodeDetailActivity.class);
intent.putExtra("position", position);
startActivity(intent);
return true;
}

@Override
public boolean nodeSet(int position) {
Intent intent = new Intent(this, SetupIotNodeActivity.class);
intent.putExtra("position", position);
startActivity(intent);
return true;
}

@Override
public boolean nodeRename(final int position) {
final LayoutInflater inflater = this.getLayoutInflater();
final View view = inflater.inflate(R.layout.dialog_name_input, null);
Expand Down
Loading

0 comments on commit c8cfc1e

Please sign in to comment.