-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 14 additions & 4 deletions
18
app/src/main/java/com/ittianyu/relight/base/_3/WidgetActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
package com.ittianyu.relight.base._3; | ||
|
||
import android.os.Bundle; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.FrameLayout; | ||
|
||
import com.ittianyu.relight.utils.WidgetUtils; | ||
import com.ittianyu.relight.utils.ViewUtils; | ||
|
||
public class WidgetActivity extends AppCompatActivity { | ||
private static final int ID_FL = 1; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
View root = WidgetUtils.render(this, StatefulUserWidget.class); | ||
setContentView(root); | ||
FrameLayout fl = new FrameLayout(this); | ||
fl.setId(ID_FL); | ||
ViewUtils.setSize(fl, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); | ||
setContentView(fl); | ||
|
||
FragmentManager fm = getSupportFragmentManager(); | ||
fm.beginTransaction() | ||
.replace(ID_FL, new WidgetFragment()) | ||
.commit(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/ittianyu/relight/base/_3/WidgetFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.ittianyu.relight.base._3; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.ittianyu.relight.utils.WidgetUtils; | ||
|
||
public class WidgetFragment extends Fragment { | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View root = WidgetUtils.render(this, StatefulUserWidget.class); | ||
return root; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters