WAI
Status Update
Comments
ku...@google.com <ku...@google.com>
ku...@google.com <ku...@google.com> #2
[Empty comment from Monorail migration]
pr...@gmail.com <pr...@gmail.com> #3
[Empty comment from Monorail migration]
pr...@gmail.com <pr...@gmail.com> #4
Hey Paul, can you give input on how important this is?
ku...@google.com <ku...@google.com> #5
Doesn't this already exist? Or is this different from the manifest property?
lb...@gmail.com <lb...@gmail.com> #6
waiting on additional feedback.
tw...@gmail.com <tw...@gmail.com> #7
GitHub issue:
https://github.com/w3c/manifest/issues/737
Discussion doc (Google only):
https://docs.google.com/document/d/1wchuU6uZAt10LYYL4U0GmI4lndwdkoMdvXKLiZkJ5Aw/edit
#4:
> Doesn't this already exist? Or is this different from the manifest property?
There's been some confusion because this feature keeps being labeled as "display: browser", which does already exist and has a separate meaning (specifically, that the app is opened in a regular browser tab).
This feature is about having a standalone app window with multiple tabs (containing separate documents inside the app scope) inside it.
Regardless of how we design this, the name of the feature proposal should not be named after a proposed solution, since that unnecessarily pigeonholes us into a particular solution.
[Monorail components: UI>Browser>WebAppInstalls]
Discussion doc (Google only):
#4:
> Doesn't this already exist? Or is this different from the manifest property?
There's been some confusion because this feature keeps being labeled as "display: browser", which does already exist and has a separate meaning (specifically, that the app is opened in a regular browser tab).
This feature is about having a standalone app window with multiple tabs (containing separate documents inside the app scope) inside it.
Regardless of how we design this, the name of the feature proposal should not be named after a proposed solution, since that unnecessarily pigeonholes us into a particular solution.
[Monorail components: UI>Browser>WebAppInstalls]
Description
Version used: 27.1.0
Theme used: -
Devices/Android versions reproduced on: emulator 26 (but doesnt matter)
To see
normal behaviour(expected): press "Pick something and edit(framework)" then follow instruction
support behaviour(bug): press "Pick something and edit(support)" then follow instruction
as you can see with support we stuck in EditActivity as onLoadFinished is called even without init/restart
the code:
package pl.selvin.android.support27bug;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v4.content.Loader;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.Random;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
final static int PICK_CODE = 666;
final static int PICK_CODE_SUPPORT = 667;
final static int LOADER_ID = 666;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Button support = new Button(this);
support.setText("Pick something and edit(support)");
support.setTag(PICK_CODE_SUPPORT);
support.setOnClickListener(this);
final Button framework = new Button(this);
framework.setText("Pick something and edit(framework)");
framework.setTag(PICK_CODE);
framework.setOnClickListener(this);
final LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(framework);
layout.addView(support);
setContentView(layout);
}
@Override
public void onClick(View v) {
startActivityForResult(new Intent(MainActivity.this, PickActivity.class), (int) v.getTag());
}
private final LoaderManager.LoaderCallbacks<Integer> mSupportInsertLoaderCallback = new LoaderManager.LoaderCallbacks<Integer>() {
@Override
public Loader<Integer> onCreateLoader(int id, Bundle args) {
return new SupportInsertLoader(MainActivity.this, args, MainActivity.this);
}
@Override
public void onLoadFinished(@NonNull Loader<Integer> loader, final Integer data) {
//getSupportLoaderManager().destroyLoader(loader.getId()); //this should fix it but why!!!
finishCreateNewElement(data);
}
@Override
public void onLoaderReset(@NonNull Loader<Integer> loader) {
((SupportInsertLoader) loader).cleanUp();
}
};
private final android.app.LoaderManager.LoaderCallbacks<Integer> mInsertLoaderCallback = new android.app.LoaderManager.LoaderCallbacks<Integer>() {
@Override
public android.content.Loader<Integer> onCreateLoader(int id, Bundle args) {
return new InsertLoader(MainActivity.this, args, MainActivity.this);
}
@Override
public void onLoadFinished(@NonNull android.content.Loader<Integer> loader, final Integer data) {
finishCreateNewElement(data);
}
@Override
public void onLoaderReset(@NonNull android.content.Loader<Integer> loader) {
((InsertLoader) loader).cleanUp();
}
};
private void finishCreateNewElement(Integer data) {
startActivity(new Intent(this, EditActivity.class).putExtra("R", data));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case PICK_CODE_SUPPORT:
if (resultCode == Activity.RESULT_OK && data != null) {
getSupportLoaderManager().restartLoader(LOADER_ID, data.getExtras(), mSupportInsertLoaderCallback);
}
break;
case PICK_CODE:
if (resultCode == Activity.RESULT_OK && data != null) {
getLoaderManager().restartLoader(LOADER_ID, data.getExtras(), mInsertLoaderCallback);
}
break;
default:
super.onActivityResult(requestCode, resultCode, data);
}
}
private Integer createNewElement(Bundle args) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
return args.getInt("R");
}
public static class EditActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final TextView textView = new TextView(this);
textView.setText(getIntent().getIntExtra("R", -1) + " was picked \n Now press back!");
setContentView(textView);
}
}
public static class PickActivity extends AppCompatActivity {
final static Random rand = new Random();
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Button button = new Button(this);
final int retVal = rand.nextInt();
button.setText("Return picked element: " + retVal);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setResult(Activity.RESULT_OK, new Intent().putExtra("R", retVal));
finish();
}
});
setContentView(button);
}
}
private static class InsertLoader extends android.content.AsyncTaskLoader<Integer> {
private Bundle args;
private Integer mInteger = null;
private MainActivity list;
InsertLoader(Context context, Bundle args, MainActivity list) {
super(context);
this.args = args;
this.list = list;
}
@Override
public Integer loadInBackground() {
if (list != null) {
mInteger = list.createNewElement(args);
cleanUp();
}
return mInteger;
}
@Override
protected void onStartLoading() {
if (mInteger != null) {
deliverResult(mInteger);
}
if (takeContentChanged() || mInteger == null) {
forceLoad();
}
}
void cleanUp() {
list = null;
args = null;
}
}
private static class SupportInsertLoader extends AsyncTaskLoader<Integer> {
private Bundle args;
private Integer mInteger = null;
private MainActivity list;
SupportInsertLoader(Context context, Bundle args, MainActivity list) {
super(context);
this.args = args;
this.list = list;
}
@Override
public Integer loadInBackground() {
if (list != null) {
mInteger = list.createNewElement(args);
cleanUp();
}
return mInteger;
}
@Override
protected void onStartLoading() {
if (mInteger != null) {
deliverResult(mInteger);
}
if (takeContentChanged() || mInteger == null) {
forceLoad();
}
}
void cleanUp() {
list = null;
args = null;
}
}
}