wear close activity when paused
This commit is contained in:
parent
ef2654d3eb
commit
6737cdf365
2 changed files with 14 additions and 1 deletions
|
@ -22,7 +22,7 @@ final class ActionsDefinitions {
|
||||||
"Fillpreset 1",
|
"Fillpreset 1",
|
||||||
"Fillpreset 2",
|
"Fillpreset 2",
|
||||||
"Fillpreset 3",
|
"Fillpreset 3",
|
||||||
"006"};
|
"008"};
|
||||||
|
|
||||||
|
|
||||||
public static void doAction(int position, Context ctx) {
|
public static void doAction(int position, Context ctx) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.wearable.activity.WearableActivity;
|
||||||
import android.support.wearable.view.DotsPageIndicator;
|
import android.support.wearable.view.DotsPageIndicator;
|
||||||
import android.support.wearable.view.GridPagerAdapter;
|
import android.support.wearable.view.GridPagerAdapter;
|
||||||
import android.support.wearable.view.GridViewPager;
|
import android.support.wearable.view.GridViewPager;
|
||||||
|
@ -36,8 +37,18 @@ public class GridActivity extends Activity {
|
||||||
pager.setAdapter(new MyGridViewPagerAdapter());
|
pager.setAdapter(new MyGridViewPagerAdapter());
|
||||||
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
|
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
|
||||||
dotsPageIndicator.setPager(pager);
|
dotsPageIndicator.setPager(pager);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
private class MyGridViewPagerAdapter extends GridPagerAdapter {
|
||||||
@Override
|
@Override
|
||||||
public int getColumnCount(int arg0) {
|
public int getColumnCount(int arg0) {
|
||||||
|
@ -67,5 +78,7 @@ public class GridActivity extends Activity {
|
||||||
public boolean isViewFromObject(View view, Object object) {
|
public boolean isViewFromObject(View view, Object object) {
|
||||||
return view==object;
|
return view==object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue