Simple Circle

MainActivity

MainActivity is the entry point to the Simple Circle sample application.

Create and Show a Template

The Quick Circle layout with a vertical sidebar is created.

template = new QCircleTemplate(this, TemplateType.CIRCLE_VERTICAL);

 

setContentView() shows the created template.

setContentView(template.getView());

 

Add a Title

mTitle is a QCircleTitle instance and added to the template

mTitle = new QCircleTitle(this, "My title");
template.addElement(mTitle);

 

Add a Back Button

mBackButton is a QCircleBackButton instance and added to the template.

mBackButton = new QCircleBackButton(this);
template.addElement(mBackButton);

 

Connect to Full Screen Activity

Intent calls a FullActivity. setFullscreenIntent recognizes cover events so that intent is invoked when the cover is opened. Here, intent is set to the full screen intent. When the cover is opened, FullActivity is called.

Intent intent = new Intent(this, FullActivity.class);
        template.setFullscreenIntent(intent);

 

registerIntentReceiver enables receiving cover events.

template.registerIntentReceiver();

 

Once registerIntentReceiver is used, it is mandatory to use unregisterReceiver. When the activity is finished, this method is called to stop recognizing cover events.

protected void onDestroy() {
  ...
template.unregisterReceiver();
}

 

FullActivity

FullActivity is an activity for the full screen. The activity is invoked in MainActivity when the cover is opened.

AndroidManifest.xml

Here, codes added to the AndroidManifest.xml are explained.

Layout Setting and Adding Icon for Quick Circle

...


...

       android:name=".MainActivity"
       android:label="@string/app_name"
       android:configChanges="orientation|keyboardHidden|screenSize" ①
       android:excludeFromRecents="true"  ②
       android:icon="@drawable/icon"  ③
       android:screenOrientation="portrait"  ④
       android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> ⑤
...




① Sets default configurations.

② When the user opens the cover, the Quick Circle activity should not be found. This setting excludes the Quick Circle activity from the recently used apps.

③ Adds an icon for Quick Circle. This icon will be displayed in the Quick Circle window.

④ Fixes the orientation to portrait.

⑤ Removes the title bar from the layout.

Showing the App in Settings

For the app to be found in the Settings, the action ‘com.lge.quickcover is an intent filter for the activity to be recognized by Settings. Users will be able to find the app from the Quick Circle app list in the Settings.


android:name=".MainActivity"
...

       
        ...
   

 

Navigation