package com.lskycity.androidtools.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.lskycity.androidtools.AppConstants;
import com.lskycity.androidtools.R;
import com.lskycity.androidtools.utils.SharedPreUtils;

/**
 * Created by zhaofliu on 2/5/17.
 *
 */

public class PublishInformActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_inform);

        TextView content = (TextView) findViewById(R.id.content);
        content.setText(SharedPreUtils.getString(this, AppConstants.SHARED_KEY_INFORM_CONTENT));

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    @Override
    public boolean onSupportNavigateUp() {
        finish();
        return true;
    }
}

@@ -32,16 +32,158 @@
 ls.ui;%0A%0A
+import android.content.BroadcastReceiver;%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.content.IntentFilter;%0A
 import a
@@ -263,40 +263,47 @@
 oid.
-support.v7.app.AppCompatActivity
+view.Menu;%0Aimport android.view.MenuItem
 ;%0Aim
@@ -331,16 +331,45 @@
 extView;
+%0Aimport android.widget.Toast;
 %0A%0Aimport
@@ -395,28 +395,27 @@
 idtools.
-AppConstants
+InformCheck
 ;%0Aimport
@@ -481,28 +481,24 @@
 ols.
-utils.SharedPreUtils
+app.BaseActivity
 ;%0A%0A/
@@ -589,27 +589,88 @@
 nds 
-AppCompatActivity %7B
+BaseActivity %7B%0A%0A    private PublishInformActivity.InformReceiver informReceiver;
 %0A%0A  
@@ -855,329 +855,1255 @@
     
-TextView content = (TextView) findViewById(R.id.content);%0A        content.setText(SharedPreUtils.getString(this, AppConstants.SHARED_KEY_INFORM_CONTENT));%0A%0A        getSupportActionBar().setDisplayHomeAsUpEnabled(true);%0A    %7D%0A%0A    @Override%0A    public boolean onSupportNavigateUp() %7B%0A        finish();%0A        return true;
+updateContent();%0A%0A        IntentFilter filter = new IntentFilter(InformCheck.ACTION_INFORM_CHANGED);%0A        registerReceiver(informReceiver = new PublishInformActivity.InformReceiver(), filter);%0A    %7D%0A%0A    @Override%0A    protected void onDestroy() %7B%0A        super.onDestroy();%0A        unregisterReceiver(informReceiver);%0A    %7D%0A%0A    @Override%0A    public boolean onCreateOptionsMenu(Menu menu) %7B%0A        getMenuInflater().inflate(R.menu.refresh, menu);%0A        return super.onCreateOptionsMenu(menu);%0A    %7D%0A%0A    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        if(item.getItemId() == R.id.refresh) %7B%0A            Toast.makeText(this, R.string.refreshing, Toast.LENGTH_LONG).show();%0A            InformCheck.checkInform();%0A            return true;%0A        %7D%0A        return super.onOptionsItemSelected(item);%0A    %7D%0A%0A    private void updateContent() %7B%0A        InformCheck.Inform inform = InformCheck.getInformFromSharedPreference(this);%0A%0A        TextView content = (TextView) findViewById(R.id.content);%0A        content.setText(inform.content);%0A    %7D%0A%0A    class InformReceiver extends BroadcastReceiver %7B%0A        @Override%0A        public void onReceive(Context context, Intent intent) %7B%0A%0A            updateContent();%0A%0A        %7D
 %0A   

add refresh function for publish inform